From fe0b2f97ea7648d118aef249659e3aa49a813881 Mon Sep 17 00:00:00 2001 From: LaizyBoy Date: Tue, 12 May 2026 09:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=97=A5=E5=BF=97=E7=AA=97?= =?UTF-8?q?=E5=8F=A3UI=E4=B8=BB=E9=A2=98=E9=A2=9C=E8=89=B2=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8toolbarTe?= =?UTF-8?q?xtColor=E5=92=8CtoolbarBackgroundColor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【主要变更】 1. 新增主题颜色属性 - 新增 toolbarTextColor 属性定义(普通模式:黑色, 深色模式:#E0E0E0) - 新增 toolbarBackgroundColor 属性定义(普通模式:绿色, 深色模式:深蓝色) 2. 移除废弃颜色属性 - 移除 buttonTextColor 属性定义 - 移除 buttonBackgroundColor 属性定义 3. 更新布局文件(普通模式+深色模式) - view_log.xml: TextView(LV:)、CheckBox(Selectable/ALL) 使用 toolbarTextColor - view_log.xml: Button(Clean/Copy) 使用 toolbarBackgroundColor - item_logtag.xml: CheckBox 使用 toolbarTextColor - activity_main.xml: 所有Button使用 toolbarBackgroundColor - activity_crash_test.xml: 所有Button使用 toolbarBackgroundColor - activity_nfc_rsa_operate.xml: Button使用 toolbarBackgroundColor - dialog_winboll_host.xml: Button使用 toolbarBackgroundColor 4. 更新Java代码 - LogView.java: CheckBox和TextView使用主题属性获取 toolbarTextColor - LogTagSpinner.java: 下拉框文本颜色使用 toolbarTextColor 5. 更新样式定义 - styles.xml: 主题属性引用新的 toolbarTextColor/toolbarBackgroundColor - attrs.xml: 移除废弃属性,保留 toolbarTextColor/toolbarBackgroundColor - colors.xml: 添加新的颜色定义 【适配说明】 - 统一普通模式和深色模式的颜色管理 - 确保日志窗口所有控件颜色与主窗口保持一致 --- appbase/build.properties | 4 ++-- .../src/main/res/layout-night/activity_main.xml | 12 ++++++------ .../src/main/res/layout/activity_crash_test.xml | 4 ++-- appbase/src/main/res/layout/activity_main.xml | 12 ++++++------ appbase/src/main/res/values-night/styles.xml | 3 ++- appbase/src/main/res/values/styles.xml | 3 ++- libappbase/build.properties | 4 ++-- .../cc/winboll/studio/libappbase/LogView.java | 15 +++++++++++++-- .../studio/libappbase/widget/LogTagSpinner.java | 10 +++++++--- .../res/layout-night/activity_nfc_rsa_operate.xml | 4 ++-- .../main/res/layout-night/dialog_winboll_host.xml | 4 ++-- .../src/main/res/layout-night/item_logtag.xml | 1 + libappbase/src/main/res/layout-night/view_log.xml | 10 +++++----- .../main/res/layout/activity_nfc_rsa_operate.xml | 4 ++-- .../src/main/res/layout/dialog_winboll_host.xml | 4 ++-- libappbase/src/main/res/layout/item_logtag.xml | 1 + libappbase/src/main/res/layout/view_log.xml | 10 +++++----- libappbase/src/main/res/values-night/attrs.xml | 6 +----- libappbase/src/main/res/values-night/colors.xml | 4 +++- libappbase/src/main/res/values-night/styles.xml | 14 ++++++++------ libappbase/src/main/res/values/attrs.xml | 6 +----- libappbase/src/main/res/values/colors.xml | 4 +++- libappbase/src/main/res/values/styles.xml | 14 ++++++++------ 23 files changed, 86 insertions(+), 67 deletions(-) diff --git a/appbase/build.properties b/appbase/build.properties index 8b53b0c..f0de4ed 100644 --- a/appbase/build.properties +++ b/appbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Mon May 11 20:30:06 HKT 2026 +#Tue May 12 09:06:52 CST 2026 stageCount=9 libraryProject=libappbase baseVersion=15.20 publishVersion=15.20.8 -buildCount=0 +buildCount=22 baseBetaVersion=15.20.9 diff --git a/appbase/src/main/res/layout-night/activity_main.xml b/appbase/src/main/res/layout-night/activity_main.xml index c7c6e98..383caad 100644 --- a/appbase/src/main/res/layout-night/activity_main.xml +++ b/appbase/src/main/res/layout-night/activity_main.xml @@ -31,7 +31,7 @@ android:text="关于应用" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onAboutActivity" @@ -43,7 +43,7 @@ android:text="应用崩溃测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onCrashTest" @@ -55,7 +55,7 @@ android:text="应用日志测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onLogTest" @@ -67,7 +67,7 @@ android:text="应用日志测试(新窗口)" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onLogTestNewTask" @@ -79,7 +79,7 @@ android:text="应用吐司测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onToastUtilsTest" @@ -93,7 +93,7 @@ android:text="多开窗口" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onMultiInstance" diff --git a/appbase/src/main/res/layout/activity_crash_test.xml b/appbase/src/main/res/layout/activity_crash_test.xml index 028c7d4..fed285a 100644 --- a/appbase/src/main/res/layout/activity_crash_test.xml +++ b/appbase/src/main/res/layout/activity_crash_test.xml @@ -35,7 +35,7 @@ android:text="返回" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onBack" @@ -47,7 +47,7 @@ android:text="测试崩溃" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onTestCrash" diff --git a/appbase/src/main/res/layout/activity_main.xml b/appbase/src/main/res/layout/activity_main.xml index c7c6e98..383caad 100644 --- a/appbase/src/main/res/layout/activity_main.xml +++ b/appbase/src/main/res/layout/activity_main.xml @@ -31,7 +31,7 @@ android:text="关于应用" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onAboutActivity" @@ -43,7 +43,7 @@ android:text="应用崩溃测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onCrashTest" @@ -55,7 +55,7 @@ android:text="应用日志测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onLogTest" @@ -67,7 +67,7 @@ android:text="应用日志测试(新窗口)" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onLogTestNewTask" @@ -79,7 +79,7 @@ android:text="应用吐司测试" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onToastUtilsTest" @@ -93,7 +93,7 @@ android:text="多开窗口" android:textSize="16sp" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:paddingVertical="12dp" android:layout_marginHorizontal="24dp" android:onClick="onMultiInstance" diff --git a/appbase/src/main/res/values-night/styles.xml b/appbase/src/main/res/values-night/styles.xml index 799f2b6..a03559c 100644 --- a/appbase/src/main/res/values-night/styles.xml +++ b/appbase/src/main/res/values-night/styles.xml @@ -6,8 +6,9 @@ \ 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 f738ba0..be91a4e 100644 --- a/appbase/src/main/res/values/styles.xml +++ b/appbase/src/main/res/values/styles.xml @@ -6,8 +6,9 @@ diff --git a/libappbase/build.properties b/libappbase/build.properties index 85cc66d..f0de4ed 100644 --- a/libappbase/build.properties +++ b/libappbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Mon May 11 20:29:55 HKT 2026 +#Tue May 12 09:06:52 CST 2026 stageCount=9 libraryProject=libappbase baseVersion=15.20 publishVersion=15.20.8 -buildCount=0 +buildCount=22 baseBetaVersion=15.20.9 diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/LogView.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/LogView.java index fa2f438..56f5d38 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/LogView.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/LogView.java @@ -8,6 +8,7 @@ package cc.winboll.studio.libappbase; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.res.TypedArray; import android.os.Handler; import android.os.Message; import android.text.Editable; @@ -248,7 +249,10 @@ public class LogView extends RelativeLayout { } mSelectAllTAGCheckBox.setLayoutParams(layoutParams2); //mSelectAllTAGCheckBox.setPadding(0,0,0,0); - mSelectAllTAGCheckBox.setTextColor(mContext.getResources().getColor(R.color.white)); + TypedArray ta1 = mContext.obtainStyledAttributes(new int[] { R.attr.toolbarTextColor }); + int toolbarTextColor1 = ta1.getColor(0, mContext.getResources().getColor(R.color.white)); + ta1.recycle(); + mSelectAllTAGCheckBox.setTextColor(toolbarTextColor1); mSelectAllTAGCheckBox.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { @@ -502,10 +506,17 @@ public class LogView extends RelativeLayout { } holder.tvText.setLayoutParams(layoutParams); holder.tvText.setPadding(0,0,0,0); - holder.tvText.setTextColor(mContext.getResources().getColor(R.color.white)); + TypedArray ta2 = mContext.obtainStyledAttributes(new int[] { R.attr.toolbarTextColor }); + int toolbarTextColor2 = ta2.getColor(0, mContext.getResources().getColor(R.color.white)); + ta2.recycle(); + holder.tvText.setTextColor(toolbarTextColor2); holder.cbChecked.setChecked(item.isChecked()); holder.cbChecked.setLayoutParams(layoutParams); holder.cbChecked.setPadding(0,0,0,0); + TypedArray ta3 = mContext.obtainStyledAttributes(new int[] { R.attr.toolbarTextColor }); + int toolbarTextColor3 = ta3.getColor(0, mContext.getResources().getColor(R.color.white)); + ta3.recycle(); + holder.cbChecked.setTextColor(toolbarTextColor3); holder.cbChecked.setOnClickListener(new View.OnClickListener(){ @Override diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/widget/LogTagSpinner.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/widget/LogTagSpinner.java index 4bc6f0f..32609ec 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/widget/LogTagSpinner.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/widget/LogTagSpinner.java @@ -3,6 +3,7 @@ package cc.winboll.studio.libappbase.widget; import android.content.Context; import android.graphics.Color; import android.text.TextUtils; +import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; @@ -153,9 +154,12 @@ public class LogTagSpinner extends Spinner { itemTv.setPadding(mTextPadding, 0, mTextPadding, 0); // 4. 文字对齐(垂直居中+靠左,符合常规 UI 设计) //itemTv.setGravity(View.GRAVITY_CENTER_VERTICAL | View.GRAVITY_START); - // 5. 文字颜色(统一深色,可改为项目颜色资源) - itemTv.setTextColor(this.mContext.getColor(R.color.white)); - itemTv.setBackgroundColor(this.mContext.getColor(R.color.btn_gray_normal)); +// 5. 文字颜色(使用主题属性 ?attr/toolbarTextColor) + TypedArray ta = mContext.obtainStyledAttributes(new int[] { R.attr.toolbarTextColor }); + int toolbarTextColor = ta.getColor(0, mContext.getResources().getColor(R.color.white)); + ta.recycle(); + itemTv.setTextColor(toolbarTextColor); + itemTv.setBackgroundColor(this.mContext.getResources().getColor(R.color.btn_gray_normal)); // 6. 文字溢出处理(最多 2 行,超出省略,避免长标签换行过多) itemTv.setSingleLine(false); itemTv.setMaxLines(2); diff --git a/libappbase/src/main/res/layout-night/activity_nfc_rsa_operate.xml b/libappbase/src/main/res/layout-night/activity_nfc_rsa_operate.xml index 8421768..d19cd6e 100644 --- a/libappbase/src/main/res/layout-night/activity_nfc_rsa_operate.xml +++ b/libappbase/src/main/res/layout-night/activity_nfc_rsa_operate.xml @@ -50,8 +50,8 @@ android:layout_height="wrap_content" android:text="功能按钮待激活" android:textSize="16sp" - android:textColor="?attr/buttonTextColor" - android:backgroundTint="?attr/buttonBackgroundColor" + android:textColor="?attr/toolbarTextColor" + android:backgroundTint="?attr/toolbarBackgroundColor" android:padding="14dp" android:enabled="false"/> diff --git a/libappbase/src/main/res/layout-night/dialog_winboll_host.xml b/libappbase/src/main/res/layout-night/dialog_winboll_host.xml index 4ac3059..642b30b 100644 --- a/libappbase/src/main/res/layout-night/dialog_winboll_host.xml +++ b/libappbase/src/main/res/layout-night/dialog_winboll_host.xml @@ -53,8 +53,8 @@ android:layout_height="wrap_content" android:text="确认" android:textSize="14sp" - android:backgroundTint="?attr/buttonBackgroundColor" - android:textColor="?attr/buttonTextColor"/> + android:backgroundTint="?attr/toolbarBackgroundColor" + android:textColor="?attr/toolbarTextColor"/> diff --git a/libappbase/src/main/res/layout-night/item_logtag.xml b/libappbase/src/main/res/layout-night/item_logtag.xml index a397e01..f00bf13 100644 --- a/libappbase/src/main/res/layout-night/item_logtag.xml +++ b/libappbase/src/main/res/layout-night/item_logtag.xml @@ -18,6 +18,7 @@ android:layout_width="wrap_content" android:layout_height="@dimen/log_button_height" android:textSize="@dimen/log_text_size" + android:textColor="?attr/toolbarTextColor" android:id="@+id/viewlogtagCheckBox1"/> diff --git a/libappbase/src/main/res/layout-night/view_log.xml b/libappbase/src/main/res/layout-night/view_log.xml index be6c505..d8459a0 100644 --- a/libappbase/src/main/res/layout-night/view_log.xml +++ b/libappbase/src/main/res/layout-night/view_log.xml @@ -21,7 +21,7 @@ android:textSize="@dimen/log_text_size" android:text="Clean" android:textColor="?attr/activityTextColor" - android:background="?attr/buttonBackgroundColor" + android:background="?attr/toolbarBackgroundColor" android:layout_centerVertical="true" android:id="@+id/viewlogButtonClean" android:layout_marginLeft="5dp"/> @@ -36,7 +36,7 @@ android:layout_centerVertical="true" android:id="@+id/viewlogTextView1" android:background="?attr/colorTittleBackgound" - android:textColor="?attr/colorText"/> + android:textColor="?attr/toolbarTextColor"/> + android:textColor="?attr/toolbarTextColor"/>