diff --git a/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java b/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java index 0cd092b1..977c3e22 100644 --- a/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java +++ b/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java @@ -12,6 +12,11 @@ public class InputType extends StandardInputType { } + private boolean isDuoLingoReportBug() { + return isAppField("com.duolingo", EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS); + } + + boolean isGoogleChat() { return isAppField( "com.google.android.apps.dynamite", @@ -155,6 +160,14 @@ public class InputType extends StandardInputType { } + /** + * Detects incorrectly defined text fields that miss the EditorInfo.TYPE_TEXT flag. + */ + @Override + protected boolean isDefectiveText() { + return isDuoLingoReportBug(); + } + /** * isAppField * Detects a particular input field of a particular application. diff --git a/app/src/main/java/io/github/sspanak/tt9/ime/helpers/StandardInputType.java b/app/src/main/java/io/github/sspanak/tt9/ime/helpers/StandardInputType.java index be10af2e..3d8a4938 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ime/helpers/StandardInputType.java +++ b/app/src/main/java/io/github/sspanak/tt9/ime/helpers/StandardInputType.java @@ -111,6 +111,9 @@ abstract public class StandardInputType { } + abstract protected boolean isDefectiveText(); + + public boolean isMultilineText() { return field != null && (field.inputType & TYPE_MULTILINE_TEXT) == TYPE_MULTILINE_TEXT; } @@ -164,6 +167,11 @@ abstract public class StandardInputType { // ↓ fallthrough to add ABC and 123 modes ↓ default: + // Enable predictions for incorrectly defined text fields. + if (isDefectiveText() && !isPassword()) { + allowedModes.add(InputMode.MODE_PREDICTIVE); + } + // For all unknown input types, default to the alphabetic // keyboard with no special features. allowedModes.add(InputMode.MODE_123);