mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 15:19:10 +00:00
parent
d25df2c4de
commit
3cf9d4c87e
4 changed files with 4 additions and 6 deletions
|
@ -91,6 +91,7 @@ public class KeyboardParams {
|
||||||
public boolean mAllowRedundantPopupKeys;
|
public boolean mAllowRedundantPopupKeys;
|
||||||
@NonNull
|
@NonNull
|
||||||
public LocaleKeyboardInfos mLocaleKeyboardInfos;
|
public LocaleKeyboardInfos mLocaleKeyboardInfos;
|
||||||
|
public boolean setTabletExtraKeys;
|
||||||
|
|
||||||
public int mMostCommonKeyHeight = 0;
|
public int mMostCommonKeyHeight = 0;
|
||||||
public int mMostCommonKeyWidth = 0;
|
public int mMostCommonKeyWidth = 0;
|
||||||
|
@ -284,5 +285,6 @@ public class KeyboardParams {
|
||||||
keyAttr.recycle();
|
keyAttr.recycle();
|
||||||
keyboardAttr.recycle();
|
keyboardAttr.recycle();
|
||||||
}
|
}
|
||||||
|
setTabletExtraKeys = Settings.getInstance().isTablet() && !mId.mSubtype.isCustom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,11 +108,8 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
|
||||||
|
|
||||||
val functionalKeys = mutableListOf<Pair<List<KeyParams>, List<KeyParams>>>()
|
val functionalKeys = mutableListOf<Pair<List<KeyParams>, List<KeyParams>>>()
|
||||||
val baseKeyParams = baseKeys.mapIndexed { i, it ->
|
val baseKeyParams = baseKeys.mapIndexed { i, it ->
|
||||||
val row: List<KeyData> = if (params.mId.isAlphaOrSymbolKeyboard && i == baseKeys.lastIndex - 1 && Settings.getInstance().isTablet) {
|
val row: List<KeyData> = if (params.mId.isAlphaOrSymbolKeyboard && i == baseKeys.lastIndex - 1 && params.setTabletExtraKeys) {
|
||||||
// add bottom row extra keys
|
// add bottom row extra keys
|
||||||
// todo (later): this can make very customized layouts look awkward
|
|
||||||
// decide when to (not) add it
|
|
||||||
// when not adding, consider that punctuation popup keys should not remove those keys!
|
|
||||||
val tabletExtraKeys = params.mLocaleKeyboardInfos.getTabletExtraKeys(params.mId.mElementId)
|
val tabletExtraKeys = params.mLocaleKeyboardInfos.getTabletExtraKeys(params.mId.mElementId)
|
||||||
tabletExtraKeys.first + it + tabletExtraKeys.second
|
tabletExtraKeys.first + it + tabletExtraKeys.second
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -86,7 +86,6 @@ class LocaleKeyboardInfos(dataStream: InputStream?, locale: Locale) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pair(extraKeysLeft, extraKeysRight) */
|
/** Pair(extraKeysLeft, extraKeysRight) */
|
||||||
// todo: they should be optional, or will unexpectedly appear on custom layouts
|
|
||||||
fun getTabletExtraKeys(elementId: Int): Pair<List<KeyData>, List<KeyData>> {
|
fun getTabletExtraKeys(elementId: Int): Pair<List<KeyData>, List<KeyData>> {
|
||||||
val flags = Key.LABEL_FLAGS_FONT_DEFAULT
|
val flags = Key.LABEL_FLAGS_FONT_DEFAULT
|
||||||
return when (elementId) {
|
return when (elementId) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ sealed interface KeyData : AbstractKeyData {
|
||||||
for (i in popupKeys.indices)
|
for (i in popupKeys.indices)
|
||||||
popupKeys[i] = popupKeys[i].rtlLabel(params) // for parentheses
|
popupKeys[i] = popupKeys[i].rtlLabel(params) // for parentheses
|
||||||
}
|
}
|
||||||
if (Settings.getInstance().isTablet && popupKeys.contains("!") && popupKeys.contains("?")) {
|
if (params.setTabletExtraKeys && popupKeys.contains("!") && popupKeys.contains("?")) {
|
||||||
// remove ! and ? keys and reduce number in autoColumnOrder
|
// remove ! and ? keys and reduce number in autoColumnOrder
|
||||||
// this makes use of removal of empty popupKeys in PopupKeySpec.insertAdditionalPopupKeys
|
// this makes use of removal of empty popupKeys in PopupKeySpec.insertAdditionalPopupKeys
|
||||||
popupKeys[popupKeys.indexOf("!")] = ""
|
popupKeys[popupKeys.indexOf("!")] = ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue