mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-10-02 14:15:10 +02:00
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 <trungnguyen02@outlookcom>
This commit is contained in:
parent
44b055c019
commit
51d48bdde6
@ -63,9 +63,9 @@ class ThemesPreference @JvmOverloads constructor(context: Context, attrs: Attrib
|
|||||||
recycler?.let {
|
recycler?.let {
|
||||||
(it.layoutManager as LinearLayoutManager).apply {
|
(it.layoutManager as LinearLayoutManager).apply {
|
||||||
scrollToPositionWithOffset(
|
scrollToPositionWithOffset(
|
||||||
// 118dp is the width of the pref_theme_item layout
|
// 114dp is the width of the pref_theme_item layout
|
||||||
lX / 118.dpToPx,
|
lX / 114.dpToPx,
|
||||||
-lX % 118.dpToPx
|
-lX % 114.dpToPx
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
lastScrollPosition = it.computeHorizontalScrollOffset()
|
lastScrollPosition = it.computeHorizontalScrollOffset()
|
||||||
|
@ -49,7 +49,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
|
|||||||
inner class ThemeViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
inner class ThemeViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
|
|
||||||
private val selectedColor = view.context.getResourceColor(R.attr.colorAccent)
|
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) {
|
fun bind(appTheme: PreferenceValues.AppTheme) {
|
||||||
binding.name.text = view.context.getString(appTheme.titleResId!!)
|
binding.name.text = view.context.getString(appTheme.titleResId!!)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="118dp"
|
android:layout_width="114dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="4dp">
|
android:padding="4dp">
|
||||||
@ -15,102 +15,115 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
app:cardCornerRadius="@dimen/card_selector_radius"
|
app:cardCornerRadius="17dp"
|
||||||
app:contentPadding="4dp"
|
|
||||||
app:strokeColor="?attr/colorAccent"
|
app:strokeColor="?attr/colorAccent"
|
||||||
app:strokeWidth="4dp"
|
app:strokeWidth="4dp"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="176dp"
|
android:layout_height="170dp"
|
||||||
android:background="?android:attr/colorBackground">
|
android:background="?android:attr/colorBackground">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/top_nav"
|
android:id="@+id/top_nav"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="40dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/top_nav_text"
|
android:id="@+id/top_nav_text"
|
||||||
android:layout_width="64dp"
|
android:layout_width="54dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="17dp"
|
||||||
android:layout_marginStart="6dp"
|
android:layout_marginTop="5dp"
|
||||||
android:src="@drawable/oval"
|
android:layout_marginStart="12dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/top_nav"
|
app:layout_constraintBottom_toBottomOf="@+id/top_nav"
|
||||||
app:layout_constraintStart_toStartOf="@+id/top_nav"
|
app:layout_constraintStart_toStartOf="@+id/top_nav"
|
||||||
app:layout_constraintTop_toTopOf="@+id/top_nav"
|
app:layout_constraintTop_toTopOf="@+id/top_nav"
|
||||||
app:tint="?attr/colorOnSurface" />
|
app:cardBackgroundColor="?attr/colorOnSurface"
|
||||||
|
app:cardCornerRadius="4dp"/>
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/cover_container"
|
android:id="@+id/cover_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="6dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:src="@drawable/rounded_rectangle"
|
android:src="@drawable/rounded_rectangle"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/top_nav"
|
app:layout_constraintTop_toBottomOf="@+id/top_nav"
|
||||||
app:layout_constraintDimensionRatio="2:3"
|
app:layout_constraintDimensionRatio="2:2.7"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/center_guideline"
|
app:layout_constraintStart_toStartOf="@id/top_nav_text"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
app:tint="?android:attr/divider" />
|
app:cardBackgroundColor="?android:attr/divider"
|
||||||
|
app:cardElevation="0dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/badges"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:background="@drawable/rounded_rectangle"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/cover_container"
|
app:layout_constraintStart_toStartOf="@+id/cover_container"
|
||||||
app:layout_constraintTop_toTopOf="@+id/cover_container">
|
app:layout_constraintTop_toTopOf="@+id/cover_container"
|
||||||
|
app:cardCornerRadius="6dp">
|
||||||
|
|
||||||
<View
|
<LinearLayout
|
||||||
android:layout_width="12dp"
|
android:id="@+id/badges"
|
||||||
android:layout_height="16dp"
|
android:layout_width="wrap_content"
|
||||||
android:background="?attr/colorTertiary" />
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/rounded_rectangle">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="12dp"
|
android:layout_width="12dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:background="?attr/colorSecondary" />
|
android:background="?attr/colorTertiary" />
|
||||||
|
|
||||||
</LinearLayout>
|
<View
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:background="?attr/colorSecondary" />
|
||||||
|
|
||||||
<View
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/bottom_nav"
|
android:id="@+id/bottom_nav"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="40dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:cardCornerRadius="0dp">
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/bottom_nav_selected_item"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="16dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="16dp"
|
android:layout_marginBottom="2dp"
|
||||||
android:src="@drawable/oval"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="6dp"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/bottom_nav"
|
android:paddingHorizontal="12dp">
|
||||||
app:layout_constraintStart_toStartOf="@+id/bottom_nav"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/bottom_nav"
|
|
||||||
app:tint="?attr/colorPrimary" />
|
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/bottom_nav_unselected_item"
|
android:id="@+id/bottom_nav_selected_item"
|
||||||
android:layout_width="0dp"
|
android:layout_width="17dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="17dp"
|
||||||
android:src="@drawable/oval"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginHorizontal="6dp"
|
app:cardBackgroundColor="?attr/colorPrimary"
|
||||||
android:alpha="0.6"
|
app:cardCornerRadius="100dp"/>
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/bottom_nav"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<com.google.android.material.card.MaterialCardView
|
||||||
app:layout_constraintStart_toEndOf="@+id/bottom_nav_selected_item"
|
android:id="@+id/bottom_nav_unselected_item"
|
||||||
app:layout_constraintTop_toTopOf="@+id/bottom_nav"
|
android:layout_width="match_parent"
|
||||||
app:tint="?attr/colorOnSurface" />
|
android:layout_height="17dp"
|
||||||
|
android:src="@drawable/oval"
|
||||||
|
android:alpha="0.6"
|
||||||
|
app:cardBackgroundColor="?attr/colorOnSurface"
|
||||||
|
app:cardCornerRadius="4dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/center_guideline"
|
android:id="@+id/center_guideline"
|
||||||
|
Loading…
Reference in New Issue
Block a user