added a workaround for showing the MainView on really stubborn phones like Sonim XP3900
This commit is contained in:
parent
31ca39bfb0
commit
16fbef0b8f
5 changed files with 22 additions and 12 deletions
|
|
@ -28,7 +28,7 @@ abstract public class AbstractHandler extends InputMethodService {
|
||||||
// UI
|
// UI
|
||||||
abstract protected View createMainView();
|
abstract protected View createMainView();
|
||||||
abstract protected void createSuggestionBar(View mainView);
|
abstract protected void createSuggestionBar(View mainView);
|
||||||
abstract protected void forceShowWindowIfHidden();
|
abstract protected void forceShowWindow(boolean forceHarder);
|
||||||
abstract protected void renderMainView();
|
abstract protected void renderMainView();
|
||||||
abstract protected void setStatusIcon(InputMode mode);
|
abstract protected void setStatusIcon(InputMode mode);
|
||||||
abstract protected void setStatusText(String status);
|
abstract protected void setStatusText(String status);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public abstract class HotkeyHandler extends TypingHandler {
|
||||||
|
|
||||||
if (!suggestionOps.isEmpty()) {
|
if (!suggestionOps.isEmpty()) {
|
||||||
if (shouldBeVisible() && !isInputViewShown()) {
|
if (shouldBeVisible() && !isInputViewShown()) {
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(true);
|
||||||
} else {
|
} else {
|
||||||
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER);
|
onAcceptSuggestionManually(suggestionOps.acceptCurrent(), KeyEvent.KEYCODE_ENTER);
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ public abstract class HotkeyHandler extends TypingHandler {
|
||||||
if (action == TextField.IME_ACTION_ENTER) {
|
if (action == TextField.IME_ACTION_ENTER) {
|
||||||
boolean actionPerformed = appHacks.onEnter();
|
boolean actionPerformed = appHacks.onEnter();
|
||||||
if (actionPerformed) {
|
if (actionPerformed) {
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
}
|
}
|
||||||
return actionPerformed;
|
return actionPerformed;
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +230,7 @@ public abstract class HotkeyHandler extends TypingHandler {
|
||||||
DictionaryLoader.autoLoad(this, mLanguage);
|
DictionaryLoader.autoLoad(this, mLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,7 +252,7 @@ public abstract class HotkeyHandler extends TypingHandler {
|
||||||
UI.toastShortSingle(this, mInputMode.getClass().getSimpleName(), mInputMode.toString());
|
UI.toastShortSingle(this, mInputMode.getClass().getSimpleName(), mInputMode.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
|
|
@ -21,6 +22,7 @@ import io.github.sspanak.tt9.ui.UI;
|
||||||
import io.github.sspanak.tt9.ui.dialogs.PopupDialog;
|
import io.github.sspanak.tt9.ui.dialogs.PopupDialog;
|
||||||
import io.github.sspanak.tt9.ui.main.MainView;
|
import io.github.sspanak.tt9.ui.main.MainView;
|
||||||
import io.github.sspanak.tt9.ui.tray.StatusBar;
|
import io.github.sspanak.tt9.ui.tray.StatusBar;
|
||||||
|
import io.github.sspanak.tt9.util.DeviceInfo;
|
||||||
import io.github.sspanak.tt9.util.Logger;
|
import io.github.sspanak.tt9.util.Logger;
|
||||||
|
|
||||||
public class TraditionalT9 extends HotkeyHandler {
|
public class TraditionalT9 extends HotkeyHandler {
|
||||||
|
|
@ -36,7 +38,7 @@ public class TraditionalT9 extends HotkeyHandler {
|
||||||
|
|
||||||
String message = intent != null ? intent.getStringExtra(PopupDialog.INTENT_CLOSE) : null;
|
String message = intent != null ? intent.getStringExtra(PopupDialog.INTENT_CLOSE) : null;
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
UI.toastLong(this, message);
|
UI.toastLong(this, message);
|
||||||
}
|
}
|
||||||
|
|
@ -164,14 +166,14 @@ public class TraditionalT9 extends HotkeyHandler {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* forceShowWindowIfHidden
|
* forceShowWindow
|
||||||
* Some applications may hide our window and it remains invisible until the screen is touched or OK is pressed.
|
* 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
|
* 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.
|
* are invisible. This function forces the InputMethodManager to show our window.
|
||||||
* WARNING! Calling this may cause a restart, which will cause InputMode to be recreated. Depending
|
* WARNING! Calling this may cause a restart, which will cause InputMode to be recreated. Depending
|
||||||
* 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 forceShowWindow(boolean forceHarder) {
|
||||||
if (isInputViewShown() || !shouldBeVisible()) {
|
if (isInputViewShown() || !shouldBeVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -181,6 +183,12 @@ public class TraditionalT9 extends HotkeyHandler {
|
||||||
} else {
|
} else {
|
||||||
showWindow(true);
|
showWindow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sonim XP3900 is quite stubborn and wouldn't show the MainView the regular way.
|
||||||
|
// Sending DPAD_CENTER seems to be the only way of doing it.
|
||||||
|
if (forceHarder && !isInputViewShown() && DeviceInfo.noTouchScreen(this)) {
|
||||||
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ public abstract class TypingHandler extends KeyPadHandler {
|
||||||
textField.setText(text);
|
textField.setText(text);
|
||||||
autoCorrectSpace(text, true, -1);
|
autoCorrectSpace(text, true, -1);
|
||||||
|
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ public abstract class TypingHandler extends KeyPadHandler {
|
||||||
String trimmedWord = suggestionOps.getCurrent(mInputMode.getSequenceLength());
|
String trimmedWord = suggestionOps.getCurrent(mInputMode.getSequenceLength());
|
||||||
appHacks.setComposingTextWithHighlightedStem(trimmedWord, mInputMode);
|
appHacks.setComposingTextWithHighlightedStem(trimmedWord, mInputMode);
|
||||||
|
|
||||||
forceShowWindowIfHidden();
|
forceShowWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,12 +195,14 @@ 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-). If it still invisible, while you are typing a new word, press the OK key and it should appear.
|
If you have opened an application where you can type, but TT9 does not wake up automatically, just start typing and it will. If it is still invisible, press the OK key, while you are typing the word and it should appear. Alternatively, pressing the hotkeys to change [the input mode](#next-input-mode-key-default-press-) or the [language](#next-language-key-default-hold-) can also bring up TT9, when it is hidden.
|
||||||
|
|
||||||
**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 is primarily 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.
|
||||||
|
|
||||||
For these reasons, in order to stick with the expected Android standards, the control is in your hands. Just press a key to "touch" the screen and keep typing.
|
For these reasons, in order to stick with the expected Android standards, the control is in your hands. Just press a key to "touch" the screen and keep typing.
|
||||||
|
|
||||||
|
Moreover, there are at least 3 different ways of asking Android to show the keyboard, so just typing something may work on one phone, but pressing OK may be required on another one.
|
||||||
|
|
||||||
#### On the Qin F21 Pro, holding 2-key or 8-key turns up or down the volume instead of typing a number
|
#### On the Qin F21 Pro, holding 2-key or 8-key turns up or down the volume instead of typing a number
|
||||||
To mitigate this problem, go to Settings → Appearance, and enable "Status Icon". TT9 should detect Qin F21 and enable the settings automatically, but in case auto-detection fails, or you have disabled the icon for some reason, you need to have it enabled, for all keys to work properly.
|
To mitigate this problem, go to Settings → Appearance, and enable "Status Icon". TT9 should detect Qin F21 and enable the settings automatically, but in case auto-detection fails, or you have disabled the icon for some reason, you need to have it enabled, for all keys to work properly.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue