From 51d48bdde68a918b7ff43c7ac8dfc95ac92e2f56 Mon Sep 17 00:00:00 2001 From: CrepeTF <70870719+CrepeTF@users.noreply.github.com> Date: Sat, 12 Feb 2022 18:14:04 +0000 Subject: [PATCH] Update Theme Preview Items (#6628) * Improved theme preview items * Tweaked theme preference item border colours * Polished theme items * Update ThemesPreference.kt item layout width value Co-authored-by: CrepeTF --- .../widget/preference/ThemesPreference.kt | 6 +- .../preference/ThemesPreferenceAdapter.kt | 2 +- app/src/main/res/layout/pref_theme_item.xml | 125 ++++++++++-------- 3 files changed, 73 insertions(+), 60 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreference.kt index 836ba1359f..330a1fcb08 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreference.kt @@ -63,9 +63,9 @@ class ThemesPreference @JvmOverloads constructor(context: Context, attrs: Attrib recycler?.let { (it.layoutManager as LinearLayoutManager).apply { scrollToPositionWithOffset( - // 118dp is the width of the pref_theme_item layout - lX / 118.dpToPx, - -lX % 118.dpToPx + // 114dp is the width of the pref_theme_item layout + lX / 114.dpToPx, + -lX % 114.dpToPx ) } lastScrollPosition = it.computeHorizontalScrollOffset() diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt index 34f669cc9c..c505bab595 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt @@ -49,7 +49,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) : inner class ThemeViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { private val selectedColor = view.context.getResourceColor(R.attr.colorAccent) - private val unselectedColor = view.context.getResourceColor(android.R.attr.textColorHint) + private val unselectedColor = view.context.getResourceColor(android.R.attr.divider) fun bind(appTheme: PreferenceValues.AppTheme) { binding.name.text = view.context.getString(appTheme.titleResId!!) diff --git a/app/src/main/res/layout/pref_theme_item.xml b/app/src/main/res/layout/pref_theme_item.xml index 4a61de31c3..393790d8fe 100644 --- a/app/src/main/res/layout/pref_theme_item.xml +++ b/app/src/main/res/layout/pref_theme_item.xml @@ -2,7 +2,7 @@ @@ -15,102 +15,115 @@ android:clickable="true" android:focusable="true" android:importantForAccessibility="no" - app:cardCornerRadius="@dimen/card_selector_radius" - app:contentPadding="4dp" + app:cardCornerRadius="17dp" app:strokeColor="?attr/colorAccent" app:strokeWidth="4dp" app:cardElevation="0dp"> - + app:cardBackgroundColor="?attr/colorOnSurface" + app:cardCornerRadius="4dp"/> - + app:layout_constraintDimensionRatio="2:2.7" + app:layout_constraintStart_toStartOf="@id/top_nav_text" + app:layout_constraintEnd_toStartOf="@id/center_guideline" + app:cardBackgroundColor="?android:attr/divider" + app:cardElevation="0dp" /> - + app:layout_constraintTop_toTopOf="@+id/cover_container" + app:cardCornerRadius="6dp"> - + - + - + - + + + + + app:layout_constraintStart_toStartOf="parent" + app:cardCornerRadius="0dp"> - + - + + + + + + +