release 2.0.13Beta
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
|||||||
applicationId "com.stardust.scriptdroid"
|
applicationId "com.stardust.scriptdroid"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 140
|
versionCode 141
|
||||||
versionName "2.0.13 Alpha3"
|
versionName "2.0.13 Beta"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
ndk {
|
ndk {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
android:name=".ui.error.IssueReporterActivity"
|
android:name=".ui.error.IssueReporterActivity"
|
||||||
android:theme="@style/IssueReporterTheme"/>
|
android:theme="@style/IssueReporterTheme"/>
|
||||||
|
|
||||||
|
|
||||||
<service android:name="com.stardust.scriptdroid.external.ScriptExecutionIntentService"/>
|
<service android:name="com.stardust.scriptdroid.external.ScriptExecutionIntentService"/>
|
||||||
<service android:name="com.stardust.scriptdroid.external.floatingwindow.menu.HoverMenuService"/>
|
<service android:name="com.stardust.scriptdroid.external.floatingwindow.menu.HoverMenuService"/>
|
||||||
|
|
||||||
|
|||||||
@@ -3,23 +3,23 @@ shell命令是通过shell函数运行的命令。等同于"adb shell"。shell函
|
|||||||
* cmd \<String\> 要执行的命令
|
* cmd \<String\> 要执行的命令
|
||||||
* root \<Boolean\> 是否以root权限运行,默认为false。
|
* root \<Boolean\> 是否以root权限运行,默认为false。
|
||||||
返回运行一个执行结果。该返回值一般不会用到,其属性如下:
|
返回运行一个执行结果。该返回值一般不会用到,其属性如下:
|
||||||
* code \<Number\> 返回码。执行成功时为1,失败时为非1的数字,一般为0。
|
* code \<Number\> 返回码。执行成功时为0,失败时为非0的数字。
|
||||||
* result \<String\> 运行结果。
|
* result \<String\> 运行结果。
|
||||||
* error \<String\> 运行的错误信息。例如执行需要root权限的命令但没有授予root权限会返回错误信息"Permission denied"。
|
* error \<String\> 运行的错误信息。例如执行需要root权限的命令但没有授予root权限会返回错误信息"Permission denied"。
|
||||||
|
|
||||||
示例(强制停止微信) :
|
示例(强制停止微信) :
|
||||||
```
|
```
|
||||||
var result = shell("am force-stop com.tencent.mm", true);
|
var result = shell("am force-stop com.tencent.mm", true);
|
||||||
if(result.code == 1){
|
log(result);
|
||||||
|
openConsole();
|
||||||
|
if(result.code == 0){
|
||||||
toast("执行成功");
|
toast("执行成功");
|
||||||
}else{
|
}else{
|
||||||
toast("执行失败!请到控制台查看错误信息");
|
toast("执行失败!请到控制台查看错误信息");
|
||||||
err(result.error);
|
|
||||||
openConsole();
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
以下关于shell命令的资料来自[AndroidStudio用户指南:Sehll命令](https://developer.android.com/studio/command-line/adb.html#shellcommands)。
|
以下关于shell命令的资料来自[AndroidStudio用户指南:Shell命令](https://developer.android.com/studio/command-line/adb.html#shellcommands)。
|
||||||
|
|
||||||
目录:
|
目录:
|
||||||
* [am命令](#am命令)
|
* [am命令](#am命令)
|
||||||
@@ -367,31 +367,19 @@ log(shell("ls /system/bin"));
|
|||||||
|
|
||||||
Shell类的构造函数。
|
Shell类的构造函数。
|
||||||
|
|
||||||
### Shell.execute(cmd)
|
### Shell.exec(cmd)
|
||||||
* cmd \<String\> 要执行的命令
|
* cmd \<String\> 要执行的命令
|
||||||
|
|
||||||
|
该命令没有返回值。
|
||||||
|
|
||||||
执行命令cmd,例如:
|
执行命令cmd,例如:
|
||||||
```
|
```
|
||||||
var sh = Shell(true);
|
var sh = new Shell(true);
|
||||||
sh.execute("rm /sdcard/1.txt"); //删除SD卡上的1.txt文件
|
sh.exec("rm -f /sdcard/1.txt"); //删除SD卡上的1.txt文件
|
||||||
```
|
```
|
||||||
|
|
||||||
### Shell.exitAndWaitFor()
|
|
||||||
退出Shell,并等待所有命令执行完成。
|
|
||||||
一个完整的例子如下:
|
|
||||||
```
|
|
||||||
var sh = Shell(true);
|
|
||||||
sh.execute("rm /sdcard/1.txt");
|
|
||||||
sh.execute("input keyevent 26");
|
|
||||||
sh.exitAndWaitFor();
|
|
||||||
```
|
|
||||||
|
|
||||||
### Shell.waitFor()
|
|
||||||
等待当前所有命令执行完成。返回一个整数作为返回码,1为执行成功,其他数字为错误。
|
|
||||||
|
|
||||||
### Shell.exit()
|
### Shell.exit()
|
||||||
退出Shell。调用该函数后再执行的命令无效。
|
退出Shell。调用该函数后再执行的命令无效。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
除以上命令之外, Shell也包含自动操作的命令,例如Shell.Tap,参见《需要Root权限的自动操作函数》。
|
除以上命令之外, Shell也包含自动操作的命令,例如Shell.Tap,参见《需要Root权限的自动操作函数》。
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
### requestScreenCapture(\[width, height\])
|
### requestScreenCapture(\[width, height\])
|
||||||
|
|
||||||
参数width和height用于指定截图的分辨率,默认为屏幕宽高。
|
参数width和height用于指定截图的分辨率,默认为屏幕宽高。
|
||||||
|
|
||||||
|
未完待续。
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
控制台通常用来输出一些调试信息和运算结果。
|
控制台通常用来输出一些调试信息和运算结果。
|
||||||
而Toast是安卓上一种显示信息的机制,即使应用在后台运行也能显示。
|
|
||||||
|
|
||||||
### openConsole()
|
### openConsole()
|
||||||
显示控制台。
|
显示控制台。
|
||||||
@@ -30,4 +29,4 @@ try{
|
|||||||
### toast(message)
|
### toast(message)
|
||||||
* message \<String\> | \<Object\> 要显示的信息
|
* message \<String\> | \<Object\> 要显示的信息
|
||||||
|
|
||||||
以灰色的方框显示信息message几秒。(具体时间取决于安卓系统)
|
以气泡显示信息message几秒。(具体时间取决于安卓系统)
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.stardust.scriptdroid.external.floatingwindow.menu.layout_inspector;
|
package com.stardust.scriptdroid.external.floatingwindow.menu.layout_inspector;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
|
|
||||||
import com.stardust.view.accessibility.AccessibilityService;
|
import com.stardust.view.accessibility.AccessibilityService;
|
||||||
import com.stardust.util.UnderuseExecutors;
|
import com.stardust.util.UnderuseExecutors;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/3/10.
|
* Created by Stardust on 2017/3/10.
|
||||||
@@ -13,16 +15,19 @@ import java.util.concurrent.Executor;
|
|||||||
|
|
||||||
public class LayoutInspector {
|
public class LayoutInspector {
|
||||||
|
|
||||||
|
private static final String LOG_TAG = LayoutInspector.class.getSimpleName();
|
||||||
private volatile NodeInfo mCapture;
|
private volatile NodeInfo mCapture;
|
||||||
private volatile boolean mDumping = false;
|
private volatile boolean mDumping = false;
|
||||||
private Executor mExecutor = UnderuseExecutors.getExecutor();
|
private Executor mExecutor = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
public void captureCurrentWindow() {
|
public void captureCurrentWindow() {
|
||||||
AccessibilityService service = AccessibilityService.getInstance();
|
AccessibilityService service = AccessibilityService.getInstance();
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
|
Log.d(LOG_TAG, "captureCurrentWindow: service = null");
|
||||||
mCapture = null;
|
mCapture = null;
|
||||||
} else {
|
} else {
|
||||||
final AccessibilityNodeInfo root = service.getRootInActiveWindow();
|
final AccessibilityNodeInfo root = service.getRootInActiveWindow();
|
||||||
|
Log.d(LOG_TAG, "captureCurrentWindow: root = null");
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
mCapture = null;
|
mCapture = null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import com.stardust.scriptdroid.ui.edit.EditActivity;
|
|||||||
import com.stardust.scriptdroid.ui.edit.completion.InputMethodEnhanceBar;
|
import com.stardust.scriptdroid.ui.edit.completion.InputMethodEnhanceBar;
|
||||||
import com.stardust.scriptdroid.ui.edit.editor920.Editor920Activity;
|
import com.stardust.scriptdroid.ui.edit.editor920.Editor920Activity;
|
||||||
import com.stardust.scriptdroid.ui.edit.editor920.Editor920Utils;
|
import com.stardust.scriptdroid.ui.edit.editor920.Editor920Utils;
|
||||||
|
import com.stardust.theme.ThemeColorManager;
|
||||||
|
import com.stardust.theme.ThemeColorManagerCompat;
|
||||||
import com.stardust.view.ViewBinder;
|
import com.stardust.view.ViewBinder;
|
||||||
import com.stardust.view.ViewBinding;
|
import com.stardust.view.ViewBinding;
|
||||||
import com.stardust.widget.ToolbarMenuItem;
|
import com.stardust.widget.ToolbarMenuItem;
|
||||||
@@ -56,6 +58,7 @@ public class TaskerScriptEditActivity extends Editor920Activity {
|
|||||||
((TextView) findViewById(R.id.summary)).setText(mSummary);
|
((TextView) findViewById(R.id.summary)).setText(mSummary);
|
||||||
mRedo = (ToolbarMenuItem) findViewById(R.id.redo);
|
mRedo = (ToolbarMenuItem) findViewById(R.id.redo);
|
||||||
mUndo = (ToolbarMenuItem) findViewById(R.id.undo);
|
mUndo = (ToolbarMenuItem) findViewById(R.id.undo);
|
||||||
|
ThemeColorManager.addActivityStatusBar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleIntent(Intent intent) {
|
private void handleIntent(Intent intent) {
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ public class VersionInfo {
|
|||||||
|
|
||||||
private boolean mDeprecated = false;
|
private boolean mDeprecated = false;
|
||||||
private UpdateChecker.UpdateInfo mUpdateInfo;
|
private UpdateChecker.UpdateInfo mUpdateInfo;
|
||||||
private final int mReconnectTimes = 2;
|
|
||||||
private int mReconnectCount = 0;
|
|
||||||
private OnReceiveUpdateResultCallback mOnReceiveUpdateResultCallback;
|
private OnReceiveUpdateResultCallback mOnReceiveUpdateResultCallback;
|
||||||
private SharedPreferences mSharedPreferences;
|
private SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@@ -87,28 +85,22 @@ public class VersionInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkUpdate(Context context) {
|
public void checkUpdate(Context context) {
|
||||||
mReconnectCount = 0;
|
|
||||||
checkUpdateInner(context);
|
checkUpdateInner(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUpdateInner(final Context context) {
|
private void checkUpdateInner(final Context context) {
|
||||||
mReconnectCount++;
|
|
||||||
new UpdateChecker(context).check(new UpdateChecker.Callback() {
|
new UpdateChecker(context).check(new UpdateChecker.Callback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(UpdateChecker.UpdateInfo result) {
|
public void onSuccess(UpdateChecker.UpdateInfo result) {
|
||||||
if (result.isValid()) {
|
if (result.isValid()) {
|
||||||
setUpdateInfo(result);
|
setUpdateInfo(result);
|
||||||
} else if (mReconnectCount < mReconnectTimes) {
|
|
||||||
checkUpdate(context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception exception) {
|
public void onError(Exception exception) {
|
||||||
if (mReconnectCount < mReconnectTimes) {
|
exception.printStackTrace();
|
||||||
checkUpdate(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
checkPermissions();
|
checkPermissions();
|
||||||
registerBackPressHandlers();
|
|
||||||
mIntentToHandle = getIntent();
|
mIntentToHandle = getIntent();
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
mVersionGuard = new VersionGuard(this);
|
mVersionGuard = new VersionGuard(this);
|
||||||
@@ -113,7 +112,7 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
setUpDrawerHeader();
|
setUpDrawerHeader();
|
||||||
setUpFragment();
|
setUpFragment();
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
registerBackPressHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAnnunciationIfNeeded() {
|
private void showAnnunciationIfNeeded() {
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ public class MyScriptListFragment extends Fragment {
|
|||||||
private MaterialDialog.InputCallback mDirectoryNameInputCallback = new InputCallback(true);
|
private MaterialDialog.InputCallback mDirectoryNameInputCallback = new InputCallback(true);
|
||||||
private String mFilePathToImport;
|
private String mFilePathToImport;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View createView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="@string/app_name"
|
android:label="@string/_app_name"
|
||||||
>
|
>
|
||||||
<activity android:name=".execution.ScriptExecuteActivity"/>
|
<activity android:name=".execution.ScriptExecuteActivity"/>
|
||||||
<service
|
<service
|
||||||
android:name="com.stardust.view.accessibility.AccessibilityService"
|
android:name="com.stardust.view.accessibility.AccessibilityService"
|
||||||
android:enabled="true"
|
android:label="@string/_app_name"
|
||||||
android:exported="true"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.accessibilityservice.AccessibilityService"/>
|
<action android:name="android.accessibilityservice.AccessibilityService"/>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class Shell extends AbstractShell implements AutoCloseable {
|
|||||||
|
|
||||||
private static final String TAG = "Shell";
|
private static final String TAG = "Shell";
|
||||||
|
|
||||||
private TermSession mTermSession;
|
private volatile TermSession mTermSession;
|
||||||
private final Object mInitLock = new Object();
|
private final Object mInitLock = new Object();
|
||||||
private final Object mExitLock = new Object();
|
private final Object mExitLock = new Object();
|
||||||
private volatile RuntimeException mInitException;
|
private volatile RuntimeException mInitException;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<string name="text_console">控制台</string>
|
<string name="text_console">控制台</string>
|
||||||
<string name="text_no_floating_window_permission">没有悬浮窗权限</string>
|
<string name="text_no_floating_window_permission">没有悬浮窗权限</string>
|
||||||
<string name="text_accessibility_service_description">使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。</string>
|
<string name="text_accessibility_service_description">使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。</string>
|
||||||
|
<string name="_app_name">AutoJs</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user