Fix migrate options dialog not being selected when tapping text

This commit is contained in:
arkon 2022-12-05 15:12:16 -05:00
parent c88b79fa17
commit 843c9c7e57

View File

@ -1,7 +1,12 @@
package eu.kanade.tachiyomi.ui.browse.migration.search package eu.kanade.tachiyomi.ui.browse.migration.search
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Checkbox import androidx.compose.material3.Checkbox
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -130,12 +135,20 @@ fun MigrateDialog(
Text(text = stringResource(R.string.migration_dialog_what_to_include)) Text(text = stringResource(R.string.migration_dialog_what_to_include))
}, },
text = { text = {
Column { Column(
modifier = Modifier.verticalScroll(rememberScrollState()),
) {
items.forEachIndexed { index, title -> items.forEachIndexed { index, title ->
val onChange: () -> Unit = {
selected[index] = !selected[index]
}
Row( Row(
modifier = Modifier
.fillMaxWidth()
.clickable(onClick = onChange),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Checkbox(checked = selected[index], onCheckedChange = { selected[index] = !selected[index] }) Checkbox(checked = selected[index], onCheckedChange = { onChange() })
Text(text = title) Text(text = title)
} }
} }
@ -143,15 +156,13 @@ fun MigrateDialog(
}, },
confirmButton = { confirmButton = {
Row { Row {
TextButton( TextButton(onClick = {
modifier = Modifier.weight(1f), onClickTitle()
onClick = { onDismissRequest()
onClickTitle() },) {
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_show_manga)) Text(text = stringResource(R.string.action_show_manga))
} }
Spacer(modifier = Modifier.weight(1f))
TextButton(onClick = { TextButton(onClick = {
scope.launchIO { scope.launchIO {
screenModel.migrateManga(oldManga, newManga, false) screenModel.migrateManga(oldManga, newManga, false)