mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-24 21:33:16 +08:00
fix: floaty
This commit is contained in:
parent
82fa139ec0
commit
429407ed2d
@ -2,23 +2,23 @@
|
||||
module.exports = function(runtime, global){
|
||||
var floaty = {};
|
||||
|
||||
floaty.window = function(layout){
|
||||
floaty.window = function(xml){
|
||||
if(typeof(xml) == 'xml'){
|
||||
xml = xml.toXMLString();
|
||||
}
|
||||
return wrap(runtime.floaty.window(function(context, parent){
|
||||
runtime.ui.layoutInflater.setContext(context);
|
||||
return ui.__inflate__(runtime.ui.layoutInflater.inflate(xml.toString(), parent, true));
|
||||
return runtime.ui.layoutInflater.inflate(xml.toString(), parent, true);
|
||||
}));
|
||||
}
|
||||
|
||||
floaty.rawWindow = function(layout){
|
||||
floaty.rawWindow = function(xml){
|
||||
if(typeof(xml) == 'xml'){
|
||||
xml = xml.toXMLString();
|
||||
}
|
||||
return wrap(runtime.floaty.rawWindow(function(context, parent){
|
||||
runtime.ui.layoutInflater.setContext(context);
|
||||
return ui.__inflate__(runtime.ui.layoutInflater.inflate(xml.toString(), parent, true));
|
||||
return runtime.ui.layoutInflater.inflate(xml.toString(), parent, true);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@ -70,14 +70,27 @@ public class ScriptEngineService {
|
||||
public void onException(ScriptExecution execution, Exception e) {
|
||||
e.printStackTrace();
|
||||
onFinish(execution);
|
||||
String message = null;
|
||||
if (!causedByInterrupted(e)) {
|
||||
message = e.getMessage();
|
||||
if (execution.getEngine() instanceof JavaScriptEngine) {
|
||||
((JavaScriptEngine) execution.getEngine()).getRuntime()
|
||||
.console.error(e);
|
||||
}
|
||||
EVENT_BUS.post(new ScriptExecutionEvent(ScriptExecutionEvent.ON_EXCEPTION, e.getMessage()));
|
||||
}
|
||||
if (execution.getEngine() instanceof JavaScriptEngine) {
|
||||
JavaScriptEngine engine = (JavaScriptEngine) execution.getEngine();
|
||||
Exception uncaughtException = engine.getUncaughtException();
|
||||
if (uncaughtException != null) {
|
||||
engine.getRuntime().console.error(uncaughtException);
|
||||
message = uncaughtException.getMessage();
|
||||
}
|
||||
}
|
||||
if (message != null) {
|
||||
EVENT_BUS.post(new ScriptExecutionEvent(ScriptExecutionEvent.ON_EXCEPTION, message));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ public class TextViewAttributes extends ViewAttributes {
|
||||
@Override
|
||||
protected void onRegisterAttrs() {
|
||||
super.onRegisterAttrs();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,6 +2,8 @@ package com.stardust.autojs.core.ui.nativeview;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
@ -14,13 +16,16 @@ import com.stardust.autojs.runtime.ScriptRuntime;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
import org.mozilla.javascript.Undefined;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ViewPrototype {
|
||||
|
||||
private final EventEmitter mEventEmitter;
|
||||
private final View mView;
|
||||
private final HashSet<String> mRegisteredEvents = new HashSet<>();
|
||||
private final Set<String> mRegisteredEvents = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private final Scriptable mScope;
|
||||
private final ViewAttributes mViewAttributes;
|
||||
private Object mWidget;
|
||||
@ -94,9 +99,21 @@ public class ViewPrototype {
|
||||
if (mRegisteredEvents.contains(eventName)) {
|
||||
return;
|
||||
}
|
||||
if (registerEvent(eventName)) {
|
||||
mRegisteredEvents.add(eventName);
|
||||
if (Looper.getMainLooper() == Looper.myLooper()) {
|
||||
if (registerEvent(eventName)) {
|
||||
mRegisteredEvents.add(eventName);
|
||||
}
|
||||
} else {
|
||||
mView.post(() -> {
|
||||
if (mRegisteredEvents.contains(eventName)) {
|
||||
return;
|
||||
}
|
||||
if (registerEvent(eventName)) {
|
||||
mRegisteredEvents.add(eventName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
||||
@ -14,6 +14,7 @@ import android.util.Base64;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.stardust.autojs.annotation.ScriptVariable;
|
||||
import com.stardust.autojs.core.image.ColorFinder;
|
||||
|
||||
@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":426,"versionName":"4.0.3 Alpha7","enabled":true,"outputFile":"commonRelease-4.0.3 Alpha7.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.3 Alpha7.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":430,"versionName":"4.0.4 Alpha","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha.apk","properties":{}}]
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"appVersionCode": 426,
|
||||
"appVersionName": "4.0.3 Alpha7",
|
||||
"appVersionCode": 430,
|
||||
"appVersionName": "4.0.4 Alpha",
|
||||
"target": 28,
|
||||
"mini": 17,
|
||||
"compile": 28,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user