Skip to content

Commit

Permalink
Add: floating window, layout inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
hyb1996 committed Mar 12, 2017
1 parent a211d20 commit e81b661
Show file tree
Hide file tree
Showing 164 changed files with 7,043 additions and 1,204 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
20 changes: 11 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.stardust.scriptdroid"
minSdkVersion 19
targetSdkVersion 23
versionCode 39
versionName "1.17.0308内测"
versionCode 40
versionName "1.17.0312内测"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true

Expand Down Expand Up @@ -46,30 +46,32 @@ repositories {
}

dependencies {
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
compile fileTree(include: ['*.jar', '*.so'], dir: 'libs')
testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'

compile 'com.github.hyb1996:MutableTheme:0.2.2'
compile 'com.afollestad.material-dialogs:core:0.9.2.3'
compile 'com.google.code.gson:gson:2.8.0'
compile('de.psdev.licensesdialog:licensesdialog:1.8.1')
compile 'com.github.atlassian:commonmark-java:commonmark-parent-0.9.0'
compile 'moe.feng:AlipayZeroSdk:1.1'
compile 'com.jraska:console:0.4.3'
compile 'com.jraska:console-timber-tree:0.4.3'
compile 'com.heinrichreimersoftware:android-issue-reporter:eae4c73cbeb91e98da83fe79a3dea088a8b97448'
//compile 'com.github.jackpal.Android-Terminal-Emulator:emulatorview:v1.0.70'
//compile 'com.github.jackpal.Android-Terminal-Emulator:libtermexec:v1.0.70'
compile 'com.bezyapps.floatieslibrary:floaties:1.0.1'
compile 'de.codecrafters.tableview:tableview:2.5.0'
compile group: "pl.openrnd.android", name: "multi-level-listview", version: "1.0.1"
compile 'de.psdev.licensesdialog:licensesdialog:1.8.1'
compile 'io.mattcarroll.hover:hover:0.9.7'
compile 'org.greenrobot:eventbus:3.0.0'

compile(name: 'libtermexec-release', ext: 'aar')
compile(name: 'emulatorview-release', ext: 'aar')
compile(name: 'term-debug', ext: 'aar')

compile 'com.afollestad.material-dialogs:commons:0.9.2.3'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.rengwuxian.materialedittext:library:2.0.3'
Expand All @@ -78,7 +80,7 @@ dependencies {
compile(name: '920-styles-release', ext: 'aar')
compile(name: '920-file_explorer-release', ext: 'aar')
compile(name: '920-app-debug', ext: 'aar')

compile project(':automator')
}

configurations {
Expand Down
Binary file modified app/libs/920-app-debug.aar
Binary file not shown.
Binary file modified app/libs/emulatorview-release.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# and specify the fully qualified class key to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
Expand Down
10 changes: 10 additions & 0 deletions app/src/androidTest/java/com/stardust/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.stardust;

/**
* Created by Stardust on 2017/3/8.
*/

public class Test {


}
19 changes: 6 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
xmlns:tools="http://schemas.android.com/tools"
android:name=".App"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@drawable/ic_android_eat_js"
android:label="@string/_app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:label">
tools:replace="android:label, android:icon, android:allowBackup">
<activity
android:name=".ui.main.MainActivity"
android:label="@string/_app_name"
Expand Down Expand Up @@ -53,17 +54,6 @@

</service>

<service
android:name=".external.tile.BoundsAssistEnableTileService"
android:icon="@drawable/ic_robot_head"
android:label="脚本辅助"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.stardust.scriptdroid.fileprovider"
Expand All @@ -89,6 +79,9 @@
<service android:name=".external.notification.bounds_assist.BoundsAssistSwitchNotificationHandleService"/>
<service android:name=".external.notification.record.ActionRecordSwitchHandleService"/>
<service android:name=".service.VolumeChangeListenService"/>
<service android:name="com.stardust.view.Floaty$FloatHeadService"/>
<service android:name="com.stardust.view.ResizableFloaty$FloatingWindowService"/>
<service android:name="com.stardust.scriptdroid.external.floating_window.HoverMenuService"/>

<activity
android:name=".external.open.EditIntentActivity"
Expand Down
32 changes: 29 additions & 3 deletions app/src/main/assets/javasccript_engine_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ var longClick = function(a, b, c, d){
}, arguments);
}

var clickId = function(id){
return droid.click(droid.id(id));
}


var scrollUp = function(a, b, c, d){
if(arguments.length == 0)
Expand Down Expand Up @@ -222,6 +220,34 @@ var Text = function(text){
return shell("input text " + text, true).code == 1;
}


var __selector__ = droid.selector();
var __obj__ = new java.lang.Object();

for(var x in __selector__){
if(!__obj__[x] && !this[x]){
this[x] = (function(method) {
return function(){
var s = droid.selector();
if(arguments.length == 0){
return s[method]();
}else if(arguments.length == 1){
return s[method](arguments[0]);
}else if(arguments.length == 2){
return s[method](arguments[0], arguments[1]);
}else{
return s[method].call(s, Array.prototype.slice.call(arguments));
}
};
})(x);
}

}

var $ = function(){
return droid.selector();
}

__importClassOld__(com.stardust.scriptdroid.droid.runtime.Shell);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.stardust.app;

import android.app.Activity;
import android.content.Intent;
import android.util.SparseArray;

Expand Down
71 changes: 71 additions & 0 deletions app/src/main/java/com/stardust/hover/HoverMenuBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.stardust.hover;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.view.WindowManager;

import io.mattcarroll.hover.HoverMenu;
import io.mattcarroll.hover.HoverMenuAdapter;
import io.mattcarroll.hover.Navigator;
import io.mattcarroll.hover.defaulthovermenu.view.ViewHoverMenu;

/**
* Created by Stardust on 2017/3/11.
*/

public class HoverMenuBuilder {

public static final int DISPLAY_MODE_WINDOW = 1; // Display directly in a window.
public static final int DISPLAY_MODE_VIEW = 2; // Display within View hierarchy.

private Context mContext;
private int mDisplayMode = DISPLAY_MODE_WINDOW;
private WindowManager mWindowManager;
private Navigator mNavigator;
private HoverMenuAdapter mAdapter;
private String mSavedVisualState = null;

public HoverMenuBuilder(@NonNull Context context) {
mContext = context;
}

public HoverMenuBuilder displayWithinWindow() {
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mDisplayMode = DISPLAY_MODE_WINDOW;
return this;
}

public HoverMenuBuilder displayWithinView(@NonNull ViewGroup container) {
mDisplayMode = DISPLAY_MODE_VIEW;
return this;
}

public HoverMenuBuilder useNavigator(@Nullable Navigator navigator) {
mNavigator = navigator;
return this;
}

public HoverMenuBuilder useAdapter(@Nullable HoverMenuAdapter adapter) {
mAdapter = adapter;
return this;
}

public HoverMenuBuilder restoreVisualState(@NonNull String visualState) {
mSavedVisualState = visualState;
return this;
}

public HoverMenu build() {
if (DISPLAY_MODE_WINDOW == mDisplayMode) {
WindowHoverMenu windowHoverMenu = new WindowHoverMenu(mContext, mWindowManager, mNavigator, mSavedVisualState);
windowHoverMenu.setAdapter(mAdapter);
return windowHoverMenu;
} else {
ViewHoverMenu viewHoverMenu = new ViewHoverMenu(mContext);
viewHoverMenu.setAdapter(mAdapter);
return viewHoverMenu;
}
}
}
Loading

0 comments on commit e81b661

Please sign in to comment.