统一内外部报告风格
This commit is contained in:
parent
54cceeed3b
commit
7b1aeeae8b
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#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
|
stageCount=1
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=1.2
|
baseVersion=1.2
|
||||||
publishVersion=1.2.0
|
publishVersion=1.2.0
|
||||||
buildCount=265
|
buildCount=326
|
||||||
baseBetaVersion=1.2.1
|
baseBetaVersion=1.2.1
|
||||||
|
@ -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>
|
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#009688</color>
|
<color name="colorTextColor">#006D26C0</color>
|
||||||
<color name="colorPrimaryDark">#00796B</color>
|
<color name="colorPrimary">#001BDCC0</color>
|
||||||
<color name="colorAccent">#FF9800</color>
|
<color name="colorPrimaryDark">#0028C025</color>
|
||||||
</resources>
|
<color name="colorAccent">#002985CC</color>
|
||||||
|
</resources>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
|
<style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#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
|
stageCount=1
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=1.2
|
baseVersion=1.2
|
||||||
publishVersion=1.2.0
|
publishVersion=1.2.0
|
||||||
buildCount=265
|
buildCount=326
|
||||||
baseBetaVersion=1.2.1
|
baseBetaVersion=1.2.1
|
||||||
|
@ -15,6 +15,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -42,11 +43,14 @@ import java.lang.Thread.UncaughtExceptionHandler;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public final class CrashHandler {
|
public final class CrashHandler {
|
||||||
|
|
||||||
public static final String TAG = "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.class.getName() + "PREFS";
|
||||||
final static String PREFS_CRASHHANDLER_ISCRASHHAPPEN = "PREFS_CRASHHANDLER_ISCRASHHAPPEN";
|
final static String PREFS_CRASHHANDLER_ISCRASHHAPPEN = "PREFS_CRASHHANDLER_ISCRASHHAPPEN";
|
||||||
|
|
||||||
@ -122,7 +126,7 @@ public final class CrashHandler {
|
|||||||
LogUtils.d(TAG, "gotoCrashActiviy: ");
|
LogUtils.d(TAG, "gotoCrashActiviy: ");
|
||||||
if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) {
|
if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) {
|
||||||
LogUtils.d(TAG, "gotoCrashActiviy: isAppCrashSafetyWireOK");
|
LogUtils.d(TAG, "gotoCrashActiviy: isAppCrashSafetyWireOK");
|
||||||
//AppCrashSafetyWire.getInstance().postCrashSafetyWire(app);
|
//AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(app);
|
||||||
intent.setClass(app, GlobalCrashActiviy.class);
|
intent.setClass(app, GlobalCrashActiviy.class);
|
||||||
intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
||||||
// 如果发生了 CrashHandler 内部崩溃, 就调用基础的应用崩溃显示类
|
// 如果发生了 CrashHandler 内部崩溃, 就调用基础的应用崩溃显示类
|
||||||
@ -130,11 +134,13 @@ public final class CrashHandler {
|
|||||||
// intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
// intent.putExtra(GlobalCrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
||||||
} else {
|
} else {
|
||||||
LogUtils.d(TAG, "gotoCrashActiviy: else");
|
LogUtils.d(TAG, "gotoCrashActiviy: else");
|
||||||
|
|
||||||
AppCrashSafetyWire.getInstance().resumeToMaximumImmediately();
|
AppCrashSafetyWire.getInstance().resumeToMaximumImmediately();
|
||||||
// 正常状态调用进阶的应用崩溃显示页
|
// 正常状态调用进阶的应用崩溃显示页
|
||||||
intent.setClass(app, CrashActiviy.class);
|
intent.setClass(app, CrashActiviy.class);
|
||||||
intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// intent.setClass(app, CrashActiviy.class);
|
// intent.setClass(app, CrashActiviy.class);
|
||||||
// intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
// intent.putExtra(CrashActiviy.EXTRA_CRASH_INFO, errorLog);
|
||||||
@ -316,7 +322,7 @@ public final class CrashHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用函数以启用持续崩溃保险,从而调用 CrashHandler 内部崩溃处理窗口
|
// 调用函数以启用持续崩溃保险,从而调用 CrashHandler 内部崩溃处理窗口
|
||||||
// boolean postCrashSafetyWire(final Context context) {
|
// boolean postResumeCrashSafetyWireHandler(final Context context) {
|
||||||
// LogUtils.d(TAG, "postCrashSafetyWire()");
|
// LogUtils.d(TAG, "postCrashSafetyWire()");
|
||||||
// if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) {
|
// if (AppCrashSafetyWire.getInstance().isAppCrashSafetyWireOK()) {
|
||||||
// // 保险丝在工作连接状态
|
// // 保险丝在工作连接状态
|
||||||
@ -326,16 +332,17 @@ public final class CrashHandler {
|
|||||||
// public void run() {
|
// public void run() {
|
||||||
// // 进程持续运行时,恢复保险丝熔断值
|
// // 进程持续运行时,恢复保险丝熔断值
|
||||||
// //Resume to maximum
|
// //Resume to maximum
|
||||||
// LogUtils.d(TAG, "postCrashSafetyWire Resume to maximum");
|
// resumeToMaximumImmediately();
|
||||||
// while (resumeToMaximum(currentSafetyLevel + 1)) {
|
//// LogUtils.d(TAG, "postCrashSafetyWire Resume to maximum");
|
||||||
// try {
|
//// while (resumeToMaximum(currentSafetyLevel + 1)) {
|
||||||
// Thread.sleep(1000);
|
//// try {
|
||||||
// } catch (InterruptedException e) {
|
//// Thread.sleep(1000);
|
||||||
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
//// } catch (InterruptedException e) {
|
||||||
// }
|
//// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
// }
|
//// }
|
||||||
|
//// }
|
||||||
// }
|
// }
|
||||||
// }, 10000);
|
// }, 1000);
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// return false;
|
// return false;
|
||||||
@ -374,6 +381,7 @@ public final class CrashHandler {
|
|||||||
|
|
||||||
contentView.addView(hw, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
contentView.addView(hw, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
setContentView(contentView);
|
setContentView(contentView);
|
||||||
|
getActionBar().setTitle(TITTLE + "(inside)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,12 +444,24 @@ public final class CrashHandler {
|
|||||||
private static final int MENUITEM_RESTART = 1;
|
private static final int MENUITEM_RESTART = 1;
|
||||||
|
|
||||||
private String mLog;
|
private String mLog;
|
||||||
|
int mTitleTextColor;
|
||||||
|
int mStartColor;
|
||||||
|
int mCenterColor;
|
||||||
|
int mEndColor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mLog = getIntent().getStringExtra(EXTRA_CRASH_INFO);
|
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: {
|
setContentView: {
|
||||||
// LinearLayout contentView = new LinearLayout(this);
|
// LinearLayout contentView = new LinearLayout(this);
|
||||||
// contentView.setOrientation(LinearLayout.VERTICAL);
|
// contentView.setOrientation(LinearLayout.VERTICAL);
|
||||||
@ -473,13 +493,17 @@ public final class CrashHandler {
|
|||||||
//
|
//
|
||||||
// setContentView(contentView);
|
// setContentView(contentView);
|
||||||
setContentView(R.layout.activity_globalcrash);
|
setContentView(R.layout.activity_globalcrash);
|
||||||
|
LinearLayout llMain = findViewById(R.id.activityglobalcrashLinearLayout1);
|
||||||
|
llMain.setBackgroundColor(Color.GRAY);
|
||||||
Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1);
|
Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1);
|
||||||
toolbar.setBackgroundColor(getColor(R.color.colorTittleBackgroung));
|
toolbar.setBackgroundColor(Color.BLACK);
|
||||||
toolbar.setTitleTextColor(getColor(R.color.colorTittleText));
|
toolbar.setTitleTextColor(Color.WHITE);
|
||||||
toolbar.setSubtitleTextColor(getColor(R.color.colorTittleText));
|
toolbar.setSubtitleTextColor(Color.WHITE);
|
||||||
setActionBar(toolbar);
|
setActionBar(toolbar);
|
||||||
TextView tvLog = findViewById(R.id.activityglobalcrashTextView1);
|
TextView tvLog = findViewById(R.id.activityglobalcrashTextView1);
|
||||||
tvLog.setText(mLog);
|
tvLog.setText(mLog);
|
||||||
|
tvLog.setTextColor(Color.BLACK);
|
||||||
|
tvLog.setBackgroundColor(Color.GRAY);
|
||||||
// // 内部崩溃测试
|
// // 内部崩溃测试
|
||||||
// tvLog.setOnClickListener(new View.OnClickListener(){
|
// tvLog.setOnClickListener(new View.OnClickListener(){
|
||||||
// @Override
|
// @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++) {
|
for (int i = 0; i < menu.size(); i++) {
|
||||||
MenuItem item = menu.getItem(i);
|
MenuItem item = menu.getItem(i);
|
||||||
SpannableString spanString = new SpannableString(item.getTitle().toString());
|
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);
|
item.setTitle(spanString);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/colorTextBackgroung"
|
android:id="@+id/activityglobalcrashLinearLayout1">
|
||||||
android:textColor="@color/colorText">
|
|
||||||
|
|
||||||
<android.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -25,7 +24,8 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activityglobalcrashTextView1"/>
|
android:id="@+id/activityglobalcrashTextView1"
|
||||||
|
android:background="#FFFFFFFF"/>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
7
libappbase/src/main/res/values/attrs.xml
Normal file
7
libappbase/src/main/res/values/attrs.xml
Normal 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>
|
@ -1,14 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- WinBoll 默认方案 -->
|
<color name="colorPrimary">#FF03AB4E</color>
|
||||||
<color name="colorPrimary">#FF196ABC</color>
|
<color name="colorPrimaryDark">#FF027C39</color>
|
||||||
<color name="colorPrimaryDark">#FF002B57</color>
|
<color name="colorAccent">#FF3DDC84</color>
|
||||||
<color name="colorAccent">#FF80BFFF</color>
|
<color name="colorText">#FF000000</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>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
|
<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>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- WinBoll 默认方案 -->
|
|
||||||
<color name="colorPrimary">#FF196ABC</color>
|
<color name="colorPrimary">#FF196ABC</color>
|
||||||
<color name="colorPrimaryDark">#FF002B57</color>
|
<color name="colorPrimaryDark">#FF002B57</color>
|
||||||
<color name="colorAccent">#FF80BFFF</color>
|
<color name="colorAccent">#FF80BFFF</color>
|
||||||
<color name="colorToastFrame">#FFA9A9A9</color>
|
|
||||||
<color name="colorToastShadow">#FF000000</color>
|
|
||||||
<color name="colorToastBackgroung">#FFFFFFFF</color>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user