Merge "Revert "Only add spaces automatically when appropriate."" into jb-mr1.1-dev
This commit is contained in:
commit
f9ff4fb5da
4 changed files with 10 additions and 31 deletions
|
@ -65,7 +65,6 @@ public final class InputAttributes {
|
||||||
final boolean flagAutoComplete =
|
final boolean flagAutoComplete =
|
||||||
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
|
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
|
||||||
|
|
||||||
// TODO: Have a helper method in InputTypeUtils
|
|
||||||
// Make sure that passwords are not displayed in {@link SuggestionStripView}.
|
// Make sure that passwords are not displayed in {@link SuggestionStripView}.
|
||||||
if (InputTypeUtils.isPasswordInputType(inputType)
|
if (InputTypeUtils.isPasswordInputType(inputType)
|
||||||
|| InputTypeUtils.isVisiblePasswordInputType(inputType)
|
|| InputTypeUtils.isVisiblePasswordInputType(inputType)
|
||||||
|
@ -162,10 +161,6 @@ public final class InputAttributes {
|
||||||
Log.i(TAG, " TYPE_TEXT_FLAG_AUTO_COMPLETE");
|
Log.i(TAG, " TYPE_TEXT_FLAG_AUTO_COMPLETE");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldInsertSpacesAutomatically() {
|
|
||||||
return InputTypeUtils.isAutoSpaceFriendlyType(mInputType);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pretty print
|
// Pretty print
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -29,37 +29,31 @@ public final class InputTypeUtils implements InputType {
|
||||||
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD;
|
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD;
|
||||||
private static final int TEXT_VISIBLE_PASSWORD_INPUT_TYPE =
|
private static final int TEXT_VISIBLE_PASSWORD_INPUT_TYPE =
|
||||||
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
|
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
|
||||||
private static final int SUPPRESSING_AUTO_SPACES_FIELD_TYPE =
|
|
||||||
InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
|
||||||
| InputType.TYPE_TEXT_VARIATION_PASSWORD
|
|
||||||
| InputType.TYPE_TEXT_VARIATION_URI
|
|
||||||
| InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
|
|
||||||
| InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
|
|
||||||
|
|
||||||
private InputTypeUtils() {
|
private InputTypeUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWebEditTextInputType(final int inputType) {
|
private static boolean isWebEditTextInputType(int inputType) {
|
||||||
return inputType == (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);
|
return inputType == (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWebPasswordInputType(final int inputType) {
|
private static boolean isWebPasswordInputType(int inputType) {
|
||||||
return WEB_TEXT_PASSWORD_INPUT_TYPE != 0
|
return WEB_TEXT_PASSWORD_INPUT_TYPE != 0
|
||||||
&& inputType == WEB_TEXT_PASSWORD_INPUT_TYPE;
|
&& inputType == WEB_TEXT_PASSWORD_INPUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWebEmailAddressInputType(final int inputType) {
|
private static boolean isWebEmailAddressInputType(int inputType) {
|
||||||
return WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE != 0
|
return WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE != 0
|
||||||
&& inputType == WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
|
&& inputType == WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isNumberPasswordInputType(final int inputType) {
|
private static boolean isNumberPasswordInputType(int inputType) {
|
||||||
return NUMBER_PASSWORD_INPUT_TYPE != 0
|
return NUMBER_PASSWORD_INPUT_TYPE != 0
|
||||||
&& inputType == NUMBER_PASSWORD_INPUT_TYPE;
|
&& inputType == NUMBER_PASSWORD_INPUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isTextPasswordInputType(final int inputType) {
|
private static boolean isTextPasswordInputType(int inputType) {
|
||||||
return inputType == TEXT_PASSWORD_INPUT_TYPE;
|
return inputType == TEXT_PASSWORD_INPUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,12 +61,12 @@ public final class InputTypeUtils implements InputType {
|
||||||
return variation == TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
|
return variation == TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmailVariation(final int variation) {
|
public static boolean isEmailVariation(int variation) {
|
||||||
return variation == TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
return variation == TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
||||||
|| isWebEmailAddressVariation(variation);
|
|| isWebEmailAddressVariation(variation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWebInputType(final int inputType) {
|
public static boolean isWebInputType(int inputType) {
|
||||||
final int maskedInputType =
|
final int maskedInputType =
|
||||||
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
||||||
return isWebEditTextInputType(maskedInputType) || isWebPasswordInputType(maskedInputType)
|
return isWebEditTextInputType(maskedInputType) || isWebPasswordInputType(maskedInputType)
|
||||||
|
@ -80,7 +74,7 @@ public final class InputTypeUtils implements InputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please refer to TextView.isPasswordInputType
|
// Please refer to TextView.isPasswordInputType
|
||||||
public static boolean isPasswordInputType(final int inputType) {
|
public static boolean isPasswordInputType(int inputType) {
|
||||||
final int maskedInputType =
|
final int maskedInputType =
|
||||||
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
||||||
return isTextPasswordInputType(maskedInputType) || isWebPasswordInputType(maskedInputType)
|
return isTextPasswordInputType(maskedInputType) || isWebPasswordInputType(maskedInputType)
|
||||||
|
@ -88,13 +82,9 @@ public final class InputTypeUtils implements InputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please refer to TextView.isVisiblePasswordInputType
|
// Please refer to TextView.isVisiblePasswordInputType
|
||||||
public static boolean isVisiblePasswordInputType(final int inputType) {
|
public static boolean isVisiblePasswordInputType(int inputType) {
|
||||||
final int maskedInputType =
|
final int maskedInputType =
|
||||||
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
inputType & (TYPE_MASK_CLASS | TYPE_MASK_VARIATION);
|
||||||
return maskedInputType == TEXT_VISIBLE_PASSWORD_INPUT_TYPE;
|
return maskedInputType == TEXT_VISIBLE_PASSWORD_INPUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAutoSpaceFriendlyType(final int inputType) {
|
|
||||||
return 0 == (inputType & SUPPRESSING_AUTO_SPACES_FIELD_TYPE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2257,9 +2257,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
|
|
||||||
// This essentially inserts a space, and that's it.
|
// This essentially inserts a space, and that's it.
|
||||||
public void promotePhantomSpace() {
|
public void promotePhantomSpace() {
|
||||||
if (mCurrentSettings.shouldInsertSpacesAutomatically()) {
|
sendKeyCodePoint(Keyboard.CODE_SPACE);
|
||||||
sendKeyCodePoint(Keyboard.CODE_SPACE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by the RingCharBuffer
|
// Used by the RingCharBuffer
|
||||||
|
|
|
@ -271,10 +271,6 @@ public final class SettingsValues {
|
||||||
return mPhantomSpacePromotingSymbols.contains(String.valueOf((char)code));
|
return mPhantomSpacePromotingSymbols.contains(String.valueOf((char)code));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldInsertSpacesAutomatically() {
|
|
||||||
return mInputAttributes.shouldInsertSpacesAutomatically();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isAutoCorrectEnabled(final Resources res,
|
private static boolean isAutoCorrectEnabled(final Resources res,
|
||||||
final String currentAutoCorrectionSetting) {
|
final String currentAutoCorrectionSetting) {
|
||||||
final String autoCorrectionOff = res.getString(
|
final String autoCorrectionOff = res.getString(
|
||||||
|
|
Loading…
Reference in a new issue