mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
move information to subtype extra value:
whether layout has shift key whether proximity-based corrections should be enabled when shift is enabled
This commit is contained in:
parent
b76dc8ced5
commit
1a630821db
4 changed files with 31 additions and 29 deletions
|
@ -70,12 +70,8 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
// todo: add setting? maybe users want it in a custom layout
|
||||
mParams.mAllowRedundantPopupKeys = mParams.mId.mElementId != KeyboardId.ELEMENT_SYMBOLS
|
||||
|
||||
// todo: should this be in subtype extra values?
|
||||
mParams.mProximityCharsCorrectionEnabled = mParams.mId.isAlphabetKeyboard && when (layoutName) {
|
||||
"bengali_akkhor", "georgian", "hindi", "lao", "nepali_romanized", "nepali_traditional", "sinhala", "thai" ->
|
||||
mParams.mId.mElementId == KeyboardId.ELEMENT_ALPHABET // not for shifted layouts
|
||||
else -> true
|
||||
}
|
||||
mParams.mProximityCharsCorrectionEnabled = mParams.mId.mElementId == KeyboardId.ELEMENT_ALPHABET
|
||||
|| (mParams.mId.isAlphabetKeyboard && !mParams.mId.mSubtype.hasExtraValue(Constants.Subtype.ExtraValue.NO_SHIFT_PROXIMITY_CORRECTION))
|
||||
|
||||
addLocaleKeyTextsToParams(mContext, mParams, sv.mShowMorePopupKeys)
|
||||
mParams.mPopupKeyTypes.addAll(sv.mPopupKeyTypes)
|
||||
|
|
|
@ -290,8 +290,8 @@ sealed interface KeyData : AbstractKeyData {
|
|||
require(width >= 0f || width == -1f) { "illegal width $width" }
|
||||
val newLabel = label.convertFlorisLabel().resolveStringLabel(params)
|
||||
if (newLabel == KeyLabel.SHIFT && params.mId.isAlphabetKeyboard
|
||||
&& params.mId.mSubtype.keyboardLayoutSetName in listOf("hindi_compact", "bengali", "arabic", "arabic_pc", "hebrew", "kannada", "kannada_extended","malayalam", "marathi", "farsi", "tamil", "telugu")) {
|
||||
return null // these layouts have no shift key, todo: should be in subtype extras
|
||||
&& params.mId.mSubtype.hasExtraValue(Constants.Subtype.ExtraValue.NO_SHIFT_KEY)) {
|
||||
return null
|
||||
}
|
||||
val newCode = code.checkAndConvertCode()
|
||||
val newLabelFlags = if (labelFlags == 0 && params.mId.isNumberLayout) {
|
||||
|
|
|
@ -72,6 +72,12 @@ public final class Constants {
|
|||
*/
|
||||
public static final String EMOJI_CAPABLE = "EmojiCapable";
|
||||
|
||||
/** Indicates that the subtype does not have a shift key */
|
||||
public static final String NO_SHIFT_KEY = "NoShiftKey";
|
||||
|
||||
/** Indicates that for this subtype corrections should not be based on proximity of keys for when shifted */
|
||||
public static final String NO_SHIFT_PROXIMITY_CORRECTION = "NoShiftProximityCorrection";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the display name of this subtype
|
||||
* contains a "%s" for printf-like replacement and it should be replaced by
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
android:imeSubtypeLocale="ar"
|
||||
android:languageTag="ar"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic,NoShiftKey,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -172,7 +172,7 @@
|
|||
android:imeSubtypeLocale="ar"
|
||||
android:languageTag="ar"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic_pc,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic_pc,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -235,7 +235,7 @@
|
|||
android:imeSubtypeLocale="bn_BD"
|
||||
android:languageTag="bn-BD"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=bengali_akkhor,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=bengali_akkhor,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -253,7 +253,7 @@
|
|||
android:imeSubtypeLocale="bn_IN"
|
||||
android:languageTag="bn-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=bengali,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=bengali,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -397,7 +397,7 @@
|
|||
android:imeSubtypeLocale="fa"
|
||||
android:languageTag="fa"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=farsi,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=farsi,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -460,7 +460,7 @@
|
|||
android:imeSubtypeLocale="hi"
|
||||
android:languageTag="hi"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -469,7 +469,7 @@
|
|||
android:imeSubtypeLocale="hi"
|
||||
android:languageTag="hi"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi_compact,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi_compact,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<!-- This Hinglish keyboard is a preliminary layout.
|
||||
|
@ -564,7 +564,7 @@
|
|||
android:imeSubtypeLocale="iw"
|
||||
android:languageTag="he"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hebrew,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=hebrew,NoShiftKey,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -582,7 +582,7 @@
|
|||
android:imeSubtypeLocale="ka_GE"
|
||||
android:languageTag="ka-GE"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=georgian,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=georgian,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -609,7 +609,7 @@
|
|||
android:imeSubtypeLocale="kn_IN"
|
||||
android:languageTag="kn-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -618,7 +618,7 @@
|
|||
android:imeSubtypeLocale="kn_IN"
|
||||
android:languageTag="kn-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada_extended,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada_extended,NoShiftKey,SupportTouchPositionCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -680,7 +680,7 @@
|
|||
android:imeSubtypeLocale="lo_LA"
|
||||
android:languageTag="lo-LA"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=lao,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=lao,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -725,7 +725,7 @@
|
|||
android:imeSubtypeLocale="ml_IN"
|
||||
android:languageTag="ml-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=malayalam,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=malayalam,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -752,7 +752,7 @@
|
|||
android:imeSubtypeLocale="mr_IN"
|
||||
android:languageTag="mr-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=marathi,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=marathi,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -779,7 +779,7 @@
|
|||
android:imeSubtypeLocale="ne_NP"
|
||||
android:languageTag="ne-NP"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=nepali_romanized,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=nepali_romanized,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -788,7 +788,7 @@
|
|||
android:imeSubtypeLocale="ne_NP"
|
||||
android:languageTag="ne-NP"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=nepali_traditional,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=nepali_traditional,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -881,7 +881,7 @@
|
|||
android:imeSubtypeLocale="si_LK"
|
||||
android:languageTag="si-LK"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=sinhala,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=sinhala,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -946,7 +946,7 @@
|
|||
android:imeSubtypeLocale="ta_IN"
|
||||
android:languageTag="ta-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=tamil,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=tamil,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<!-- TODO: Enabling/Disabling ta_LK subtype must be aligned with si_LK subtype. -->
|
||||
|
@ -967,7 +967,7 @@
|
|||
android:imeSubtypeLocale="ta_SG"
|
||||
android:languageTag="ta-SG"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=tamil,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=tamil,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -976,7 +976,7 @@
|
|||
android:imeSubtypeLocale="te_IN"
|
||||
android:languageTag="te-IN"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=telugu,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=telugu,NoShiftKey,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
@ -985,7 +985,7 @@
|
|||
android:imeSubtypeLocale="th"
|
||||
android:languageTag="th"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=thai,EmojiCapable"
|
||||
android:imeSubtypeExtraValue="KeyboardLayoutSet=thai,NoShiftProximityCorrection,EmojiCapable"
|
||||
android:isAsciiCapable="false"
|
||||
/>
|
||||
<subtype android:icon="@drawable/ic_ime_switcher"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue