diff --git a/appbase/src/main/res/values-night/styles.xml b/appbase/src/main/res/values-night/styles.xml
index 4d0fa5f..40600c3 100644
--- a/appbase/src/main/res/values-night/styles.xml
+++ b/appbase/src/main/res/values-night/styles.xml
@@ -1,13 +1,13 @@
-
\ No newline at end of file
diff --git a/appbase/src/main/res/values/styles.xml b/appbase/src/main/res/values/styles.xml
index bfb751e..4417b69 100644
--- a/appbase/src/main/res/values/styles.xml
+++ b/appbase/src/main/res/values/styles.xml
@@ -1,13 +1,13 @@
-
diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalCrashReportView.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalCrashReportView.java
index 43a0891..7ecedcc 100644
--- a/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalCrashReportView.java
+++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalCrashReportView.java
@@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.R;
+import android.content.res.Resources;
/**
* @Author ZhanGSKen&豆包大模型
@@ -175,10 +176,11 @@ public class GlobalCrashReportView extends LinearLayout {
* 初始化默认配置(无自定义属性时使用)
*/
private void initDefaultConfig() {
- // 设置默认配色(普通模式黑色文字)
- mTitleColor = Color.BLACK;
- mTitleBackgroundColor = Color.BLACK;
- mTextColor = Color.BLACK;
+ // 设置默认配色(使用 debugTextColor 属性)
+ Resources.Theme theme = mContext.getTheme();
+ mTitleColor = theme.getResources().getColor(android.R.color.holo_green_dark);
+ mTitleBackgroundColor = Color.GRAY;
+ mTextColor = obtainDebugTextColor(theme);
mTextBackgroundColor = Color.WHITE;
// 加载布局
inflateView();
@@ -186,6 +188,21 @@ public class GlobalCrashReportView extends LinearLayout {
initWidgetStyle();
}
+ private int obtainDebugTextColor(Resources.Theme theme) {
+ int[] attrs = new int[] { cc.winboll.studio.libappbase.R.attr.themeDebug };
+ TypedArray themeTypedArray = theme.obtainStyledAttributes(attrs);
+ int themeResId = themeTypedArray.getResourceId(0, 0);
+ themeTypedArray.recycle();
+ if (themeResId != 0) {
+ int[] debugAttrs = new int[] { cc.winboll.studio.libappbase.R.attr.debugTextColor };
+ TypedArray debugTypedArray = theme.obtainStyledAttributes(themeResId, debugAttrs);
+ int color = debugTypedArray.getColor(0, Color.GRAY);
+ debugTypedArray.recycle();
+ return color;
+ }
+ return Color.GRAY;
+ }
+
/**
* 初始化视图(解析自定义属性 + 加载布局 + 设置样式)
* @param attrs 自定义属性集合
@@ -195,7 +212,7 @@ public class GlobalCrashReportView extends LinearLayout {
TypedArray typedArray = mContext.obtainStyledAttributes(
attrs,
R.styleable.GlobalCrashActivity,
- R.attr.themeGlobalCrashActivity,
+ R.attr.themeDebug,
0
);
@@ -208,10 +225,7 @@ public class GlobalCrashReportView extends LinearLayout {
R.styleable.GlobalCrashActivity_colorTittleBackgound, // 注:原拼写错误(Backgound→Background),保持与 attrs.xml 一致
Color.BLACK
);
- mTextColor = typedArray.getColor(
- R.styleable.GlobalCrashActivity_colorText,
- Color.BLACK
- );
+ mTextColor = obtainDebugTextColor(mContext.getTheme());
mTextBackgroundColor = typedArray.getColor(
R.styleable.GlobalCrashActivity_colorTextBackgound, // 注:原拼写错误,保持与 attrs.xml 一致
Color.WHITE
diff --git a/libappbase/src/main/res/layout-night/view_globalcrashreport.xml b/libappbase/src/main/res/layout-night/view_globalcrashreport.xml
index 2df3e47..a5f427e 100644
--- a/libappbase/src/main/res/layout-night/view_globalcrashreport.xml
+++ b/libappbase/src/main/res/layout-night/view_globalcrashreport.xml
@@ -2,7 +2,7 @@
+ android:background="?attr/colorTextBackgound">
@@ -34,8 +35,8 @@
android:layout_toRightOf="@+id/viewlogButtonClean"
android:layout_centerVertical="true"
android:id="@+id/viewlogTextView1"
- android:background="?attr/buttonBackgroundColor"
- android:textColor="?attr/buttonTextColor"/>
+ android:background="?attr/colorTittleBackgound"
+ android:textColor="?attr/colorText"/>
+ android:textColor="?attr/colorText"/>