fixed incorrect behavior of the virtual Clear Filter key when using the suggestion to be filtered was selected with a hardware key
This commit is contained in:
parent
11a6c97afa
commit
d9c899f787
3 changed files with 12 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ abstract public class AbstractHandler extends InputMethodService {
|
|||
abstract public boolean onOK();
|
||||
abstract public boolean onText(String text, boolean validateOnly); // used for "#", "*" and whatnot
|
||||
|
||||
// lifecycle
|
||||
abstract protected void onInit();
|
||||
abstract protected boolean onStart(InputConnection inputConnection, EditorInfo inputField);
|
||||
abstract protected void onFinishTyping();
|
||||
|
|
@ -27,7 +28,7 @@ abstract public class AbstractHandler extends InputMethodService {
|
|||
abstract protected void createSuggestionBar();
|
||||
abstract protected void resetStatus();
|
||||
|
||||
|
||||
// informational
|
||||
abstract protected InputMode getInputMode();
|
||||
abstract protected int getInputModeId();
|
||||
abstract protected SuggestionOps getSuggestionOps();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class SoftFilterKey extends SoftKey {
|
|||
preventRepeat();
|
||||
if (validateTT9Handler() && tt9.onKeyFilterClear(false)) {
|
||||
vibrate(Vibration.getHoldVibration());
|
||||
ignoreLastPressedKey();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
private boolean repeat = false;
|
||||
private long lastLongClickTime = 0;
|
||||
private final Handler repeatHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private static int lastPressedKey = -1;
|
||||
private boolean ignoreLastPressedKey = false;
|
||||
|
||||
|
||||
public SoftKey(Context context) {
|
||||
|
|
@ -88,7 +90,7 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
if (!repeat || hold) {
|
||||
hold = false;
|
||||
boolean result = handleRelease();
|
||||
lastPressedKey = getId();
|
||||
lastPressedKey = ignoreLastPressedKey ? -1 : getId();
|
||||
return result;
|
||||
}
|
||||
repeat = false;
|
||||
|
|
@ -120,7 +122,7 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
if (hold) {
|
||||
repeat = true;
|
||||
handleHold();
|
||||
lastPressedKey = getId();
|
||||
lastPressedKey = ignoreLastPressedKey ? -1 : getId();
|
||||
repeatHandler.removeCallbacks(this::repeatOnLongPress);
|
||||
repeatHandler.postDelayed(this::repeatOnLongPress, getLongPressRepeatDelay());
|
||||
}
|
||||
|
|
@ -151,6 +153,11 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
}
|
||||
|
||||
|
||||
protected void ignoreLastPressedKey() {
|
||||
ignoreLastPressedKey = true;
|
||||
}
|
||||
|
||||
|
||||
protected boolean handlePress() {
|
||||
if (validateTT9Handler()) {
|
||||
vibrate(Vibration.getPressVibration(this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue