From 562dce60ee144be75434957d64ec7ab916dcce6a Mon Sep 17 00:00:00 2001 From: Soitora Date: Sat, 22 May 2021 17:55:05 +0200 Subject: [PATCH] Ripple overhaul (#5109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create drawables for the ripples Temporary colors in them to aid in unifying the ripples. The 'ripple_circular' and 'ripple_normal' are probably going to be merge as one in the end. * Change selectableItems to drawables Changes 'selectableItemBackgroundBorderless' to 'ripple_circular' drawable. Changes 'selectableItemBackground' to 'selectable_item_background' drawable. * Add temporary colors to aid in finding unstyled ripples * Fix button sizes to not make oval ripples * Make the chip selectable follow ripple color * Style using the built in rippleColor when possible * Ripple away 💸 * Set ripple color for tabs Main activity tabs as well as sheet tabs * Set ripple color in seekbar buttons * Fix ripple color for the toolbar * Round off and start to finish the ripples * Set custom colorful ripple for bottom navigation Makes the app a little more fun than just black and white. Took inspiration from a ton of updated Google apps. * Revert two layout changes These were not necessary for the ripple as it is designed now, but it was before. Co-authored-by: Andreas E --- .../res/color/background_color_chip_state.xml | 7 +++++ .../res/drawable/reader_seekbar_ripple.xml | 2 +- app/src/main/res/drawable/ripple_dark.xml | 5 ++++ app/src/main/res/drawable/ripple_light.xml | 5 ++++ app/src/main/res/drawable/ripple_regular.xml | 3 ++ .../drawable/selectable_item_background.xml | 3 ++ .../main/res/layout/chapter_download_view.xml | 2 +- .../main/res/layout/common_tabbed_sheet.xml | 3 +- app/src/main/res/layout/download_item.xml | 2 +- .../layout/global_search_controller_card.xml | 2 +- app/src/main/res/layout/history_item.xml | 4 +-- app/src/main/res/layout/main_activity.xml | 1 + .../main/res/layout/main_activity_toolbar.xml | 3 +- .../main/res/layout/manga_chapters_header.xml | 4 +-- app/src/main/res/layout/manga_info_header.xml | 3 ++ .../res/layout/navigation_view_checkbox.xml | 2 +- .../layout/navigation_view_checkedtext.xml | 2 +- .../main/res/layout/navigation_view_radio.xml | 2 +- .../res/layout/navigation_view_spinner.xml | 2 +- .../main/res/layout/navigation_view_text.xml | 2 +- app/src/main/res/layout/pref_settings.xml | 2 +- app/src/main/res/layout/reader_activity.xml | 8 +++--- app/src/main/res/layout/reader_page_sheet.xml | 6 ++-- .../settings_search_controller_card.xml | 2 +- .../source_main_controller_card_item.xml | 4 +-- .../main/res/layout/spinner_preference.xml | 2 +- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/colors.xml | 9 ++++-- app/src/main/res/values/styles.xml | 28 ++++++++++++++++--- app/src/main/res/values/themes.xml | 12 ++++---- 30 files changed, 95 insertions(+), 38 deletions(-) create mode 100644 app/src/main/res/color/background_color_chip_state.xml create mode 100644 app/src/main/res/drawable/ripple_dark.xml create mode 100644 app/src/main/res/drawable/ripple_light.xml create mode 100644 app/src/main/res/drawable/ripple_regular.xml create mode 100644 app/src/main/res/drawable/selectable_item_background.xml diff --git a/app/src/main/res/color/background_color_chip_state.xml b/app/src/main/res/color/background_color_chip_state.xml new file mode 100644 index 000000000..04f3cfb2d --- /dev/null +++ b/app/src/main/res/color/background_color_chip_state.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/reader_seekbar_ripple.xml b/app/src/main/res/drawable/reader_seekbar_ripple.xml index 69a3fbcf5..0c8c0e16b 100644 --- a/app/src/main/res/drawable/reader_seekbar_ripple.xml +++ b/app/src/main/res/drawable/reader_seekbar_ripple.xml @@ -1,6 +1,6 @@ + android:color="?attr/rippleColor"> diff --git a/app/src/main/res/drawable/ripple_dark.xml b/app/src/main/res/drawable/ripple_dark.xml new file mode 100644 index 000000000..26f690272 --- /dev/null +++ b/app/src/main/res/drawable/ripple_dark.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ripple_light.xml b/app/src/main/res/drawable/ripple_light.xml new file mode 100644 index 000000000..425e6e676 --- /dev/null +++ b/app/src/main/res/drawable/ripple_light.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ripple_regular.xml b/app/src/main/res/drawable/ripple_regular.xml new file mode 100644 index 000000000..6032d19cc --- /dev/null +++ b/app/src/main/res/drawable/ripple_regular.xml @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selectable_item_background.xml b/app/src/main/res/drawable/selectable_item_background.xml new file mode 100644 index 000000000..dbaebc325 --- /dev/null +++ b/app/src/main/res/drawable/selectable_item_background.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/chapter_download_view.xml b/app/src/main/res/layout/chapter_download_view.xml index f1bb020d9..201d665f5 100644 --- a/app/src/main/res/layout/chapter_download_view.xml +++ b/app/src/main/res/layout/chapter_download_view.xml @@ -5,7 +5,7 @@ android:layout_width="42dp" android:layout_height="42dp" android:padding="8dp" - android:background="?selectableItemBackgroundBorderless"> + android:background="@drawable/ripple_regular"> + android:background="@drawable/selectable_item_background"> diff --git a/app/src/main/res/layout/main_activity_toolbar.xml b/app/src/main/res/layout/main_activity_toolbar.xml index 47dedf572..2f7906791 100644 --- a/app/src/main/res/layout/main_activity_toolbar.xml +++ b/app/src/main/res/layout/main_activity_toolbar.xml @@ -19,7 +19,8 @@ android:id="@+id/tabs" style="@style/Theme.Widget.Tabs" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + app:tabRippleColor="?attr/rippleColor" /> @@ -154,6 +155,7 @@ android:text="@string/manga_tracking_tab" android:visibility="gone" app:icon="@drawable/ic_sync_24dp" + app:rippleColor="?attr/rippleColor" app:layout_constraintEnd_toStartOf="@+id/btn_webview" app:layout_constraintStart_toEndOf="@+id/btn_favorite" app:layout_constraintTop_toBottomOf="@+id/manga_info" @@ -168,6 +170,7 @@ android:text="@string/action_web_view" android:visibility="gone" app:icon="@drawable/ic_public_24dp" + app:rippleColor="?attr/rippleColor" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/btn_tracking" app:layout_constraintTop_toBottomOf="@+id/manga_info" diff --git a/app/src/main/res/layout/navigation_view_checkbox.xml b/app/src/main/res/layout/navigation_view_checkbox.xml index 2c36b7bf4..d1bd53190 100644 --- a/app/src/main/res/layout/navigation_view_checkbox.xml +++ b/app/src/main/res/layout/navigation_view_checkbox.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/layout/navigation_view_checkedtext.xml b/app/src/main/res/layout/navigation_view_checkedtext.xml index 51243946c..c625d96a7 100644 --- a/app/src/main/res/layout/navigation_view_checkedtext.xml +++ b/app/src/main/res/layout/navigation_view_checkedtext.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/layout/navigation_view_radio.xml b/app/src/main/res/layout/navigation_view_radio.xml index 7ac1d6687..0cbeff65a 100644 --- a/app/src/main/res/layout/navigation_view_radio.xml +++ b/app/src/main/res/layout/navigation_view_radio.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/layout/navigation_view_spinner.xml b/app/src/main/res/layout/navigation_view_spinner.xml index eea785cb6..e253f4dd0 100644 --- a/app/src/main/res/layout/navigation_view_spinner.xml +++ b/app/src/main/res/layout/navigation_view_spinner.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="?attr/listPreferredItemHeightSmall" - android:background="?attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:focusable="true" android:paddingStart="?attr/listPreferredItemPaddingStart" android:paddingEnd="?attr/listPreferredItemPaddingEnd"> diff --git a/app/src/main/res/layout/navigation_view_text.xml b/app/src/main/res/layout/navigation_view_text.xml index c9c8698c7..ca1e1d1ea 100644 --- a/app/src/main/res/layout/navigation_view_text.xml +++ b/app/src/main/res/layout/navigation_view_text.xml @@ -2,7 +2,7 @@ @@ -37,7 +37,7 @@ android:layout_height="56dp" android:clickable="true" android:focusable="true" - android:foreground="?attr/selectableItemBackground" + android:foreground="@drawable/selectable_item_background" android:gravity="center" android:paddingStart="16dp" android:paddingEnd="16dp"> @@ -63,7 +63,7 @@ android:layout_height="56dp" android:clickable="true" android:focusable="true" - android:foreground="?attr/selectableItemBackground" + android:foreground="@drawable/selectable_item_background" android:gravity="center" android:paddingStart="16dp" android:paddingEnd="16dp"> diff --git a/app/src/main/res/layout/settings_search_controller_card.xml b/app/src/main/res/layout/settings_search_controller_card.xml index 50dcf119b..33eb822f2 100644 --- a/app/src/main/res/layout/settings_search_controller_card.xml +++ b/app/src/main/res/layout/settings_search_controller_card.xml @@ -4,7 +4,7 @@ android:id="@+id/title_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:orientation="vertical" android:padding="16dp"> diff --git a/app/src/main/res/layout/source_main_controller_card_item.xml b/app/src/main/res/layout/source_main_controller_card_item.xml index e648403a1..5ea31cfc0 100644 --- a/app/src/main/res/layout/source_main_controller_card_item.xml +++ b/app/src/main/res/layout/source_main_controller_card_item.xml @@ -70,9 +70,9 @@ diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index f259e821c..b19eefd78 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -22,5 +22,6 @@ + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 2d914635b..1b768fa1f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -18,7 +18,8 @@ @color/md_black_1000_54 @color/md_black_1000_38 @color/md_black_1000_12 - @color/md_black_1000_12 + @color/md_black_1000_6 + @color/md_blue_A400_4 @color/md_grey_50 @color/md_white_1000 @color/md_blue_A400_38 @@ -29,7 +30,8 @@ @color/md_white_1000_70 @color/md_white_1000_50 @android:color/transparent - @color/md_white_1000_20 + @color/md_white_1000_6 + #0A3399FF @color/colorDarkPrimaryDark @color/colorDarkPrimary @color/md_blue_A200_50 @@ -47,6 +49,7 @@ #8A000000 #61000000 #1F000000 + #0F000000 #FFFFFFFF #B3FFFFFF @@ -54,6 +57,7 @@ #80FFFFFF #33FFFFFF #1FFFFFFF + #0FFFFFFF #000000 @@ -71,6 +75,7 @@ #2979FF #612979FF + #0A2979FF #263238 #37474F diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 419959c6e..7b158ea97 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -6,10 +6,14 @@ + + @@ -227,9 +231,13 @@ @@ -358,4 +366,16 @@ 15sp + + + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 24e31ed5a..4477d23f7 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -37,6 +37,7 @@ @color/textColorSecondaryDark @color/textColorHintDark @color/rippleColorLight + @color/rippleNavColorLight ?attr/colorAccent @color/dividerLight @@ -58,7 +59,7 @@ @drawable/ic_close_24dp @style/ThemeOverlay.MaterialComponents @style/Theme.Toolbar.Navigation - @style/PreferenceThemeOverlay + @style/PreferenceThemeLight @style/Theme.AlertDialog.Light @style/Theme.AlertDialog.Light @style/Theme.BottomSheet @@ -136,6 +137,7 @@ @color/textColorPrimaryLight @color/textColorSecondaryLight @color/textColorHintLight + @color/rippleNavColorDark @color/rippleColorDark ?attr/colorAccent @@ -152,10 +154,10 @@ @style/Theme.ActionMode @style/Theme.ActionMode.CloseButton @drawable/ic_close_24dp - @style/ThemeOverlay.MaterialComponents.Dark.ActionBar + @style/Theme.Toolbar.Custom @style/ThemeOverlay.MaterialComponents @style/Theme.Toolbar.Navigation - @style/PreferenceThemeOverlay + @style/PreferenceThemeDark @style/Theme.AlertDialog.Dark @style/Theme.AlertDialog.Dark @style/Theme.BottomSheet @@ -221,7 +223,7 @@ ?attr/colorPrimaryVariant ?attr/colorPrimaryVariant - @style/ThemeOverlay.MaterialComponents.Dark.ActionBar + @style/Theme.Toolbar.Custom @style/ThemeOverlay.MaterialComponents @style/Theme.Widget.BasicSwitch @style/Theme.BottomSheet @@ -237,7 +239,7 @@ ?attr/colorPrimaryVariant ?attr/colorPrimaryVariant - @style/ThemeOverlay.MaterialComponents.Dark.ActionBar + @style/Theme.Toolbar.Custom @style/ThemeOverlay.MaterialComponents @style/Theme.Widget.BasicSwitch @style/Theme.BottomSheet