feat(AboutView): 适配深色模式
- 优化布局颜色:应用名改为colorPrimaryDark,分割线改为gray_400 - 功能项背景根据深色/浅色模式动态设置背景色(gray_800/white) - 功能项标题文字根据深色/浅色模式动态设置颜色(gray_100/gray_900)
This commit is contained in:
@@ -421,9 +421,10 @@ public class AboutView extends LinearLayout {
|
||||
*/
|
||||
private android.graphics.drawable.Drawable create_item_background() {
|
||||
android.graphics.drawable.GradientDrawable drawable = new android.graphics.drawable.GradientDrawable();
|
||||
drawable.setStroke(1, mItemContext.getResources().getColor(R.color.gray_200));
|
||||
drawable.setStroke(1, mItemContext.getResources().getColor(R.color.gray_400));
|
||||
drawable.setCornerRadius(4);
|
||||
drawable.setColor(mItemContext.getResources().getColor(android.R.color.white));
|
||||
boolean isNightMode = (mItemContext.getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK) == android.content.res.Configuration.UI_MODE_NIGHT_YES;
|
||||
drawable.setColor(isNightMode ? mItemContext.getResources().getColor(R.color.gray_800) : mItemContext.getResources().getColor(android.R.color.white));
|
||||
return drawable;
|
||||
}
|
||||
|
||||
@@ -449,7 +450,8 @@ public class AboutView extends LinearLayout {
|
||||
TextView tvTitle = new TextView(mItemContext);
|
||||
tvTitle.setText(mTitle);
|
||||
tvTitle.setTextSize(16);
|
||||
tvTitle.setTextColor(mItemContext.getResources().getColor(R.color.gray_900));
|
||||
boolean isNightMode = (mItemContext.getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK) == android.content.res.Configuration.UI_MODE_NIGHT_YES;
|
||||
tvTitle.setTextColor(isNightMode ? mItemContext.getResources().getColor(R.color.gray_100) : mItemContext.getResources().getColor(R.color.gray_900));
|
||||
llText.addView(tvTitle);
|
||||
// 内容
|
||||
TextView tvContent = new TextView(mItemContext);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/gray_900"/>
|
||||
android:textColor="@color/colorPrimaryDark"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_desc"
|
||||
@@ -42,7 +42,7 @@
|
||||
android:layout_height="1px"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/gray_200"/>
|
||||
android:background="@color/gray_400"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_function_container"
|
||||
|
||||
Reference in New Issue
Block a user