6.7.0 - Alpha13 - Fine tuning

This commit is contained in:
SuperMonster003
2025-12-25 17:54:30 +08:00
parent adc27e2c34
commit 4ed77a3085
10 changed files with 63 additions and 91 deletions

View File

@@ -29,7 +29,6 @@ import org.autojs.autojs.runtime.api.Shell
import org.autojs.autojs.runtime.api.WrappedShizuku
import org.autojs.autojs.script.AutoFileSource
import org.autojs.autojs.script.JavaScriptSource
import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.tool.UiHandler
import org.autojs.autojs.util.StringUtils
import org.autojs.autojs.util.ViewUtils

View File

@@ -57,10 +57,9 @@ public class GlobalActionRecorder implements Recorder.OnStateChangedListener {
return new TouchRecorder(mContext) {
@Override
protected InputEventRecorder createInputEventRecorder() {
if (Pref.rootRecordGeneratesBinary())
return new InputEventToAutoFileRecorder(mContext);
else
return new InputEventToRootAutomatorRecorder();
return Pref.rootRecordGeneratesBinary()
? new InputEventToAutoFileRecorder(mContext)
: new InputEventToRootAutomatorRecorder();
}
};
}
@@ -86,8 +85,9 @@ public class GlobalActionRecorder implements Recorder.OnStateChangedListener {
}
public int getState() {
if (mTouchRecorder == null)
if (mTouchRecorder == null) {
return Recorder.STATE_NOT_START;
}
return mTouchRecorder.getState();
}
@@ -116,10 +116,11 @@ public class GlobalActionRecorder implements Recorder.OnStateChangedListener {
}
if (!mDiscard) {
String code = getCode();
if (code != null)
if (code != null) {
handleRecordedScript(code);
else
} else {
handleRecordedFile(getPath());
}
}
for (Recorder.OnStateChangedListener listener : mOnStateChangedListeners) {
listener.onStop();
@@ -154,14 +155,13 @@ public class GlobalActionRecorder implements Recorder.OnStateChangedListener {
}
private void handleRecordedFile(final String path) {
if (isBackgroundThread()) {
if (isMainThread()) {
new ScriptOperations(mContext, null)
.importFile(path)
.subscribe();
} else {
GlobalAppContext.post(() -> handleRecordedFile(path));
return;
}
new ScriptOperations(mContext, null)
.importFile(path)
.subscribe();
}
private void showRecordHandleDialog(final String script) {

View File

@@ -13,7 +13,7 @@ import kotlin.math.roundToLong
*/
class VersionInfo : ExtendedVersionInfo {
var versionName: String = ""
var versionName = ""
private set
var versionCode = 0L
@@ -43,7 +43,7 @@ class VersionInfo : ExtendedVersionInfo {
Log.d(TAG, "versionName: $versionName")
}
if (versionCode <= 0 && line.contains(regexVersionCode)) {
versionCode = regexVersionCode.find(line)?.groupValues?.get(1)?.toDouble()?.roundToLong() ?: -1L
versionCode = regexVersionCode.find(line)?.groupValues?.get(1)?.toDoubleOrNull()?.roundToLong() ?: -1L
Log.d(TAG, "versionCode: $versionCode")
}
if (versionName.isNotBlank() && versionCode > 0) {

View File

@@ -66,13 +66,13 @@ class DocumentationActivity : BaseActivity() {
(function() {
let mainElements = document.querySelectorAll('main > *');
if (mainElements.length > 0) {
// Online docs (zh-CN: 在线文档)
// Online docs. (zh-CN: 在线文档.)
mainElements.forEach(ele => {
let basePaddingBottom = ele.className === 'sidebar-toggle' ? 10 : 0;
ele.style.paddingBottom = (basePaddingBottom + ${systemBarInsetsBottom}) / window.devicePixelRatio + 'px';
});
} else {
// Local docs (zh-CN: 本地文档)
// Local docs. (zh-CN: 本地文档.)
document.body.style.paddingBottom = '${systemBarInsetsBottom}px';
}
})();

View File

@@ -51,7 +51,7 @@ import java.text.MessageFormat;
/**
* Created by Stardust on Oct 18, 2017.
*/
public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInspector.CaptureAvailableListener {
public class CircularMenu implements LayoutInspector.CaptureAvailableListener {
public record StateChangeEvent(int currentState, int previousState) {
/* Empty record body. */
@@ -67,6 +67,7 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
private RoundedImageView mActionViewIcon;
private Context mContext;
private final GlobalActionRecorder mRecorder;
private final Recorder.OnStateChangedListener mRecorderStateListener;
private CircularActionMenuBinding binding;
private MaterialDialog mSettingsDialog;
private MaterialDialog mLayoutInspectDialog;
@@ -90,7 +91,28 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
initFloaty();
setupWindowListeners();
mRecorder = GlobalActionRecorder.getSingleton(context);
mRecorder.addOnStateChangedListener(this);
mRecorderStateListener = new Recorder.OnStateChangedListener() {
@Override
public void onStart() {
setState(STATE_RECORDING);
}
@Override
public void onStop() {
setState(STATE_NORMAL);
}
@Override
public void onPause() {
/* Empty body. */
}
@Override
public void onResume() {
/* Empty body. */
}
};
mRecorder.addOnStateChangedListener(mRecorderStateListener);
AutoJs.getInstance().getLayoutInspector().addCaptureAvailableListener(this);
mA11yTool = new AccessibilityTool(mContext);
}
@@ -373,28 +395,8 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
EventBus.getDefault().post(new StateChangeEvent(STATE_CLOSED, mState));
mState = STATE_CLOSED;
}
mRecorder.removeOnStateChangedListener(this);
mRecorder.removeOnStateChangedListener(mRecorderStateListener);
AutoJs.getInstance().getLayoutInspector().removeCaptureAvailableListener(this);
}
@Override
public void onStart() {
setState(STATE_RECORDING);
}
@Override
public void onStop() {
setState(STATE_NORMAL);
}
@Override
public void onPause() {
/* Empty body. */
}
@Override
public void onResume() {
/* Empty body. */
}
}

View File

@@ -1,51 +1,21 @@
package org.autojs.autojs.util;
import org.autojs.autojs.runtime.api.augment.util.VersionCodesInfoGenerated;
/**
* Created by Stardust on Apr 3, 2017.
* Modified by SuperMonster003 as of Feb 5, 2022.
*/
public class SdkVersionUtils {
private static final String[] SDK_VERSIONS = {
/* placeholder */ null,
/* api: 1 */ "1.0",
/* api: 2 */ "1.1",
/* api: 3 */ "1.5",
/* api: 4 */ "1.6",
/* api: 5 */ "2.0",
/* api: 6 */ "2.0.1",
/* api: 7 */ "2.1.x",
/* api: 8 */ "2.2.x",
/* api: 9 */ "2.3",
/* api: 10 */ "2.3.3",
/* api: 11 */ "3.0.x",
/* api: 12 */ "3.1.x",
/* api: 13 */ "3.2",
/* api: 14 */ "4.0",
/* api: 15 */ "4.0.3",
/* api: 16 */ "4.1",
/* api: 17 */ "4.2",
/* api: 18 */ "4.3",
/* api: 19 */ "4.4.2",
/* api: 20 */ "4.4W",
/* api: 21 */ "5.0",
/* api: 22 */ "5.1",
/* api: 23 */ "6.0",
/* api: 24 */ "7.0",
/* api: 25 */ "7.1",
/* api: 26 */ "8.0",
/* api: 27 */ "8.1",
/* api: 28 */ "9",
/* api: 29 */ "10",
/* api: 30 */ "11",
/* api: 31 */ "12",
/* api: 32 */ "12.1",
/* api: 33 */ "13",
/* api: 34 */ "14"
};
public static String sdkIntToString(int i) {
return i >= 1 && i <= SDK_VERSIONS.length ? SDK_VERSIONS[i] : "Unknown";
for (int j = 0; j < VersionCodesInfoGenerated.list.size(); j++) {
var versionCodesInfo = VersionCodesInfoGenerated.list.get(j);
if (versionCodesInfo.getApiLevel().equals(String.valueOf(i))) {
return versionCodesInfo.getPlatformVersion();
}
}
return "Unknown";
}
}