Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,13 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
if (!params.mId.mNumberRowEnabled && params.mId.mNumberRowInSymbols && params.mId.mElementId == KeyboardId.ELEMENT_SYMBOLS) {
// replace first symbols row with number row, but use the labels as popupKeys
val numberRowCopy = numberRow.toMutableList()
numberRowCopy.forEachIndexed { index, keyData -> keyData.popup.symbol = baseKeys[0].getOrNull(index)?.label }
numberRowCopy.forEachIndexed { index, keyData ->
val symbolKey = baseKeys[0].getOrNull(index) ?: return@forEachIndexed
val symbols = mutableListOf<String>()
symbolKey.label.takeIf { it.isNotEmpty() }?.let { symbols.add(it) }
symbolKey.popup.getPopupKeyLabels(params)?.let { symbols.addAll(it) }
if (symbols.isNotEmpty()) keyData.popup.symbols = symbols
}
baseKeys[0] = numberRowCopy
} else if (!params.mId.mNumberRowEnabled && params.mId.isAlphabetKeyboard && !hasBuiltInNumbers()) {
if (baseKeys[0].any { it.popup.main != null || !it.popup.relevant.isNullOrEmpty() } // first row of baseKeys has any layout popup key
Expand All @@ -290,7 +296,11 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
layout.forEachIndexed { i, row ->
val baseRow = baseKeys.getOrNull(i) ?: return@forEachIndexed
row.forEachIndexed { j, key ->
baseRow.getOrNull(j)?.popup?.symbol = key.label
val baseKey = baseRow.getOrNull(j) ?: return@forEachIndexed
val symbols = mutableListOf<String>()
key.label.takeIf { it.isNotEmpty() }?.let { symbols.add(it) }
key.popup.getPopupKeyLabels(params)?.let { symbols.addAll(it) }
if (symbols.isNotEmpty()) baseKey.popup.symbols = symbols
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ open class PopupSet<T : AbstractKeyData>(
open fun isEmpty(): Boolean = main == null && relevant.isNullOrEmpty()

var numberLabel: String? = null
var symbol: String? = null // maybe list of keys?
var symbols: Collection<String>? = null

fun <U : AbstractKeyData> merge(other: PopupSet<U>?): PopupSet<out AbstractKeyData> {
if (other == null || other.isEmpty()) return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun createPopupKeysArray(popupSet: PopupSet<*>?, params: KeyboardParams, label:
when (type) {
POPUP_KEYS_NUMBER -> popupSet?.numberLabel?.let { popupKeys.add(it) }
POPUP_KEYS_LAYOUT -> popupSet?.getPopupKeyLabels(params)?.let { popupKeys.addAll(it) }
POPUP_KEYS_SYMBOLS -> popupSet?.symbol?.let { popupKeys.add(it) }
POPUP_KEYS_SYMBOLS -> popupSet?.symbols?.let { popupKeys.addAll(it) }
POPUP_KEYS_LANGUAGE -> params.mLocaleKeyboardInfos.getPopupKeys(label)?.let { popupKeys.addAll(it) }
POPUP_KEYS_LANGUAGE_PRIORITY -> params.mLocaleKeyboardInfos.getPriorityPopupKeys(label)?.let { popupKeys.addAll(it) }
}
Expand Down Expand Up @@ -66,7 +66,7 @@ fun getHintLabel(popupSet: PopupSet<*>?, params: KeyboardParams, label: String):
when (type) {
POPUP_KEYS_NUMBER -> popupSet?.numberLabel?.let { hintLabel = it }
POPUP_KEYS_LAYOUT -> popupSet?.getPopupKeyLabels(params)?.let { hintLabel = it.firstOrNull() }
POPUP_KEYS_SYMBOLS -> popupSet?.symbol?.let { hintLabel = it }
POPUP_KEYS_SYMBOLS -> popupSet?.symbols?.let { hintLabel = it.firstOrNull() }
POPUP_KEYS_LANGUAGE -> params.mLocaleKeyboardInfos.getPopupKeys(label)?.let { hintLabel = it.firstOrNull() }
POPUP_KEYS_LANGUAGE_PRIORITY -> params.mLocaleKeyboardInfos.getPriorityPopupKeys(label)?.let { hintLabel = it.firstOrNull() }
}
Expand Down