mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-23 07:39:11 +00:00
change subtype dialog to screen
mostly just moved the content and adjusted necessary calls still needs some minor tweaking
This commit is contained in:
parent
ac805a9286
commit
6bbce0b5ca
4 changed files with 145 additions and 135 deletions
|
@ -103,6 +103,7 @@ fun <T: Any?> SearchScreen(
|
||||||
title: @Composable () -> Unit,
|
title: @Composable () -> Unit,
|
||||||
filteredItems: (String) -> List<T>,
|
filteredItems: (String) -> List<T>,
|
||||||
itemContent: @Composable (T) -> Unit,
|
itemContent: @Composable (T) -> Unit,
|
||||||
|
icon: @Composable (() -> Unit)? = null,
|
||||||
menu: List<Pair<String, () -> Unit>>? = null,
|
menu: List<Pair<String, () -> Unit>>? = null,
|
||||||
content: @Composable (ColumnScope.() -> Unit)? = null,
|
content: @Composable (ColumnScope.() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
|
@ -137,8 +138,10 @@ fun <T: Any?> SearchScreen(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = { setShowSearch(!showSearch) })
|
if (icon == null)
|
||||||
{ SearchIcon() }
|
IconButton(onClick = { setShowSearch(!showSearch) }) { SearchIcon() }
|
||||||
|
else
|
||||||
|
icon()
|
||||||
if (menu != null)
|
if (menu != null)
|
||||||
Box {
|
Box {
|
||||||
var showMenu by remember { mutableStateOf(false) }
|
var showMenu by remember { mutableStateOf(false) }
|
||||||
|
|
|
@ -16,6 +16,7 @@ import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import helium314.keyboard.latin.common.LocaleUtils.constructLocale
|
import helium314.keyboard.latin.common.LocaleUtils.constructLocale
|
||||||
|
import helium314.keyboard.latin.settings.SettingsSubtype.Companion.toSettingsSubtype
|
||||||
import helium314.keyboard.settings.screens.AboutScreen
|
import helium314.keyboard.settings.screens.AboutScreen
|
||||||
import helium314.keyboard.settings.screens.AdvancedSettingsScreen
|
import helium314.keyboard.settings.screens.AdvancedSettingsScreen
|
||||||
import helium314.keyboard.settings.screens.AppearanceScreen
|
import helium314.keyboard.settings.screens.AppearanceScreen
|
||||||
|
@ -29,6 +30,7 @@ import helium314.keyboard.settings.screens.PersonalDictionariesScreen
|
||||||
import helium314.keyboard.settings.screens.PersonalDictionaryScreen
|
import helium314.keyboard.settings.screens.PersonalDictionaryScreen
|
||||||
import helium314.keyboard.settings.screens.PreferencesScreen
|
import helium314.keyboard.settings.screens.PreferencesScreen
|
||||||
import helium314.keyboard.settings.screens.SecondaryLayoutScreen
|
import helium314.keyboard.settings.screens.SecondaryLayoutScreen
|
||||||
|
import helium314.keyboard.settings.screens.SubtypeScreen
|
||||||
import helium314.keyboard.settings.screens.TextCorrectionScreen
|
import helium314.keyboard.settings.screens.TextCorrectionScreen
|
||||||
import helium314.keyboard.settings.screens.ToolbarScreen
|
import helium314.keyboard.settings.screens.ToolbarScreen
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -126,6 +128,9 @@ fun SettingsNavHost(
|
||||||
composable(SettingsDestination.ColorsNight + "{theme}") {
|
composable(SettingsDestination.ColorsNight + "{theme}") {
|
||||||
ColorsScreen(isNight = true, theme = it.arguments?.getString("theme"), onClickBack = ::goBack)
|
ColorsScreen(isNight = true, theme = it.arguments?.getString("theme"), onClickBack = ::goBack)
|
||||||
}
|
}
|
||||||
|
composable(SettingsDestination.Subtype + "{subtype}") {
|
||||||
|
SubtypeScreen(initialSubtype = it.arguments?.getString("subtype")!!.toSettingsSubtype(), onClickBack = ::goBack)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (target.value != SettingsDestination.Settings/* && target.value != navController.currentBackStackEntry?.destination?.route*/)
|
if (target.value != SettingsDestination.Settings/* && target.value != navController.currentBackStackEntry?.destination?.route*/)
|
||||||
navController.navigate(route = target.value)
|
navController.navigate(route = target.value)
|
||||||
|
@ -146,6 +151,7 @@ object SettingsDestination {
|
||||||
const val PersonalDictionaries = "personal_dictionaries"
|
const val PersonalDictionaries = "personal_dictionaries"
|
||||||
const val PersonalDictionary = "personal_dictionary/"
|
const val PersonalDictionary = "personal_dictionary/"
|
||||||
const val Languages = "languages"
|
const val Languages = "languages"
|
||||||
|
const val Subtype = "subtype/"
|
||||||
const val Layouts = "layouts"
|
const val Layouts = "layouts"
|
||||||
const val Dictionaries = "dictionaries"
|
const val Dictionaries = "dictionaries"
|
||||||
val navTarget = MutableStateFlow(Settings)
|
val navTarget = MutableStateFlow(Settings)
|
||||||
|
|
|
@ -18,7 +18,6 @@ import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -39,15 +38,14 @@ import helium314.keyboard.latin.utils.Log
|
||||||
import helium314.keyboard.latin.utils.MissingDictionaryDialog
|
import helium314.keyboard.latin.utils.MissingDictionaryDialog
|
||||||
import helium314.keyboard.latin.utils.SubtypeLocaleUtils
|
import helium314.keyboard.latin.utils.SubtypeLocaleUtils
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
import helium314.keyboard.latin.utils.SubtypeUtilsAdditional
|
|
||||||
import helium314.keyboard.latin.utils.displayName
|
import helium314.keyboard.latin.utils.displayName
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.locale
|
import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SearchScreen
|
import helium314.keyboard.settings.SearchScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.SettingsDestination
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.SubtypeDialog
|
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -57,12 +55,11 @@ fun LanguageScreen(
|
||||||
onClickBack: () -> Unit,
|
onClickBack: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
var sortedSubtypes by remember { mutableStateOf(getSortedSubtypes(ctx)) }
|
val sortedSubtypes by remember { mutableStateOf(getSortedSubtypes(ctx)) }
|
||||||
val prefs = ctx.prefs()
|
val prefs = ctx.prefs()
|
||||||
val b = (LocalContext.current.getActivity() as? SettingsActivity)?.prefChanged?.collectAsState()
|
val b = (LocalContext.current.getActivity() as? SettingsActivity)?.prefChanged?.collectAsState()
|
||||||
if ((b?.value ?: 0) < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
var selectedSubtype: String? by rememberSaveable { mutableStateOf(null) }
|
|
||||||
val enabledSubtypes = SubtypeSettings.getEnabledSubtypes()
|
val enabledSubtypes = SubtypeSettings.getEnabledSubtypes()
|
||||||
SearchScreen(
|
SearchScreen(
|
||||||
onClickBack = onClickBack,
|
onClickBack = onClickBack,
|
||||||
|
@ -87,7 +84,9 @@ fun LanguageScreen(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable { selectedSubtype = item.toSettingsSubtype().toPref() }
|
.clickable {
|
||||||
|
SettingsDestination.navigateTo(SettingsDestination.Subtype + item.toSettingsSubtype().toPref())
|
||||||
|
}
|
||||||
.padding(vertical = 6.dp, horizontal = 16.dp)
|
.padding(vertical = 6.dp, horizontal = 16.dp)
|
||||||
) {
|
) {
|
||||||
var showNoDictDialog by remember { mutableStateOf(false) }
|
var showNoDictDialog by remember { mutableStateOf(false) }
|
||||||
|
@ -119,19 +118,6 @@ fun LanguageScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (selectedSubtype != null) {
|
|
||||||
val oldSubtype = selectedSubtype!!.toSettingsSubtype()
|
|
||||||
SubtypeDialog(
|
|
||||||
onDismissRequest = {
|
|
||||||
selectedSubtype = null
|
|
||||||
sortedSubtypes = getSortedSubtypes(ctx)
|
|
||||||
},
|
|
||||||
onConfirmed = {
|
|
||||||
SubtypeUtilsAdditional.changeAdditionalSubtype(oldSubtype, it, ctx)
|
|
||||||
},
|
|
||||||
initialSubtype = oldSubtype
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dictsAvailable(locale: Locale, context: Context): Boolean {
|
private fun dictsAvailable(locale: Locale, context: Context): Boolean {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
package helium314.keyboard.settings.screens
|
||||||
package helium314.keyboard.settings.dialogs
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
@ -14,6 +13,7 @@ import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
|
@ -68,22 +68,32 @@ import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.mainLayoutName
|
import helium314.keyboard.latin.utils.mainLayoutName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.DefaultButton
|
import helium314.keyboard.settings.DefaultButton
|
||||||
|
import helium314.keyboard.settings.DeleteButton
|
||||||
import helium314.keyboard.settings.DropDownField
|
import helium314.keyboard.settings.DropDownField
|
||||||
|
import helium314.keyboard.settings.SearchScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.WithSmallTitle
|
import helium314.keyboard.settings.WithSmallTitle
|
||||||
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
|
import helium314.keyboard.settings.dialogs.LayoutEditDialog
|
||||||
|
import helium314.keyboard.settings.dialogs.ListPickerDialog
|
||||||
|
import helium314.keyboard.settings.dialogs.MultiListPickerDialog
|
||||||
|
import helium314.keyboard.settings.dialogs.ReorderDialog
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.layoutFilePicker
|
import helium314.keyboard.settings.layoutFilePicker
|
||||||
import helium314.keyboard.settings.layoutIntent
|
import helium314.keyboard.settings.layoutIntent
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.GetIcon
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
// todo:
|
||||||
|
// dropdowns are weird
|
||||||
|
// at very least too wide and too high
|
||||||
|
// also too wide left (anchor should be icon)
|
||||||
|
// title shows only the layout name
|
||||||
@Composable
|
@Composable
|
||||||
fun SubtypeDialog(
|
fun SubtypeScreen(
|
||||||
onDismissRequest: () -> Unit,
|
|
||||||
initialSubtype: SettingsSubtype,
|
initialSubtype: SettingsSubtype,
|
||||||
onConfirmed: (SettingsSubtype) -> Unit,
|
onClickBack: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val prefs = ctx.prefs()
|
val prefs = ctx.prefs()
|
||||||
|
@ -92,7 +102,10 @@ fun SubtypeDialog(
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
var currentSubtypeString by rememberSaveable { mutableStateOf(initialSubtype.toPref()) }
|
var currentSubtypeString by rememberSaveable { mutableStateOf(initialSubtype.toPref()) }
|
||||||
val currentSubtype = currentSubtypeString.toSettingsSubtype()
|
val currentSubtype = currentSubtypeString.toSettingsSubtype()
|
||||||
fun setCurrentSubtype(subtype: SettingsSubtype) { currentSubtypeString = subtype.toPref() }
|
fun setCurrentSubtype(subtype: SettingsSubtype) {
|
||||||
|
SubtypeUtilsAdditional.changeAdditionalSubtype(currentSubtype, subtype, ctx)
|
||||||
|
currentSubtypeString = subtype.toPref()
|
||||||
|
}
|
||||||
LaunchedEffect(currentSubtypeString) {
|
LaunchedEffect(currentSubtypeString) {
|
||||||
if (ScriptUtils.scriptSupportsUppercase(currentSubtype.locale)) return@LaunchedEffect
|
if (ScriptUtils.scriptSupportsUppercase(currentSubtype.locale)) return@LaunchedEffect
|
||||||
// update the noShiftKey extra value
|
// update the noShiftKey extra value
|
||||||
|
@ -120,25 +133,25 @@ fun SubtypeDialog(
|
||||||
var showMorePopupsDialog by remember { mutableStateOf(false) }
|
var showMorePopupsDialog by remember { mutableStateOf(false) }
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
val customMainLayouts = LayoutUtilsCustom.getLayoutFiles(LayoutType.MAIN, ctx, currentSubtype.locale).map { it.name }
|
val customMainLayouts = LayoutUtilsCustom.getLayoutFiles(LayoutType.MAIN, ctx, currentSubtype.locale).map { it.name }
|
||||||
ThreeButtonAlertDialog(
|
SearchScreen(
|
||||||
onDismissRequest = onDismissRequest,
|
onClickBack = onClickBack,
|
||||||
onConfirmed = { onConfirmed(currentSubtype) },
|
icon = { if (currentSubtype.isAdditionalSubtype(prefs)) DeleteButton {
|
||||||
neutralButtonText = if (initialSubtype.isAdditionalSubtype(prefs)) stringResource(R.string.delete) else null,
|
SubtypeUtilsAdditional.removeAdditionalSubtype(ctx, currentSubtype.toAdditionalSubtype())
|
||||||
onNeutral = {
|
SubtypeSettings.removeEnabledSubtype(ctx, currentSubtype.toAdditionalSubtype())
|
||||||
SubtypeUtilsAdditional.removeAdditionalSubtype(ctx, initialSubtype.toAdditionalSubtype())
|
onClickBack()
|
||||||
SubtypeSettings.removeEnabledSubtype(ctx, initialSubtype.toAdditionalSubtype())
|
} },
|
||||||
onDismissRequest()
|
|
||||||
},
|
|
||||||
title = {
|
title = {
|
||||||
val mainLayout = initialSubtype.mainLayoutName() ?: SubtypeLocaleUtils.QWERTY
|
val mainLayout = currentSubtype.mainLayoutName() ?: SubtypeLocaleUtils.QWERTY
|
||||||
Text(SubtypeLocaleUtils.getDisplayNameInSystemLocale(mainLayout, initialSubtype.locale))
|
Text(SubtypeLocaleUtils.getDisplayNameInSystemLocale(mainLayout, currentSubtype.locale))
|
||||||
},
|
},
|
||||||
content = {
|
itemContent = { },
|
||||||
|
filteredItems = { emptyList<String>() }
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.verticalScroll(scrollState),
|
modifier = Modifier.verticalScroll(scrollState).padding(horizontal = 12.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
MainLayoutRow(initialSubtype, currentSubtype, customMainLayouts) { setCurrentSubtype(it) }
|
MainLayoutRow(currentSubtype, customMainLayouts) { setCurrentSubtype(it) }
|
||||||
if (availableLocalesForScript.size > 1) {
|
if (availableLocalesForScript.size > 1) {
|
||||||
WithSmallTitle(stringResource(R.string.secondary_locale)) {
|
WithSmallTitle(stringResource(R.string.secondary_locale)) {
|
||||||
TextButton(onClick = { showSecondaryLocaleDialog = true }) {
|
TextButton(onClick = { showSecondaryLocaleDialog = true }) {
|
||||||
|
@ -233,7 +246,6 @@ fun SubtypeDialog(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
|
||||||
if (showSecondaryLocaleDialog)
|
if (showSecondaryLocaleDialog)
|
||||||
MultiListPickerDialog(
|
MultiListPickerDialog(
|
||||||
onDismissRequest = { showSecondaryLocaleDialog = false },
|
onDismissRequest = { showSecondaryLocaleDialog = false },
|
||||||
|
@ -294,6 +306,7 @@ fun SubtypeDialog(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// from ReorderSwitchPreference
|
// from ReorderSwitchPreference
|
||||||
@Composable
|
@Composable
|
||||||
private fun PopupOrderDialog(
|
private fun PopupOrderDialog(
|
||||||
|
@ -336,7 +349,6 @@ private fun PopupOrderDialog(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MainLayoutRow(
|
private fun MainLayoutRow(
|
||||||
initialSubtype: SettingsSubtype,
|
|
||||||
currentSubtype: SettingsSubtype,
|
currentSubtype: SettingsSubtype,
|
||||||
customLayouts: List<String>,
|
customLayouts: List<String>,
|
||||||
setCurrentSubtype: (SettingsSubtype) -> Unit,
|
setCurrentSubtype: (SettingsSubtype) -> Unit,
|
||||||
|
@ -369,13 +381,13 @@ private fun MainLayoutRow(
|
||||||
Text(SubtypeLocaleUtils.getDisplayNameInSystemLocale(it, currentSubtype.locale))
|
Text(SubtypeLocaleUtils.getDisplayNameInSystemLocale(it, currentSubtype.locale))
|
||||||
Row (verticalAlignment = Alignment.CenterVertically) {
|
Row (verticalAlignment = Alignment.CenterVertically) {
|
||||||
Icon(painterResource(R.drawable.ic_edit), stringResource(R.string.edit_layout), Modifier.clickable { showLayoutEditDialog = it to null })
|
Icon(painterResource(R.drawable.ic_edit), stringResource(R.string.edit_layout), Modifier.clickable { showLayoutEditDialog = it to null })
|
||||||
if (it in customLayouts && initialSubtype.mainLayoutName() != it) // don't allow current main layout
|
if (it in customLayouts && currentSubtype.mainLayoutName() != it) // don't allow current main layout // todo: this was initialSubtype, maybe needs adjustment now
|
||||||
Icon(painterResource(R.drawable.ic_bin), stringResource(R.string.delete), Modifier.clickable { showLayoutDeleteDialog = true })
|
Icon(painterResource(R.drawable.ic_bin), stringResource(R.string.delete), Modifier.clickable { showLayoutDeleteDialog = true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (showLayoutDeleteDialog) {
|
if (showLayoutDeleteDialog) {
|
||||||
val others = SubtypeSettings.getAdditionalSubtypes().filter { st -> st.mainLayoutName() == it }
|
val others = SubtypeSettings.getAdditionalSubtypes().filter { st -> st.mainLayoutName() == it }
|
||||||
.any { it.toSettingsSubtype() != initialSubtype }
|
.any { it.toSettingsSubtype() != currentSubtype } // todo: this was initialSubtype, maybe needs adjustment now
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
onDismissRequest = { showLayoutDeleteDialog = false },
|
onDismissRequest = { showLayoutDeleteDialog = false },
|
||||||
confirmButtonText = stringResource(R.string.delete),
|
confirmButtonText = stringResource(R.string.delete),
|
||||||
|
@ -442,11 +454,14 @@ private fun MainLayoutRow(
|
||||||
private fun getAvailableSecondaryLocales(context: Context, mainLocale: Locale): List<Locale> =
|
private fun getAvailableSecondaryLocales(context: Context, mainLocale: Locale): List<Locale> =
|
||||||
getDictionaryLocales(context).filter { it != mainLocale && it.script() == mainLocale.script() }
|
getDictionaryLocales(context).filter { it != mainLocale && it.script() == mainLocale.script() }
|
||||||
|
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
initPreview(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
Theme(previewDark) {
|
Theme(previewDark) {
|
||||||
SubtypeDialog({}, SettingsSubtype(Locale.ENGLISH, "")) { }
|
Surface {
|
||||||
|
SubtypeScreen(SettingsSubtype(Locale.ENGLISH, "")) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue