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:
parent
ba611c92be
commit
cde3292774
4 changed files with 14 additions and 10 deletions
|
|
@ -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
|
@Override
|
||||||
protected boolean isDefectiveText() {
|
public boolean isDefectiveText() {
|
||||||
return isDuoLingoReportBug() || isContactsAndroid15Field();
|
return isDuoLingoReportBug() || isContactsAndroid15Field();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* isAppField
|
* isAppField
|
||||||
* Detects a particular input field of a particular application.
|
* Detects a particular input field of a particular application.
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
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;
|
||||||
|
|
@ -169,7 +172,7 @@ abstract public class StandardInputType {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Enable predictions for incorrectly defined text fields.
|
// Enable predictions for incorrectly defined text fields.
|
||||||
if (isDefectiveText() && !isPassword()) {
|
if (isDefectiveText()) {
|
||||||
allowedModes.add(InputMode.MODE_PREDICTIVE);
|
allowedModes.add(InputMode.MODE_PREDICTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,14 +195,14 @@ abstract public class StandardInputType {
|
||||||
return InputMode.CASE_UNDEFINED;
|
return InputMode.CASE_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSpecialized()) {
|
|
||||||
return InputMode.CASE_LOWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isPersonName()) {
|
if (isPersonName()) {
|
||||||
return InputMode.CASE_CAPITALIZE;
|
return InputMode.CASE_CAPITALIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isSpecialized() || isNoSuggestionsText()) {
|
||||||
|
return InputMode.CASE_LOWER;
|
||||||
|
}
|
||||||
|
|
||||||
return switch (field.inputType & InputType.TYPE_MASK_FLAGS) {
|
return switch (field.inputType & InputType.TYPE_MASK_FLAGS) {
|
||||||
case InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS -> InputMode.CASE_UPPER;
|
case InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS -> InputMode.CASE_UPPER;
|
||||||
case InputType.TYPE_TEXT_FLAG_CAP_WORDS -> InputMode.CASE_CAPITALIZE;
|
case InputType.TYPE_TEXT_FLAG_CAP_WORDS -> InputMode.CASE_CAPITALIZE;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ abstract public class InputMode {
|
||||||
|
|
||||||
|
|
||||||
protected InputMode(SettingsStore settings, InputType inputType) {
|
protected InputMode(SettingsStore settings, InputType inputType) {
|
||||||
isEmailMode = inputType != null && inputType.isEmail();
|
isEmailMode = inputType != null && inputType.isEmail() && !inputType.isDefectiveText();
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class Mode123 extends ModePassthrough {
|
||||||
setSpecificSpecialCharacters(Characters.Phone, false);
|
setSpecificSpecialCharacters(Characters.Phone, false);
|
||||||
} else if (inputType.isNumeric()) {
|
} else if (inputType.isNumeric()) {
|
||||||
setSpecificSpecialCharacters(Characters.getNumberSpecialCharacters(inputType.isDecimal(), inputType.isSignedNumber()), false);
|
setSpecificSpecialCharacters(Characters.getNumberSpecialCharacters(inputType.isDecimal(), inputType.isSignedNumber()), false);
|
||||||
} else if (inputType.isEmail()) {
|
} else if (isEmailMode) {
|
||||||
setSpecificSpecialCharacters(Characters.Email, true);
|
setSpecificSpecialCharacters(Characters.Email, true);
|
||||||
} else {
|
} else {
|
||||||
setDefaultSpecialCharacters();
|
setDefaultSpecialCharacters();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue