1
0
Fork 0

fixed the suggestions not being displayed, when attempting to type while the MainView is still hidden

This commit is contained in:
sspanak 2024-04-01 20:22:41 +03:00 committed by Dimo Karaivanov
parent f4caa24387
commit f69cdc8d9b
4 changed files with 13 additions and 9 deletions

View file

@ -95,7 +95,7 @@ public abstract class HotkeyHandler extends TypingHandler {
public boolean onKeyAddWord(boolean validateOnly) {
if (!isInputViewShown() || mInputMode.isNumeric()) {
if (shouldBeOff() || mInputMode.isNumeric()) {
return false;
}
@ -123,7 +123,7 @@ public abstract class HotkeyHandler extends TypingHandler {
public boolean onKeyChangeKeyboard(boolean validateOnly) {
if (!isInputViewShown()) {
if (shouldBeOff()) {
return false;
}
@ -200,6 +200,7 @@ public abstract class HotkeyHandler extends TypingHandler {
suggestionOps.scrollTo(backward ? -1 : 1);
mInputMode.setWordStem(suggestionOps.getCurrent(), true);
appHacks.setComposingTextWithHighlightedStem(suggestionOps.getCurrent(), mInputMode);
return true;
}
@ -221,7 +222,6 @@ public abstract class HotkeyHandler extends TypingHandler {
setStatusText(mInputMode.toString());
renderMainView();
forceShowWindowIfHidden();
if (!suggestionOps.isEmpty() || settings.isMainLayoutStealth()) {
UI.toastShortSingle(this, mLanguage.getClass().getSimpleName(), mLanguage.getName());
}
@ -230,6 +230,7 @@ public abstract class HotkeyHandler extends TypingHandler {
DictionaryLoader.autoLoad(this, mLanguage);
}
forceShowWindowIfHidden();
return true;
}
@ -247,14 +248,14 @@ public abstract class HotkeyHandler extends TypingHandler {
nextInputMode();
renderMainView();
setStatusIcon(mInputMode.getIcon());
forceShowWindowIfHidden();
forceShowWindowIfHidden();
return true;
}
public boolean onKeyShowSettings(boolean validateOnly) {
if (!isInputViewShown()) {
if (shouldBeOff()) {
return false;
}

View file

@ -154,9 +154,11 @@ public class TraditionalT9 extends HotkeyHandler {
* Some applications may hide our window and it remains invisible until the screen is touched or OK is pressed.
* This is fine for touchscreen keyboards, but the hardware keyboard allows typing even when the window and the suggestions
* are invisible. This function forces the InputMethodManager to show our window.
* WARNING! While this is running, it is not possible to load or display suggestions,
* or change the composing text. Use with care, after all processing is done.
*/
protected void forceShowWindowIfHidden() {
if (getInputMode().isPassthrough() || isInputViewShown()) {
if (getInputMode().isPassthrough() || isInputViewShown() || settings.isMainLayoutStealth()) {
return;
}

View file

@ -124,7 +124,6 @@ public abstract class TypingHandler extends KeyPadHandler {
*/
protected boolean onNumber(int key, boolean hold, int repeat) {
suggestionOps.cancelDelayedAccept();
forceShowWindowIfHidden();
// Automatically accept the previous word, when the next one is a space or punctuation,
// instead of requiring "OK" before that.
@ -166,7 +165,6 @@ public abstract class TypingHandler extends KeyPadHandler {
}
suggestionOps.cancelDelayedAccept();
forceShowWindowIfHidden();
// accept the previously typed word (if any)
String lastWord = suggestionOps.acceptIncomplete();
@ -178,6 +176,7 @@ public abstract class TypingHandler extends KeyPadHandler {
textField.setText(text);
autoCorrectSpace(text, true, -1);
forceShowWindowIfHidden();
return true;
}
@ -303,5 +302,7 @@ public abstract class TypingHandler extends KeyPadHandler {
// for a more intuitive experience.
String trimmedWord = suggestionOps.getCurrent(mInputMode.getSequenceLength());
appHacks.setComposingTextWithHighlightedStem(trimmedWord, mInputMode);
forceShowWindowIfHidden();
}
}

View file

@ -102,7 +102,7 @@ public class Predictions {
boolean retryAllowed = !digitSequence.equals(EmojiLanguage.CUSTOM_EMOJI_SEQUENCE);
WordStoreAsync.getWords(
(words) -> onDbWords(words, retryAllowed),
(dbWords) -> onDbWords(dbWords, retryAllowed),
language,
digitSequence,
stem,