From 4d0fa3177994fd52297819b69f98ebd272eb800f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 19 Nov 2012 19:30:47 +0900 Subject: [PATCH] Fix variation dumping. Variations are not flags - they should not be OR'd in this way. Only one variation may be active at a time. Change-Id: I9d3d4c8fc04af56c914c65f9c55f1e7b9517fc68 --- .../inputmethod/latin/InputAttributes.java | 80 ++++++++++++------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java index 2f7608a03..6c1e0301a 100644 --- a/java/src/com/android/inputmethod/latin/InputAttributes.java +++ b/java/src/com/android/inputmethod/latin/InputAttributes.java @@ -112,36 +112,56 @@ public final class InputAttributes { if (inputClass == InputType.TYPE_CLASS_DATETIME) Log.i(TAG, " TYPE_CLASS_DATETIME"); Log.i(TAG, "Variation:"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)) - Log.i(TAG, " TYPE_TEXT_VARIATION_EMAIL_ADDRESS"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT)) - Log.i(TAG, " TYPE_TEXT_VARIATION_EMAIL_SUBJECT"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_FILTER)) - Log.i(TAG, " TYPE_TEXT_VARIATION_FILTER"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE)) - Log.i(TAG, " TYPE_TEXT_VARIATION_LONG_MESSAGE"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_NORMAL)) - Log.i(TAG, " TYPE_TEXT_VARIATION_NORMAL"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD)) - Log.i(TAG, " TYPE_TEXT_VARIATION_PASSWORD"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_PERSON_NAME)) - Log.i(TAG, " TYPE_TEXT_VARIATION_PERSON_NAME"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_PHONETIC)) - Log.i(TAG, " TYPE_TEXT_VARIATION_PHONETIC"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS)) - Log.i(TAG, " TYPE_TEXT_VARIATION_POSTAL_ADDRESS"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)) - Log.i(TAG, " TYPE_TEXT_VARIATION_SHORT_MESSAGE"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_URI)) - Log.i(TAG, " TYPE_TEXT_VARIATION_URI"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD)) - Log.i(TAG, " TYPE_TEXT_VARIATION_VISIBLE_PASSWORD"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT)) - Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_EDIT_TEXT"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS)) - Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS"); - if (0 != (inputType & InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD)) - Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_PASSWORD"); + switch (InputType.TYPE_MASK_VARIATION & inputType) { + case InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: + Log.i(TAG, " TYPE_TEXT_VARIATION_EMAIL_ADDRESS"); + break; + case InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT: + Log.i(TAG, " TYPE_TEXT_VARIATION_EMAIL_SUBJECT"); + break; + case InputType.TYPE_TEXT_VARIATION_FILTER: + Log.i(TAG, " TYPE_TEXT_VARIATION_FILTER"); + break; + case InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE: + Log.i(TAG, " TYPE_TEXT_VARIATION_LONG_MESSAGE"); + break; + case InputType.TYPE_TEXT_VARIATION_NORMAL: + Log.i(TAG, " TYPE_TEXT_VARIATION_NORMAL"); + break; + case InputType.TYPE_TEXT_VARIATION_PASSWORD: + Log.i(TAG, " TYPE_TEXT_VARIATION_PASSWORD"); + break; + case InputType.TYPE_TEXT_VARIATION_PERSON_NAME: + Log.i(TAG, " TYPE_TEXT_VARIATION_PERSON_NAME"); + break; + case InputType.TYPE_TEXT_VARIATION_PHONETIC: + Log.i(TAG, " TYPE_TEXT_VARIATION_PHONETIC"); + break; + case InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS: + Log.i(TAG, " TYPE_TEXT_VARIATION_POSTAL_ADDRESS"); + break; + case InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE: + Log.i(TAG, " TYPE_TEXT_VARIATION_SHORT_MESSAGE"); + break; + case InputType.TYPE_TEXT_VARIATION_URI: + Log.i(TAG, " TYPE_TEXT_VARIATION_URI"); + break; + case InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: + Log.i(TAG, " TYPE_TEXT_VARIATION_VISIBLE_PASSWORD"); + break; + case InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: + Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_EDIT_TEXT"); + break; + case InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: + Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS"); + break; + case InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD: + Log.i(TAG, " TYPE_TEXT_VARIATION_WEB_PASSWORD"); + break; + default: + Log.i(TAG, " Unknown variation"); + break; + } Log.i(TAG, "Flags:"); if (0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)) Log.i(TAG, " TYPE_TEXT_FLAG_NO_SUGGESTIONS");