make the "+" layouts selectable with normal name

This commit is contained in:
Helium314 2025-02-20 16:18:19 +01:00
parent f7cf1762b5
commit d03801f22e
2 changed files with 4 additions and 3 deletions

View file

@ -16,9 +16,10 @@ object LayoutUtils {
return SubtypeSettings.getAllAvailableSubtypes()
.mapTo(HashSet()) { it.mainLayoutName()?.substringBefore("+") ?: "qwerty" }
.apply { addAll(context.resources.getStringArray(R.array.predefined_layouts)) }
val layouts = SubtypeSettings.getResourceSubtypesForLocale(locale).mapNotNullTo(mutableSetOf()) { it.mainLayoutName() }
if (locale.script() == ScriptUtils.SCRIPT_LATIN)
return context.resources.getStringArray(R.array.predefined_layouts).toList()
return SubtypeSettings.getResourceSubtypesForLocale(locale).mapNotNullTo(HashSet()) { it.mainLayoutName() }
layouts.addAll(context.resources.getStringArray(R.array.predefined_layouts))
return layouts
}
fun getLMainLayoutsForLocales(locales: List<Locale>, context: Context): Collection<String> =

View file

@ -66,12 +66,12 @@ import helium314.keyboard.settings.screens.GetIcon
import java.util.Locale
// todo:
// "+" layouts for languages that have one are not selectable, they should use the language name
// fix the display name (why is the layout always added now e.g. after adding a secondary locale, when it's not there initially?)
// some way of editing, adding and removing main layouts
// here or in layouts screen?
// layouts screen: that would be the purpose, but there is no default for main, and it's language dependent
// here we need at least an indicator which layouts are custom (edit or delete buttons)
// sometimes the layout is not enabled after changing something
@Composable
fun SubtypeDialog(
onDismissRequest: () -> Unit,