Treat the new web fields like their corresponding variations.

Bug:2692655
Bug:2460543

Change-Id: I86e814902447ecd5c8b00e399a0143d3dc2ad2cf
main
Leon Scroggins 2010-11-02 14:34:45 -04:00
parent 9d34f2c72e
commit 47f795dc87
1 changed files with 15 additions and 6 deletions

View File

@ -548,6 +548,17 @@ public class LatinIME extends InputMethodService
return mCandidateViewContainer; return mCandidateViewContainer;
} }
private static boolean isPasswordVariation(int variation) {
return variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD
|| variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
|| variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD;
}
private static boolean isEmailVariation(int variation) {
return variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|| variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
}
@Override @Override
public void onStartInputView(EditorInfo attribute, boolean restarting) { public void onStartInputView(EditorInfo attribute, boolean restarting) {
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
@ -570,8 +581,7 @@ public class LatinIME extends InputMethodService
// the switch statement) whether we want to enable the voice button. // the switch statement) whether we want to enable the voice button.
mPasswordText = false; mPasswordText = false;
int variation = attribute.inputType & EditorInfo.TYPE_MASK_VARIATION; int variation = attribute.inputType & EditorInfo.TYPE_MASK_VARIATION;
if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD || if (isPasswordVariation(variation)) {
variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
mPasswordText = true; mPasswordText = true;
} }
@ -605,17 +615,16 @@ public class LatinIME extends InputMethodService
//startPrediction(); //startPrediction();
mPredictionOn = true; mPredictionOn = true;
// Make sure that passwords are not displayed in candidate view // Make sure that passwords are not displayed in candidate view
if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD || if (isPasswordVariation(variation)) {
variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD ) {
mPredictionOn = false; mPredictionOn = false;
} }
if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS if (isEmailVariation(variation)
|| variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) { || variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) {
mAutoSpace = false; mAutoSpace = false;
} else { } else {
mAutoSpace = true; mAutoSpace = true;
} }
if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) { if (isEmailVariation(variation)) {
mPredictionOn = false; mPredictionOn = false;
mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_EMAIL, mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_EMAIL,
attribute.imeOptions, enableVoiceButton); attribute.imeOptions, enableVoiceButton);