Change app excludes from switches to checkboxes

apparently this is closer to the material design specs:
https://m2.material.io/components/checkboxes#usage
This commit is contained in:
Torsten Grote 2024-05-20 13:25:08 -03:00
parent af15b4afdf
commit 16813395c7
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
3 changed files with 12 additions and 12 deletions

View file

@ -96,15 +96,15 @@ internal class AppStatusAdapter(private val toggleListener: AppStatusToggleListe
v.background = clickableBackground
if (editMode) {
v.setOnClickListener {
switchView.toggle()
item.enabled = switchView.isChecked
checkBox.toggle()
item.enabled = checkBox.isChecked
toggleListener.onAppStatusToggled(item)
}
appInfo.visibility = GONE
appStatus.visibility = INVISIBLE
progressBar.visibility = INVISIBLE
switchView.visibility = VISIBLE
switchView.isChecked = item.enabled
checkBox.visibility = VISIBLE
checkBox.isChecked = item.enabled
} else {
v.setOnClickListener(null)
v.setOnLongClickListener {
@ -130,7 +130,7 @@ internal class AppStatusAdapter(private val toggleListener: AppStatusToggleListe
}
appInfo.visibility = VISIBLE
}
switchView.visibility = INVISIBLE
checkBox.visibility = INVISIBLE
}
// show disabled items differently
showEnabled(item.enabled)

View file

@ -15,7 +15,7 @@ import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.switchmaterial.SwitchMaterial
import com.google.android.material.checkbox.MaterialCheckBox
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.ui.AppBackupState.FAILED
import com.stevesoltys.seedvault.ui.AppBackupState.IN_PROGRESS
@ -32,7 +32,7 @@ internal abstract class AppViewHolder(protected val v: View) : RecyclerView.View
protected val appInfo: TextView = v.requireViewById(R.id.appInfo)
protected val appStatus: ImageView = v.requireViewById(R.id.appStatus)
protected val progressBar: ProgressBar = v.requireViewById(R.id.progressBar)
protected val switchView: SwitchMaterial = v.requireViewById(R.id.switchView)
protected val checkBox: MaterialCheckBox = v.requireViewById(R.id.checkboxView)
init {
// don't use clickable background by default

View file

@ -8,9 +8,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginHorizontal="16dp"
android:background="?android:selectableItemBackground"
android:paddingHorizontal="24dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:screenReaderFocusable="true">
@ -35,7 +35,7 @@
android:layout_marginEnd="16dp"
android:textColor="?android:textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/appInfo"
app:layout_constraintEnd_toStartOf="@+id/switchView"
app:layout_constraintEnd_toStartOf="@+id/checkboxView"
app:layout_constraintStart_toEndOf="@+id/appIcon"
app:layout_constraintTop_toTopOf="parent"
tools:text="Seedvault Backup" />
@ -72,8 +72,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchView"
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/checkboxView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"