统一内外部报告风格

This commit is contained in:
ZhanGSKen 2025-02-09 11:18:15 +08:00
parent 54cceeed3b
commit 7b1aeeae8b
11 changed files with 79 additions and 61 deletions

View File

@ -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

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">?android:colorPrimary</item>
</style>
</resources>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#009688</color>
<color name="colorPrimaryDark">#00796B</color>
<color name="colorAccent">#FF9800</color>
<color name="colorTextColor">#006D26C0</color>
<color name="colorPrimary">#001BDCC0</color>
<color name="colorPrimaryDark">#0028C025</color>
<color name="colorAccent">#002985CC</color>
</resources>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
</style>
</resources>

View File

@ -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

View File

@ -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,12 +134,14 @@ 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;

View File

@ -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.widget.Toolbar
android:layout_width="match_parent"
@ -25,7 +24,8 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityglobalcrashTextView1"/>
android:id="@+id/activityglobalcrashTextView1"
android:background="#FFFFFFFF"/>
</HorizontalScrollView>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="attrTextColor" format="color" />
<attr name="attrPrimaryColor" format="color" />
<attr name="attrPrimaryDarkColor" format="color" />
<attr name="attrAccentColor" format="color" />
</resources>

View File

@ -1,14 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- WinBoll 默认方案 -->
<color name="colorPrimary">#FF196ABC</color>
<color name="colorPrimaryDark">#FF002B57</color>
<color name="colorAccent">#FF80BFFF</color>
<color name="colorTittleText">#FF80BFFF</color>
<color name="colorTittleBackgroung">#FF196ABC</color>
<color name="colorText">#FF002B57</color>
<color name="colorTextBackgroung">#FF80BFFF</color>
<color name="colorToastFrame">#FFA9A9A9</color>
<color name="colorToastShadow">#FF000000</color>
<color name="colorToastBackgroung">#FFE7E7E7</color>
<color name="colorPrimary">#FF03AB4E</color>
<color name="colorPrimaryDark">#FF027C39</color>
<color name="colorAccent">#FF3DDC84</color>
<color name="colorText">#FF000000</color>
</resources>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="attrTextColor">#FF000000</item>
<item name="attrPrimaryColor">@color/colorPrimary</item>
<item name="attrPrimaryDarkColor">@color/colorPrimaryDark</item>
<item name="attrAccentColor">@color/colorAccent</item>
</style>
</resources>

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- WinBoll 默认方案 -->
<color name="colorPrimary">#FF196ABC</color>
<color name="colorPrimaryDark">#FF002B57</color>
<color name="colorAccent">#FF80BFFF</color>
<color name="colorToastFrame">#FFA9A9A9</color>
<color name="colorToastShadow">#FF000000</color>
<color name="colorToastBackgroung">#FFFFFFFF</color>
</resources>