|
@@ -1,7 +1,9 @@
|
|
|
-package eu.kanade.tachiyomi.ui.library
|
|
|
+package eu.kanade.presentation.components
|
|
|
|
|
|
+import androidx.compose.foundation.clickable
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
import androidx.compose.material3.AlertDialog
|
|
|
import androidx.compose.material3.Checkbox
|
|
|
import androidx.compose.material3.Text
|
|
@@ -12,6 +14,7 @@ import androidx.compose.runtime.mutableStateOf
|
|
|
import androidx.compose.runtime.remember
|
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
+import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
import eu.kanade.core.prefs.CheckboxState
|
|
|
import eu.kanade.tachiyomi.R
|
|
@@ -58,16 +61,23 @@ fun DeleteLibraryMangaDialog(
|
|
|
text = {
|
|
|
Column {
|
|
|
list.forEach { state ->
|
|
|
- Row(verticalAlignment = Alignment.CenterVertically) {
|
|
|
+ val onCheck = {
|
|
|
+ val index = list.indexOf(state)
|
|
|
+ val mutableList = list.toMutableList()
|
|
|
+ mutableList.removeAt(index)
|
|
|
+ mutableList.add(index, state.next() as CheckboxState.State<Int>)
|
|
|
+ list = mutableList.toList()
|
|
|
+ }
|
|
|
+
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .clickable { onCheck() },
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ ) {
|
|
|
Checkbox(
|
|
|
checked = state.isChecked,
|
|
|
- onCheckedChange = {
|
|
|
- val index = list.indexOf(state)
|
|
|
- val mutableList = list.toMutableList()
|
|
|
- mutableList.removeAt(index)
|
|
|
- mutableList.add(index, state.next() as CheckboxState.State<Int>)
|
|
|
- list = mutableList.toList()
|
|
|
- },
|
|
|
+ onCheckedChange = { onCheck() },
|
|
|
)
|
|
|
Text(text = stringResource(state.value))
|
|
|
}
|