mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-03 13:14:46 +00:00
avoid duplicate symbols moreKeys
This commit is contained in:
parent
2c03623b8a
commit
33ea631235
5 changed files with 8 additions and 7 deletions
|
@ -344,6 +344,9 @@ public class Key implements Comparable<Key> {
|
|||
mMoreKeys = moreKeys;
|
||||
mMoreKeysColumnAndFlags = key.mMoreKeysColumnAndFlags;
|
||||
mBackgroundType = key.mBackgroundType;
|
||||
if (moreKeys == null && mCode > Constants.CODE_SPACE && (key.mActionFlags & ACTION_FLAGS_ENABLE_LONG_PRESS) != 0)
|
||||
mActionFlags = key.mActionFlags - ACTION_FLAGS_ENABLE_LONG_PRESS;
|
||||
else
|
||||
mActionFlags = key.mActionFlags;
|
||||
mKeyVisualAttributes = key.mKeyVisualAttributes;
|
||||
mOptionalAttributes = key.mOptionalAttributes;
|
||||
|
|
|
@ -110,6 +110,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
fun load(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> {
|
||||
mParams.mId = id
|
||||
if (id.isEmojiKeyboard) {
|
||||
setAllowRedundantMoreKeys(true)
|
||||
readAttributes(R.xml.kbd_emoji_category1) // all the same anyway, gridRows are ignored
|
||||
keysInRows = EmojiParser(mParams, mContext).parse()
|
||||
} else {
|
||||
|
|
|
@ -117,7 +117,7 @@ public final class MoreKeySpec {
|
|||
|
||||
public void addLetter(@NonNull final Key key) {
|
||||
final int code = key.getCode();
|
||||
if (Character.isAlphabetic(code)) {
|
||||
if (code > 32) {
|
||||
mCodes.put(code, 0);
|
||||
} else if (code == Constants.CODE_OUTPUT_TEXT) {
|
||||
mTexts.add(key.getOutputText());
|
||||
|
@ -126,7 +126,7 @@ public final class MoreKeySpec {
|
|||
|
||||
public boolean contains(@NonNull final MoreKeySpec moreKey) {
|
||||
final int code = moreKey.mCode;
|
||||
if (Character.isAlphabetic(code) && mCodes.indexOfKey(code) >= 0) {
|
||||
if (mCodes.indexOfKey(code) >= 0) {
|
||||
return true;
|
||||
} else return code == Constants.CODE_OUTPUT_TEXT && mTexts.contains(moreKey.mOutputText);
|
||||
}
|
||||
|
|
|
@ -823,7 +823,7 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
|
|||
params.mId.mElementId == KeyboardId.ELEMENT_ALPHABET
|
||||
else -> true
|
||||
}
|
||||
val allowRedundantMoreKeys = name != "nordic" && name != "serbian_qwertz"
|
||||
val allowRedundantMoreKeys = name != "nordic" && name != "serbian_qwertz" && params.mId.mElementId != KeyboardId.ELEMENT_SYMBOLS
|
||||
// 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)
|
||||
// todo: null for MoreKeysKeyboard only
|
||||
|
|
|
@ -32,9 +32,6 @@ const val MORE_KEYS_ORDER_DEFAULT = "$MORE_KEYS_LANGUAGE_PRIORITY,true;$MORE_KEY
|
|||
// todo:
|
||||
// could be done later:
|
||||
// some way to allow hint labels in symbols layout
|
||||
// remove duplicate symbol moreKeys
|
||||
// in remove_symbol_duplicates.patch
|
||||
// issues, see comments
|
||||
// maybe put "language" moreKeys into a different category when not using alphabet layout
|
||||
// because disabling language moreKeys will remove e.g. quote moreKeys
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue