diff options
| author | Wisha Wa <wisha.wa@yandex.com> | 2020-07-07 04:28:21 +0000 |
|---|---|---|
| committer | Wisha Wa <wisha.wa@yandex.com> | 2020-07-07 04:28:21 +0000 |
| commit | 4369ffe4cad97d0bab762e9e692be06e6c13893f (patch) | |
| tree | 9a2a76d09895acd70930f90baeedd91b871cc8d8 | |
| parent | 5f50aadb034deb39aed629534b55bdf50cb89d60 (diff) | |
| download | AnySoftKeyboard-4369ffe4cad97d0bab762e9e692be06e6c13893f.tar.gz AnySoftKeyboard-4369ffe4cad97d0bab762e9e692be06e6c13893f.tar.bz2 | |
Add ask:isShiftAlways to allow Thai language keyboard to work
| -rw-r--r-- | api/src/main/res/values/keyboard_layout_api.xml | 3 | ||||
| -rw-r--r-- | ime/app/src/main/java/com/anysoftkeyboard/keyboards/AnyKeyboard.java | 22 |
2 files changed, 17 insertions, 8 deletions
diff --git a/api/src/main/res/values/keyboard_layout_api.xml b/api/src/main/res/values/keyboard_layout_api.xml index 627e8b1c8..c814592f4 100644 --- a/api/src/main/res/values/keyboard_layout_api.xml +++ b/api/src/main/res/values/keyboard_layout_api.xml @@ -73,6 +73,9 @@ Copyright (C) 2013 Menny Even-Danan <attr name="longPressCode" format="reference|integer"/> <attr name="isFunctional" format="reference|boolean"/> + + <!-- Should the shift code be outputted even if the shift is only active because of sticky? --> + <attr name="isShiftAlways" format="reference|boolean"/> <attr name="shiftedCodes" format="reference|integer|string"/> diff --git a/ime/app/src/main/java/com/anysoftkeyboard/keyboards/AnyKeyboard.java b/ime/app/src/main/java/com/anysoftkeyboard/keyboards/AnyKeyboard.java index 03d22079b..374904e38 100644 --- a/ime/app/src/main/java/com/anysoftkeyboard/keyboards/AnyKeyboard.java +++ b/ime/app/src/main/java/com/anysoftkeyboard/keyboards/AnyKeyboard.java @@ -737,6 +737,7 @@ public abstract class AnyKeyboard extends Keyboard { @ShowKeyInLayoutType public int showKeyInLayout; @NonNull int[] mShiftedCodes = EMPTY_INT_ARRAY; private boolean mShiftCodesAlways; + private boolean mShiftCodesAlwaysOverride; private boolean mFunctionalKey; private boolean mEnabled; @NonNull private List<String> mKeyTags = Collections.emptyList(); @@ -760,6 +761,7 @@ public abstract class AnyKeyboard extends Keyboard { longPressCode = 0; shiftedKeyLabel = null; hintLabel = null; + mShiftCodesAlwaysOverride = false; final int[] remoteStyleableArrayFromLocal = resourceMapping.getRemoteStyleableArrayFromLocal( @@ -789,6 +791,10 @@ public abstract class AnyKeyboard extends Keyboard { case R.attr.shiftedKeyLabel: shiftedKeyLabel = a.getString(remoteIndex); break; + case R.attr.isShiftAlways: + mShiftCodesAlwaysOverride = true; + mShiftCodesAlways = a.getBoolean(remoteIndex, false); + break; case R.attr.hintLabel: hintLabel = a.getString(remoteIndex); break; @@ -830,14 +836,14 @@ public abstract class AnyKeyboard extends Keyboard { } } - // if the shift-character is a symbol, we only show it if the SHIFT is pressed, - // not if the shift is active. - mShiftCodesAlways = - mShiftedCodes.length == 0 - || Character.isLetter(mShiftedCodes[0]) - || Character.getType(mShiftedCodes[0]) == Character.NON_SPACING_MARK - || Character.getType(mShiftedCodes[0]) - == Character.COMBINING_SPACING_MARK; + if (!mShiftCodesAlwaysOverride) { + // if the shift-character is a symbol, we only show it if the SHIFT is pressed, + // not if the shift is active. + mShiftCodesAlways = mShiftedCodes.length == 0 + || Character.isLetter(mShiftedCodes[0]) + || Character.getType(mShiftedCodes[0]) == Character.NON_SPACING_MARK + || Character.getType(mShiftedCodes[0]) == Character.COMBINING_SPACING_MARK; + } if (popupCharacters != null && popupCharacters.length() == 0) { // If there is a keyboard with no keys specified in |
