mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-26 09:36:50 +00:00
fix issues with moreKeys in json layouts (e.g. azerty)
This commit is contained in:
parent
50b38d7687
commit
a1dbfedc0b
2 changed files with 11 additions and 11 deletions
|
@ -32,7 +32,7 @@
|
|||
{ "label": "n", "popup": { "main": { "label": "!" } } },
|
||||
{ "$": "shift_state_selector",
|
||||
"shiftedManual": { "label": "?" },
|
||||
"default": { "label": "'" }, "popup": { "main": { "label": "?" } }
|
||||
"default": { "label": "'", "popup": { "main": { "label": "?" } } }
|
||||
}
|
||||
]
|
||||
]
|
||||
|
|
|
@ -33,19 +33,19 @@ open class PopupSet<T : AbstractKeyData>(
|
|||
val moreKeys = mutableListOf<String>()
|
||||
// number + main + relevant in this order (label is later taken from first element in resulting array)
|
||||
moreKeys.addAll(params.mLocaleKeyTexts.getNumberMoreKeys(numberIndex))
|
||||
main?.getLabel(params)?.let { moreKeys.add(it) }
|
||||
moreKeys.addAll(relevant.map {
|
||||
val label = it.getLabel(params)
|
||||
if (label == "$$$") { // currency key
|
||||
if (params.mId.passwordInput()) "$"
|
||||
else params.mLocaleKeyTexts.currencyKey.first
|
||||
} else if (params.mId.mSubtype.isRtlSubtype) {
|
||||
label.rtlLabel(params)
|
||||
} else label
|
||||
})
|
||||
main?.getLabel(params)?.let { moreKeys.add(transformLabel(it, params)) }
|
||||
moreKeys.addAll(relevant.map { transformLabel(it.getLabel(params), params) })
|
||||
return moreKeys.takeIf { it.isNotEmpty() }?.toTypedArray()
|
||||
}
|
||||
|
||||
private fun transformLabel(label: String, params: KeyboardParams): String =
|
||||
if (label == "$$$") { // currency key
|
||||
if (params.mId.passwordInput()) "$"
|
||||
else params.mLocaleKeyTexts.currencyKey.first
|
||||
} else if (params.mId.mSubtype.isRtlSubtype) {
|
||||
label.rtlLabel(params)
|
||||
} else label
|
||||
|
||||
private val popupKeys: PopupKeys<T> by lazy {
|
||||
PopupKeys(null, listOfNotNull(main), relevant)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue