6.7.0 - Alpha13 - Fine tuning
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package org.autojs.autojs.runtime.api;
|
||||
|
||||
import org.autojs.autojs.extension.AnyExtensions;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -24,8 +23,8 @@ import org.autojs.autojs.annotation.ScriptVariable;
|
||||
import org.autojs.autojs.concurrent.VolatileDispose;
|
||||
import org.autojs.autojs.core.image.CapturedImage;
|
||||
import org.autojs.autojs.core.image.ImageWrapper;
|
||||
import org.autojs.autojs.core.image.Shootable;
|
||||
import org.autojs.autojs.core.image.RhinoColorFinder;
|
||||
import org.autojs.autojs.core.image.Shootable;
|
||||
import org.autojs.autojs.core.image.TemplateMatching;
|
||||
import org.autojs.autojs.core.image.capture.ScreenCaptureRequester;
|
||||
import org.autojs.autojs.core.image.capture.ScreenCapturer;
|
||||
@@ -34,6 +33,7 @@ import org.autojs.autojs.core.opencv.Mat;
|
||||
import org.autojs.autojs.core.opencv.OpenCVHelper;
|
||||
import org.autojs.autojs.core.pref.Language;
|
||||
import org.autojs.autojs.core.ui.inflater.util.Drawables;
|
||||
import org.autojs.autojs.extension.AnyExtensions;
|
||||
import org.autojs.autojs.pio.UncheckedIOException;
|
||||
import org.autojs.autojs.runtime.ScriptRuntime;
|
||||
import org.autojs.autojs.runtime.api.ImageFeatureMatching.FeatureMatchingDescriptor;
|
||||
|
||||
@@ -342,7 +342,7 @@ object Inspect : Augmentable(), Invokable {
|
||||
if (value is NativeJavaPackage) return value.toString()
|
||||
if (value is NativeJavaClass) return value.toString()
|
||||
if (value.javaClass.isArray) return javaArrayToString(value)
|
||||
if (value !is ScriptableObject) return formatValue(ctx, Context.toString(value), recurseTimes)
|
||||
if (value !is ScriptableObject) return Context.toString(value)
|
||||
if (value is ProxyObject) return formatValue(ctx, value[AUGMENTED_OBJECT_KEY], recurseTimes)
|
||||
|
||||
// @Hint by SuperMonster003 on Apr 16, 2024.
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.autojs.autojs.util.RhinoUtils.ObsoletedRhinoFunctionException
|
||||
import org.autojs.autojs.util.RhinoUtils.callToStringFunction
|
||||
import org.autojs.autojs.util.RhinoUtils.coerceFloatNumber
|
||||
import org.autojs.autojs.util.RhinoUtils.coerceNumber
|
||||
import org.autojs.autojs.util.RhinoUtils.coerceString
|
||||
import org.autojs.autojs.util.RhinoUtils.js_function_bind
|
||||
import org.autojs.autojs.util.RhinoUtils.js_json_stringify
|
||||
import org.autojs.autojs.util.RhinoUtils.js_object_create
|
||||
@@ -349,13 +350,13 @@ object Util : Augmentable() {
|
||||
if (args.isEmpty()) return ""
|
||||
|
||||
val first = args[0]
|
||||
if (first !is String) {
|
||||
if (!first.isJsString()) {
|
||||
return args.joinToString(" ") { inspectRhino(it) }
|
||||
}
|
||||
|
||||
val argsSize = args.size
|
||||
var index = 1
|
||||
val fmt = first
|
||||
val fmt = coerceString(first)
|
||||
val len = fmt.length
|
||||
// Estimate some margin to reduce expansion.
|
||||
// zh-CN: 预估一些余量, 减少扩容.
|
||||
@@ -421,7 +422,9 @@ object Util : Augmentable() {
|
||||
}
|
||||
}
|
||||
|
||||
val formatted = inspectRhino(sb.toString())
|
||||
// Do NOT inspect the formatted string, otherwise control characters like '\n' will be escaped.
|
||||
// zh-CN: 不要对格式化结果做 inspect, 否则诸如 '\n' 的控制字符会被转义.
|
||||
val formatted = sb.toString()
|
||||
|
||||
return when {
|
||||
index >= argsSize -> formatted
|
||||
@@ -430,14 +433,17 @@ object Util : Augmentable() {
|
||||
// zh-CN: 追加剩余参数, 以空格分隔.
|
||||
val out = StringBuilder(formatted.length + 1 + (argsSize - index) * 8)
|
||||
out.append(formatted)
|
||||
out.append(' ')
|
||||
// Append the first one first, then add spaces for the rest to avoid checking leading spaces in the loop.
|
||||
// zh-CN: 为避免在循环中判断前导空格, 这里先追加第一个, 再对剩余的加空格.
|
||||
out.append(inspectRhino(args[index++]))
|
||||
|
||||
while (index < argsSize) {
|
||||
val x = args[index++]
|
||||
out.append(' ')
|
||||
out.append(inspectRhino(args[index++]))
|
||||
if (x == null || !x.isJsObject()) {
|
||||
out.append(Context.toString(x))
|
||||
} else {
|
||||
out.append(inspectRhino(x))
|
||||
}
|
||||
}
|
||||
|
||||
out.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:background="?android:divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginVertical="2dp"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
@@ -58,6 +58,7 @@
|
||||
android:text="@string/text_settings"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -87,6 +88,7 @@
|
||||
android:text="@string/text_plugins"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -146,6 +148,7 @@
|
||||
android:text="@string/text_exit"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user