pref: 优化夜间模式配色

This commit is contained in:
HuanChengFly 2020-11-14 17:02:56 +08:00
parent 0c25dd8572
commit 9f5cb28f92
8 changed files with 57 additions and 34 deletions

View File

@ -397,6 +397,20 @@ class BaseApplication : Application() {
context.getColorCompat(resources.getIdentifier("theme_color_swipe_refresh_view_background_$theme", "color", packageName)) context.getColorCompat(resources.getIdentifier("theme_color_swipe_refresh_view_background_$theme", "color", packageName))
} else context.getColorCompat(R.color.theme_color_swipe_refresh_view_background_light) } else context.getColorCompat(R.color.theme_color_swipe_refresh_view_background_light)
} }
R.attr.colorToolbarBar -> {
return if (ThemeUtil.isNightMode(context)) {
context.getColorCompat(R.color.theme_color_toolbar_bar_dark)
} else {
context.getColorCompat(R.color.theme_color_toolbar_bar_light)
}
}
R.attr.colorOnToolbarBar -> {
return if (ThemeUtil.isNightMode(context)) {
context.getColorCompat(R.color.theme_color_on_toolbar_bar_dark)
} else {
context.getColorCompat(R.color.theme_color_on_toolbar_bar_light)
}
}
} }
return Util.getColorByAttr(context, attrId, R.color.transparent) return Util.getColorByAttr(context, attrId, R.color.transparent)
} }
@ -415,6 +429,8 @@ class BaseApplication : Application() {
R.color.default_color_toolbar_item -> return getColorByAttr(context, R.attr.colorToolbarItem) R.color.default_color_toolbar_item -> return getColorByAttr(context, R.attr.colorToolbarItem)
R.color.default_color_toolbar_item_active -> return getColorByAttr(context, R.attr.colorToolbarItemActive) R.color.default_color_toolbar_item_active -> return getColorByAttr(context, R.attr.colorToolbarItemActive)
R.color.default_color_toolbar_item_secondary -> return getColorByAttr(context, R.attr.color_toolbar_item_secondary) R.color.default_color_toolbar_item_secondary -> return getColorByAttr(context, R.attr.color_toolbar_item_secondary)
R.color.default_color_toolbar_bar -> return getColorByAttr(context, R.attr.colorToolbarBar)
R.color.default_color_on_toolbar_bar -> return getColorByAttr(context, R.attr.colorOnToolbarBar)
R.color.default_color_card -> return getColorByAttr(context, R.attr.colorCard) R.color.default_color_card -> return getColorByAttr(context, R.attr.colorCard)
R.color.default_color_floor_card -> return getColorByAttr(context, R.attr.colorFloorCard) R.color.default_color_floor_card -> return getColorByAttr(context, R.attr.colorFloorCard)
R.color.default_color_nav -> return getColorByAttr(context, R.attr.colorNavBar) R.color.default_color_nav -> return getColorByAttr(context, R.attr.colorNavBar)

View File

@ -296,13 +296,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<FrameLayout <com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/bg_radius_8dp" android:background="@drawable/bg_radius_8dp"
android:backgroundTint="@color/color_toolbar_bar" app:backgroundTint="@color/default_color_toolbar_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -314,7 +314,7 @@
android:id="@+id/forum_tab" android:id="@+id/forum_tab"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</FrameLayout> </com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout> </com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout> </com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout>

View File

@ -19,7 +19,7 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
app:boxBackgroundColor="@color/color_toolbar_bar" app:boxBackgroundColor="@color/default_color_toolbar_bar"
app:boxCollapsedPaddingTop="0dp" app:boxCollapsedPaddingTop="0dp"
app:boxCornerRadiusBottomEnd="8dp" app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp" app:boxCornerRadiusBottomStart="8dp"
@ -32,9 +32,9 @@
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:startIconTint="@color/color_on_toolbar_bar" app:startIconTint="@color/default_color_on_toolbar_bar"
app:hintTextColor="@color/color_on_toolbar_bar" app:hintTextColor="@color/default_color_on_toolbar_bar"
app:placeholderTextColor="@color/color_on_toolbar_bar" app:placeholderTextColor="@color/default_color_on_toolbar_bar"
app:startIconDrawable="@drawable/ic_round_arrow_back"> app:startIconDrawable="@drawable/ic_round_arrow_back">
<com.huanchengfly.tieba.post.widgets.theme.TintTextInputEditText <com.huanchengfly.tieba.post.widgets.theme.TintTextInputEditText
@ -46,7 +46,7 @@
android:background="@null" android:background="@null"
android:hint="@string/hint_search" android:hint="@string/hint_search"
android:textStyle="bold" android:textStyle="bold"
android:textColorHint="@color/color_on_toolbar_bar" /> android:textColorHint="@color/default_color_on_toolbar_bar" />
</com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout> </com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout> </com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout>
@ -64,7 +64,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/bg_radius_8dp" android:background="@drawable/bg_radius_8dp"
app:backgroundTint="@color/color_toolbar_bar" app:backgroundTint="@color/default_color_toolbar_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@ -21,7 +21,7 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
app:boxBackgroundColor="@color/color_toolbar_bar" app:boxBackgroundColor="@color/default_color_toolbar_bar"
app:boxCollapsedPaddingTop="0dp" app:boxCollapsedPaddingTop="0dp"
app:boxCornerRadiusBottomEnd="8dp" app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp" app:boxCornerRadiusBottomStart="8dp"
@ -34,9 +34,9 @@
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:startIconTint="@color/color_on_toolbar_bar" app:startIconTint="@color/default_color_on_toolbar_bar"
app:hintTextColor="@color/color_on_toolbar_bar" app:hintTextColor="@color/default_color_on_toolbar_bar"
app:placeholderTextColor="@color/color_on_toolbar_bar" app:placeholderTextColor="@color/default_color_on_toolbar_bar"
app:startIconDrawable="@drawable/ic_round_arrow_back"> app:startIconDrawable="@drawable/ic_round_arrow_back">
<com.huanchengfly.tieba.post.widgets.theme.TintTextInputEditText <com.huanchengfly.tieba.post.widgets.theme.TintTextInputEditText
@ -48,7 +48,7 @@
android:background="@null" android:background="@null"
android:hint="@string/hint_search" android:hint="@string/hint_search"
android:textStyle="bold" android:textStyle="bold"
android:textColorHint="@color/color_on_toolbar_bar" /> android:textColorHint="@color/default_color_on_toolbar_bar" />
</com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout> </com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout> </com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout>

View File

@ -39,8 +39,8 @@
app:layoutDescription="@xml/fragment_main_forum_list_scene"> app:layoutDescription="@xml/fragment_main_forum_list_scene">
<com.huanchengfly.tieba.post.widgets.theme.TintLinearLayout <com.huanchengfly.tieba.post.widgets.theme.TintLinearLayout
app:backgroundTint="@color/color_toolbar_bar" app:backgroundTint="@color/default_color_toolbar_bar"
tools:backgroundTint="@color/color_toolbar_bar" tools:backgroundTint="@color/default_color_toolbar_bar"
android:padding="12dp" android:padding="12dp"
android:background="@drawable/bg_radius_8dp_ripple" android:background="@drawable/bg_radius_8dp_ripple"
android:layout_width="0dp" android:layout_width="0dp"
@ -52,15 +52,15 @@
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
app:srcCompat="@drawable/ic_search" app:srcCompat="@drawable/ic_search"
tools:tint="@color/color_on_toolbar_bar" tools:tint="@color/default_color_on_toolbar_bar"
app:tint="@color/color_on_toolbar_bar" /> app:tint="@color/default_color_on_toolbar_bar" />
<com.huanchengfly.tieba.post.widgets.theme.TintTextView <com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:textStyle="bold" android:textStyle="bold"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:textSize="16sp" android:textSize="16sp"
tools:textColor="@color/color_on_toolbar_bar" tools:textColor="@color/default_color_on_toolbar_bar"
app:tint="@color/color_on_toolbar_bar" app:tint="@color/default_color_on_toolbar_bar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View File

@ -39,13 +39,13 @@
</FrameLayout> </FrameLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintToolbar> </com.huanchengfly.tieba.post.widgets.theme.TintToolbar>
<FrameLayout <com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/bg_radius_8dp" android:background="@drawable/bg_radius_8dp"
android:backgroundTint="@color/color_toolbar_bar" app:backgroundTint="@color/default_color_toolbar_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -57,7 +57,7 @@
android:id="@+id/fragment_message_tab" android:id="@+id/fragment_message_tab"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</FrameLayout> </com.huanchengfly.tieba.post.widgets.theme.TintFrameLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout> </com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout>
<com.huanchengfly.tieba.post.widgets.MyViewPager <com.huanchengfly.tieba.post.widgets.MyViewPager

View File

@ -3,7 +3,12 @@
<declare-styleable name="Theme"> <declare-styleable name="Theme">
<attr name="colorPrimary" format="color" /> <attr name="colorPrimary" format="color" />
<attr name="colorAccent" format="color" /> <attr name="colorAccent" format="color" />
<attr name="colorToolbar" format="color" />
<attr name="colorToolbarItem" format="color" /> <attr name="colorToolbarItem" format="color" />
<attr name="color_toolbar_item_secondary" format="color" />
<attr name="colorToolbarItemActive" format="color" />
<attr name="colorToolbarBar" format="color" />
<attr name="colorOnToolbarBar" format="color" />
<attr name="colorText" format="color" /> <attr name="colorText" format="color" />
<attr name="colorTextOnPrimary" format="color" /> <attr name="colorTextOnPrimary" format="color" />
<attr name="colorTextSecondary" format="color" /> <attr name="colorTextSecondary" format="color" />
@ -12,13 +17,10 @@
<attr name="colorWindowBackground" format="color" /> <attr name="colorWindowBackground" format="color" />
<attr name="colorUnselected" format="color" /> <attr name="colorUnselected" format="color" />
<attr name="colorNavBar" format="color" /> <attr name="colorNavBar" format="color" />
<attr name="colorToolbar" format="color" />
<attr name="colorToolbarItemActive" format="color" />
<attr name="colorFloorCard" format="color" /> <attr name="colorFloorCard" format="color" />
<attr name="colorCard" format="color" /> <attr name="colorCard" format="color" />
<attr name="colorDivider" format="color" /> <attr name="colorDivider" format="color" />
<attr name="shadow_color" format="color" /> <attr name="shadow_color" format="color" />
<attr name="color_toolbar_item_secondary" format="color" />
<attr name="color_swipe_refresh_layout_background" format="color" /> <attr name="color_swipe_refresh_layout_background" format="color" />
</declare-styleable> </declare-styleable>

View File

@ -23,10 +23,6 @@
<color name="black">#000</color> <color name="black">#000</color>
<color name="tieba">#4477E0</color> <color name="tieba">#4477E0</color>
<color name="color_toolbar_bar">#E6F2F7FB</color>
<color name="color_on_toolbar_bar">#6654585B</color>
<color name="color_text">#FF31343C</color> <color name="color_text">#FF31343C</color>
<color name="color_text_secondary">#FF545967</color> <color name="color_text_secondary">#FF545967</color>
<color name="color_text_disabled">#FF65696C</color> <color name="color_text_disabled">#FF65696C</color>
@ -43,6 +39,7 @@
<color name="color_text_secondary_translucent_dark">#B3000000</color> <color name="color_text_secondary_translucent_dark">#B3000000</color>
<color name="color_text_disabled_translucent_dark">#80000000</color> <color name="color_text_disabled_translucent_dark">#80000000</color>
<color name="default_color_primary">#FF4477E0</color> <color name="default_color_primary">#FF4477E0</color>
<color name="default_color_accent">#FF4477E0</color> <color name="default_color_accent">#FF4477E0</color>
<color name="default_color_text">#FF31343C</color> <color name="default_color_text">#FF31343C</color>
@ -51,16 +48,18 @@
<color name="default_color_text_disabled">#FF65696C</color> <color name="default_color_text_disabled">#FF65696C</color>
<color name="default_color_toolbar">#FFFFFFFF</color> <color name="default_color_toolbar">#FFFFFFFF</color>
<color name="default_color_toolbar_item">#FF474B54</color> <color name="default_color_toolbar_item">#FF474B54</color>
<color name="default_color_toolbar_item_secondary">#FF545967</color>
<color name="default_color_toolbar_item_active">#FF4477E0</color>
<color name="default_color_toolbar_bar">#E6F2F7FB</color>
<color name="default_color_on_toolbar_bar">#6654585B</color>
<color name="default_color_background">#FFFFFFFF</color> <color name="default_color_background">#FFFFFFFF</color>
<color name="default_color_window_background">#FFF3F7F9</color> <color name="default_color_window_background">#FFF3F7F9</color>
<color name="default_color_nav">#FFFFFFFF</color> <color name="default_color_nav">#FFFFFFFF</color>
<color name="default_color_unselected">#FF6E7486</color> <color name="default_color_unselected">#FF6E7486</color>
<color name="default_color_toolbar_item_active">#FF4477E0</color>
<color name="default_color_floor_card">#FFF0F3F5</color> <color name="default_color_floor_card">#FFF0F3F5</color>
<color name="default_color_card">#FFFFFFFF</color> <color name="default_color_card">#FFFFFFFF</color>
<color name="default_color_divider">#FFF7FBFE</color> <color name="default_color_divider">#FFF7FBFE</color>
<color name="default_color_shadow">#FEE9E9E9</color> <color name="default_color_shadow">#FEE9E9E9</color>
<color name="default_color_toolbar_item_secondary">#FF545967</color>
<color name="default_color_swipe_refresh_view_background">#FFFFFFFF</color> <color name="default_color_swipe_refresh_view_background">#FFFFFFFF</color>
<color name="theme_color_primary_white">@color/tieba</color> <color name="theme_color_primary_white">@color/tieba</color>
@ -109,13 +108,19 @@
<color name="theme_color_toolbar_item_active_grey_dark">@color/white</color> <color name="theme_color_toolbar_item_active_grey_dark">@color/white</color>
<color name="theme_color_toolbar_item_active_amoled_dark">@color/white</color> <color name="theme_color_toolbar_item_active_amoled_dark">@color/white</color>
<color name="theme_color_toolbar_bar_light">#E6F2F7FB</color>
<color name="theme_color_toolbar_bar_dark">#A110161C</color>
<color name="theme_color_on_toolbar_bar_light">#6654585B</color>
<color name="theme_color_on_toolbar_bar_dark">#FF8C96A0</color>
<color name="theme_color_background_light">#FFFFFFFF</color> <color name="theme_color_background_light">#FFFFFFFF</color>
<color name="theme_color_background_dark">#FF131D28</color> <color name="theme_color_background_dark">#FF131D28</color>
<color name="theme_color_background_grey_dark">#FF212121</color> <color name="theme_color_background_grey_dark">#FF212121</color>
<color name="theme_color_background_amoled_dark">#FF000000</color> <color name="theme_color_background_amoled_dark">#FF000000</color>
<color name="theme_color_window_background_light">#FFF3F7F9</color> <color name="theme_color_window_background_light">#FFF3F7F9</color>
<color name="theme_color_window_background_dark">#FF131D28</color> <color name="theme_color_window_background_dark">#FF10171F</color>
<color name="theme_color_window_background_grey_dark">#FF212121</color> <color name="theme_color_window_background_grey_dark">#FF212121</color>
<color name="theme_color_window_background_amoled_dark">#FF000000</color> <color name="theme_color_window_background_amoled_dark">#FF000000</color>
@ -141,7 +146,7 @@
<color name="theme_color_card_light">#FFFFFFFF</color> <color name="theme_color_card_light">#FFFFFFFF</color>
<color name="theme_color_card_translucent_light">#10FFFFFF</color> <color name="theme_color_card_translucent_light">#10FFFFFF</color>
<color name="theme_color_card_translucent_dark">#20000000</color> <color name="theme_color_card_translucent_dark">#20000000</color>
<color name="theme_color_card_dark">#FF15202B</color> <color name="theme_color_card_dark">#FF131D27</color>
<color name="theme_color_card_grey_dark">#FF2A2A2A</color> <color name="theme_color_card_grey_dark">#FF2A2A2A</color>
<color name="theme_color_card_amoled_dark">#FF101010</color> <color name="theme_color_card_amoled_dark">#FF101010</color>