From 11a232a2dfd42094ebabba1a1c02997931fcdd10 Mon Sep 17 00:00:00 2001 From: Soitora Date: Thu, 27 May 2021 00:11:14 +0200 Subject: [PATCH] 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 --- .../main/res/layout-sw600dp/main_activity.xml | 4 +-- app/src/main/res/layout/main_activity.xml | 4 +-- .../main/res/layout/main_activity_toolbar.xml | 4 +-- .../layout/source_comfortable_grid_item.xml | 12 ++++---- .../res/layout/source_compact_grid_item.xml | 12 ++++---- app/src/main/res/layout/source_list_item.xml | 12 ++++---- app/src/main/res/values/attrs.xml | 2 ++ app/src/main/res/values/styles.xml | 16 ++++++++++ app/src/main/res/values/themes.xml | 30 +++++++++++++++++++ 9 files changed, 72 insertions(+), 24 deletions(-) diff --git a/app/src/main/res/layout-sw600dp/main_activity.xml b/app/src/main/res/layout-sw600dp/main_activity.xml index f0a4a89c7..9da7d3677 100644 --- a/app/src/main/res/layout-sw600dp/main_activity.xml +++ b/app/src/main/res/layout-sw600dp/main_activity.xml @@ -32,7 +32,7 @@ android:id="@+id/downloaded_only" android:layout_width="0dp" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -45,7 +45,7 @@ android:layout_gravity="center" android:padding="4dp" android:text="@string/label_downloaded_only" - android:textColor="@color/md_white_1000" /> + android:textColor="?attr/colorOnTertiary" /> diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index 74b8004d1..9e78a2229 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -31,7 +31,7 @@ android:id="@+id/downloaded_only" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:visibility="gone" tools:visibility="visible"> @@ -41,7 +41,7 @@ android:layout_gravity="center" android:padding="4dp" android:text="@string/label_downloaded_only" - android:textColor="@color/md_white_1000" /> + android:textColor="?attr/colorOnTertiary" /> diff --git a/app/src/main/res/layout/main_activity_toolbar.xml b/app/src/main/res/layout/main_activity_toolbar.xml index 47dedf572..4a1a6a5ae 100644 --- a/app/src/main/res/layout/main_activity_toolbar.xml +++ b/app/src/main/res/layout/main_activity_toolbar.xml @@ -25,7 +25,7 @@ android:id="@+id/downloaded_only" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:visibility="gone" tools:visibility="visible"> @@ -35,7 +35,7 @@ android:layout_gravity="center" android:padding="4dp" android:text="@string/label_downloaded_only" - android:textColor="@color/md_white_1000" /> + android:textColor="?attr/colorOnTertiary" /> diff --git a/app/src/main/res/layout/source_comfortable_grid_item.xml b/app/src/main/res/layout/source_comfortable_grid_item.xml index d94478785..9a857bf03 100644 --- a/app/src/main/res/layout/source_comfortable_grid_item.xml +++ b/app/src/main/res/layout/source_comfortable_grid_item.xml @@ -42,13 +42,13 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" android:text="@string/local_source_badge" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:visibility="visible" /> @@ -57,12 +57,12 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:text="120" tools:visibility="visible" /> @@ -72,12 +72,12 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/colorAccentDark" + android:background="?attr/colorSecondary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnSecondary" android:visibility="gone" tools:text="120" tools:visibility="visible" /> diff --git a/app/src/main/res/layout/source_compact_grid_item.xml b/app/src/main/res/layout/source_compact_grid_item.xml index 7ccc0ccdb..1dd7123aa 100644 --- a/app/src/main/res/layout/source_compact_grid_item.xml +++ b/app/src/main/res/layout/source_compact_grid_item.xml @@ -41,13 +41,13 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" android:text="@string/local_source_badge" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:visibility="visible" /> @@ -56,12 +56,12 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:text="120" tools:visibility="visible" /> @@ -71,12 +71,12 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/colorAccentDark" + android:background="?attr/colorSecondary" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnSecondary" android:visibility="gone" tools:text="120" tools:visibility="visible" /> diff --git a/app/src/main/res/layout/source_list_item.xml b/app/src/main/res/layout/source_list_item.xml index e25d6019d..b9678d7ab 100644 --- a/app/src/main/res/layout/source_list_item.xml +++ b/app/src/main/res/layout/source_list_item.xml @@ -54,14 +54,14 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:maxLines="1" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" android:text="@string/local_source_badge" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:visibility="visible" /> @@ -70,13 +70,13 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/green" + android:background="?attr/colorTertiary" android:maxLines="1" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnTertiary" android:visibility="gone" tools:text="122" tools:visibility="visible" /> @@ -86,13 +86,13 @@ style="@style/TextAppearance.Regular.Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/colorAccentLight" + android:background="?attr/colorSecondary" android:maxLines="1" android:paddingStart="3dp" android:paddingTop="1dp" android:paddingEnd="3dp" android:paddingBottom="1dp" - android:textColor="@color/md_white_1000" + android:textColor="?attr/colorOnSecondary" android:visibility="gone" tools:text="130" tools:visibility="visible" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index e1b983818..f9ef51421 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -22,6 +22,8 @@ + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f09c42891..10bb94ff2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -68,14 +68,30 @@ @color/colorAccentLight + + + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 75c8145f1..7ab1fcc6a 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -23,6 +23,8 @@ @color/md_white_1000 @color/colorAccentLight @color/md_white_1000 + @color/green + @color/md_white_1000 @color/dialogLight @color/textColorPrimaryLight @color/textColorPrimaryLight @@ -45,6 +47,7 @@ @color/rippleColorLight @color/rippleSecondaryColorLight @color/rippleToolbarColorLight + @color/rippleColorLight gravity @@ -84,6 +87,7 @@ ?attr/colorOnSurface ?attr/colorOnSurface ?attr/colorAccent + ?attr/rippleColor literal @dimen/dialog_radius @@ -137,11 +141,16 @@ @color/colorAccentStrawberry @color/colorAccentStrawberry + @color/md_blue_A400 + @color/md_white_1000 @color/colorAccentStrawberry @color/rippleSecondaryColorStrawberry + + @style/Theme.AlertDialog.Light.StrawberryDaiquiri + @color/selectorColorStrawberry @@ -159,6 +168,8 @@ @color/colorDarkPrimary @color/colorAccentDark @color/textColorPrimaryDark + @color/green + @color/md_white_1000 @color/dialogDark @color/textColorPrimaryDark @color/textColorPrimaryDark @@ -186,6 +197,7 @@ @color/rippleColorDark @color/rippleSecondaryColorDark @color/rippleToolbarColorDark + @color/rippleColorDark ?attr/colorPrimary @@ -221,6 +233,7 @@ ?attr/colorOnSurface ?attr/colorOnSurface ?attr/colorAccent + ?attr/rippleColor literal @dimen/dialog_radius @@ -254,11 +267,16 @@ @color/colorAccentApple @color/colorAccentApple @color/colorOnSecondaryApple + @color/md_blue_A400 + @color/md_white_1000 @color/colorAccentApple @color/rippleSecondaryColorApple + + @style/Theme.AlertDialog.Dark.GreenApple + @color/selectorColorApple @@ -272,6 +290,8 @@ @color/dialogDusk @color/colorAccentDusk @color/textColorPrimaryDusk + @color/md_blue_A400 + @color/md_white_1000 @color/dialogDusk @color/textColorPrimaryDusk @color/textColorPrimaryDusk @@ -284,6 +304,9 @@ @color/rippleSecondaryColorDusk + + @style/Theme.AlertDialog.Dark.MidnightDusk + @color/selectorColorDark @color/selectorColorDark @@ -329,6 +352,7 @@ @color/rippleColorAmoled @color/rippleSecondaryColorAmoled @color/rippleToolbarColorAmoled + @color/rippleColorAmoled ?attr/colorPrimary @@ -363,6 +387,7 @@ ?attr/colorOnSurface ?attr/colorOnSurface ?attr/colorAccent + ?attr/rippleColor literal @dimen/dialog_radius @@ -385,12 +410,17 @@ @color/colorAccentPink @color/colorAccentPink @color/textColorPrimaryPink + @color/md_blue_A400 + @color/md_white_1000 @color/textColorPrimaryPink @color/textColorPrimaryPink @color/colorAccentPink @color/rippleSecondaryColorPink + + + @style/Theme.AlertDialog.Amoled.HotPink