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:
CrepeTF
2022-02-12 18:14:04 +00:00
committed by GitHub
parent 44b055c019
commit 51d48bdde6
3 changed files with 73 additions and 60 deletions

View File

@ -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()

View File

@ -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!!)