mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-27 03:27:51 +02:00
Further tweak migration config screen sheet
This commit is contained in:
@ -29,6 +29,8 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.util.fastForEach
|
||||
import eu.kanade.core.util.fastFilterNot
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.presentation.components.AdaptiveSheet
|
||||
import mihon.domain.migration.models.MigrationFlag
|
||||
@ -77,31 +79,32 @@ fun MigrationConfigScreenSheet(
|
||||
.padding(bottom = MaterialTheme.padding.extraSmall),
|
||||
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
|
||||
) {
|
||||
MigrationFlag.entries.forEach { flag ->
|
||||
if (flag == MigrationFlag.REMOVE_DOWNLOAD) return@forEach
|
||||
val selected = flag in migrationFlags
|
||||
FilterChip(
|
||||
selected = selected,
|
||||
onClick = {
|
||||
preferences.migrationFlags().getAndSet {
|
||||
if (selected) {
|
||||
it - flag
|
||||
} else {
|
||||
it + flag
|
||||
MigrationFlag.entries
|
||||
.fastFilterNot { it == MigrationFlag.REMOVE_DOWNLOAD }
|
||||
.fastForEach { flag ->
|
||||
val selected = flag in migrationFlags
|
||||
FilterChip(
|
||||
selected = selected,
|
||||
onClick = {
|
||||
preferences.migrationFlags().getAndSet { currentFlags ->
|
||||
if (flag in currentFlags) {
|
||||
currentFlags - flag
|
||||
} else {
|
||||
currentFlags + flag
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
label = { Text(stringResource(flag.getLabel())) },
|
||||
leadingIcon = {
|
||||
if (selected) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Check,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
label = { Text(stringResource(flag.getLabel())) },
|
||||
leadingIcon = {
|
||||
if (selected) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Check,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
val removeDownloads = MigrationFlag.REMOVE_DOWNLOAD in migrationFlags
|
||||
MigrationSheetSwitchItem(
|
||||
@ -123,9 +126,6 @@ fun MigrationConfigScreenSheet(
|
||||
value = extraSearchQuery,
|
||||
onValueChange = { extraSearchQuery = it },
|
||||
label = { Text(stringResource(MR.strings.migrationConfigScreen_additionalSearchQueryLabel)) },
|
||||
placeholder = {
|
||||
Text(stringResource(MR.strings.migrationConfigScreen_additionalSearchQueryPlaceholder))
|
||||
},
|
||||
supportingText = {
|
||||
Text(stringResource(MR.strings.migrationConfigScreen_additionalSearchQuerySupportingText))
|
||||
},
|
||||
@ -142,13 +142,13 @@ fun MigrationConfigScreenSheet(
|
||||
subtitle = null,
|
||||
preference = preferences.migrationHideUnmatched(),
|
||||
)
|
||||
MigrationSheetDividerItem()
|
||||
MigrationSheetWarningItem(stringResource(MR.strings.migrationConfigScreen_enhancedOptionsWarning))
|
||||
MigrationSheetSwitchItem(
|
||||
title = stringResource(MR.strings.migrationConfigScreen_hideWithoutUpdatesTitle),
|
||||
subtitle = stringResource(MR.strings.migrationConfigScreen_hideWithoutUpdatesSubtitle),
|
||||
preference = preferences.migrationHideWithoutUpdates(),
|
||||
)
|
||||
MigrationSheetDividerItem()
|
||||
MigrationSheetWarningItem(stringResource(MR.strings.migrationConfigScreen_enhancedOptionsWarning))
|
||||
MigrationSheetSwitchItem(
|
||||
title = stringResource(MR.strings.migrationConfigScreen_deepSearchModeTitle),
|
||||
subtitle = stringResource(MR.strings.migrationConfigScreen_deepSearchModeSubtitle),
|
||||
@ -156,13 +156,16 @@ fun MigrationConfigScreenSheet(
|
||||
)
|
||||
MigrationSheetSwitchItem(
|
||||
title = stringResource(MR.strings.migrationConfigScreen_prioritizeByChaptersTitle),
|
||||
subtitle = null,
|
||||
subtitle = stringResource(MR.strings.migrationConfigScreen_prioritizeByChaptersSubtitle),
|
||||
preference = preferences.migrationPrioritizeByChapters(),
|
||||
)
|
||||
}
|
||||
HorizontalDivider()
|
||||
Button(
|
||||
onClick = { onStartMigration(extraSearchQuery) },
|
||||
onClick = {
|
||||
val cleanedExtraSearchQuery = extraSearchQuery.trim().ifBlank { null }
|
||||
onStartMigration(cleanedExtraSearchQuery)
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
@ -182,11 +185,10 @@ private fun MigrationSheetSwitchItem(
|
||||
subtitle: String?,
|
||||
preference: Preference<Boolean>,
|
||||
) {
|
||||
val checked by preference.collectAsState()
|
||||
MigrationSheetSwitchItem(
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
checked = checked,
|
||||
checked = preference.collectAsState().value,
|
||||
onClick = { preference.toggle() },
|
||||
)
|
||||
}
|
||||
|
@ -1005,15 +1005,15 @@
|
||||
<string name="migrationConfigScreen.selectPinnedLabel">Select pinned sources</string>
|
||||
<string name="migrationConfigScreen.continueButtonText">Continue</string>
|
||||
<string name="migrationConfigScreen.dataToMigrateHeader">Data to migrate</string>
|
||||
<string name="migrationConfigScreen.removeDownloadsTitle">Delete downloads after migration</string>
|
||||
<string name="migrationConfigScreen.additionalSearchQueryLabel">Additional search keywords</string>
|
||||
<string name="migrationConfigScreen.additionalSearchQueryPlaceholder">e.g. language:english</string>
|
||||
<string name="migrationConfigScreen.additionalSearchQuerySupportingText">Appends keywords to the search query</string>
|
||||
<string name="migrationConfigScreen.hideUnmatchedTitle">Hide unmatched manga</string>
|
||||
<string name="migrationConfigScreen.enhancedOptionsWarning">Settings below can be slower and may lead to temporary source restrictions</string>
|
||||
<string name="migrationConfigScreen.hideWithoutUpdatesTitle">Hide if no new chapters</string>
|
||||
<string name="migrationConfigScreen.hideWithoutUpdatesSubtitle">Show only if the match offers newer chapters</string>
|
||||
<string name="migrationConfigScreen.deepSearchModeTitle">Deep search mode</string>
|
||||
<string name="migrationConfigScreen.deepSearchModeSubtitle">More detailed keyword search</string>
|
||||
<string name="migrationConfigScreen.prioritizeByChaptersTitle">Prioritize by newer chapters</string>
|
||||
<string name="migrationConfigScreen.removeDownloadsTitle">Delete downloads of current entry after migration</string>
|
||||
<string name="migrationConfigScreen.additionalSearchQueryLabel">Additional keywords (optional)</string>
|
||||
<string name="migrationConfigScreen.additionalSearchQuerySupportingText">Helps narrow down search results by adding additional keywords</string>
|
||||
<string name="migrationConfigScreen.hideUnmatchedTitle">Hide entries without a match</string>
|
||||
<string name="migrationConfigScreen.hideWithoutUpdatesTitle">Hide entries without newer chapters</string>
|
||||
<string name="migrationConfigScreen.hideWithoutUpdatesSubtitle">Only show entry if the match has additional chapters</string>
|
||||
<string name="migrationConfigScreen.enhancedOptionsWarning">These options are slow and dangerous and may lead to restrictions from sources</string>
|
||||
<string name="migrationConfigScreen.deepSearchModeTitle">Advanced search mode</string>
|
||||
<string name="migrationConfigScreen.deepSearchModeSubtitle">Breaks down the title into keywords for a wider search</string>
|
||||
<string name="migrationConfigScreen.prioritizeByChaptersTitle">Match based on chapter number</string>
|
||||
<string name="migrationConfigScreen.prioritizeByChaptersSubtitle">If enabled, chooses the match furthest ahead. Otherwise, picks the first match by source priority.</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user