1
0
Fork 0

disabled Automatic Capitalizations in email and URL fields, as well as in text fields that do request no word suggestions

This commit is contained in:
sspanak 2025-01-08 15:53:13 +02:00 committed by Dimo Karaivanov
parent ba611c92be
commit cde3292774
4 changed files with 14 additions and 10 deletions

View file

@ -186,13 +186,14 @@ public class InputType extends StandardInputType {
/**
* Detects incorrectly defined text fields that miss the EditorInfo.TYPE_TEXT flag.
* Detects incorrectly defined text fields.
*/
@Override
protected boolean isDefectiveText() {
public boolean isDefectiveText() {
return isDuoLingoReportBug() || isContactsAndroid15Field();
}
/**
* isAppField
* Detects a particular input field of a particular application.

View file

@ -112,8 +112,11 @@ abstract public class StandardInputType {
}
abstract protected boolean isDefectiveText();
abstract public boolean isDefectiveText();
private boolean isNoSuggestionsText() {
return isText() && (field.inputType & InputType.TYPE_MASK_FLAGS & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) == InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
public boolean isMultilineText() {
return field != null && (field.inputType & TYPE_MULTILINE_TEXT) == TYPE_MULTILINE_TEXT;
@ -169,7 +172,7 @@ abstract public class StandardInputType {
default:
// Enable predictions for incorrectly defined text fields.
if (isDefectiveText() && !isPassword()) {
if (isDefectiveText()) {
allowedModes.add(InputMode.MODE_PREDICTIVE);
}
@ -192,14 +195,14 @@ abstract public class StandardInputType {
return InputMode.CASE_UNDEFINED;
}
if (isSpecialized()) {
return InputMode.CASE_LOWER;
}
if (isPersonName()) {
return InputMode.CASE_CAPITALIZE;
}
if (isSpecialized() || isNoSuggestionsText()) {
return InputMode.CASE_LOWER;
}
return switch (field.inputType & InputType.TYPE_MASK_FLAGS) {
case InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS -> InputMode.CASE_UPPER;
case InputType.TYPE_TEXT_FLAG_CAP_WORDS -> InputMode.CASE_CAPITALIZE;

View file

@ -42,7 +42,7 @@ abstract public class InputMode {
protected InputMode(SettingsStore settings, InputType inputType) {
isEmailMode = inputType != null && inputType.isEmail();
isEmailMode = inputType != null && inputType.isEmail() && !inputType.isDefectiveText();
this.settings = settings;
}

View file

@ -29,7 +29,7 @@ class Mode123 extends ModePassthrough {
setSpecificSpecialCharacters(Characters.Phone, false);
} else if (inputType.isNumeric()) {
setSpecificSpecialCharacters(Characters.getNumberSpecialCharacters(inputType.isDecimal(), inputType.isSignedNumber()), false);
} else if (inputType.isEmail()) {
} else if (isEmailMode) {
setSpecificSpecialCharacters(Characters.Email, true);
} else {
setDefaultSpecialCharacters();