Highlight selected theme

This commit is contained in:
Lucas Lima 2020-08-18 00:16:15 -03:00
parent 9743e27403
commit f9fee40c70
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
2 changed files with 8 additions and 2 deletions

View file

@ -58,11 +58,18 @@ class ThemeAdapter(
val theme = themes[position]
val paintSettings = createAreaPaintSettings(holder.itemView.context, areaSize)
holder.itemView.run {
val selected = (theme.id == themeViewModel.singleState().current.id)
val areas = listOf(area0, area1, area2, area3, area4, area5, area6, area7, area8)
if (selected) {
areas.forEach { it.alpha = 0.25f }
} else {
areas.forEach { it.alpha = 1.0f }
}
areas.forEachIndexed { index, areaView -> areaView.bindTheme(minefield[index], theme, paintSettings) }
if (position < 2) {
if (position < 2 && !selected) {
areas.forEach { it.alpha = 0.35f }
label.apply {

View file

@ -11,7 +11,6 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:columnCount="3"
android:background="#FFFF0000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"