mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 05:52:47 +00:00
switch internal codes for functional keys to the same as florisboard
for better compatibility of layouts also convert labels
This commit is contained in:
parent
7b0ee924ae
commit
a34b3f4cdd
40 changed files with 448 additions and 410 deletions
|
@ -42,6 +42,7 @@ import android.view.inputmethod.InputMethodSubtype;
|
|||
import helium314.keyboard.accessibility.AccessibilityUtils;
|
||||
import helium314.keyboard.compat.ConfigurationCompatKt;
|
||||
import helium314.keyboard.compat.EditorInfoCompatUtils;
|
||||
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode;
|
||||
import helium314.keyboard.latin.common.InsetsOutlineProvider;
|
||||
import helium314.keyboard.dictionarypack.DictionaryPackConstants;
|
||||
import helium314.keyboard.event.Event;
|
||||
|
@ -1402,7 +1403,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// some apps don't return any text via input connection, and the cursor can't be moved
|
||||
// we fall back to virtually pressing the left/right key one or more times instead
|
||||
while (steps != 0) {
|
||||
onCodeInput(Constants.CODE_LEFT, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
onCodeInput(KeyCode.ARROW_LEFT, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
++steps;
|
||||
}
|
||||
return;
|
||||
|
@ -1412,7 +1413,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
moveSteps = Math.min(availableCharacters, steps);
|
||||
if (moveSteps == 0) {
|
||||
while (steps != 0) {
|
||||
onCodeInput(Constants.CODE_RIGHT, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
onCodeInput(KeyCode.ARROW_RIGHT, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
--steps;
|
||||
}
|
||||
return;
|
||||
|
@ -1446,7 +1447,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
public void onUpWithDeletePointerActive() {
|
||||
if (mInputLogic.mConnection.hasSelection()) {
|
||||
mInputLogic.finishInput();
|
||||
onCodeInput(Constants.CODE_DELETE, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
onCodeInput(KeyCode.DELETE, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1527,12 +1528,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// TODO: Instead of checking for alphabetic keyboard here, separate keycodes for
|
||||
// alphabetic shift and shift while in symbol layout and get rid of this method.
|
||||
private int getCodePointForKeyboard(final int codePoint) {
|
||||
if (Constants.CODE_SHIFT == codePoint) {
|
||||
if (KeyCode.SHIFT == codePoint) {
|
||||
final Keyboard currentKeyboard = mKeyboardSwitcher.getKeyboard();
|
||||
if (null != currentKeyboard && currentKeyboard.mId.isAlphabetKeyboard()) {
|
||||
return codePoint;
|
||||
}
|
||||
return Constants.CODE_SYMBOL_SHIFT;
|
||||
return KeyCode.SYMBOL_SHIFT;
|
||||
}
|
||||
return codePoint;
|
||||
}
|
||||
|
@ -1542,8 +1543,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
public void onCodeInput(final int codePoint, final int x, final int y, final boolean isKeyRepeat) {
|
||||
if (codePoint < 0) {
|
||||
switch (codePoint) {
|
||||
case Constants.CODE_TOGGLE_AUTOCORRECT -> {mSettings.toggleAutoCorrect(); return; }
|
||||
case Constants.CODE_TOGGLE_INCOGNITO -> {mSettings.toggleAlwaysIncognitoMode(); return; }
|
||||
case KeyCode.TOGGLE_AUTOCORRECT -> {mSettings.toggleAutoCorrect(); return; }
|
||||
case KeyCode.TOGGLE_INCOGNITO_MODE -> {mSettings.toggleAlwaysIncognitoMode(); return; }
|
||||
}
|
||||
}
|
||||
// TODO: this processing does not belong inside LatinIME, the caller should be doing this.
|
||||
|
@ -1562,7 +1563,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// This method is public for testability of LatinIME, but also in the future it should
|
||||
// completely replace #onCodeInput.
|
||||
public void onEvent(@NonNull final Event event) {
|
||||
if (Constants.CODE_SHORTCUT == event.getMKeyCode()) {
|
||||
if (KeyCode.VOICE_INPUT == event.getMKeyCode()) {
|
||||
mRichImm.switchToShortcutIme(this);
|
||||
}
|
||||
final InputTransaction completeInputTransaction =
|
||||
|
@ -1595,7 +1596,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
@Override
|
||||
public void onTextInput(final String rawText) {
|
||||
// TODO: have the keyboard pass the correct key code when we need it.
|
||||
final Event event = Event.createSoftwareTextEvent(rawText, Constants.CODE_OUTPUT_TEXT);
|
||||
final Event event = Event.createSoftwareTextEvent(rawText, KeyCode.MULTIPLE_CODE_POINTS);
|
||||
final InputTransaction completeInputTransaction =
|
||||
mInputLogic.onTextInput(mSettings.getCurrent(), event,
|
||||
mKeyboardSwitcher.getKeyboardShiftMode(), mHandler);
|
||||
|
@ -1802,7 +1803,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
return;
|
||||
}
|
||||
if (repeatCount > 0) {
|
||||
if (code == Constants.CODE_DELETE && !mInputLogic.mConnection.canDeleteCharacters()) {
|
||||
if (code == KeyCode.DELETE && !mInputLogic.mConnection.canDeleteCharacters()) {
|
||||
// No need to feedback when repeat delete key will have no effect.
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue