release 2.0.13Beta

This commit is contained in:
hyb1996 2017-07-02 16:41:33 +08:00
parent 306cf4c5d3
commit e97744d7f2
13 changed files with 32 additions and 50 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "com.stardust.scriptdroid"
minSdkVersion 19
targetSdkVersion 23
versionCode 140
versionName "2.0.13 Alpha3"
versionCode 141
versionName "2.0.13 Beta"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {

View File

@ -79,6 +79,7 @@
android:name=".ui.error.IssueReporterActivity"
android:theme="@style/IssueReporterTheme"/>
<service android:name="com.stardust.scriptdroid.external.ScriptExecutionIntentService"/>
<service android:name="com.stardust.scriptdroid.external.floatingwindow.menu.HoverMenuService"/>

View File

@ -3,23 +3,23 @@ shell命令是通过shell函数运行的命令。等同于"adb shell"。shell函
* cmd \<String\> 要执行的命令
* root \<Boolean\> 是否以root权限运行默认为false。
返回运行一个执行结果。该返回值一般不会用到,其属性如下:
* code \<Number\> 返回码。执行成功时为1失败时为非1的数字一般为0
* code \<Number\> 返回码。执行成功时为0失败时为非0的数字
* result \<String\> 运行结果。
* error \<String\> 运行的错误信息。例如执行需要root权限的命令但没有授予root权限会返回错误信息"Permission denied"。
示例(强制停止微信)
```
var result = shell("am force-stop com.tencent.mm", true);
if(result.code == 1){
log(result);
openConsole();
if(result.code == 0){
toast("执行成功");
}else{
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命令)
@ -367,31 +367,19 @@ log(shell("ls /system/bin"));
Shell类的构造函数。
### Shell.execute(cmd)
### Shell.exec(cmd)
* cmd \<String\> 要执行的命令
该命令没有返回值。
执行命令cmd例如
```
var sh = Shell(true);
sh.execute("rm /sdcard/1.txt"); //删除SD卡上的1.txt文件
var sh = new Shell(true);
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。调用该函数后再执行的命令无效。
除以上命令之外, Shell也包含自动操作的命令例如Shell.Tap参见《需要Root权限的自动操作函数》。

View File

@ -1,3 +1,5 @@
### requestScreenCapture(\[width, height\])
参数width和height用于指定截图的分辨率默认为屏幕宽高。
参数width和height用于指定截图的分辨率默认为屏幕宽高。
未完待续。

View File

@ -1,5 +1,4 @@
控制台通常用来输出一些调试信息和运算结果。
而Toast是安卓上一种显示信息的机制即使应用在后台运行也能显示。
### openConsole()
显示控制台。
@ -30,4 +29,4 @@ try{
### toast(message)
* message \<String\> | \<Object\> 要显示的信息
灰色的方框显示信息message几秒。(具体时间取决于安卓系统)
气泡显示信息message几秒。(具体时间取决于安卓系统)

View File

@ -1,11 +1,13 @@
package com.stardust.scriptdroid.external.floatingwindow.menu.layout_inspector;
import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo;
import com.stardust.view.accessibility.AccessibilityService;
import com.stardust.util.UnderuseExecutors;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
* Created by Stardust on 2017/3/10.
@ -13,16 +15,19 @@ import java.util.concurrent.Executor;
public class LayoutInspector {
private static final String LOG_TAG = LayoutInspector.class.getSimpleName();
private volatile NodeInfo mCapture;
private volatile boolean mDumping = false;
private Executor mExecutor = UnderuseExecutors.getExecutor();
private Executor mExecutor = Executors.newSingleThreadExecutor();
public void captureCurrentWindow() {
AccessibilityService service = AccessibilityService.getInstance();
if (service == null) {
Log.d(LOG_TAG, "captureCurrentWindow: service = null");
mCapture = null;
} else {
final AccessibilityNodeInfo root = service.getRootInActiveWindow();
Log.d(LOG_TAG, "captureCurrentWindow: root = null");
if (root == null) {
mCapture = null;
} else {

View File

@ -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.editor920.Editor920Activity;
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.ViewBinding;
import com.stardust.widget.ToolbarMenuItem;
@ -56,6 +58,7 @@ public class TaskerScriptEditActivity extends Editor920Activity {
((TextView) findViewById(R.id.summary)).setText(mSummary);
mRedo = (ToolbarMenuItem) findViewById(R.id.redo);
mUndo = (ToolbarMenuItem) findViewById(R.id.undo);
ThemeColorManager.addActivityStatusBar(this);
}
private void handleIntent(Intent intent) {

View File

@ -30,8 +30,6 @@ public class VersionInfo {
private boolean mDeprecated = false;
private UpdateChecker.UpdateInfo mUpdateInfo;
private final int mReconnectTimes = 2;
private int mReconnectCount = 0;
private OnReceiveUpdateResultCallback mOnReceiveUpdateResultCallback;
private SharedPreferences mSharedPreferences;
@ -87,28 +85,22 @@ public class VersionInfo {
}
public void checkUpdate(Context context) {
mReconnectCount = 0;
checkUpdateInner(context);
}
private void checkUpdateInner(final Context context) {
mReconnectCount++;
new UpdateChecker(context).check(new UpdateChecker.Callback() {
@Override
public void onSuccess(UpdateChecker.UpdateInfo result) {
if (result.isValid()) {
setUpdateInfo(result);
} else if (mReconnectCount < mReconnectTimes) {
checkUpdate(context);
}
}
@Override
public void onError(Exception exception) {
if (mReconnectCount < mReconnectTimes) {
checkUpdate(context);
}
exception.printStackTrace();
}
});
}

View File

@ -99,7 +99,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkPermissions();
registerBackPressHandlers();
mIntentToHandle = getIntent();
EventBus.getDefault().register(this);
mVersionGuard = new VersionGuard(this);
@ -113,7 +112,7 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
setUpDrawerHeader();
setUpFragment();
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
registerBackPressHandlers();
}
private void showAnnunciationIfNeeded() {

View File

@ -55,12 +55,6 @@ public class MyScriptListFragment extends Fragment {
private MaterialDialog.InputCallback mDirectoryNameInputCallback = new InputCallback(true);
private String mFilePathToImport;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View createView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View File

@ -4,14 +4,12 @@
>
<application
android:label="@string/app_name"
android:label="@string/_app_name"
>
<activity android:name=".execution.ScriptExecuteActivity"/>
<service
android:name="com.stardust.view.accessibility.AccessibilityService"
android:enabled="true"
android:exported="true"
android:label="@string/app_name"
android:label="@string/_app_name"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService"/>

View File

@ -63,7 +63,7 @@ public class Shell extends AbstractShell implements AutoCloseable {
private static final String TAG = "Shell";
private TermSession mTermSession;
private volatile TermSession mTermSession;
private final Object mInitLock = new Object();
private final Object mExitLock = new Object();
private volatile RuntimeException mInitException;

View File

@ -13,6 +13,7 @@
<string name="text_console">控制台</string>
<string name="text_no_floating_window_permission">没有悬浮窗权限</string>
<string name="text_accessibility_service_description">使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。</string>
<string name="_app_name">AutoJs</string>
</resources>