fixed auto-accepting causig MainView to hide unexpectedly when changing the input mode (#324)
This commit is contained in:
parent
49eda37b99
commit
005683bb7e
1 changed files with 21 additions and 11 deletions
|
|
@ -300,12 +300,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
return performOKAction();
|
return performOKAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
String word = suggestionBar.getCurrentSuggestion();
|
acceptCurrentSuggestion(KeyEvent.KEYCODE_ENTER);
|
||||||
|
|
||||||
mInputMode.onAcceptSuggestion(word);
|
|
||||||
commitCurrentSuggestion();
|
|
||||||
autoCorrectSpace(word, true, KeyEvent.KEYCODE_ENTER);
|
|
||||||
resetKeyRepeat();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -504,11 +499,15 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
private boolean scheduleAutoAccept(int delay) {
|
private boolean scheduleAutoAccept(int delay) {
|
||||||
cancelAutoAccept();
|
cancelAutoAccept();
|
||||||
|
|
||||||
|
if (!suggestionBar.hasElements()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (delay == 0) {
|
if (delay == 0) {
|
||||||
this.onOK();
|
this.acceptCurrentSuggestion();
|
||||||
return true;
|
return true;
|
||||||
} else if (delay > 0) {
|
} else if (delay > 0) {
|
||||||
autoAcceptHandler.postDelayed(this::autoAccept, delay);
|
autoAcceptHandler.postDelayed(this::acceptCurrentSuggestion, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -520,10 +519,20 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void autoAccept() {
|
private void acceptCurrentSuggestion(int fromKey) {
|
||||||
if (suggestionBar.hasElements()) {
|
String word = suggestionBar.getCurrentSuggestion();
|
||||||
this.onOK();
|
if (word.isEmpty()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInputMode.onAcceptSuggestion(word);
|
||||||
|
commitCurrentSuggestion();
|
||||||
|
autoCorrectSpace(word, true, fromKey);
|
||||||
|
resetKeyRepeat();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void acceptCurrentSuggestion() {
|
||||||
|
acceptCurrentSuggestion(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -798,6 +807,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
if (mInputMode.isPassthrough() || isInputViewShown()) {
|
if (mInputMode.isPassthrough() || isInputViewShown()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
requestShowSelf(InputMethodManager.SHOW_IMPLICIT);
|
requestShowSelf(InputMethodManager.SHOW_IMPLICIT);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue