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:
parent
2600ceef6b
commit
b05455eb5d
5 changed files with 12 additions and 15 deletions
|
|
@ -31,7 +31,11 @@ public abstract class HotkeyHandler extends TypingHandler {
|
|||
suggestionOps.cancelDelayedAccept();
|
||||
|
||||
if (!suggestionOps.isEmpty()) {
|
||||
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER);
|
||||
if (shouldBeVisible() && !isInputViewShown()) {
|
||||
forceShowWindowIfHidden();
|
||||
} else {
|
||||
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public class TraditionalT9 extends HotkeyHandler {
|
|||
* on how much time the restart takes, this may erase the current user input.
|
||||
*/
|
||||
protected void forceShowWindowIfHidden() {
|
||||
if (getInputModeId() == InputMode.MODE_PASSTHROUGH || isInputViewShown() || settings.isMainLayoutStealth()) {
|
||||
if (isInputViewShown() || !shouldBeVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ public class TraditionalT9 extends HotkeyHandler {
|
|||
|
||||
@Override
|
||||
protected boolean shouldBeVisible() {
|
||||
return getInputModeId() != InputMode.MODE_PASSTHROUGH;
|
||||
return getInputModeId() != InputMode.MODE_PASSTHROUGH && !settings.isMainLayoutStealth();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public class AppHacks {
|
|||
* no matter how the hardware key is implemented.
|
||||
*/
|
||||
private boolean onEnterFbMessenger() {
|
||||
if (inputConnection == null || textField == null || !textField.isThereText()) {
|
||||
if (inputConnection == null || textField == null || textField.isEmpty()) {
|
||||
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.
|
||||
*/
|
||||
private boolean onEnterGoogleChat() {
|
||||
if (inputConnection == null || textField == null || !textField.isThereText()) {
|
||||
if (inputConnection == null || textField == null || textField.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import android.text.SpannableString;
|
|||
import android.text.style.StyleSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.ExtractedText;
|
||||
import android.view.inputmethod.ExtractedTextRequest;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
|
@ -44,13 +42,8 @@ public class TextField {
|
|||
}
|
||||
|
||||
|
||||
public boolean isThereText() {
|
||||
if (connection == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ExtractedText extractedText = connection.getExtractedText(new ExtractedTextRequest(), 0);
|
||||
return extractedText != null && extractedText.text.length() > 0;
|
||||
public boolean isEmpty() {
|
||||
return getStringBeforeCursor(1).isEmpty() && getStringAfterCursor(1).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue