1
0
Fork 0

fixed Predictive mode not available in the Duolingo report bug dialog

This commit is contained in:
sspanak 2024-10-16 11:50:57 +03:00 committed by Dimo Karaivanov
parent 057702e7b5
commit 0cedaa55d4
2 changed files with 21 additions and 0 deletions

View file

@ -12,6 +12,11 @@ public class InputType extends StandardInputType {
} }
private boolean isDuoLingoReportBug() {
return isAppField("com.duolingo", EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}
boolean isGoogleChat() { boolean isGoogleChat() {
return isAppField( return isAppField(
"com.google.android.apps.dynamite", "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 * isAppField
* Detects a particular input field of a particular application. * Detects a particular input field of a particular application.

View file

@ -111,6 +111,9 @@ abstract public class StandardInputType {
} }
abstract protected boolean isDefectiveText();
public boolean isMultilineText() { public boolean isMultilineText() {
return field != null && (field.inputType & TYPE_MULTILINE_TEXT) == TYPE_MULTILINE_TEXT; 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 // fallthrough to add ABC and 123 modes
default: 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 // For all unknown input types, default to the alphabetic
// keyboard with no special features. // keyboard with no special features.
allowedModes.add(InputMode.MODE_123); allowedModes.add(InputMode.MODE_123);