aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-05-27 21:41:13 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-05-27 21:47:14 +0900
commit9e2d810dc524380ca1db6b384cfb00b4401585e5 (patch)
tree76a0a9a7c498aab54d2f8d94330b2ce80a419b2c /java/src
parent144e97f154ef27c48ac9030980ebb6f3ae959369 (diff)
downloadlatinime-9e2d810dc524380ca1db6b384cfb00b4401585e5.tar.gz
latinime-9e2d810dc524380ca1db6b384cfb00b4401585e5.tar.xz
latinime-9e2d810dc524380ca1db6b384cfb00b4401585e5.zip
Remove web mode and add webInput boolean
Bug: 4490948 Change-Id: I6fe23c9ab4918eab6806cc621c4d6821c2e1baf9 Cherry-Pick: I4cd1af0b
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/compat/InputTypeCompatUtils.java25
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java17
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardParser.java12
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java6
-rw-r--r--java/src/com/android/inputmethod/latin/Utils.java2
5 files changed, 44 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputTypeCompatUtils.java b/java/src/com/android/inputmethod/compat/InputTypeCompatUtils.java
index d85174188..6684f6a8f 100644
--- a/java/src/com/android/inputmethod/compat/InputTypeCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/InputTypeCompatUtils.java
@@ -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 =
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index 2a5e17771..88d23985a 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -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";
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
index 5980f0255..43d9f271f 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
@@ -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"),
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d625951fc..fd6c47803 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -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) {
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index 5207f38ad..66a6d161b 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -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;
}