random click and gesture for android 7.0+!!!

This commit is contained in:
hyb1996
2017-05-16 21:40:23 +08:00
parent ec98d75d3b
commit c4ec951a10
42 changed files with 757 additions and 564 deletions

View File

@@ -3,6 +3,7 @@ package com.stardust.scriptdroid.external;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import com.stardust.autojs.script.FileScriptSource;
import com.stardust.autojs.script.ScriptSource;
@@ -32,6 +33,7 @@ public class CommonUtils {
String directoryPath = null;
String script = intent.getStringExtra(CommonUtils.EXTRA_KEY_PRE_EXECUTE_SCRIPT);
ScriptSource source = null;
Toast.makeText(context, path, Toast.LENGTH_SHORT).show();
if (path == null && script != null) {
source = new StringScriptSource(script);
} else if (path != null && new PathChecker(context).checkAndToastError(path)) {

View File

@@ -0,0 +1,23 @@
package com.stardust.scriptdroid.external;
import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.Nullable;
/**
* Created by Stardust on 2017/5/15.
*/
public class ScriptExecutionIntentService extends IntentService {
public ScriptExecutionIntentService() {
super("ScriptExecutionIntentService");
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
if (intent == null)
return;
CommonUtils.handleIntent(this, intent);
}
}

View File

@@ -5,8 +5,8 @@ import android.support.annotation.NonNull;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.stardust.util.ScreenMetrics.getScreenHeight;
import static com.stardust.util.ScreenMetrics.getScreenWidth;
import static com.stardust.util.ScreenMetrics.getDeviceScreenHeight;
import static com.stardust.util.ScreenMetrics.getDeviceScreenWidth;
/**
* Created by Stardust on 2017/5/3.
@@ -23,8 +23,8 @@ public class InputEventToSendEventJsConverter extends InputEventConverter {
public InputEventToSendEventJsConverter() {
mCode.append("var sh = new Shell(true);\n")
.append("sh.SetScreenMetrics(").append(getScreenWidth()).append(", ")
.append(getScreenHeight()).append(");\n");
.append("sh.SetScreenMetrics(").append(getDeviceScreenWidth()).append(", ")
.append(getDeviceScreenHeight()).append(");\n");
}

View File

@@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
import com.stardust.scriptdroid.App;
import com.stardust.scriptdroid.external.CommonUtils;
import com.stardust.scriptdroid.external.ScriptExecutionIntentService;
import com.stardust.scriptdroid.external.open.RunIntentActivity;
import com.twofortyfouram.locale.sdk.client.receiver.AbstractPluginSettingReceiver;
@@ -30,9 +31,8 @@ public class FireSettingReceiver extends AbstractPluginSettingReceiver {
@Override
protected void firePluginSetting(@NonNull Context context, @NonNull Bundle bundle) {
CommonUtils.handleIntent(context, new Intent(App.getApp(), RunIntentActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(CommonUtils.EXTRA_KEY_PATH, bundle.getString(CommonUtils.EXTRA_KEY_PATH))
.putExtra(CommonUtils.EXTRA_KEY_PRE_EXECUTE_SCRIPT, bundle.getString(CommonUtils.EXTRA_KEY_PRE_EXECUTE_SCRIPT)));
context.startService(new Intent(context, ScriptExecutionIntentService.class)
.putExtras(bundle));
}
}