add / to symbols layout and adjust functional key layouts for symbols layouts

i remember this was requested, can't find the issue though
anyway, now with fully customizable layouts this is not blocked by "people might be used to this" any more
This commit is contained in:
Helium314 2024-05-22 22:55:52 +02:00
parent 0459971e3a
commit bd7461f628
10 changed files with 15 additions and 28 deletions

View file

@ -218,31 +218,11 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
)
baseKeys.removeLast()
}
// add those extra keys depending on layout (remove later)
val spaceIndex = functionalKeysBottom.indexOfFirst { it.label == KeyLabel.SPACE && it.width <= 0 } // 0 or -1
// add zwnj key next to space if necessary
val spaceIndex = functionalKeysBottom.indexOfFirst { it.label == KeyLabel.SPACE && it.width <= 0 } // width could be 0 or -1
if (spaceIndex >= 0) {
if (params.mLocaleKeyboardInfos.hasZwnjKey && params.mId.isAlphabetKeyboard) {
// add zwnj key next to space
functionalKeysBottom.add(spaceIndex + 1, TextKeyData(label = KeyLabel.ZWNJ))
} else if (params.mId.mElementId == KeyboardId.ELEMENT_SYMBOLS) {
// add / key next to space, todo (later): not any more, but keep it so this PR can be released without too many people complaining
functionalKeysBottom.add(spaceIndex + 1, TextKeyData(label = "/", type = KeyType.FUNCTION))
} else if (params.mId.mElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED) {
// add < and > keys next to space, todo (later): not any more, but keep it so this PR can be released without too many people complaining
val key1 = TextKeyData(
label = "<",
popup = SimplePopups(listOf("!fixedColumnOrder!3", "", "", "«")),
labelFlags = Key.LABEL_FLAGS_HAS_POPUP_HINT,
type = KeyType.FUNCTION
)
val key2 = TextKeyData(
label = ">",
popup = SimplePopups(listOf("!fixedColumnOrder!3", "", "", "»")),
labelFlags = Key.LABEL_FLAGS_HAS_POPUP_HINT,
type = KeyType.FUNCTION
)
functionalKeysBottom.add(spaceIndex + 1, key2)
functionalKeysBottom.add(spaceIndex, key1)
}
}
baseKeys.add(mutableListOf())

View file

@ -402,6 +402,9 @@ sealed interface KeyData : AbstractKeyData {
KeyLabel.SHIFT -> return getShiftBackground(params)
}
if (type == KeyType.PLACEHOLDER) return Key.BACKGROUND_TYPE_EMPTY
if ((params.mId.mElementId == KeyboardId.ELEMENT_SYMBOLS || params.mId.mElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED)
&& (groupId == GROUP_COMMA || groupId == GROUP_PERIOD))
return Key.BACKGROUND_TYPE_FUNCTIONAL
return Key.BACKGROUND_TYPE_NORMAL
}