aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-02-17 12:45:31 +0900
committerKen Wakasa <kwakasa@google.com>2011-02-17 14:44:44 +0900
commit16ee377bcd5fd13cd10e88da1b95a0059786306a (patch)
tree61316978bb0cfa3cd65b193151579ed9119d9720 /java/src
parent58e01050e1f7f085324fcd305542a8581a3ebc7c (diff)
downloadlatinime-16ee377bcd5fd13cd10e88da1b95a0059786306a.tar.gz
latinime-16ee377bcd5fd13cd10e88da1b95a0059786306a.tar.xz
latinime-16ee377bcd5fd13cd10e88da1b95a0059786306a.zip
Fix password variation check code
Change-Id: Id994112a029982b4dabd6ebca34edd1d787e5ae2
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index cb1ff41dd..9f65bf788 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -494,10 +494,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return container;
}
- private static boolean isPasswordVariation(int variation) {
- return variation == InputType.TYPE_TEXT_VARIATION_PASSWORD
- || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
- || variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
+ // Please refer to TextView.isPasswordInputType
+ private static boolean isPasswordInputType(int inputType) {
+ final int variation =
+ inputType & (InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION);
+ return (variation
+ == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD))
+ || (variation
+ == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD))
+ || (variation
+ == (InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD));
+ }
+
+ // Please refer to TextView.isVisiblePasswordInputType
+ private static boolean isVisiblePasswordInputType(int inputType) {
+ final int variation =
+ inputType & (InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION);
+ return variation
+ == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}
private static boolean isEmailVariation(int variation) {
@@ -525,8 +539,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Most such things we decide below in initializeInputAttributesAndGetMode, but we need to
// know now whether this is a password text field, because we need to know now whether we
// want to enable the voice button.
- mVoiceConnector.resetVoiceStates(isPasswordVariation(
- attribute.inputType & InputType.TYPE_MASK_VARIATION));
+ mVoiceConnector.resetVoiceStates(isPasswordInputType(attribute.inputType)
+ || isVisiblePasswordInputType(attribute.inputType));
final int mode = initializeInputAttributesAndGetMode(attribute.inputType);
@@ -583,7 +597,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
case InputType.TYPE_CLASS_TEXT:
mIsSettingsSuggestionStripOn = true;
// Make sure that passwords are not displayed in candidate view
- if (isPasswordVariation(variation)) {
+ if (isPasswordInputType(inputType) || isVisiblePasswordInputType(inputType)) {
mIsSettingsSuggestionStripOn = false;
}
if (isEmailVariation(variation)