1
0
Fork 0

pressing OK while typing a word is now another way of displaying the Main View (if it is hidden for some reason)

This commit is contained in:
sspanak 2024-04-18 15:14:38 +03:00 committed by Dimo Karaivanov
parent 2600ceef6b
commit b05455eb5d
5 changed files with 12 additions and 15 deletions

View file

@ -31,7 +31,11 @@ public abstract class HotkeyHandler extends TypingHandler {
suggestionOps.cancelDelayedAccept(); suggestionOps.cancelDelayedAccept();
if (!suggestionOps.isEmpty()) { if (!suggestionOps.isEmpty()) {
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER); if (shouldBeVisible() && !isInputViewShown()) {
forceShowWindowIfHidden();
} else {
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER);
}
return true; return true;
} }

View file

@ -172,7 +172,7 @@ public class TraditionalT9 extends HotkeyHandler {
* on how much time the restart takes, this may erase the current user input. * on how much time the restart takes, this may erase the current user input.
*/ */
protected void forceShowWindowIfHidden() { protected void forceShowWindowIfHidden() {
if (getInputModeId() == InputMode.MODE_PASSTHROUGH || isInputViewShown() || settings.isMainLayoutStealth()) { if (isInputViewShown() || !shouldBeVisible()) {
return; return;
} }
@ -202,7 +202,7 @@ public class TraditionalT9 extends HotkeyHandler {
@Override @Override
protected boolean shouldBeVisible() { protected boolean shouldBeVisible() {
return getInputModeId() != InputMode.MODE_PASSTHROUGH; return getInputModeId() != InputMode.MODE_PASSTHROUGH && !settings.isMainLayoutStealth();
} }

View file

@ -190,7 +190,7 @@ public class AppHacks {
* no matter how the hardware key is implemented. * no matter how the hardware key is implemented.
*/ */
private boolean onEnterFbMessenger() { private boolean onEnterFbMessenger() {
if (inputConnection == null || textField == null || !textField.isThereText()) { if (inputConnection == null || textField == null || textField.isEmpty()) {
return false; return false;
} }
@ -205,7 +205,7 @@ public class AppHacks {
* the send button it, then going back to the text field, so that one can continue typing. * the send button it, then going back to the text field, so that one can continue typing.
*/ */
private boolean onEnterGoogleChat() { private boolean onEnterGoogleChat() {
if (inputConnection == null || textField == null || !textField.isThereText()) { if (inputConnection == null || textField == null || textField.isEmpty()) {
return false; return false;
} }

View file

@ -6,8 +6,6 @@ import android.text.SpannableString;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -44,13 +42,8 @@ public class TextField {
} }
public boolean isThereText() { public boolean isEmpty() {
if (connection == null) { return getStringBeforeCursor(1).isEmpty() && getStringAfterCursor(1).isEmpty();
return false;
}
ExtractedText extractedText = connection.getExtractedText(new ExtractedTextRequest(), 0);
return extractedText != null && extractedText.text.length() > 0;
} }

View file

@ -195,7 +195,7 @@ This happens if you are using one of the small-sized layouts. Currently, there i
- You can now go back to the settings and disable the on-screen numpad. The emoji and sticker panels will remain accessible until you restart the app or the phone. - You can now go back to the settings and disable the on-screen numpad. The emoji and sticker panels will remain accessible until you restart the app or the phone.
#### Traditional T9 does not appear immediately in some applications #### Traditional T9 does not appear immediately in some applications
If you have opened an application where you can type, but TT9 does not wake up, just start typing and it will. Alternatively, you could also use the hotkeys to change [the input mode](#next-input-mode-key-default-press-) or the [language](#next-language-key-default-hold-). You may also use the OK key, but this is not recommended, because you may accidentally send a message, submit a form, or perform another action, depending on the application. If you have opened an application where you can type, but TT9 does not wake up, just start typing and it will. Alternatively, you could also use the hotkeys to change [the input mode](#next-input-mode-key-default-press-) or the [language](#next-language-key-default-hold-). If it still invisible, while you are typing a new word, press the OK key and it should appear.
**Long explanation.** The reason for this problem is Android was originally designed for touchscreen devices. Hence, it expects you to touch the text/number field to show the keyboard. It is possible to make TT9 appear without this confirmation, but then, in some cases, Android will forget to hide it when it must. For example, it may remain visible after you have dialed a phone number or after you have submitted text in a search field. **Long explanation.** The reason for this problem is Android was originally designed for touchscreen devices. Hence, it expects you to touch the text/number field to show the keyboard. It is possible to make TT9 appear without this confirmation, but then, in some cases, Android will forget to hide it when it must. For example, it may remain visible after you have dialed a phone number or after you have submitted text in a search field.