fix editing "+" layouts, update todos

This commit is contained in:
Helium314 2025-02-19 23:56:02 +01:00
parent 35083e6515
commit e7acef5396
3 changed files with 6 additions and 8 deletions

View file

@ -110,7 +110,9 @@ data class SettingsSubtype(val locale: Locale, val extraValues: String) {
fun toAdditionalSubtype(): InputMethodSubtype? {
val asciiCapable = locale.script() == ScriptUtils.SCRIPT_LATIN
val subtype = SubtypeUtilsAdditional.createAdditionalSubtype(locale, extraValues, asciiCapable, true)
if (subtype.nameResId == SubtypeLocaleUtils.UNKNOWN_KEYBOARD_LAYOUT && !LayoutUtilsCustom.isCustomLayout(mainLayoutName() ?: SubtypeLocaleUtils.QWERTY)) {
if (subtype.nameResId == SubtypeLocaleUtils.UNKNOWN_KEYBOARD_LAYOUT
&& mainLayoutName()?.endsWith("+") != true // "+" layouts and custom layouts are always "unknown"
&& !LayoutUtilsCustom.isCustomLayout(mainLayoutName() ?: SubtypeLocaleUtils.QWERTY)) {
// Skip unknown keyboard layout subtype. This may happen when predefined keyboard
// layout has been removed.
Log.w(SettingsSubtype::class.simpleName, "unknown additional subtype $this")

View file

@ -66,10 +66,8 @@ import helium314.keyboard.settings.screens.GetIcon
import java.util.Locale
// todo:
// save when "editing" a resource subtypes is not working
// but really needs to, because e.g. a user may just want to add a secondary locale on swedish qwerty+
// settings upgrade to move the override settings to extra values, and actually use them (via getSelectedSubtype, not RichIMM)
// maybe hide some settings initially? list is long, any maybe e.g. more popups doesn't need to be subtype-dependent
// "+" 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?)
@Composable
fun SubtypeDialog(
onDismissRequest: () -> Unit,
@ -105,7 +103,7 @@ fun SubtypeDialog(
val appLayouts = LayoutUtils.getAvailableLayouts(LayoutType.MAIN, ctx, currentSubtype.locale)
val customLayouts = LayoutUtilsCustom.getLayoutFiles(LayoutType.MAIN, ctx, currentSubtype.locale).map { it.name }
DropDownField(
items = appLayouts + customLayouts, // todo: allow the "+" layouts for languages that have one
items = appLayouts + customLayouts,
selectedItem = currentSubtype.mainLayoutName() ?: "qwerty",
onSelected = {
currentSubtype = currentSubtype.withLayout(LayoutType.MAIN, it)

View file

@ -107,8 +107,6 @@ fun LanguageScreen(
SubtypeDialog(
onDismissRequest = { selectedSubtype = null },
onConfirmed = {
// todo: this does not work when "modifying" a resource subtype like German (Germany) or Danish (probably because of the + layout)
// maybe this also applied to upgrading
SubtypeUtilsAdditional.changeAdditionalSubtype(oldSubtype.toSettingsSubtype(), it, ctx)
sortedSubtypes = getSortedSubtypes(ctx)
},