From 38515ae57709b5d108d67b6f958b3e856fabc83d Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 26 May 2011 23:18:17 +0900 Subject: [PATCH] Remove web mode and add webInput boolean (DO NOT MERGE) Bug: 4490948 Change-Id: I4cd1af0b48d7ebcf8f4bd939e0e363e34dbfe8b7 --- java/res/values/attrs.xml | 7 +++--- java/res/xml-sw600dp/kbd_settings.xml | 2 +- java/res/xml/kbd_qwerty_f1.xml | 2 +- java/res/xml/kbd_qwerty_row4.xml | 6 ++--- .../inputmethod/keyboard/KeyboardId.java | 16 ++++++------- .../inputmethod/keyboard/KeyboardParser.java | 12 ++++++---- .../com/android/inputmethod/latin/Utils.java | 24 +++++++++++-------- 7 files changed, 38 insertions(+), 31 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index fb4d97b8b..3bd6619d8 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -165,11 +165,10 @@ - - - - + + + diff --git a/java/res/xml-sw600dp/kbd_settings.xml b/java/res/xml-sw600dp/kbd_settings.xml index 86dc1f7e7..14f7377a8 100644 --- a/java/res/xml-sw600dp/kbd_settings.xml +++ b/java/res/xml-sw600dp/kbd_settings.xml @@ -23,7 +23,7 @@ > %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/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index a895ba281..1cbc434b6 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -16,8 +16,6 @@ package com.android.inputmethod.latin; -import com.android.inputmethod.keyboard.KeyboardId; - import android.content.res.Resources; import android.inputmethodservice.InputMethodService; import android.os.AsyncTask; @@ -25,13 +23,14 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Process; import android.text.InputType; -import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; +import com.android.inputmethod.keyboard.KeyboardId; + import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -39,7 +38,6 @@ import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; -import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.Date; @@ -487,9 +485,7 @@ public class Utils { case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: - if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) { - return KeyboardId.MODE_WEB_EMAIL; - } else if (Utils.isEmailVariation(variation)) { + if (Utils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; @@ -497,9 +493,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 - || variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD) { - return KeyboardId.MODE_WEB; } else { return KeyboardId.MODE_TEXT; } @@ -513,6 +506,17 @@ public class Utils { || variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; } + public static boolean isWebInputType(int inputType) { + final int variation = + inputType & (InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION); + return (variation + == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT)) + || (variation + == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD)) + || (variation + == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS)); + } + // Please refer to TextView.isPasswordInputType public static boolean isPasswordInputType(int inputType) { final int variation =