|
@@ -15,14 +15,14 @@ import androidx.compose.ui.res.stringResource
|
|
|
import androidx.compose.ui.res.vectorResource
|
|
|
import eu.kanade.domain.manga.model.readingModeType
|
|
|
import eu.kanade.presentation.components.AdaptiveSheet
|
|
|
+import eu.kanade.presentation.theme.TachiyomiTheme
|
|
|
import eu.kanade.tachiyomi.R
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
|
|
import tachiyomi.presentation.core.components.SettingsIconGrid
|
|
|
import tachiyomi.presentation.core.components.material.IconToggleButton
|
|
|
import tachiyomi.presentation.core.components.material.padding
|
|
|
-
|
|
|
-private val readingModeOptions = ReadingModeType.entries.map { it.stringRes to it }
|
|
|
+import tachiyomi.presentation.core.util.ThemePreviews
|
|
|
|
|
|
@Composable
|
|
|
fun ReadingModeSelectDialog(
|
|
@@ -34,22 +34,46 @@ fun ReadingModeSelectDialog(
|
|
|
val readingMode = remember(manga) { ReadingModeType.fromPreference(manga?.readingModeType?.toInt()) }
|
|
|
|
|
|
AdaptiveSheet(onDismissRequest = onDismissRequest) {
|
|
|
- Box(modifier = Modifier.padding(vertical = MaterialTheme.padding.medium)) {
|
|
|
- SettingsIconGrid(R.string.pref_category_reading_mode) {
|
|
|
- items(readingModeOptions) { (stringRes, mode) ->
|
|
|
- IconToggleButton(
|
|
|
- checked = mode == readingMode,
|
|
|
- onCheckedChange = {
|
|
|
- screenModel.onChangeReadingMode(mode)
|
|
|
- onChange(stringRes)
|
|
|
- onDismissRequest()
|
|
|
- },
|
|
|
- modifier = Modifier.fillMaxWidth(),
|
|
|
- imageVector = ImageVector.vectorResource(mode.iconRes),
|
|
|
- title = stringResource(stringRes),
|
|
|
- )
|
|
|
- }
|
|
|
+ DialogContent(
|
|
|
+ readingMode = readingMode,
|
|
|
+ onChangeReadingMode = {
|
|
|
+ screenModel.onChangeReadingMode(it)
|
|
|
+ onChange(it.stringRes)
|
|
|
+ onDismissRequest()
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+private fun DialogContent(
|
|
|
+ readingMode: ReadingModeType,
|
|
|
+ onChangeReadingMode: (ReadingModeType) -> Unit,
|
|
|
+) {
|
|
|
+ Box(modifier = Modifier.padding(vertical = MaterialTheme.padding.medium)) {
|
|
|
+ SettingsIconGrid(R.string.pref_category_reading_mode) {
|
|
|
+ items(ReadingModeType.entries) { mode ->
|
|
|
+ IconToggleButton(
|
|
|
+ checked = mode == readingMode,
|
|
|
+ onCheckedChange = {
|
|
|
+ onChangeReadingMode(mode)
|
|
|
+ },
|
|
|
+ modifier = Modifier.fillMaxWidth(),
|
|
|
+ imageVector = ImageVector.vectorResource(mode.iconRes),
|
|
|
+ title = stringResource(mode.stringRes),
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+@ThemePreviews
|
|
|
+@Composable
|
|
|
+private fun DialogContentPreview() {
|
|
|
+ TachiyomiTheme {
|
|
|
+ DialogContent(
|
|
|
+ readingMode = ReadingModeType.DEFAULT,
|
|
|
+ onChangeReadingMode = {},
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|