mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-27 18:17:38 +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": "!" } } },
|
{ "label": "n", "popup": { "main": { "label": "!" } } },
|
||||||
{ "$": "shift_state_selector",
|
{ "$": "shift_state_selector",
|
||||||
"shiftedManual": { "label": "?" },
|
"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>()
|
val moreKeys = mutableListOf<String>()
|
||||||
// number + main + relevant in this order (label is later taken from first element in resulting array)
|
// number + main + relevant in this order (label is later taken from first element in resulting array)
|
||||||
moreKeys.addAll(params.mLocaleKeyTexts.getNumberMoreKeys(numberIndex))
|
moreKeys.addAll(params.mLocaleKeyTexts.getNumberMoreKeys(numberIndex))
|
||||||
main?.getLabel(params)?.let { moreKeys.add(it) }
|
main?.getLabel(params)?.let { moreKeys.add(transformLabel(it, params)) }
|
||||||
moreKeys.addAll(relevant.map {
|
moreKeys.addAll(relevant.map { transformLabel(it.getLabel(params), params) })
|
||||||
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
|
|
||||||
})
|
|
||||||
return moreKeys.takeIf { it.isNotEmpty() }?.toTypedArray()
|
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 {
|
private val popupKeys: PopupKeys<T> by lazy {
|
||||||
PopupKeys(null, listOfNotNull(main), relevant)
|
PopupKeys(null, listOfNotNull(main), relevant)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue