convert popup multiTextKey codePoints into (KeySpec) label

fixes #1376
This commit is contained in:
Helium314 2025-02-26 21:16:23 +01:00
parent 2e9ba954ad
commit 1c955a34b2

View file

@ -301,6 +301,8 @@ sealed interface KeyData : AbstractKeyData {
// idea: directly create PopupKeySpec, but need to deal with needsToUpcase and popupKeysColumnAndFlags // idea: directly create PopupKeySpec, but need to deal with needsToUpcase and popupKeysColumnAndFlags
fun getPopupLabel(params: KeyboardParams): String { fun getPopupLabel(params: KeyboardParams): String {
val newLabel = processLabel(params) val newLabel = processLabel(params)
if (newLabel == "!")
Log.w("test", "code $code, newCode ${processCode()}")
if (code == KeyCode.UNSPECIFIED) { if (code == KeyCode.UNSPECIFIED) {
if (newLabel == label) return label if (newLabel == label) return label
val newCode = processCode() val newCode = processCode()
@ -315,11 +317,14 @@ sealed interface KeyData : AbstractKeyData {
return "${newLabel.substringBefore("|")}|${StringUtils.newSingleCodePointString(code)}" return "${newLabel.substringBefore("|")}|${StringUtils.newSingleCodePointString(code)}"
} }
return "$newLabel|${StringUtils.newSingleCodePointString(code)}" return "$newLabel|${StringUtils.newSingleCodePointString(code)}"
} }
if (code in KeyCode.Spec.CURRENCY) { if (code in KeyCode.Spec.CURRENCY) {
return getCurrencyLabel(params) return getCurrencyLabel(params)
} }
if (code == KeyCode.MULTIPLE_CODE_POINTS && this is MultiTextKeyData) {
val outputText = String(codePoints, 0, codePoints.size)
return "${newLabel}|$outputText"
}
return if (newLabel.endsWith("|")) "$newLabel!code/${processCode()}" // for toolbar keys return if (newLabel.endsWith("|")) "$newLabel!code/${processCode()}" // for toolbar keys
else "$newLabel|!code/${processCode()}" else "$newLabel|!code/${processCode()}"
} }