6.6.2 - Alpha6 - 优化 VSCode 插件保存项目或运行项目出现异常时的消息提示方式
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
"notice 模块缺失 getBuilder 等扩展方法的问题 _[`issue #301`](http://issues.autojs6.com/301)_",
|
"notice 模块缺失 getBuilder 等扩展方法的问题 _[`issue #301`](http://issues.autojs6.com/301)_",
|
||||||
"shizuku/shell 等方法无法接受字符串参数的问题 _[`issue #310`](http://issues.autojs6.com/310)_",
|
"shizuku/shell 等方法无法接受字符串参数的问题 _[`issue #310`](http://issues.autojs6.com/310)_",
|
||||||
"colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_",
|
"colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_",
|
||||||
"engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常",
|
"engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常 _[`issue #340`](http://issues.autojs6.com/340)_ _[`issue #339`](http://issues.autojs6.com/339)_",
|
||||||
"floaty.window/floaty.rawWindow 无法在子线程执行的问题",
|
"floaty.window/floaty.rawWindow 无法在子线程执行的问题",
|
||||||
"floaty.getClip 可能无法正常获取剪切板内容的问题 _[`issue #341`](http://issues.autojs6.com/341)_",
|
"floaty.getClip 可能无法正常获取剪切板内容的问题 _[`issue #341`](http://issues.autojs6.com/341)_",
|
||||||
"ui.inflate 返回值丢失 attr/on/click 等原型方法的问题",
|
"ui.inflate 返回值丢失 attr/on/click 等原型方法的问题",
|
||||||
@@ -272,7 +272,7 @@
|
|||||||
"console.setTouchable 方法 _[`issue #122`](http://issues.autojs6.com/122)_"
|
"console.setTouchable 方法 _[`issue #122`](http://issues.autojs6.com/122)_"
|
||||||
],
|
],
|
||||||
"fix": [
|
"fix": [
|
||||||
"ocr 模块部分方法无法识别区域参数的问题 _[`issue #162`](http://issues.autojs6.com/162)_ _[`issue #175`](http://issues.autojs6.com/175)_",
|
"ocr 模块部分方法无法识别区域参数的问题 _[`issue #162`](http://issues.autojs6.com/162)_ _[`issue #175`](http://issues.autojs6.com/175)_",
|
||||||
"Android 7.x 发现新版本时无法获取版本详情的问题",
|
"Android 7.x 发现新版本时无法获取版本详情的问题",
|
||||||
"Android 14 申请截图权限时导致应用崩溃的问题",
|
"Android 14 申请截图权限时导致应用崩溃的问题",
|
||||||
"主页抽屉快速切换 \"浮动按钮\" 开关时可能导致应用崩溃的问题",
|
"主页抽屉快速切换 \"浮动按钮\" 开关时可能导致应用崩溃的问题",
|
||||||
|
|||||||
@@ -255,7 +255,12 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="org.autojs.autojs.ui.project.BuildActivity"
|
android:name="org.autojs.autojs.ui.project.BuildActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize|locale" />
|
android:configChanges="orientation|keyboardHidden|screenSize|locale" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="org.autojs.autojs.ui.error.ErrorDialogActivity"
|
||||||
|
android:theme="@style/AppTheme.Transparent"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
<activity android:name="org.autojs.autojs.ui.project.ProjectConfigActivity" />
|
<activity android:name="org.autojs.autojs.ui.project.ProjectConfigActivity" />
|
||||||
|
|
||||||
<activity android:name="org.autojs.autojs.ui.keystore.ManageKeyStoreActivity" />
|
<activity android:name="org.autojs.autojs.ui.keystore.ManageKeyStoreActivity" />
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.autojs.autojs.pluginclient;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonNull;
|
import com.google.gson.JsonNull;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
@@ -18,12 +17,17 @@ import org.autojs.autojs.model.script.Scripts;
|
|||||||
import org.autojs.autojs.pio.PFiles;
|
import org.autojs.autojs.pio.PFiles;
|
||||||
import org.autojs.autojs.project.ProjectLauncher;
|
import org.autojs.autojs.project.ProjectLauncher;
|
||||||
import org.autojs.autojs.script.StringScriptSource;
|
import org.autojs.autojs.script.StringScriptSource;
|
||||||
|
import org.autojs.autojs.ui.error.ErrorDialogActivity;
|
||||||
import org.autojs.autojs.util.MD5Utils;
|
import org.autojs.autojs.util.MD5Utils;
|
||||||
import org.autojs.autojs.util.ViewUtils;
|
import org.autojs.autojs.util.ViewUtils;
|
||||||
import org.autojs.autojs.util.WorkingDirectoryUtils;
|
import org.autojs.autojs.util.WorkingDirectoryUtils;
|
||||||
import org.autojs.autojs6.R;
|
import org.autojs.autojs6.R;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +128,19 @@ public class DevPluginResponseHandler implements Handler {
|
|||||||
new ProjectLauncher(dir).launch(AutoJs.getInstance().getScriptEngineService());
|
new ProjectLauncher(dir).launch(AutoJs.getInstance().getScriptEngineService());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ViewUtils.showToast(mContext, R.string.text_invalid_project, true);
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
ViewUtils.showToast(mContext, R.string.text_invalid_project, true);
|
||||||
|
} else {
|
||||||
|
// 使用 ErrorDialogActivity 代替直接显示 MaterialDialog
|
||||||
|
// 这样可以避免在非UI线程或Activity不可见状态下调用对话框的问题
|
||||||
|
ErrorDialogActivity.showErrorDialog(
|
||||||
|
mContext.getApplicationContext(),
|
||||||
|
R.string.text_invalid_project,
|
||||||
|
message,
|
||||||
|
R.string.dialog_button_dismiss
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +207,12 @@ public class DevPluginResponseHandler implements Handler {
|
|||||||
var e = err.getMessage();
|
var e = err.getMessage();
|
||||||
if (e != null) msg += "\n" + e;
|
if (e != null) msg += "\n" + e;
|
||||||
|
|
||||||
new MaterialDialog.Builder(mContext)
|
ErrorDialogActivity.showErrorDialog(
|
||||||
.title(R.string.text_failed)
|
mContext.getApplicationContext(),
|
||||||
.content(msg)
|
R.string.text_failed,
|
||||||
.positiveText(R.string.dialog_button_confirm)
|
msg,
|
||||||
.show();
|
R.string.dialog_button_confirm
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import org.mozilla.javascript.EvaluatorException
|
|||||||
// @Hint by SuperMonster003 on Oct 31, 2024.
|
// @Hint by SuperMonster003 on Oct 31, 2024.
|
||||||
// ! This class include the exception's code line number when printing the error stack trace.
|
// ! This class include the exception's code line number when printing the error stack trace.
|
||||||
// ! zh-CN: 当前类可在打印错误堆栈信息时包含异常所在的 code line number (代码行号).
|
// ! zh-CN: 当前类可在打印错误堆栈信息时包含异常所在的 code line number (代码行号).
|
||||||
class WrappedRuntimeException(detailMessage: String, private val causeException: Throwable? = null) : EvaluatorException(detailMessage) {
|
class WrappedRuntimeException @JvmOverloads constructor(
|
||||||
|
detailMessage: String,
|
||||||
|
private val causeException: Throwable? = null,
|
||||||
|
) : EvaluatorException(detailMessage) {
|
||||||
|
|
||||||
constructor(causeException: Throwable) : this(causeException.message ?: "", causeException)
|
constructor(causeException: Throwable) : this(causeException.message ?: "", causeException)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package org.autojs.autojs.ui.error;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Window;
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
|
import org.autojs.autojs.ui.BaseActivity;
|
||||||
|
import org.autojs.autojs6.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple activity to show error dialogs when a context is not available or valid
|
||||||
|
* for showing dialogs directly.
|
||||||
|
*/
|
||||||
|
public class ErrorDialogActivity extends BaseActivity {
|
||||||
|
|
||||||
|
public static final String EXTRA_TITLE = "title";
|
||||||
|
public static final String EXTRA_MESSAGE = "message";
|
||||||
|
public static final String EXTRA_POSITIVE_BUTTON_TEXT = "positive_button_text";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
|
// Get extras from intent
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String title = intent.getStringExtra(EXTRA_TITLE);
|
||||||
|
String message = intent.getStringExtra(EXTRA_MESSAGE);
|
||||||
|
String positiveButtonText = intent.getStringExtra(EXTRA_POSITIVE_BUTTON_TEXT);
|
||||||
|
|
||||||
|
// If no positive button text provided, use default dismiss text
|
||||||
|
if (positiveButtonText == null) {
|
||||||
|
positiveButtonText = getString(R.string.dialog_button_dismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show dialog
|
||||||
|
new MaterialDialog.Builder(this)
|
||||||
|
.title(title)
|
||||||
|
.content(message)
|
||||||
|
.positiveText(positiveButtonText)
|
||||||
|
.positiveColorRes(R.color.dialog_button_default)
|
||||||
|
.cancelable(true)
|
||||||
|
.canceledOnTouchOutside(true)
|
||||||
|
.onPositive((dialog, which) -> finish())
|
||||||
|
.dismissListener(dialog -> finish())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to show an error dialog from any context
|
||||||
|
*/
|
||||||
|
public static void showErrorDialog(android.content.Context context, int titleRes, String message) {
|
||||||
|
Intent intent = new Intent(context, ErrorDialogActivity.class);
|
||||||
|
intent.putExtra(EXTRA_TITLE, context.getString(titleRes));
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, message);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to show an error dialog from any context with custom positive button text
|
||||||
|
*/
|
||||||
|
public static void showErrorDialog(android.content.Context context, int titleRes, String message, int positiveButtonTextRes) {
|
||||||
|
Intent intent = new Intent(context, ErrorDialogActivity.class);
|
||||||
|
intent.putExtra(EXTRA_TITLE, context.getString(titleRes));
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, message);
|
||||||
|
intent.putExtra(EXTRA_POSITIVE_BUTTON_TEXT, context.getString(positiveButtonTextRes));
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!ENTITY url_github_autojs6 "http://project.autojs6.com">
|
<!ENTITY url_github_autojs6 "http://project.autojs6.com">
|
||||||
|
|
||||||
<!ENTITY url_github_autojs6_vscode_extension "http://vsc_ext-project.autojs6.com">
|
<!ENTITY url_github_autojs6_vscode_extension "http://vscext-project.autojs6.com">
|
||||||
|
|
||||||
]>
|
]>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Sun Apr 13 22:00:48 CST 2025
|
#Mon Apr 14 23:03:48 CST 2025
|
||||||
BUILD_TIME=1744552848536
|
BUILD_TIME=1744643028517
|
||||||
COMPILE_SDK_VERSION=35
|
COMPILE_SDK_VERSION=35
|
||||||
JAVA_VERSION=23
|
JAVA_VERSION=23
|
||||||
JAVA_VERSION_MIN_RADICAL=0
|
JAVA_VERSION_MIN_RADICAL=0
|
||||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=35
|
TARGET_SDK_VERSION=35
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=3137
|
VERSION_BUILD=3139
|
||||||
VERSION_NAME=6.6.2 Alpha6
|
VERSION_NAME=6.6.2 Alpha6
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user