diff --git a/app/src/main/java/eu/kanade/presentation/components/ChangeCategoryDialog.kt b/app/src/main/java/eu/kanade/presentation/components/ChangeCategoryDialog.kt index 8914458ce..3e05c3517 100644 --- a/app/src/main/java/eu/kanade/presentation/components/ChangeCategoryDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/ChangeCategoryDialog.kt @@ -1,8 +1,10 @@ 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.Spacer +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.AlertDialog import androidx.compose.material3.Checkbox @@ -85,27 +87,30 @@ fun ChangeCategoryDialog( text = { Column { selection.forEach { checkbox -> + val onChange: (CheckboxState) -> Unit = { + val index = selection.indexOf(it) + val mutableList = selection.toMutableList() + mutableList.removeAt(index) + mutableList.add(index, it.next()) + selection = mutableList.toList() + } Row( + modifier = Modifier + .fillMaxWidth() + .clickable { onChange(checkbox) }, verticalAlignment = Alignment.CenterVertically, ) { - val onCheckboxChange: (CheckboxState) -> Unit = { - val index = selection.indexOf(it) - val mutableList = selection.toMutableList() - mutableList.removeAt(index) - mutableList.add(index, it.next()) - selection = mutableList.toList() - } when (checkbox) { is CheckboxState.TriState -> { TriStateCheckbox( state = checkbox.asState(), - onClick = { onCheckboxChange(checkbox) }, + onClick = { onChange(checkbox) }, ) } is CheckboxState.State -> { Checkbox( checked = checkbox.isChecked, - onCheckedChange = { onCheckboxChange(checkbox) }, + onCheckedChange = { onChange(checkbox) }, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/components/DeleteLibraryMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/components/DeleteLibraryMangaDialog.kt index cc9a60e3c..7eb6ba168 100644 --- a/app/src/main/java/eu/kanade/presentation/components/DeleteLibraryMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/DeleteLibraryMangaDialog.kt @@ -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) + 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) - list = mutableList.toList() - }, + onCheckedChange = { onCheck() }, ) Text(text = stringResource(state.value)) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index ccc88f442..95be196e8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -13,6 +13,7 @@ import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.isLocal import eu.kanade.domain.manga.model.toDbManga import eu.kanade.presentation.components.ChangeCategoryDialog +import eu.kanade.presentation.components.DeleteLibraryMangaDialog import eu.kanade.presentation.library.LibraryScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.toDomainManga