fix: floaty
This commit is contained in:
@@ -2,23 +2,23 @@
|
|||||||
module.exports = function(runtime, global){
|
module.exports = function(runtime, global){
|
||||||
var floaty = {};
|
var floaty = {};
|
||||||
|
|
||||||
floaty.window = function(layout){
|
floaty.window = function(xml){
|
||||||
if(typeof(xml) == 'xml'){
|
if(typeof(xml) == 'xml'){
|
||||||
xml = xml.toXMLString();
|
xml = xml.toXMLString();
|
||||||
}
|
}
|
||||||
return wrap(runtime.floaty.window(function(context, parent){
|
return wrap(runtime.floaty.window(function(context, parent){
|
||||||
runtime.ui.layoutInflater.setContext(context);
|
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'){
|
if(typeof(xml) == 'xml'){
|
||||||
xml = xml.toXMLString();
|
xml = xml.toXMLString();
|
||||||
}
|
}
|
||||||
return wrap(runtime.floaty.rawWindow(function(context, parent){
|
return wrap(runtime.floaty.rawWindow(function(context, parent){
|
||||||
runtime.ui.layoutInflater.setContext(context);
|
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) {
|
public void onException(ScriptExecution execution, Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
onFinish(execution);
|
onFinish(execution);
|
||||||
|
String message = null;
|
||||||
if (!causedByInterrupted(e)) {
|
if (!causedByInterrupted(e)) {
|
||||||
|
message = e.getMessage();
|
||||||
if (execution.getEngine() instanceof JavaScriptEngine) {
|
if (execution.getEngine() instanceof JavaScriptEngine) {
|
||||||
((JavaScriptEngine) execution.getEngine()).getRuntime()
|
((JavaScriptEngine) execution.getEngine()).getRuntime()
|
||||||
.console.error(e);
|
.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
|
@Override
|
||||||
protected void onRegisterAttrs() {
|
protected void onRegisterAttrs() {
|
||||||
super.onRegisterAttrs();
|
super.onRegisterAttrs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.stardust.autojs.core.ui.nativeview;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
|
||||||
@@ -14,13 +16,16 @@ import com.stardust.autojs.runtime.ScriptRuntime;
|
|||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.Undefined;
|
import org.mozilla.javascript.Undefined;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ViewPrototype {
|
public class ViewPrototype {
|
||||||
|
|
||||||
private final EventEmitter mEventEmitter;
|
private final EventEmitter mEventEmitter;
|
||||||
private final View mView;
|
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 Scriptable mScope;
|
||||||
private final ViewAttributes mViewAttributes;
|
private final ViewAttributes mViewAttributes;
|
||||||
private Object mWidget;
|
private Object mWidget;
|
||||||
@@ -94,9 +99,21 @@ public class ViewPrototype {
|
|||||||
if (mRegisteredEvents.contains(eventName)) {
|
if (mRegisteredEvents.contains(eventName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (registerEvent(eventName)) {
|
if (Looper.getMainLooper() == Looper.myLooper()) {
|
||||||
mRegisteredEvents.add(eventName);
|
if (registerEvent(eventName)) {
|
||||||
|
mRegisteredEvents.add(eventName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mView.post(() -> {
|
||||||
|
if (mRegisteredEvents.contains(eventName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (registerEvent(eventName)) {
|
||||||
|
mRegisteredEvents.add(eventName);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.util.Base64;
|
|||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.stardust.autojs.annotation.ScriptVariable;
|
import com.stardust.autojs.annotation.ScriptVariable;
|
||||||
import com.stardust.autojs.core.image.ColorFinder;
|
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,
|
"appVersionCode": 430,
|
||||||
"appVersionName": "4.0.3 Alpha7",
|
"appVersionName": "4.0.4 Alpha",
|
||||||
"target": 28,
|
"target": 28,
|
||||||
"mini": 17,
|
"mini": 17,
|
||||||
"compile": 28,
|
"compile": 28,
|
||||||
|
|||||||
Reference in New Issue
Block a user