6.0.2 - 新增images.bilateralFilter() 修复toast多次调用/客户端及服务端模式开关/安卓7无法使用UI模式 部分插件及工具版本更新
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "com.android.library"
|
||||
id "kotlin-android"
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
@@ -10,21 +10,21 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
}
|
||||
|
||||
// tasks.withType(JavaCompile) {
|
||||
// options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
|
||||
// options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
|
||||
// }
|
||||
|
||||
android {
|
||||
compileSdkVersion versions.compile
|
||||
compileSdkVersion versions.project.compile
|
||||
defaultConfig {
|
||||
minSdkVersion versions.mini
|
||||
targetSdkVersion versions.target
|
||||
minSdkVersion versions.project.mini
|
||||
targetSdkVersion versions.project.target
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
@@ -41,32 +41,27 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "junit:junit:${junitVer}"
|
||||
testImplementation "junit:junit:${versions.junit}"
|
||||
|
||||
implementation "net.lingala.zip4j:zip4j:2.9.1"
|
||||
|
||||
implementation "com.afollestad.material-dialogs:core:0.9.6.0"
|
||||
implementation "com.google.android.material:material:1.6.0-alpha01"
|
||||
implementation 'net.lingala.zip4j:zip4j:2.9.1'
|
||||
|
||||
// OkHttp
|
||||
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.3"
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.4'
|
||||
|
||||
// Gson
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation 'com.google.code.gson:gson:2.8.9'
|
||||
|
||||
// Log4j
|
||||
implementation group: "de.mindpipe.android", name: "android-logging-log4j", version: "1.0.3"
|
||||
implementation group: "log4j", name: "log4j", version: "1.2.17"
|
||||
implementation 'de.mindpipe.android:android-logging-log4j:1.0.3'
|
||||
implementation 'log4j:log4j:1.2.17'
|
||||
|
||||
// Terminal emulator
|
||||
api project(":libs:jackpal.androidterm.libtermexec-1.0")
|
||||
api project(":libs:jackpal.androidterm.emulatorview-1.0.42")
|
||||
api project(":libs:jackpal.androidterm-1.0.70")
|
||||
api project(':libs:jackpal.androidterm.libtermexec-1.0')
|
||||
api project(':libs:jackpal.androidterm.emulatorview-1.0.42')
|
||||
api project(':libs:jackpal.androidterm-1.0.70')
|
||||
|
||||
api project(":libs:com.android.dx-1.7.0")
|
||||
api project(":libs:org.mozilla.rhino-1.7.14")
|
||||
api project(":libs:org.opencv-4.5.4")
|
||||
api project(':libs:com.android.dx-1.7.0')
|
||||
|
||||
api project(":common")
|
||||
api project(":automator")
|
||||
api project(':common')
|
||||
api project(':automator')
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
let Looper = android.os.Looper;
|
||||
let Toast = android.widget.Toast;
|
||||
let Runnable = java.lang.Runnable;
|
||||
let ScriptInterruptedException = com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||
let ReentrantLock = java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
module.exports = function (runtime, global) {
|
||||
let _ = {
|
||||
@@ -54,6 +56,28 @@ module.exports = function (runtime, global) {
|
||||
}
|
||||
return this.buildTypes.release;
|
||||
},
|
||||
toasts: {
|
||||
/**
|
||||
* @type {android.widget.Toast[]}
|
||||
*/
|
||||
pool: [],
|
||||
lock: new ReentrantLock(),
|
||||
add(t) {
|
||||
if (t instanceof Toast) {
|
||||
this.lock.lock();
|
||||
this.pool.push(t);
|
||||
this.lock.unlock();
|
||||
}
|
||||
},
|
||||
dismiss() {
|
||||
this.lock.lock();
|
||||
this.pool.forEach((t) => {
|
||||
t.cancel();
|
||||
});
|
||||
this.pool.splice(0);
|
||||
this.lock.unlock();
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Object.assign(global, {
|
||||
@@ -62,29 +86,15 @@ module.exports = function (runtime, global) {
|
||||
androidx: Packages.androidx,
|
||||
toast(msg, is_long, is_forcible) {
|
||||
let $ = {
|
||||
cache: null,
|
||||
toast(msg, is_long, is_forcible) {
|
||||
toast() {
|
||||
this.init(arguments);
|
||||
this.post();
|
||||
this.show();
|
||||
},
|
||||
/** @param {IArguments} args */
|
||||
init(args) {
|
||||
let [msg, is_long, is_forcible] = args;
|
||||
init() {
|
||||
this.message = isNullish(msg) ? '' : msg.toString();
|
||||
this.is_long = this.parseIsLong(is_long);
|
||||
this.is_forcible = is_forcible;
|
||||
},
|
||||
post() {
|
||||
ui.post(() => {
|
||||
new android.os.Handler(Looper.getMainLooper()).post(new Runnable({
|
||||
run() {
|
||||
$.is_forcible && $.dismiss();
|
||||
$.cache = Toast.makeText(context, $.message, $.is_long);
|
||||
$.show();
|
||||
},
|
||||
}));
|
||||
});
|
||||
},
|
||||
parseIsLong(is_long) {
|
||||
if (typeof is_long === 'number') {
|
||||
return Number(!!is_long);
|
||||
@@ -97,22 +107,23 @@ module.exports = function (runtime, global) {
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
dismiss() {
|
||||
if (this.cache instanceof Toast) {
|
||||
this.cache.cancel();
|
||||
this.cache = null;
|
||||
}
|
||||
},
|
||||
show() {
|
||||
this.cache.show();
|
||||
ui.post(() => {
|
||||
new android.os.Handler(Looper.getMainLooper()).post(new Runnable({
|
||||
run() {
|
||||
if ($.is_forcible) {
|
||||
$.dismiss();
|
||||
}
|
||||
$.toastObj = Toast.makeText(context, $.message, $.is_long);
|
||||
_.toasts.add($.toastObj);
|
||||
$.toastObj.show();
|
||||
},
|
||||
}));
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
(function $LazY() {
|
||||
this.toast = $.toast.bind($);
|
||||
this.toast.dismiss = () => $.dismiss();
|
||||
return this.toast;
|
||||
}.call(this)).apply(null, arguments);
|
||||
$.toast();
|
||||
},
|
||||
toastLog(msg, is_long, is_forcible) {
|
||||
this.toast.apply(this, arguments);
|
||||
@@ -136,7 +147,13 @@ module.exports = function (runtime, global) {
|
||||
sleep(min, max) {
|
||||
if (this.trigger()) {
|
||||
this.parseArgs(min, max);
|
||||
runtime.sleep(this.min + this.rand_bound);
|
||||
try {
|
||||
runtime.sleep(this.min + this.rand_bound);
|
||||
} catch (e) {
|
||||
if (!(e.javaException instanceof ScriptInterruptedException)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
trigger() {
|
||||
@@ -262,5 +279,17 @@ module.exports = function (runtime, global) {
|
||||
isReference(o) {
|
||||
return o === Object(o);
|
||||
},
|
||||
});
|
||||
$bind() {
|
||||
this.toast.dismiss = function () {
|
||||
ui.post(() => {
|
||||
new android.os.Handler(Looper.getMainLooper()).post(new Runnable({
|
||||
run() {
|
||||
_.toasts.dismiss();
|
||||
},
|
||||
}));
|
||||
});
|
||||
};
|
||||
return this;
|
||||
},
|
||||
}.$bind());
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,6 @@ import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.view.accessibility.AccessibilityNodeInfo
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.stardust.autojs.annotation.ScriptInterface
|
||||
import com.stardust.autojs.runtime.ScriptRuntime
|
||||
import com.stardust.autojs.runtime.accessibility.AccessibilityConfig
|
||||
@@ -41,7 +40,6 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
return ActionTarget.BoundsActionTarget(Rect(left, top, right, bottom))
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@ScriptInterface
|
||||
fun editable(i: Int): ActionTarget {
|
||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@@ -104,14 +102,12 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
fun setText(target: ActionTarget, text: String): Boolean {
|
||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
return performAction(target.createAction(AccessibilityNodeInfo.ACTION_SET_TEXT, text))
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
fun appendText(target: ActionTarget, text: String): Boolean {
|
||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
return performAction(target.createAction(UiObject.ACTION_APPEND_TEXT, text))
|
||||
@@ -128,7 +124,6 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
fun powerDialog(): Boolean {
|
||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
return performGlobalAction(AccessibilityService.GLOBAL_ACTION_POWER_DIALOG)
|
||||
@@ -150,33 +145,27 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun splitScreen(): Boolean {
|
||||
return performGlobalAction(AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN)
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun gesture(start: Long, duration: Long, vararg points: IntArray): Boolean {
|
||||
prepareForGesture()
|
||||
return mGlobalActionAutomator.gesture(start, duration, *points)
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun gestureAsync(start: Long, duration: Long, vararg points: IntArray) {
|
||||
prepareForGesture()
|
||||
mGlobalActionAutomator.gestureAsync(start, duration, *points)
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun gestures(strokes: Any): Boolean {
|
||||
prepareForGesture()
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return mGlobalActionAutomator.gestures(*strokes as Array<GestureDescription.StrokeDescription>)
|
||||
}
|
||||
|
||||
//如果这里用GestureDescription.StrokeDescription[]为参数,安卓7.0以下会因为找不到这个类而报错
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun gesturesAsync(strokes: Any) {
|
||||
prepareForGesture()
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -195,28 +184,24 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun click(x: Int, y: Int): Boolean {
|
||||
prepareForGesture()
|
||||
return mGlobalActionAutomator.click(x, y)
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun press(x: Int, y: Int, delay: Int): Boolean {
|
||||
prepareForGesture()
|
||||
return mGlobalActionAutomator.press(x, y, delay)
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun longClick(x: Int, y: Int): Boolean {
|
||||
prepareForGesture()
|
||||
return mGlobalActionAutomator.longClick(x, y)
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
fun swipe(x1: Int, y1: Int, x2: Int, y2: Int, delay: Int): Boolean {
|
||||
prepareForGesture()
|
||||
return mGlobalActionAutomator.swipe(x1, y1, x2, y2, delay.toLong())
|
||||
@@ -228,7 +213,6 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
return service.performGlobalAction(action)
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
@ScriptInterface
|
||||
fun paste(target: ActionTarget): Boolean {
|
||||
ScriptRuntime.requiresApi(18)
|
||||
@@ -244,7 +228,7 @@ class SimpleActionAutomator(private val mAccessibilityBridge: AccessibilityBridg
|
||||
if (AccessibilityConfig.isUnintendedGuardEnabled() && isRunningPackageSelf) {
|
||||
return false
|
||||
}
|
||||
val roots = mAccessibilityBridge.windowRoots().filter { it != null }
|
||||
val roots = mAccessibilityBridge.windowRoots().filterNotNull()
|
||||
if (roots.isEmpty())
|
||||
return false
|
||||
var succeed = true
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.stardust.autojs.core.image;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.stardust.autojs.core.opencv.MatOfPoint;
|
||||
@@ -23,7 +24,7 @@ import org.opencv.core.Scalar;
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
public class ColorFinder {
|
||||
|
||||
private ScreenMetrics mScreenMetrics;
|
||||
private final ScreenMetrics mScreenMetrics;
|
||||
|
||||
public ColorFinder(ScreenMetrics screenMetrics) {
|
||||
mScreenMetrics = screenMetrics;
|
||||
@@ -56,7 +57,6 @@ public class ColorFinder {
|
||||
}
|
||||
|
||||
public Point[] findAllPointsForColor(ImageWrapper image, int color, int threshold, Rect rect) {
|
||||
|
||||
MatOfPoint matOfPoint = findColorInner(image, color, threshold, rect);
|
||||
if (matOfPoint == null) {
|
||||
return new Point[0];
|
||||
@@ -64,9 +64,9 @@ public class ColorFinder {
|
||||
Point[] points = matOfPoint.toArray();
|
||||
OpenCVHelper.release(matOfPoint);
|
||||
if (rect != null) {
|
||||
for (int i = 0; i < points.length; i++) {
|
||||
points[i].x = mScreenMetrics.scaleX((int) (points[i].x + rect.x));
|
||||
points[i].y = mScreenMetrics.scaleX((int) (points[i].y + rect.y));
|
||||
for (Point point : points) {
|
||||
point.x = mScreenMetrics.scaleX((int) (point.x + rect.x));
|
||||
point.y = mScreenMetrics.scaleX((int) (point.y + rect.y));
|
||||
}
|
||||
}
|
||||
return points;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.stardust.autojs.core.ui.inflater;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.InflateException;
|
||||
@@ -19,6 +16,9 @@ import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.stardust.autojs.core.ui.inflater.inflaters.AppBarInflater;
|
||||
import com.stardust.autojs.core.ui.inflater.inflaters.BaseViewInflater;
|
||||
@@ -64,7 +64,7 @@ public class DynamicLayoutInflater {
|
||||
private Map<String, ViewInflater<?>> mViewAttrSetters = new HashMap<>();
|
||||
private Map<String, ViewCreator<?>> mViewCreators = new HashMap<>();
|
||||
private Context mContext;
|
||||
private ResourceParser mResourceParser;
|
||||
private final ResourceParser mResourceParser;
|
||||
@NonNull
|
||||
private LayoutInflaterDelegate mLayoutInflaterDelegate = LayoutInflaterDelegate.NO_OP;
|
||||
private int mInflateFlags;
|
||||
@@ -74,7 +74,7 @@ public class DynamicLayoutInflater {
|
||||
registerViewAttrSetters();
|
||||
}
|
||||
|
||||
@SuppressWarnings("IncompleteCopyConstructor")
|
||||
@SuppressWarnings("CopyConstructorMissesField")
|
||||
public DynamicLayoutInflater(DynamicLayoutInflater inflater) {
|
||||
this.mResourceParser = inflater.mResourceParser;
|
||||
this.mContext = inflater.mContext;
|
||||
@@ -159,7 +159,7 @@ public class DynamicLayoutInflater {
|
||||
return mLayoutInflaterDelegate.afterInflation(context, doInflation(context, xml, parent, attachToParent), xml, parent);
|
||||
}
|
||||
|
||||
public InflateContext newInflateContext(){
|
||||
public InflateContext newInflateContext() {
|
||||
return new InflateContext();
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ public class DynamicLayoutInflater {
|
||||
}
|
||||
Class<?> clazz = Class.forName(name);
|
||||
String style = attrs.get("style");
|
||||
if (style == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (style == null) {
|
||||
return (View) clazz.getConstructor(Context.class).newInstance(mContext);
|
||||
} else {
|
||||
int styleRes = Res.parseStyle(mContext, style);
|
||||
@@ -316,7 +316,6 @@ public class DynamicLayoutInflater {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void applyAttributes(InflateContext context, View view, ViewInflater<View> setter, Map<String, String> attrs, @Nullable ViewGroup parent) {
|
||||
if (setter != null) {
|
||||
for (Map.Entry<String, String> entry : attrs.entrySet()) {
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package com.stardust.autojs.core.ui.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/5/15.
|
||||
*/
|
||||
|
||||
@SuppressLint("AppCompatCustomView")
|
||||
public class JsTextView extends AppCompatTextView {
|
||||
|
||||
public JsTextView(Context context) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.stardust.autojs.core.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompatlegacy.widget.AppCompatTextView;
|
||||
|
||||
public class JsTextViewLegacy extends AppCompatTextView {
|
||||
|
||||
public JsTextViewLegacy(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public JsTextViewLegacy(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public JsTextViewLegacy(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public String text() {
|
||||
return getText().toString();
|
||||
}
|
||||
|
||||
public void text(CharSequence text) {
|
||||
setText(text);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.stardust.autojs.core.ui.xml;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import android.os.Build;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -13,6 +10,9 @@ import android.widget.ScrollView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.stardust.autojs.core.graphics.ScriptCanvasView;
|
||||
@@ -27,6 +27,7 @@ import com.stardust.autojs.core.ui.widget.JsRelativeLayout;
|
||||
import com.stardust.autojs.core.ui.widget.JsSpinner;
|
||||
import com.stardust.autojs.core.ui.widget.JsTabLayout;
|
||||
import com.stardust.autojs.core.ui.widget.JsTextView;
|
||||
import com.stardust.autojs.core.ui.widget.JsTextViewLegacy;
|
||||
import com.stardust.autojs.core.ui.widget.JsToolbar;
|
||||
import com.stardust.autojs.core.ui.widget.JsViewPager;
|
||||
import com.stardust.autojs.core.ui.widget.JsWebView;
|
||||
@@ -59,7 +60,9 @@ public class XmlConverter {
|
||||
.map("horizontal", JsLinearLayout.class.getName())
|
||||
.map("relative", JsRelativeLayout.class.getName())
|
||||
.map("button", JsButton.class.getName())
|
||||
.map("text", JsTextView.class.getName())
|
||||
.map("text", Build.VERSION.SDK_INT < Build.VERSION_CODES.O
|
||||
? JsTextViewLegacy.class.getName()
|
||||
: JsTextView.class.getName())
|
||||
.map("input", JsEditText.class.getName())
|
||||
.map("img", JsImageView.class.getName())
|
||||
.map("datepicker", DatePicker.class.getName())
|
||||
|
||||
@@ -332,9 +332,6 @@ public class ScriptRuntime {
|
||||
}
|
||||
|
||||
public void requestPermissions(String[] permissions) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
return;
|
||||
}
|
||||
Context context = uiHandler.getContext();
|
||||
permissions = Permissions.getPermissionsNeedToRequest(context, permissions);
|
||||
if (permissions.length == 0)
|
||||
@@ -412,9 +409,7 @@ public class ScriptRuntime {
|
||||
mRootShell = null;
|
||||
mShellSupplier = null;
|
||||
});
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
ignoresException(images::releaseScreenCapturer);
|
||||
}
|
||||
ignoresException(images::releaseScreenCapturer);
|
||||
ignoresException(sensors::unregisterAll);
|
||||
ignoresException(timers::recycle);
|
||||
ignoresException(ui::recycle);
|
||||
@@ -456,8 +451,7 @@ public class ScriptRuntime {
|
||||
public static String getStackTrace(Throwable e, boolean printJavaStackTrace) {
|
||||
String message = e.getMessage();
|
||||
StringBuilder scriptTrace = new StringBuilder(message == null ? "" : message + "\n");
|
||||
if (e instanceof RhinoException) {
|
||||
RhinoException rhinoException = (RhinoException) e;
|
||||
if (e instanceof RhinoException rhinoException) {
|
||||
scriptTrace.append(rhinoException.details()).append("\n");
|
||||
for (ScriptStackElement element : rhinoException.getScriptStack()) {
|
||||
element.renderV8Style(scriptTrace);
|
||||
|
||||
Reference in New Issue
Block a user