Remove web mode and add webInput boolean
Bug: 4490948 Change-Id: I6fe23c9ab4918eab6806cc621c4d6821c2e1baf9 Cherry-Pick: I4cd1af0bmain
parent
144e97f154
commit
9e2d810dc5
|
@ -184,9 +184,10 @@
|
|||
<enum name="url" value="1" />
|
||||
<enum name="email" value="2" />
|
||||
<enum name="im" value="3" />
|
||||
<enum name="web" value="4" />
|
||||
<enum name="phone" value="5" />
|
||||
<enum name="phone" value="4" />
|
||||
<enum name="number" value="5" />
|
||||
</attr>
|
||||
<attr name="webInput" format="boolean" />
|
||||
<attr name="passwordInput" format="boolean" />
|
||||
<attr name="hasSettingsKey" format="string" />
|
||||
<attr name="voiceKeyEnabled" format="string" />
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</case>
|
||||
<!-- latin:hasVoiceKey="false" -->
|
||||
<case
|
||||
latin:mode="web"
|
||||
latin:webInput="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyLabel="."
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
latin:keyWidth="40%p" />
|
||||
<switch>
|
||||
<case
|
||||
latin:mode="web"
|
||||
latin:webInput="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyHintIcon="@drawable/hint_popup"
|
||||
|
@ -90,7 +90,7 @@
|
|||
latin:keyWidth="30%p" />
|
||||
<switch>
|
||||
<case
|
||||
latin:mode="web"
|
||||
latin:webInput="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyHintIcon="@drawable/hint_popup"
|
||||
|
|
|
@ -37,6 +37,7 @@ public class InputTypeCompatUtils {
|
|||
(Integer) CompatUtils.getFieldValue(null, null,
|
||||
FIELD_InputType_TYPE_NUMBER_VARIATION_PASSWORD);
|
||||
private static final int WEB_TEXT_PASSWORD_INPUT_TYPE;
|
||||
private static final int WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
|
||||
private static final int NUMBER_PASSWORD_INPUT_TYPE;
|
||||
private static final int TEXT_PASSWORD_INPUT_TYPE =
|
||||
InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
|
||||
|
@ -45,9 +46,14 @@ public class InputTypeCompatUtils {
|
|||
|
||||
static {
|
||||
WEB_TEXT_PASSWORD_INPUT_TYPE =
|
||||
OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD != null
|
||||
? InputType.TYPE_CLASS_TEXT | OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD
|
||||
: 0;
|
||||
OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD != null
|
||||
? InputType.TYPE_CLASS_TEXT | OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD
|
||||
: 0;
|
||||
WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE =
|
||||
OBJ_InputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != null
|
||||
? InputType.TYPE_CLASS_TEXT
|
||||
| OBJ_InputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
|
||||
: 0;
|
||||
NUMBER_PASSWORD_INPUT_TYPE =
|
||||
OBJ_InputType_TYPE_NUMBER_VARIATION_PASSWORD != null
|
||||
? InputType.TYPE_CLASS_NUMBER | OBJ_InputType_TYPE_NUMBER_VARIATION_PASSWORD
|
||||
|
@ -59,6 +65,11 @@ public class InputTypeCompatUtils {
|
|||
&& inputType == WEB_TEXT_PASSWORD_INPUT_TYPE;
|
||||
}
|
||||
|
||||
private static boolean isWebEmailAddressInputType(int inputType) {
|
||||
return WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE != 0
|
||||
&& inputType == WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
|
||||
}
|
||||
|
||||
private static boolean isNumberPasswordInputType(int inputType) {
|
||||
return NUMBER_PASSWORD_INPUT_TYPE != 0
|
||||
&& inputType == NUMBER_PASSWORD_INPUT_TYPE;
|
||||
|
@ -78,6 +89,14 @@ public class InputTypeCompatUtils {
|
|||
|| isWebEmailAddressVariation(variation);
|
||||
}
|
||||
|
||||
public static boolean isWebInputType(int inputType) {
|
||||
final int maskedInputType =
|
||||
inputType & (InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION);
|
||||
return maskedInputType == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
|
||||
|| isWebPasswordInputType(maskedInputType)
|
||||
|| isWebEmailAddressInputType(maskedInputType);
|
||||
}
|
||||
|
||||
// Please refer to TextView.isPasswordInputType
|
||||
public static boolean isPasswordInputType(int inputType) {
|
||||
final int maskedInputType =
|
||||
|
|
|
@ -34,9 +34,8 @@ public class KeyboardId {
|
|||
public static final int MODE_URL = 1;
|
||||
public static final int MODE_EMAIL = 2;
|
||||
public static final int MODE_IM = 3;
|
||||
public static final int MODE_WEB = 4;
|
||||
public static final int MODE_PHONE = 5;
|
||||
public static final int MODE_NUMBER = 6;
|
||||
public static final int MODE_PHONE = 4;
|
||||
public static final int MODE_NUMBER = 5;
|
||||
|
||||
public final Locale mLocale;
|
||||
public final int mOrientation;
|
||||
|
@ -44,6 +43,7 @@ public class KeyboardId {
|
|||
public final int mMode;
|
||||
public final int mXmlId;
|
||||
public final int mColorScheme;
|
||||
public final boolean mWebInput;
|
||||
public final boolean mPasswordInput;
|
||||
public final boolean mHasSettingsKey;
|
||||
public final boolean mVoiceKeyEnabled;
|
||||
|
@ -67,6 +67,7 @@ public class KeyboardId {
|
|||
this.mMode = mode;
|
||||
this.mXmlId = xmlId;
|
||||
this.mColorScheme = colorScheme;
|
||||
this.mWebInput = InputTypeCompatUtils.isWebInputType(inputType);
|
||||
this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
|
||||
|| InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
|
||||
this.mHasSettingsKey = hasSettingsKey;
|
||||
|
@ -88,6 +89,7 @@ public class KeyboardId {
|
|||
mode,
|
||||
xmlId,
|
||||
colorScheme,
|
||||
mWebInput,
|
||||
mPasswordInput,
|
||||
hasSettingsKey,
|
||||
voiceKeyEnabled,
|
||||
|
@ -141,6 +143,7 @@ public class KeyboardId {
|
|||
&& other.mMode == this.mMode
|
||||
&& other.mXmlId == this.mXmlId
|
||||
&& other.mColorScheme == this.mColorScheme
|
||||
&& other.mWebInput == this.mWebInput
|
||||
&& other.mPasswordInput == this.mPasswordInput
|
||||
&& other.mHasSettingsKey == this.mHasSettingsKey
|
||||
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
|
||||
|
@ -156,18 +159,19 @@ public class KeyboardId {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("[%s.xml %s %s%d %s %s %s%s%s%s%s%s]",
|
||||
return String.format("[%s.xml %s %s%d %s %s %s %s%s%s%s%s%s]",
|
||||
mXmlName,
|
||||
mLocale,
|
||||
(mOrientation == 1 ? "port" : "land"), mWidth,
|
||||
modeName(mMode),
|
||||
EditorInfoCompatUtils.imeOptionsName(mImeAction),
|
||||
colorSchemeName(mColorScheme),
|
||||
(mWebInput ? " webInput" : ""),
|
||||
(mPasswordInput ? " passwordInput" : ""),
|
||||
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
||||
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
|
||||
(mHasVoiceKey ? " hasVoiceKey" : ""),
|
||||
(mEnableShiftLock ? " enableShiftLock" : ""),
|
||||
colorSchemeName(mColorScheme)
|
||||
(mEnableShiftLock ? " enableShiftLock" : "")
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -177,7 +181,6 @@ public class KeyboardId {
|
|||
case MODE_URL: return "url";
|
||||
case MODE_EMAIL: return "email";
|
||||
case MODE_IM: return "im";
|
||||
case MODE_WEB: return "web";
|
||||
case MODE_PHONE: return "phone";
|
||||
case MODE_NUMBER: return "number";
|
||||
}
|
||||
|
|
|
@ -456,6 +456,8 @@ public class KeyboardParser {
|
|||
try {
|
||||
final boolean modeMatched = matchInteger(a,
|
||||
R.styleable.Keyboard_Case_mode, id.mMode);
|
||||
final boolean webInputMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_webInput, id.mWebInput);
|
||||
final boolean passwordInputMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
|
||||
final boolean settingsKeyMatched = matchBoolean(a,
|
||||
|
@ -476,16 +478,18 @@ public class KeyboardParser {
|
|||
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
|
||||
final boolean countryCodeMatched = matchString(a,
|
||||
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
||||
final boolean selected = modeMatched && passwordInputMatched && settingsKeyMatched
|
||||
&& voiceEnabledMatched && voiceKeyMatched && colorSchemeMatched
|
||||
&& imeActionMatched && languageCodeMatched && countryCodeMatched;
|
||||
final boolean selected = modeMatched && webInputMatched && passwordInputMatched
|
||||
&& settingsKeyMatched && voiceEnabledMatched && voiceKeyMatched
|
||||
&& colorSchemeMatched && imeActionMatched && languageCodeMatched
|
||||
&& countryCodeMatched;
|
||||
|
||||
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE,
|
||||
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE,
|
||||
textAttr(KeyboardId.modeName(
|
||||
a.getInt(R.styleable.Keyboard_Case_mode, -1)), "mode"),
|
||||
textAttr(KeyboardId.colorSchemeName(
|
||||
viewAttr.getInt(
|
||||
R.styleable.KeyboardView_colorScheme, -1)), "colorSchemeName"),
|
||||
booleanAttr(a, R.styleable.Keyboard_Case_webInput, "webInput"),
|
||||
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
|
||||
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
|
||||
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
|
||||
|
|
|
@ -81,7 +81,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
private static final String TAG = LatinIME.class.getSimpleName();
|
||||
private static final boolean PERF_DEBUG = false;
|
||||
private static final boolean TRACE = false;
|
||||
private static boolean DEBUG = LatinImeLogger.sDBG;
|
||||
private static boolean DEBUG;
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no microphone should be
|
||||
|
@ -357,6 +357,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
||||
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
||||
mRecorrection = Recorrection.getInstance();
|
||||
DEBUG = LatinImeLogger.sDBG;
|
||||
|
||||
loadSettings();
|
||||
|
||||
|
@ -506,7 +507,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
LatinKeyboardView inputView = switcher.getKeyboardView();
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onStartInputView: " + inputView);
|
||||
Log.d(TAG, "onStartInputView: inputType=" + ((attribute == null) ? "none"
|
||||
: String.format("0x%08x", attribute.inputType)));
|
||||
}
|
||||
// In landscape mode, this method gets called without the input view being created.
|
||||
if (inputView == null) {
|
||||
|
|
|
@ -538,8 +538,6 @@ public class Utils {
|
|||
return KeyboardId.MODE_IM;
|
||||
} else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
|
||||
return KeyboardId.MODE_TEXT;
|
||||
} else if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) {
|
||||
return KeyboardId.MODE_WEB;
|
||||
} else {
|
||||
return KeyboardId.MODE_TEXT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue