Allow themes to style more objects (#5197)

* Add Tertiary color and use it for Badges

* Define ripple color for Material Dialog

Although it doesn't do anything, but it should

* Add tertiary colors for Green Apple theme

* Use the correct theme accent in AlertDialog

* Declare a global colorControlHighlight

Fixes some of the ripples listed on #5154.

* Change md_ripple_color to primary ripple color
This commit is contained in:
Soitora 2021-05-27 00:11:14 +02:00 committed by GitHub
parent 8dcd919ff0
commit 11a232a2df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 72 additions and 24 deletions

View file

@ -32,7 +32,7 @@
android:id="@+id/downloaded_only" android:id="@+id/downloaded_only"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -45,7 +45,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:padding="4dp" android:padding="4dp"
android:text="@string/label_downloaded_only" android:text="@string/label_downloaded_only"
android:textColor="@color/md_white_1000" /> android:textColor="?attr/colorOnTertiary" />
</FrameLayout> </FrameLayout>

View file

@ -31,7 +31,7 @@
android:id="@+id/downloaded_only" android:id="@+id/downloaded_only"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
@ -41,7 +41,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:padding="4dp" android:padding="4dp"
android:text="@string/label_downloaded_only" android:text="@string/label_downloaded_only"
android:textColor="@color/md_white_1000" /> android:textColor="?attr/colorOnTertiary" />
</FrameLayout> </FrameLayout>

View file

@ -25,7 +25,7 @@
android:id="@+id/downloaded_only" android:id="@+id/downloaded_only"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
@ -35,7 +35,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:padding="4dp" android:padding="4dp"
android:text="@string/label_downloaded_only" android:text="@string/label_downloaded_only"
android:textColor="@color/md_white_1000" /> android:textColor="?attr/colorOnTertiary" />
</FrameLayout> </FrameLayout>

View file

@ -42,13 +42,13 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:text="@string/local_source_badge" android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
@ -57,12 +57,12 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:text="120" tools:text="120"
tools:visibility="visible" /> tools:visibility="visible" />
@ -72,12 +72,12 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorAccentDark" android:background="?attr/colorSecondary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnSecondary"
android:visibility="gone" android:visibility="gone"
tools:text="120" tools:text="120"
tools:visibility="visible" /> tools:visibility="visible" />

View file

@ -41,13 +41,13 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:text="@string/local_source_badge" android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
@ -56,12 +56,12 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:text="120" tools:text="120"
tools:visibility="visible" /> tools:visibility="visible" />
@ -71,12 +71,12 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorAccentDark" android:background="?attr/colorSecondary"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnSecondary"
android:visibility="gone" android:visibility="gone"
tools:text="120" tools:text="120"
tools:visibility="visible" /> tools:visibility="visible" />

View file

@ -54,14 +54,14 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:maxLines="1" android:maxLines="1"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:text="@string/local_source_badge" android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
@ -70,13 +70,13 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/green" android:background="?attr/colorTertiary"
android:maxLines="1" android:maxLines="1"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnTertiary"
android:visibility="gone" android:visibility="gone"
tools:text="122" tools:text="122"
tools:visibility="visible" /> tools:visibility="visible" />
@ -86,13 +86,13 @@
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorAccentLight" android:background="?attr/colorSecondary"
android:maxLines="1" android:maxLines="1"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000" android:textColor="?attr/colorOnSecondary"
android:visibility="gone" android:visibility="gone"
tools:text="130" tools:text="130"
tools:visibility="visible" /> tools:visibility="visible" />

View file

@ -22,6 +22,8 @@
<attr name="colorFilterActive" format="reference|integer"/> <attr name="colorFilterActive" format="reference|integer"/>
<attr name="colorBackgroundSplash" format="reference|integer"/> <attr name="colorBackgroundSplash" format="reference|integer"/>
<attr name="colorAccentOnPrimary" format="reference|integer"/> <attr name="colorAccentOnPrimary" format="reference|integer"/>
<attr name="colorTertiary" format="reference|integer"/>
<attr name="colorOnTertiary" format="reference|integer"/>
<attr name="rippleSecondaryColor" format="reference|integer"/> <attr name="rippleSecondaryColor" format="reference|integer"/>
<attr name="rippleToolbarColor" format="reference|integer"/> <attr name="rippleToolbarColor" format="reference|integer"/>

View file

@ -68,14 +68,30 @@
<item name="colorAccent">@color/colorAccentLight</item> <item name="colorAccent">@color/colorAccentLight</item>
</style> </style>
<style name="Theme.AlertDialog.Light.StrawberryDaiquiri" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentStrawberry</item>
</style>
<style name="Theme.AlertDialog.Dark" parent="Theme.AlertDialog"> <style name="Theme.AlertDialog.Dark" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentDark</item> <item name="colorAccent">@color/colorAccentDark</item>
</style> </style>
<style name="Theme.AlertDialog.Dark.GreenApple" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentApple</item>
</style>
<style name="Theme.AlertDialog.Dark.MidnightDusk" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentDusk</item>
</style>
<style name="Theme.AlertDialog.Amoled" parent="Theme.AlertDialog"> <style name="Theme.AlertDialog.Amoled" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentAmoled</item> <item name="colorAccent">@color/colorAccentAmoled</item>
</style> </style>
<style name="Theme.AlertDialog.Amoled.HotPink" parent="Theme.AlertDialog">
<item name="colorAccent">@color/colorAccentPink</item>
</style>
<!--===========--> <!--===========-->
<!--BottomSheet--> <!--BottomSheet-->

View file

@ -23,6 +23,8 @@
<item name="colorPrimaryVariant">@color/md_white_1000</item> <item name="colorPrimaryVariant">@color/md_white_1000</item>
<item name="colorSecondary">@color/colorAccentLight</item> <item name="colorSecondary">@color/colorAccentLight</item>
<item name="colorOnSecondary">@color/md_white_1000</item> <item name="colorOnSecondary">@color/md_white_1000</item>
<item name="colorTertiary">@color/green</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorSurface">@color/dialogLight</item> <item name="colorSurface">@color/dialogLight</item>
<item name="colorOnSurface">@color/textColorPrimaryLight</item> <item name="colorOnSurface">@color/textColorPrimaryLight</item>
<item name="colorOnBackground">@color/textColorPrimaryLight</item> <item name="colorOnBackground">@color/textColorPrimaryLight</item>
@ -45,6 +47,7 @@
<item name="rippleColor">@color/rippleColorLight</item> <item name="rippleColor">@color/rippleColorLight</item>
<item name="rippleSecondaryColor">@color/rippleSecondaryColorLight</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorLight</item>
<item name="rippleToolbarColor">@color/rippleToolbarColorLight</item> <item name="rippleToolbarColor">@color/rippleToolbarColorLight</item>
<item name="android:colorControlHighlight">@color/rippleColorLight</item>
<!-- Handles RTL text --> <!-- Handles RTL text -->
<item name="android:textAlignment">gravity</item> <item name="android:textAlignment">gravity</item>
@ -84,6 +87,7 @@
<item name="md_color_title">?attr/colorOnSurface</item> <item name="md_color_title">?attr/colorOnSurface</item>
<item name="md_color_content">?attr/colorOnSurface</item> <item name="md_color_content">?attr/colorOnSurface</item>
<item name="md_color_button_text">?attr/colorAccent</item> <item name="md_color_button_text">?attr/colorAccent</item>
<item name="md_ripple_color">?attr/rippleColor</item>
<item name="md_button_casing">literal</item> <item name="md_button_casing">literal</item>
<item name="md_corner_radius">@dimen/dialog_radius</item> <item name="md_corner_radius">@dimen/dialog_radius</item>
@ -137,11 +141,16 @@
<!-- Theme colors --> <!-- Theme colors -->
<item name="colorAccentOnPrimary">@color/colorAccentStrawberry</item> <item name="colorAccentOnPrimary">@color/colorAccentStrawberry</item>
<item name="colorSecondary">@color/colorAccentStrawberry</item> <item name="colorSecondary">@color/colorAccentStrawberry</item>
<item name="colorTertiary">@color/md_blue_A400</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorAccent">@color/colorAccentStrawberry</item> <item name="colorAccent">@color/colorAccentStrawberry</item>
<!-- Ripples --> <!-- Ripples -->
<item name="rippleSecondaryColor">@color/rippleSecondaryColorStrawberry</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorStrawberry</item>
<!-- Themes -->
<item name="materialAlertDialogTheme">@style/Theme.AlertDialog.Light.StrawberryDaiquiri</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="colorLibrarySelectionActive">@color/selectorColorStrawberry</item> <item name="colorLibrarySelectionActive">@color/selectorColorStrawberry</item>
</style> </style>
@ -159,6 +168,8 @@
<item name="colorPrimaryVariant">@color/colorDarkPrimary</item> <item name="colorPrimaryVariant">@color/colorDarkPrimary</item>
<item name="colorSecondary">@color/colorAccentDark</item> <item name="colorSecondary">@color/colorAccentDark</item>
<item name="colorOnSecondary">@color/textColorPrimaryDark</item> <item name="colorOnSecondary">@color/textColorPrimaryDark</item>
<item name="colorTertiary">@color/green</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorSurface">@color/dialogDark</item> <item name="colorSurface">@color/dialogDark</item>
<item name="colorOnSurface">@color/textColorPrimaryDark</item> <item name="colorOnSurface">@color/textColorPrimaryDark</item>
<item name="colorOnBackground">@color/textColorPrimaryDark</item> <item name="colorOnBackground">@color/textColorPrimaryDark</item>
@ -186,6 +197,7 @@
<item name="rippleColor">@color/rippleColorDark</item> <item name="rippleColor">@color/rippleColorDark</item>
<item name="rippleSecondaryColor">@color/rippleSecondaryColorDark</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorDark</item>
<item name="rippleToolbarColor">@color/rippleToolbarColorDark</item> <item name="rippleToolbarColor">@color/rippleToolbarColorDark</item>
<item name="android:colorControlHighlight">@color/rippleColorDark</item>
<!-- Themes --> <!-- Themes -->
<item name="android:statusBarColor">?attr/colorPrimary</item> <item name="android:statusBarColor">?attr/colorPrimary</item>
@ -221,6 +233,7 @@
<item name="md_color_title">?attr/colorOnSurface</item> <item name="md_color_title">?attr/colorOnSurface</item>
<item name="md_color_content">?attr/colorOnSurface</item> <item name="md_color_content">?attr/colorOnSurface</item>
<item name="md_color_button_text">?attr/colorAccent</item> <item name="md_color_button_text">?attr/colorAccent</item>
<item name="md_ripple_color">?attr/rippleColor</item>
<item name="md_button_casing">literal</item> <item name="md_button_casing">literal</item>
<item name="md_corner_radius">@dimen/dialog_radius</item> <item name="md_corner_radius">@dimen/dialog_radius</item>
@ -254,11 +267,16 @@
<item name="colorAccentOnPrimary">@color/colorAccentApple</item> <item name="colorAccentOnPrimary">@color/colorAccentApple</item>
<item name="colorSecondary">@color/colorAccentApple</item> <item name="colorSecondary">@color/colorAccentApple</item>
<item name="colorOnSecondary">@color/colorOnSecondaryApple</item> <item name="colorOnSecondary">@color/colorOnSecondaryApple</item>
<item name="colorTertiary">@color/md_blue_A400</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorAccent">@color/colorAccentApple</item> <item name="colorAccent">@color/colorAccentApple</item>
<!-- Ripples --> <!-- Ripples -->
<item name="rippleSecondaryColor">@color/rippleSecondaryColorApple</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorApple</item>
<!-- Themes -->
<item name="materialAlertDialogTheme">@style/Theme.AlertDialog.Dark.GreenApple</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="colorLibrarySelectionActive">@color/selectorColorApple</item> <item name="colorLibrarySelectionActive">@color/selectorColorApple</item>
</style> </style>
@ -272,6 +290,8 @@
<item name="colorPrimaryVariant">@color/dialogDusk</item> <item name="colorPrimaryVariant">@color/dialogDusk</item>
<item name="colorSecondary">@color/colorAccentDusk</item> <item name="colorSecondary">@color/colorAccentDusk</item>
<item name="colorOnSecondary">@color/textColorPrimaryDusk</item> <item name="colorOnSecondary">@color/textColorPrimaryDusk</item>
<item name="colorTertiary">@color/md_blue_A400</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorSurface">@color/dialogDusk</item> <item name="colorSurface">@color/dialogDusk</item>
<item name="colorOnSurface">@color/textColorPrimaryDusk</item> <item name="colorOnSurface">@color/textColorPrimaryDusk</item>
<item name="colorOnBackground">@color/textColorPrimaryDusk</item> <item name="colorOnBackground">@color/textColorPrimaryDusk</item>
@ -284,6 +304,9 @@
<!-- Ripples --> <!-- Ripples -->
<item name="rippleSecondaryColor">@color/rippleSecondaryColorDusk</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorDusk</item>
<!-- Themes -->
<item name="materialAlertDialogTheme">@style/Theme.AlertDialog.Dark.MidnightDusk</item>
<!-- Custom Attributes --> <!-- Custom Attributes -->
<item name="colorLibrarySelection">@color/selectorColorDark</item> <item name="colorLibrarySelection">@color/selectorColorDark</item>
<item name="colorLibrarySelectionActive">@color/selectorColorDark</item> <item name="colorLibrarySelectionActive">@color/selectorColorDark</item>
@ -329,6 +352,7 @@
<item name="rippleColor">@color/rippleColorAmoled</item> <item name="rippleColor">@color/rippleColorAmoled</item>
<item name="rippleSecondaryColor">@color/rippleSecondaryColorAmoled</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorAmoled</item>
<item name="rippleToolbarColor">@color/rippleToolbarColorAmoled</item> <item name="rippleToolbarColor">@color/rippleToolbarColorAmoled</item>
<item name="android:colorControlHighlight">@color/rippleColorAmoled</item>
<!-- Themes --> <!-- Themes -->
<item name="android:statusBarColor">?attr/colorPrimary</item> <item name="android:statusBarColor">?attr/colorPrimary</item>
@ -363,6 +387,7 @@
<item name="md_color_title">?attr/colorOnSurface</item> <item name="md_color_title">?attr/colorOnSurface</item>
<item name="md_color_content">?attr/colorOnSurface</item> <item name="md_color_content">?attr/colorOnSurface</item>
<item name="md_color_button_text">?attr/colorAccent</item> <item name="md_color_button_text">?attr/colorAccent</item>
<item name="md_ripple_color">?attr/rippleColor</item>
<item name="md_button_casing">literal</item> <item name="md_button_casing">literal</item>
<item name="md_corner_radius">@dimen/dialog_radius</item> <item name="md_corner_radius">@dimen/dialog_radius</item>
@ -385,12 +410,17 @@
<item name="colorAccentOnPrimary">@color/colorAccentPink</item> <item name="colorAccentOnPrimary">@color/colorAccentPink</item>
<item name="colorSecondary">@color/colorAccentPink</item> <item name="colorSecondary">@color/colorAccentPink</item>
<item name="colorOnSecondary">@color/textColorPrimaryPink</item> <item name="colorOnSecondary">@color/textColorPrimaryPink</item>
<item name="colorTertiary">@color/md_blue_A400</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
<item name="colorOnSurface">@color/textColorPrimaryPink</item> <item name="colorOnSurface">@color/textColorPrimaryPink</item>
<item name="colorOnBackground">@color/textColorPrimaryPink</item> <item name="colorOnBackground">@color/textColorPrimaryPink</item>
<item name="colorAccent">@color/colorAccentPink</item> <item name="colorAccent">@color/colorAccentPink</item>
<!-- Ripples --> <!-- Ripples -->
<item name="rippleSecondaryColor">@color/rippleSecondaryColorPink</item> <item name="rippleSecondaryColor">@color/rippleSecondaryColorPink</item>
<!-- Themes -->
<item name="materialAlertDialogTheme">@style/Theme.AlertDialog.Amoled.HotPink</item>
</style> </style>
<!--===============--> <!--===============-->