api: event click, long_click, touch_down and so on for view

This commit is contained in:
hyb1996
2018-03-20 21:27:02 +08:00
parent f16b3ad922
commit b46e08e6bf
15 changed files with 192 additions and 26 deletions

View File

@@ -1,6 +1,9 @@
package com.stardust.autojs.core.eventloop;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import com.stardust.autojs.core.looper.Timer;
@@ -110,10 +113,6 @@ public class EventEmitter {
mBridges = bridges;
}
protected void setTimer(Timer timer) {
mTimer = timer;
}
public EventEmitter once(String eventName, Object listener) {
getListeners(eventName).add(listener, true);
return this;

View File

@@ -181,7 +181,7 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
@Override
protected void observeInstructionCount(Context cx, int instructionCount) {
if (Thread.currentThread().isInterrupted()) {
if (Thread.currentThread().isInterrupted() && Looper.myLooper() != Looper.getMainLooper()) {
throw new ScriptInterruptedException();
}
}
@@ -195,14 +195,6 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
@Override
protected Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
if (Looper.myLooper() == Looper.getMainLooper()) {
try {
return super.doTopCall(callable, cx, scope, thisObj, args);
} catch (Exception e) {
getRuntime().exit(e);
return null;
}
}
return super.doTopCall(callable, cx, scope, thisObj, args);
}
}

View File

@@ -3,6 +3,8 @@ package com.stardust.autojs.runtime;
import android.content.Context;
import android.os.Build;
import android.os.Looper;
import android.view.MotionEvent;
import android.view.View;
import com.stardust.autojs.R;
import com.stardust.autojs.ScriptEngineService;

View File

@@ -1,5 +1,7 @@
package com.stardust.autojs.runtime.api;
import android.widget.RadioGroup;
import com.stardust.autojs.ScriptEngineService;
import com.stardust.autojs.engine.ScriptEngine;
import com.stardust.autojs.execution.ExecutionConfig;