From 7d0ea614daa52fa0d1f18977f6c0b072f8de3bb6 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 11 Mar 2020 19:08:57 -0400 Subject: [PATCH] Migrate to MaterialComponents themes --- .../ui/catalogue/CatalogueAdapter.kt | 2 +- .../ui/extension/ExtensionAdapter.kt | 2 +- .../tachiyomi/ui/migration/SourceAdapter.kt | 2 +- .../preference/LoginDialogPreference.kt | 2 +- .../preference/SwitchPreferenceCategory.kt | 3 - .../widget/preference/TrackLoginDialog.kt | 2 +- .../res/drawable/bottom_nav_item_selector.xml | 8 -- .../res/drawable/button_bg_transparent.xml | 10 +-- ...line_divider_dark.xml => line_divider.xml} | 4 +- .../main/res/drawable/line_divider_light.xml | 11 --- ...lector_dark.xml => list_item_selector.xml} | 8 +- .../drawable/list_item_selector_amoled.xml | 19 ----- .../res/drawable/list_item_selector_light.xml | 19 ----- app/src/main/res/drawable/sc_book_48dp.xml | 4 +- app/src/main/res/drawable/sc_explore_48dp.xml | 4 +- app/src/main/res/drawable/sc_history_48dp.xml | 2 +- .../res/drawable/sc_new_releases_48dp.xml | 2 +- .../layout-land/reader_color_filter_sheet.xml | 2 +- ...gue_global_search_controller_card_item.xml | 2 +- .../main/res/layout/catalogue_grid_item.xml | 4 +- .../main/res/layout/catalogue_list_item.xml | 2 +- .../catalogue_main_controller_card_item.xml | 2 +- app/src/main/res/layout/categories_item.xml | 2 +- app/src/main/res/layout/chapters_item.xml | 2 +- .../res/layout/download_custom_amount.xml | 8 +- .../main/res/layout/extension_card_item.xml | 2 +- app/src/main/res/layout/history_item.xml | 1 - app/src/main/res/layout/main_activity.xml | 8 +- .../main/res/layout/navigation_view_text.xml | 7 +- .../main/res/layout/pref_account_login.xml | 37 +++++---- .../main/res/layout/reader_color_filter.xml | 6 +- .../res/layout/reader_color_filter_sheet.xml | 2 +- app/src/main/res/layout/reader_page_sheet.xml | 2 +- .../main/res/layout/reader_settings_sheet.xml | 54 ++++++------- app/src/main/res/layout/track_item.xml | 6 +- .../main/res/layout/track_search_dialog.xml | 2 +- app/src/main/res/layout/track_search_item.xml | 3 +- app/src/main/res/layout/updates_item.xml | 2 +- app/src/main/res/values/attrs.xml | 5 -- app/src/main/res/values/colors.xml | 9 +-- app/src/main/res/values/styles.xml | 62 +++++++-------- app/src/main/res/values/themes.xml | 78 +++++++++++-------- 42 files changed, 174 insertions(+), 240 deletions(-) delete mode 100644 app/src/main/res/drawable/bottom_nav_item_selector.xml rename app/src/main/res/drawable/{line_divider_dark.xml => line_divider.xml} (77%) delete mode 100644 app/src/main/res/drawable/line_divider_light.xml rename app/src/main/res/drawable/{list_item_selector_dark.xml => list_item_selector.xml} (60%) delete mode 100644 app/src/main/res/drawable/list_item_selector_amoled.xml delete mode 100644 app/src/main/res/drawable/list_item_selector_light.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt index ca7822878..2c9ac946c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor class CatalogueAdapter(val controller: CatalogueController) : FlexibleAdapter>(null, controller, true) { - val cardBackground = controller.activity!!.getResourceColor(R.attr.background_card) + val cardBackground = controller.activity!!.getResourceColor(R.attr.colorSurface) init { setDisplayHeadersAtStartUp(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionAdapter.kt index f8b1f5671..7c071dbd7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionAdapter.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor class ExtensionAdapter(val controller: ExtensionController) : FlexibleAdapter>(null, controller, true) { - val cardBackground = controller.activity!!.getResourceColor(R.attr.background_card) + val cardBackground = controller.activity!!.getResourceColor(R.attr.colorSurface) init { setDisplayHeadersAtStartUp(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceAdapter.kt index 8aa6ed757..22af8dd0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceAdapter.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor class SourceAdapter(val controller: MigrationController) : FlexibleAdapter>(null, controller, true) { - val cardBackground = controller.activity!!.getResourceColor(R.attr.background_card) + val cardBackground = controller.activity!!.getResourceColor(R.attr.colorSurface) private var items: List>? = null diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt index 5abb672e1..c3e836ca8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt @@ -50,7 +50,7 @@ abstract class LoginDialogPreference(private val usernameLabel: String? = null, } if (!usernameLabel.isNullOrEmpty()) { - username_label.text = usernameLabel + username_label.hint = usernameLabel } login.setMode(ActionProcessButton.Mode.ENDLESS) diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt index e5f759581..92ee4f096 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt @@ -1,9 +1,7 @@ package eu.kanade.tachiyomi.widget.preference -import android.annotation.TargetApi import android.content.Context import android.content.res.TypedArray -import android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH import android.util.AttributeSet import android.view.View import android.widget.Checkable @@ -41,7 +39,6 @@ class SwitchPreferenceCategory @JvmOverloads constructor( syncSwitchView(switchView) } - @TargetApi(ICE_CREAM_SANDWICH) private fun syncSwitchView(view: View) { if (view is Checkable) { val isChecked = view.isChecked diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt index 0dacbfe83..75dbf10c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt @@ -35,7 +35,7 @@ class TrackLoginDialog(usernameLabel: String? = null, bundle: Bundle? = null) : requestSubscription?.unsubscribe() v?.apply { - if (username.text.isEmpty() || password.text.isEmpty()) + if (username.text.isNullOrEmpty() || password.text.isNullOrEmpty()) return login.progress = 1 diff --git a/app/src/main/res/drawable/bottom_nav_item_selector.xml b/app/src/main/res/drawable/bottom_nav_item_selector.xml deleted file mode 100644 index a4b1bce02..000000000 --- a/app/src/main/res/drawable/bottom_nav_item_selector.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/drawable/button_bg_transparent.xml b/app/src/main/res/drawable/button_bg_transparent.xml index 84577aa47..d7924bf40 100644 --- a/app/src/main/res/drawable/button_bg_transparent.xml +++ b/app/src/main/res/drawable/button_bg_transparent.xml @@ -3,7 +3,7 @@ - + @@ -15,12 +15,12 @@ - - + + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/line_divider_dark.xml b/app/src/main/res/drawable/line_divider.xml similarity index 77% rename from app/src/main/res/drawable/line_divider_dark.xml rename to app/src/main/res/drawable/line_divider.xml index 3d8da577a..454cad4bd 100644 --- a/app/src/main/res/drawable/line_divider_dark.xml +++ b/app/src/main/res/drawable/line_divider.xml @@ -6,6 +6,6 @@ android:width="1dp" android:height="1dp" /> - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/line_divider_light.xml b/app/src/main/res/drawable/line_divider_light.xml deleted file mode 100644 index eca76daba..000000000 --- a/app/src/main/res/drawable/line_divider_light.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/list_item_selector_dark.xml b/app/src/main/res/drawable/list_item_selector.xml similarity index 60% rename from app/src/main/res/drawable/list_item_selector_dark.xml rename to app/src/main/res/drawable/list_item_selector.xml index 5b08a69f7..1e2592665 100644 --- a/app/src/main/res/drawable/list_item_selector_dark.xml +++ b/app/src/main/res/drawable/list_item_selector.xml @@ -1,18 +1,18 @@ + android:color="?attr/rippleColor"> - + - + - + diff --git a/app/src/main/res/drawable/list_item_selector_amoled.xml b/app/src/main/res/drawable/list_item_selector_amoled.xml deleted file mode 100644 index f3a9c3e06..000000000 --- a/app/src/main/res/drawable/list_item_selector_amoled.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/list_item_selector_light.xml b/app/src/main/res/drawable/list_item_selector_light.xml deleted file mode 100644 index 3fa9224b9..000000000 --- a/app/src/main/res/drawable/list_item_selector_light.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/sc_book_48dp.xml b/app/src/main/res/drawable/sc_book_48dp.xml index 35c7a7c2f..cea55b9a2 100644 --- a/app/src/main/res/drawable/sc_book_48dp.xml +++ b/app/src/main/res/drawable/sc_book_48dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="48"> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/sc_explore_48dp.xml b/app/src/main/res/drawable/sc_explore_48dp.xml index 1489806c8..911db2d81 100644 --- a/app/src/main/res/drawable/sc_explore_48dp.xml +++ b/app/src/main/res/drawable/sc_explore_48dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="48"> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/sc_history_48dp.xml b/app/src/main/res/drawable/sc_history_48dp.xml index 9a1d531c9..76d656f30 100644 --- a/app/src/main/res/drawable/sc_history_48dp.xml +++ b/app/src/main/res/drawable/sc_history_48dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="48"> diff --git a/app/src/main/res/layout/catalogue_global_search_controller_card_item.xml b/app/src/main/res/layout/catalogue_global_search_controller_card_item.xml index f78bb13f4..d15b5b91e 100644 --- a/app/src/main/res/layout/catalogue_global_search_controller_card_item.xml +++ b/app/src/main/res/layout/catalogue_global_search_controller_card_item.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" android:orientation="vertical" android:paddingStart="4dp" android:paddingTop="8dp" diff --git a/app/src/main/res/layout/catalogue_grid_item.xml b/app/src/main/res/layout/catalogue_grid_item.xml index 630d1cee0..bbdf1e8c2 100644 --- a/app/src/main/res/layout/catalogue_grid_item.xml +++ b/app/src/main/res/layout/catalogue_grid_item.xml @@ -16,8 +16,8 @@ android:id="@+id/thumbnail" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/colorBackground" - tools:background="?android:attr/colorBackground" + android:background="?attr/colorSurface" + tools:background="?attr/colorSurface" tools:ignore="ContentDescription" tools:src="@mipmap/ic_launcher" /> diff --git a/app/src/main/res/layout/catalogue_list_item.xml b/app/src/main/res/layout/catalogue_list_item.xml index 66d717b8f..cdf5fe2ba 100644 --- a/app/src/main/res/layout/catalogue_list_item.xml +++ b/app/src/main/res/layout/catalogue_list_item.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height" android:layout_gravity="center_vertical" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="25dp"> diff --git a/app/src/main/res/layout/catalogue_main_controller_card_item.xml b/app/src/main/res/layout/catalogue_main_controller_card_item.xml index 672abf30c..35f66ce13 100644 --- a/app/src/main/res/layout/catalogue_main_controller_card_item.xml +++ b/app/src/main/res/layout/catalogue_main_controller_card_item.xml @@ -9,7 +9,7 @@ android:id="@+id/card" android:layout_width="match_parent" android:layout_height="@dimen/material_component_lists_two_line_height" - android:background="?attr/selectable_list_drawable"> + android:background="@drawable/list_item_selector"> + android:background="@drawable/list_item_selector"> diff --git a/app/src/main/res/layout/download_custom_amount.xml b/app/src/main/res/layout/download_custom_amount.xml index 7e41e7dc6..b4368204e 100644 --- a/app/src/main/res/layout/download_custom_amount.xml +++ b/app/src/main/res/layout/download_custom_amount.xml @@ -10,7 +10,7 @@ android:id="@+id/btn_decrease_10" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="?selectable_list_drawable" + android:background="@drawable/list_item_selector" android:padding="8dp" android:tint="?colorAccent" app:srcCompat="@drawable/ic_chevron_left_double_black_24dp" /> @@ -19,7 +19,7 @@ android:id="@+id/btn_decrease" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="?selectable_list_drawable" + android:background="@drawable/list_item_selector" android:padding="8dp" android:tint="?colorAccent" app:srcCompat="@drawable/ic_chevron_left_black_24dp" /> @@ -37,7 +37,7 @@ android:id="@+id/btn_increase" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="?selectable_list_drawable" + android:background="@drawable/list_item_selector" android:padding="8dp" android:tint="?colorAccent" app:srcCompat="@drawable/ic_chevron_right_black_24dp" /> @@ -46,7 +46,7 @@ android:id="@+id/btn_increase_10" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="?selectable_list_drawable" + android:background="@drawable/list_item_selector" android:padding="8dp" android:tint="?colorAccent" app:srcCompat="@drawable/ic_chevron_right_double_black_24dp" /> diff --git a/app/src/main/res/layout/extension_card_item.xml b/app/src/main/res/layout/extension_card_item.xml index 0370cd1a0..beebc90c0 100644 --- a/app/src/main/res/layout/extension_card_item.xml +++ b/app/src/main/res/layout/extension_card_item.xml @@ -9,7 +9,7 @@ android:id="@+id/card" android:layout_width="match_parent" android:layout_height="64dp" - android:background="?attr/selectable_list_drawable"> + android:background="@drawable/list_item_selector"> diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index 5ebd768f1..c7820fced 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -25,11 +25,10 @@ @@ -44,12 +43,11 @@ diff --git a/app/src/main/res/layout/navigation_view_text.xml b/app/src/main/res/layout/navigation_view_text.xml index 23432d98d..87bbc2776 100644 --- a/app/src/main/res/layout/navigation_view_text.xml +++ b/app/src/main/res/layout/navigation_view_text.xml @@ -1,7 +1,7 @@ + android:background="?android:attr/divider" /> - + android:hint="@string/username"> - + - + + + android:hint="@string/password"> - + + + - - - @@ -31,7 +31,7 @@ app:layout_constraintStart_toEndOf="@id/general_prefs" app:layout_constraintTop_toTopOf="@id/general_prefs" /> - - - - - - - - - - - @@ -249,20 +242,19 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/end_general_preferences" /> - - diff --git a/app/src/main/res/layout/track_item.xml b/app/src/main/res/layout/track_item.xml index da7d9d1b1..673e20d8d 100644 --- a/app/src/main/res/layout/track_item.xml +++ b/app/src/main/res/layout/track_item.xml @@ -51,7 +51,7 @@ android:id="@+id/status_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" android:clickable="true" android:focusable="true" android:orientation="horizontal" @@ -104,7 +104,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" android:clickable="true" android:focusable="true" android:orientation="horizontal" @@ -132,7 +132,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" android:clickable="true" android:focusable="true" android:orientation="horizontal" diff --git a/app/src/main/res/layout/track_search_dialog.xml b/app/src/main/res/layout/track_search_dialog.xml index c6aff5cf9..c2ecc59ad 100644 --- a/app/src/main/res/layout/track_search_dialog.xml +++ b/app/src/main/res/layout/track_search_dialog.xml @@ -42,7 +42,7 @@ android:dividerHeight="10dp" android:footerDividersEnabled="true" android:headerDividersEnabled="true" - android:listSelector="?attr/selectable_list_drawable" + android:listSelector="@drawable/list_item_selector" android:paddingTop="4dp" android:paddingBottom="4dp" android:scrollbars="none" diff --git a/app/src/main/res/layout/track_search_item.xml b/app/src/main/res/layout/track_search_item.xml index ec9d87e6b..916dc5e29 100644 --- a/app/src/main/res/layout/track_search_item.xml +++ b/app/src/main/res/layout/track_search_item.xml @@ -2,7 +2,6 @@ @@ -10,7 +9,7 @@ android:id="@+id/linearLayout" android:layout_width="match_parent" android:layout_height="216dp" - android:background="?attr/selectable_list_drawable" + android:background="@drawable/list_item_selector" android:orientation="horizontal"> + android:background="@drawable/list_item_selector"> - - - - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 53d3d89dc..ad5c6cecd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,6 +3,7 @@ #54759E #435E7E + #212121 #1C1C1D @@ -17,12 +18,9 @@ @color/md_black_1000_38 @color/md_black_1000_12 @color/md_black_1000_12 - @color/md_grey_50 @color/md_white_1000 - @color/md_blue_A400_38 - @color/md_black_1000_54 #3399FF @@ -31,14 +29,9 @@ @color/md_white_1000_50 @android:color/transparent @color/md_white_1000_20- - - @color/md_black_1000 - @color/md_grey_900 @color/colorDarkPrimaryDark @color/colorDarkPrimary - @color/md_blue_A200_50 - @color/md_white_1000_54 @color/colorDarkPrimary diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f268632c1..cc379cf2e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -4,38 +4,36 @@ - - - - - + + - - - @@ -125,7 +123,7 @@ @@ -185,26 +182,30 @@ - - - - - @@ -212,7 +213,7 @@ - @@ -234,7 +235,7 @@ @style/ThemeOverlay.AppCompat.Dark.ActionBar - + - diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 0ad8b28da..8282c4aa6 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -9,38 +9,48 @@ - @@ -55,20 +65,28 @@ - -