From a399dc449dc962c088c2cacbc4c32d503ced816f Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 04 十二月 2024 18:58:41 +0800
Subject: [PATCH] 2024年12月04日18:58:39

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 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..b311b03 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
@@ -14,7 +14,7 @@
 import com.hdl.photovoltaic.enums.ShowErrorMode;
 import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
 import com.hdl.photovoltaic.widget.ConfirmationExceptionDialog;
-import com.hdl.photovoltaic.widget.FlashingBoxDialog;
+import com.hdl.photovoltaic.widget.FlashingIconBoxDialog;
 
 /**
  * 绾跨▼閫昏緫
@@ -141,7 +141,7 @@
 
 
     /**
-     * 閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
+     * 鍏ㄥ眬寮瑰嚭妗�,閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
      *
      * @param isBoolean 鍥炬爣(true浣跨敤鎴愬姛鍥炬爣,false浣跨敤鎴愬姛鍥炬爣)
      * @param msg       淇℃伅
@@ -152,7 +152,7 @@
     }
 
     /**
-     * 閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
+     * 鍏ㄥ眬寮瑰嚭妗�,閿欒鎻愮ず妗嗭紙钃濇箹涓婃牱寮忥級
      *
      * @param isBoolean   鍥炬爣(true浣跨敤鎴愬姛鍥炬爣,false浣跨敤鎴愬姛鍥炬爣)
      * @param msg         淇℃伅
@@ -160,19 +160,27 @@
      * @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() {
-                FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(context, millisecond);
+                FlashingIconBoxDialog flashingIconBoxDialog = new FlashingIconBoxDialog(context, millisecond);
                 if (isBoolean) {
                     Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_succeed);
-                    flashingBoxDialog.setImage(drawable);
+                    flashingIconBoxDialog.setImage(drawable);
                 } else {
                     Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_fail);
-                    flashingBoxDialog.setImage(drawable);
+                    flashingIconBoxDialog.setImage(drawable);
                 }
-                flashingBoxDialog.setContent(msg + "\r\n(" + code + ")");
-                flashingBoxDialog.show();
+                if (code == 0) {
+                    //鎴愬姛涓嶉渶瑕佸鍔犵姸鎬佺爜
+                    flashingIconBoxDialog.setContent(msg);
+                } else {
+                    flashingIconBoxDialog.setContent(msg + "(" + code + ")");
+                }
+                flashingIconBoxDialog.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