mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Cleanup general settings
This commit is contained in:
@@ -20,7 +20,6 @@ import ca.gosyer.ui.base.resources.stringResource
|
|||||||
import ca.gosyer.ui.base.vm.ViewModel
|
import ca.gosyer.ui.base.vm.ViewModel
|
||||||
import ca.gosyer.ui.base.vm.viewModel
|
import ca.gosyer.ui.base.vm.viewModel
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import ca.gosyer.util.lang.capitalize
|
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
@@ -42,25 +41,24 @@ class SettingsGeneralViewModel @Inject constructor(
|
|||||||
private val now: Instant = Instant.now()
|
private val now: Instant = Instant.now()
|
||||||
private val currentLocale = Locale.getDefault()
|
private val currentLocale = Locale.getDefault()
|
||||||
|
|
||||||
private fun getLocalePair(locale: String): Pair<String, String> {
|
fun getStartScreenChoices() = mapOf(
|
||||||
return locale to Locale.forLanguageTag(locale).getDisplayName(currentLocale)
|
StartScreen.Library to resources.getStringA("location_library"),
|
||||||
}
|
StartScreen.Sources to resources.getStringA("location_sources"),
|
||||||
|
StartScreen.Extensions to resources.getStringA("location_extensions")
|
||||||
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun getLanguageChoices(): Map<String, String> {
|
fun getLanguageChoices(): Map<String, String> = mapOf(
|
||||||
val currentLocaleDisplayName = currentLocale.getDisplayName(currentLocale).capitalize(currentLocale)
|
"" to resources.getString("language_system_default", currentLocale.getDisplayName(currentLocale))
|
||||||
|
) + listOf(
|
||||||
return mapOf(
|
"en",
|
||||||
"" to resources.getString("language_system_default", currentLocaleDisplayName),
|
"en-CA",
|
||||||
getLocalePair("en"),
|
"fa",
|
||||||
getLocalePair("en-CA"),
|
"hi",
|
||||||
getLocalePair("fa"),
|
"pt-BR",
|
||||||
getLocalePair("hi"),
|
"sv",
|
||||||
getLocalePair("pt-BR"),
|
"tam"
|
||||||
getLocalePair("sv"),
|
).associateWith { Locale.forLanguageTag(it).getDisplayName(currentLocale) }
|
||||||
getLocalePair("tam")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun getDateChoices(): Map<String, String> {
|
fun getDateChoices(): Map<String, String> {
|
||||||
@@ -92,11 +90,7 @@ fun SettingsGeneralScreen(navController: BackStack<Route>) {
|
|||||||
ChoicePreference(
|
ChoicePreference(
|
||||||
preference = vm.startScreen,
|
preference = vm.startScreen,
|
||||||
title = stringResource("start_screen"),
|
title = stringResource("start_screen"),
|
||||||
choices = mapOf(
|
choices = vm.getStartScreenChoices()
|
||||||
StartScreen.Library to stringResource("location_library"),
|
|
||||||
StartScreen.Sources to stringResource("location_sources"),
|
|
||||||
StartScreen.Extensions to stringResource("location_extensions"),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
|
|||||||
Reference in New Issue
Block a user