From 7b1aeeae8bed6b3054a1267cc12a41acbb2221c8 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sun, 9 Feb 2025 11:18:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=86=85=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appbase/build.properties | 4 +- appbase/src/main/res/values-v21/styles.xml | 9 --- appbase/src/main/res/values/colors.xml | 13 ++-- appbase/src/main/res/values/styles.xml | 10 +-- libappbase/build.properties | 4 +- .../studio/libappbase/CrashHandler.java | 62 +++++++++++++------ .../main/res/layout/activity_globalcrash.xml | 6 +- libappbase/src/main/res/values/attrs.xml | 7 +++ libappbase/src/main/res/values/colors.xml | 15 ++--- libappbase/src/main/res/values/styles.xml | 6 +- libapputils/src/main/res/values/colors.xml | 4 -- 11 files changed, 79 insertions(+), 61 deletions(-) delete mode 100644 appbase/src/main/res/values-v21/styles.xml create mode 100644 libappbase/src/main/res/values/attrs.xml diff --git a/appbase/build.properties b/appbase/build.properties index db3b6d0..a1322c2 100644 --- a/appbase/build.properties +++ b/appbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Feb 08 06:24:40 GMT 2025 +#Sun Feb 09 03:17:19 GMT 2025 stageCount=1 libraryProject=libappbase baseVersion=1.2 publishVersion=1.2.0 -buildCount=265 +buildCount=326 baseBetaVersion=1.2.1 diff --git a/appbase/src/main/res/values-v21/styles.xml b/appbase/src/main/res/values-v21/styles.xml deleted file mode 100644 index 0aed032..0000000 --- a/appbase/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/appbase/src/main/res/values/colors.xml b/appbase/src/main/res/values/colors.xml index 294809a..f2c2d2d 100644 --- a/appbase/src/main/res/values/colors.xml +++ b/appbase/src/main/res/values/colors.xml @@ -1,6 +1,7 @@ - - - #009688 - #00796B - #FF9800 - \ No newline at end of file + + + #006D26C0 + #001BDCC0 + #0028C025 + #002985CC + diff --git a/appbase/src/main/res/values/styles.xml b/appbase/src/main/res/values/styles.xml index 6799c28..309de0b 100644 --- a/appbase/src/main/res/values/styles.xml +++ b/appbase/src/main/res/values/styles.xml @@ -1,5 +1,5 @@ - - - - \ No newline at end of file + + + + diff --git a/libappbase/build.properties b/libappbase/build.properties index db3b6d0..a1322c2 100644 --- a/libappbase/build.properties +++ b/libappbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Feb 08 06:24:40 GMT 2025 +#Sun Feb 09 03:17:19 GMT 2025 stageCount=1 libraryProject=libappbase baseVersion=1.2 publishVersion=1.2.0 -buildCount=265 +buildCount=326 baseBetaVersion=1.2.1 diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java index 412b221..fb482d3 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java @@ -15,6 +15,7 @@ import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.Color; import android.os.Build; import android.os.Bundle; @@ -42,11 +43,14 @@ import java.lang.Thread.UncaughtExceptionHandler; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import android.widget.LinearLayout; public final class CrashHandler { public static final String TAG = "CrashHandler"; - + + public static final String TITTLE = "CrashReport"; + final static String PREFS = CrashHandler.class.getName() + "PREFS"; final static String PREFS_CRASHHANDLER_ISCRASHHAPPEN = "PREFS_CRASHHANDLER_ISCRASHHAPPEN"; @@ -122,7 +126,7 @@ public final class CrashHandler { LogUtils.d(TAG, "gotoCrashActiviy: "); if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) { LogUtils.d(TAG, "gotoCrashActiviy: isAppCrashSafetyWireOK"); - //AppCrashSafetyWire.getInstance().postCrashSafetyWire(app); + //AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(app); intent.setClass(app, GlobalCrashActiviy.class); intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog); // 如果发生了 CrashHandler 内部崩溃, 就调用基础的应用崩溃显示类 @@ -130,11 +134,13 @@ public final class CrashHandler { // intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog); } else { LogUtils.d(TAG, "gotoCrashActiviy: else"); + AppCrashSafetyWire.getInstance().resumeToMaximumImmediately(); // 正常状态调用进阶的应用崩溃显示页 intent.setClass(app, CrashActiviy.class); intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog); - } + } + // intent.setClass(app, CrashActiviy.class); // intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog); @@ -316,7 +322,7 @@ public final class CrashHandler { } // 调用函数以启用持续崩溃保险,从而调用 CrashHandler 内部崩溃处理窗口 -// boolean postCrashSafetyWire(final Context context) { +// boolean postResumeCrashSafetyWireHandler(final Context context) { // LogUtils.d(TAG, "postCrashSafetyWire()"); // if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) { // // 保险丝在工作连接状态 @@ -326,16 +332,17 @@ public final class CrashHandler { // public void run() { // // 进程持续运行时,恢复保险丝熔断值 // //Resume to maximum -// LogUtils.d(TAG, "postCrashSafetyWire Resume to maximum"); -// while (resumeToMaximum(currentSafetyLevel + 1)) { -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); -// } -// } +// resumeToMaximumImmediately(); +//// LogUtils.d(TAG, "postCrashSafetyWire Resume to maximum"); +//// while (resumeToMaximum(currentSafetyLevel + 1)) { +//// try { +//// Thread.sleep(1000); +//// } catch (InterruptedException e) { +//// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); +//// } +//// } // } -// }, 10000); +// }, 1000); // return true; // } // return false; @@ -374,6 +381,7 @@ public final class CrashHandler { contentView.addView(hw, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); setContentView(contentView); + getActionBar().setTitle(TITTLE + "(inside)"); } } @@ -436,12 +444,24 @@ public final class CrashHandler { private static final int MENUITEM_RESTART = 1; private String mLog; + int mTitleTextColor; + int mStartColor; + int mCenterColor; + int mEndColor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLog = getIntent().getStringExtra(EXTRA_CRASH_INFO); - setTheme(android.R.style.Theme_DeviceDefault_Light_NoActionBar_Fullscreen); + setTheme(android.R.style.Theme_DeviceDefault_NoActionBar); +// TypedArray a = obtainStyledAttributes(attrs, R.styleable.ASupportToolbar, R.attr.aSupportToolbar, 0); +// mTitleTextColor = a.getColor(R.style.AppTheme.attrs.colo, Color.GREEN); +// mStartColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarStartColor, Color.BLUE); +// mCenterColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarCenterColor, Color.RED); +// mEndColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarEndColor, Color.YELLOW); +// // 返回一个绑定资源结束的信号给资源 +// a.recycle(); + setContentView: { // LinearLayout contentView = new LinearLayout(this); // contentView.setOrientation(LinearLayout.VERTICAL); @@ -473,13 +493,17 @@ public final class CrashHandler { // // setContentView(contentView); setContentView(R.layout.activity_globalcrash); + LinearLayout llMain = findViewById(R.id.activityglobalcrashLinearLayout1); + llMain.setBackgroundColor(Color.GRAY); Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1); - toolbar.setBackgroundColor(getColor(R.color.colorTittleBackgroung)); - toolbar.setTitleTextColor(getColor(R.color.colorTittleText)); - toolbar.setSubtitleTextColor(getColor(R.color.colorTittleText)); + toolbar.setBackgroundColor(Color.BLACK); + toolbar.setTitleTextColor(Color.WHITE); + toolbar.setSubtitleTextColor(Color.WHITE); setActionBar(toolbar); TextView tvLog = findViewById(R.id.activityglobalcrashTextView1); tvLog.setText(mLog); + tvLog.setTextColor(Color.BLACK); + tvLog.setBackgroundColor(Color.GRAY); // // 内部崩溃测试 // tvLog.setOnClickListener(new View.OnClickListener(){ // @Override @@ -489,6 +513,8 @@ public final class CrashHandler { // } // } // }); + + getActionBar().setTitle(TITTLE); } } @@ -544,7 +570,7 @@ public final class CrashHandler { for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); SpannableString spanString = new SpannableString(item.getTitle().toString()); - spanString.setSpan(new ForegroundColorSpan(getColor(R.color.colorTittleText)), 0, spanString.length(), 0); + spanString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spanString.length(), 0); item.setTitle(spanString); } return true; diff --git a/libappbase/src/main/res/layout/activity_globalcrash.xml b/libappbase/src/main/res/layout/activity_globalcrash.xml index eaa5b5d..ff06e75 100644 --- a/libappbase/src/main/res/layout/activity_globalcrash.xml +++ b/libappbase/src/main/res/layout/activity_globalcrash.xml @@ -5,8 +5,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/colorTextBackgroung" - android:textColor="@color/colorText"> + android:id="@+id/activityglobalcrashLinearLayout1"> + android:id="@+id/activityglobalcrashTextView1" + android:background="#FFFFFFFF"/> diff --git a/libappbase/src/main/res/values/attrs.xml b/libappbase/src/main/res/values/attrs.xml new file mode 100644 index 0000000..efe7291 --- /dev/null +++ b/libappbase/src/main/res/values/attrs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/libappbase/src/main/res/values/colors.xml b/libappbase/src/main/res/values/colors.xml index 37a30c6..fcd701b 100644 --- a/libappbase/src/main/res/values/colors.xml +++ b/libappbase/src/main/res/values/colors.xml @@ -1,14 +1,7 @@ - - #FF196ABC - #FF002B57 - #FF80BFFF - #FF80BFFF - #FF196ABC - #FF002B57 - #FF80BFFF - #FFA9A9A9 - #FF000000 - #FFE7E7E7 + #FF03AB4E + #FF027C39 + #FF3DDC84 + #FF000000 diff --git a/libappbase/src/main/res/values/styles.xml b/libappbase/src/main/res/values/styles.xml index 8d78246..0267b7f 100644 --- a/libappbase/src/main/res/values/styles.xml +++ b/libappbase/src/main/res/values/styles.xml @@ -1,5 +1,9 @@ - \ No newline at end of file + diff --git a/libapputils/src/main/res/values/colors.xml b/libapputils/src/main/res/values/colors.xml index 6be8764..d8b303c 100644 --- a/libapputils/src/main/res/values/colors.xml +++ b/libapputils/src/main/res/values/colors.xml @@ -1,10 +1,6 @@ - #FF196ABC #FF002B57 #FF80BFFF - #FFA9A9A9 - #FF000000 - #FFFFFFFF