From a3798b01c03911efcd7f7b28f78cebc35871c528 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 06 八月 2024 18:37:07 +0800
Subject: [PATCH] 2024年08月06日18:37:05
---
app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
index 96176d4..dd6dbfa 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
@@ -141,7 +141,7 @@
/**
- * 閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
+ * 鍏ㄥ眬寮瑰嚭妗�,閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
*
* @param isBoolean 鍥炬爣(true浣跨敤鎴愬姛鍥炬爣,false浣跨敤鎴愬姛鍥炬爣)
* @param msg 淇℃伅
@@ -152,7 +152,7 @@
}
/**
- * 閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
+ * 鍏ㄥ眬寮瑰嚭妗�,閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
*
* @param isBoolean 鍥炬爣(true浣跨敤鎴愬姛鍥炬爣,false浣跨敤鎴愬姛鍥炬爣)
* @param msg 淇℃伅
@@ -160,6 +160,9 @@
* @param millisecond 璁剧疆寤舵椂鏃堕棿鍏抽棴寮圭獥(鍗曚綅ms)
*/
public static void tipFlashingBox(Context context, boolean isBoolean, String msg, int code, int millisecond) {
+ if (context == null) {
+ return;
+ }
HdlThreadLogic.runMainThread(new Runnable() {
@Override
public void run() {
@@ -171,7 +174,12 @@
Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_fail);
flashingBoxDialog.setImage(drawable);
}
- flashingBoxDialog.setContent(msg + "\r\n(" + code + ")");
+ if (code == 0) {
+ //鎴愬姛涓嶉渶瑕佸鍔犵姸鎬佺爜
+ flashingBoxDialog.setContent(msg);
+ } else {
+ flashingBoxDialog.setContent(msg + "(" + code + ")");
+ }
flashingBoxDialog.show();
}
}, null, null);
@@ -226,7 +234,7 @@
* @return 璋冪敤鏍�
*/
private static String getStackTrace(Exception ex) {
- StringBuilder sb = new StringBuilder("");
+ StringBuilder sb = new StringBuilder();
StackTraceElement[] trace = ex.getStackTrace();
for (StackTraceElement stackTraceElement : trace) {
sb.append(stackTraceElement).append("\n");
--
Gitblit v1.8.0