mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-06 23:00:15 +00:00
send key event instead of text when entering numbers in a non-text field
fixes #585
This commit is contained in:
parent
7adeb408cc
commit
f07c6d9c77
1 changed files with 7 additions and 0 deletions
|
@ -8,6 +8,7 @@ package helium314.keyboard.latin.inputlogic;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -968,6 +969,12 @@ public final class InputLogic {
|
||||||
|
|
||||||
if (swapWeakSpace && trySwapSwapperAndSpace(event, inputTransaction)) {
|
if (swapWeakSpace && trySwapSwapperAndSpace(event, inputTransaction)) {
|
||||||
mSpaceState = SpaceState.WEAK;
|
mSpaceState = SpaceState.WEAK;
|
||||||
|
} else if ((settingsValues.mInputAttributes.mInputType & InputType.TYPE_MASK_CLASS) != InputType.TYPE_CLASS_TEXT
|
||||||
|
&& codePoint >= '0' && codePoint <= '9') {
|
||||||
|
// weird issue when committing text: https://github.com/Helium314/HeliBoard/issues/585
|
||||||
|
// but at the same time we don't always want to do it for numbers because it might interfere with url detection
|
||||||
|
// todo: consider always using sendDownUpKeyEvent for non-text-inputType
|
||||||
|
sendDownUpKeyEvent(codePoint - '0' + KeyEvent.KEYCODE_0);
|
||||||
} else {
|
} else {
|
||||||
mConnection.commitCodePoint(codePoint);
|
mConnection.commitCodePoint(codePoint);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue