always set AllowRedundantPopupKeys in the same place

This commit is contained in:
Helium314 2024-05-12 19:06:04 +02:00
parent 3862d1e9b2
commit 1d1e0cc987
2 changed files with 5 additions and 10 deletions

View file

@ -43,19 +43,18 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
mParams.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height)
}
fun setAllowRedundantPopupKeys(enabled: Boolean) {
mParams.mAllowRedundantPopupKeys = enabled
}
fun load(id: KeyboardId): KeyboardBuilder<KP> {
mParams.mId = id
if (id.isEmojiKeyboard) {
setAllowRedundantPopupKeys(true)
mParams.mAllowRedundantPopupKeys = true
readAttributes(R.xml.kbd_emoji)
keysInRows = EmojiParser(mParams, mContext).parse()
} else {
try {
val sv = Settings.getInstance().current
// previously was false for nordic and serbian_qwertz, true for all others
// todo: add setting? maybe users want it in a custom layout
mParams.mAllowRedundantPopupKeys = mParams.mId.mElementId != KeyboardId.ELEMENT_SYMBOLS
addLocaleKeyTextsToParams(mContext, mParams, sv.mShowMorePopupKeys)
mParams.mPopupKeyTypes.addAll(sv.mPopupKeyTypes)
// add label source only if popup key type enabled

View file

@ -63,7 +63,6 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
fun parseLayoutString(layoutContent: String): ArrayList<ArrayList<KeyParams>> {
params.readAttributes(context, null)
params.mProximityCharsCorrectionEnabled = infos.enableProximityCharsCorrection
params.mAllowRedundantPopupKeys = infos.allowRedundantPopupKeys
if (infos.touchPositionCorrectionData == null) // need to set correctly, as it's not properly done in readAttributes with attr = null
params.mTouchPositionCorrection.load(emptyArray())
else
@ -551,7 +550,6 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
params.mId.mElementId == KeyboardId.ELEMENT_ALPHABET
else -> true
}
val allowRedundantPopupKeys = params.mId.mElementId != KeyboardId.ELEMENT_SYMBOLS // todo: always set to false?
// essentially this is default for 4 row and non-alphabet layouts, maybe this could be determined automatically instead of using a list
// todo: check the difference between default (i.e. none) and holo (test behavior on keyboard)
val touchPositionCorrectionData = if (params.mId.isAlphabetKeyboard && layout in listOf("armenian_phonetic", "khmer", "lao", "malayalam", "pcqwerty", "thai"))
@ -561,7 +559,7 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
val hasShiftKey = !params.mId.isAlphabetKeyboard
|| layout !in listOf("hindi_compact", "bengali", "arabic", "arabic_pc", "hebrew", "kannada", "kannada_extended","malayalam", "marathi", "farsi", "tamil", "telugu")
val numbersOnTopRow = layout !in listOf("pcqwerty", "lao", "thai", "korean_sebeolsik_390", "korean_sebeolsik_final")
return LayoutInfos(enableProximityCharsCorrection, allowRedundantPopupKeys, touchPositionCorrectionData, hasShiftKey, numbersOnTopRow)
return LayoutInfos(enableProximityCharsCorrection, touchPositionCorrectionData, hasShiftKey, numbersOnTopRow)
}
}
@ -572,8 +570,6 @@ data class LayoutInfos(
// disabled by default, but enabled for all alphabet layouts
// currently set in keyboardLayoutSet
val enableProximityCharsCorrection: Boolean = false,
// previously was false for nordic and serbian_qwertz, true for all others
val allowRedundantPopupKeys: Boolean = true,
// there is holo, default and null
// null only for popupKeys keyboard
val touchPositionCorrectionData: Int? = null,