1
0
Fork 0

fixed the Main View not appearing in the Contacts app, on touchscreen-only phones

This commit is contained in:
sspanak 2024-05-30 14:29:37 +03:00 committed by Dimo Karaivanov
parent 59d45cf373
commit 29814793c8
3 changed files with 14 additions and 6 deletions

View file

@ -41,6 +41,11 @@ public class InputType extends StandardInputType {
} }
public boolean isDumbPhoneDialer(Context context) {
return field.packageName.equals("com.android.dialer") && !DeviceInfo.noKeyboard(context);
}
public boolean isLgX100SDialer() { public boolean isLgX100SDialer() {
int imeOptions = EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_ENTER_ACTION; int imeOptions = EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_ENTER_ACTION;
return return
@ -114,11 +119,13 @@ public class InputType extends StandardInputType {
* <a href="https://github.com/sspanak/tt9/issues/46">the initial GitHub issue about Qin F21 Pro+</a> * <a href="https://github.com/sspanak/tt9/issues/46">the initial GitHub issue about Qin F21 Pro+</a>
* <a href="https://github.com/sspanak/tt9/pull/326">the PR about calculators</a> * <a href="https://github.com/sspanak/tt9/pull/326">the PR about calculators</a>
* <a href="https://github.com/sspanak/tt9/issues/300">Dialer not detected correctly on LG X100S</a> * <a href="https://github.com/sspanak/tt9/issues/300">Dialer not detected correctly on LG X100S</a>
* [NO ISSUE] On touchscreen-only phones, in the Dialer app, we can't switch to passthrough, because
* they don't have a physical keyboard.
*/ */
protected boolean isSpecialNumeric() { protected boolean isSpecialNumeric(Context context) {
return return
field.packageName.contains("com.android.calculator") // there is "calculator2", hence the contains() field.packageName.contains("com.android.calculator") // there is "calculator2", hence the contains()
|| field.packageName.equals("com.android.dialer") || isDumbPhoneDialer(context)
|| isLgX100SDialer(); || isLgX100SDialer();
} }

View file

@ -254,7 +254,7 @@ public abstract class TypingHandler extends KeyPadHandler {
return InputMode.MODE_PASSTHROUGH; return InputMode.MODE_PASSTHROUGH;
} }
allowedInputModes = inputType.determineInputModes(); allowedInputModes = inputType.determineInputModes(this);
return InputModeValidator.validateMode(settings.getInputMode(), allowedInputModes); return InputModeValidator.validateMode(settings.getInputMode(), allowedInputModes);
} }

View file

@ -1,5 +1,6 @@
package io.github.sspanak.tt9.ime.helpers; package io.github.sspanak.tt9.ime.helpers;
import android.content.Context;
import android.text.InputType; import android.text.InputType;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
@ -65,7 +66,7 @@ abstract public class StandardInputType {
} }
abstract protected boolean isSpecialNumeric(); abstract protected boolean isSpecialNumeric(Context context);
public boolean isEmail() { public boolean isEmail() {
@ -126,7 +127,7 @@ abstract public class StandardInputType {
* *
* @return ArrayList<SettingsStore.MODE_ABC | SettingsStore.MODE_123 | SettingsStore.MODE_PREDICTIVE> * @return ArrayList<SettingsStore.MODE_ABC | SettingsStore.MODE_123 | SettingsStore.MODE_PREDICTIVE>
*/ */
public ArrayList<Integer> determineInputModes() { public ArrayList<Integer> determineInputModes(Context context) {
ArrayList<Integer> allowedModes = new ArrayList<>(); ArrayList<Integer> allowedModes = new ArrayList<>();
if (field == null) { if (field == null) {
@ -137,7 +138,7 @@ abstract public class StandardInputType {
// Calculators (only 0-9 and math) and Dialer (0-9, "#" and "*") fields // Calculators (only 0-9 and math) and Dialer (0-9, "#" and "*") fields
// handle all input themselves, so we are supposed to pass through all key presses. // handle all input themselves, so we are supposed to pass through all key presses.
// Note: A Dialer field is not a Phone number field. // Note: A Dialer field is not a Phone number field.
if (isSpecialNumeric()) { if (isSpecialNumeric(context)) {
allowedModes.add(InputMode.MODE_PASSTHROUGH); allowedModes.add(InputMode.MODE_PASSTHROUGH);
return allowedModes; return allowedModes;
} }