am ec8cb2eb: Merge "Remove web mode and add webInput boolean (DO NOT MERGE)" into honeycomb-mr2

* commit 'ec8cb2eb53ae8fdc45c51cf58b01384161901b97':
  Remove web mode and add webInput boolean (DO NOT MERGE)
This commit is contained in:
Tadashi G. Takaoka 2011-05-27 00:15:50 -07:00 committed by Android Git Automerger
commit d0a88868ca
7 changed files with 38 additions and 31 deletions

View file

@ -165,11 +165,10 @@
<enum name="url" value="1" /> <enum name="url" value="1" />
<enum name="email" value="2" /> <enum name="email" value="2" />
<enum name="im" value="3" /> <enum name="im" value="3" />
<enum name="web" value="4" /> <enum name="phone" value="4" />
<enum name="phone" value="5" /> <enum name="number" value="5" />
<enum name="number" value="6" />
<enum name="webEmail" value="7" />
</attr> </attr>
<attr name="webInput" format="boolean" />
<attr name="passwordInput" format="boolean" /> <attr name="passwordInput" format="boolean" />
<attr name="hasSettingsKey" format="string" /> <attr name="hasSettingsKey" format="string" />
<attr name="voiceKeyEnabled" format="string" /> <attr name="voiceKeyEnabled" format="string" />

View file

@ -23,7 +23,7 @@
> >
<switch> <switch>
<case <case
latin:mode="web" latin:webInput="true"
> >
<switch> <switch>
<case <case

View file

@ -46,7 +46,7 @@
</case> </case>
<!-- latin:hasVoiceKey="false" --> <!-- latin:hasVoiceKey="false" -->
<case <case
latin:mode="web" latin:webInput="true"
> >
<Key <Key
latin:keyLabel="." latin:keyLabel="."

View file

@ -37,7 +37,7 @@
latin:keyboardLayout="@xml/kbd_qwerty_f1" /> latin:keyboardLayout="@xml/kbd_qwerty_f1" />
<switch> <switch>
<case <case
latin:mode="web" latin:webInput="true"
> >
<Key <Key
latin:keyStyle="spaceKeyStyle" latin:keyStyle="spaceKeyStyle"
@ -88,7 +88,7 @@
latin:keyboardLayout="@xml/kbd_qwerty_f1" /> latin:keyboardLayout="@xml/kbd_qwerty_f1" />
<switch> <switch>
<case <case
latin:mode="web" latin:webInput="true"
> >
<Key <Key
latin:keyStyle="spaceKeyStyle" latin:keyStyle="spaceKeyStyle"
@ -118,7 +118,7 @@
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />
</case> </case>
<case <case
latin:mode="web" latin:webInput="true"
> >
<Key <Key
latin:keyStyle="returnKeyStyle" latin:keyStyle="returnKeyStyle"

View file

@ -33,17 +33,15 @@ public class KeyboardId {
public static final int MODE_URL = 1; public static final int MODE_URL = 1;
public static final int MODE_EMAIL = 2; public static final int MODE_EMAIL = 2;
public static final int MODE_IM = 3; public static final int MODE_IM = 3;
public static final int MODE_WEB = 4; public static final int MODE_PHONE = 4;
public static final int MODE_PHONE = 5; public static final int MODE_NUMBER = 5;
public static final int MODE_NUMBER = 6;
// Should come up with implementing web & email mode clearer way.
public static final int MODE_WEB_EMAIL = 7;
public final Locale mLocale; public final Locale mLocale;
public final int mOrientation; public final int mOrientation;
public final int mMode; public final int mMode;
public final int mXmlId; public final int mXmlId;
public final int mColorScheme; public final int mColorScheme;
public final boolean mWebInput;
public final boolean mPasswordInput; public final boolean mPasswordInput;
public final boolean mHasSettingsKey; public final boolean mHasSettingsKey;
public final boolean mVoiceKeyEnabled; public final boolean mVoiceKeyEnabled;
@ -64,6 +62,7 @@ public class KeyboardId {
this.mMode = mode; this.mMode = mode;
this.mXmlId = xmlId; this.mXmlId = xmlId;
this.mColorScheme = colorScheme; this.mColorScheme = colorScheme;
this.mWebInput = Utils.isWebInputType(inputType);
this.mPasswordInput = Utils.isPasswordInputType(inputType) this.mPasswordInput = Utils.isPasswordInputType(inputType)
|| Utils.isVisiblePasswordInputType(inputType); || Utils.isVisiblePasswordInputType(inputType);
this.mHasSettingsKey = hasSettingsKey; this.mHasSettingsKey = hasSettingsKey;
@ -82,6 +81,7 @@ public class KeyboardId {
mode, mode,
xmlId, xmlId,
colorScheme, colorScheme,
mWebInput,
mPasswordInput, mPasswordInput,
hasSettingsKey, hasSettingsKey,
voiceKeyEnabled, voiceKeyEnabled,
@ -122,6 +122,7 @@ public class KeyboardId {
&& other.mMode == this.mMode && other.mMode == this.mMode
&& other.mXmlId == this.mXmlId && other.mXmlId == this.mXmlId
&& other.mColorScheme == this.mColorScheme && other.mColorScheme == this.mColorScheme
&& other.mWebInput == this.mWebInput
&& other.mPasswordInput == this.mPasswordInput && other.mPasswordInput == this.mPasswordInput
&& other.mHasSettingsKey == this.mHasSettingsKey && other.mHasSettingsKey == this.mHasSettingsKey
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled && other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
@ -137,12 +138,13 @@ public class KeyboardId {
@Override @Override
public String toString() { public String toString() {
return String.format("[%s.xml %s %s %s imeAction=%s %s%s%s%s%s%s]", return String.format("[%s.xml %s %s %s imeAction=%s %s%s%s%s%s%s%s]",
mXmlName, mXmlName,
mLocale, mLocale,
(mOrientation == 1 ? "port" : "land"), (mOrientation == 1 ? "port" : "land"),
modeName(mMode), modeName(mMode),
imeOptionsName(mImeAction), imeOptionsName(mImeAction),
(mWebInput ? " webInput" : ""),
(mPasswordInput ? " passwordInput" : ""), (mPasswordInput ? " passwordInput" : ""),
(mHasSettingsKey ? " hasSettingsKey" : ""), (mHasSettingsKey ? " hasSettingsKey" : ""),
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""), (mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
@ -158,10 +160,8 @@ public class KeyboardId {
case MODE_URL: return "url"; case MODE_URL: return "url";
case MODE_EMAIL: return "email"; case MODE_EMAIL: return "email";
case MODE_IM: return "im"; case MODE_IM: return "im";
case MODE_WEB: return "web";
case MODE_PHONE: return "phone"; case MODE_PHONE: return "phone";
case MODE_NUMBER: return "number"; case MODE_NUMBER: return "number";
case MODE_WEB_EMAIL: return "webEmail";
} }
return null; return null;
} }

View file

@ -419,6 +419,8 @@ public class KeyboardParser {
try { try {
final boolean modeMatched = matchInteger(a, final boolean modeMatched = matchInteger(a,
R.styleable.Keyboard_Case_mode, id.mMode); R.styleable.Keyboard_Case_mode, id.mMode);
final boolean webInputMatched = matchBoolean(a,
R.styleable.Keyboard_Case_webInput, id.mWebInput);
final boolean passwordInputMatched = matchBoolean(a, final boolean passwordInputMatched = matchBoolean(a,
R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput); R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
final boolean settingsKeyMatched = matchBoolean(a, final boolean settingsKeyMatched = matchBoolean(a,
@ -439,16 +441,18 @@ public class KeyboardParser {
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage()); R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
final boolean countryCodeMatched = matchString(a, final boolean countryCodeMatched = matchString(a,
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry()); R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
final boolean selected = modeMatched && passwordInputMatched && settingsKeyMatched final boolean selected = modeMatched && webInputMatched && passwordInputMatched
&& voiceEnabledMatched && voiceKeyMatched && colorSchemeMatched && settingsKeyMatched && voiceEnabledMatched && voiceKeyMatched
&& imeActionMatched && languageCodeMatched && countryCodeMatched; && 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( textAttr(KeyboardId.modeName(
a.getInt(R.styleable.Keyboard_Case_mode, -1)), "mode"), a.getInt(R.styleable.Keyboard_Case_mode, -1)), "mode"),
textAttr(KeyboardId.colorSchemeName( textAttr(KeyboardId.colorSchemeName(
viewAttr.getInt( viewAttr.getInt(
R.styleable.KeyboardView_colorScheme, -1)), "colorSchemeName"), 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_passwordInput, "passwordInput"),
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"), booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"), booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),

View file

@ -16,8 +16,6 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.keyboard.KeyboardId;
import android.content.res.Resources; import android.content.res.Resources;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -25,13 +23,14 @@ import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.os.Process; import android.os.Process;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import com.android.inputmethod.keyboard.KeyboardId;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -39,7 +38,6 @@ import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -487,9 +485,7 @@ public class Utils {
case InputType.TYPE_CLASS_PHONE: case InputType.TYPE_CLASS_PHONE:
return KeyboardId.MODE_PHONE; return KeyboardId.MODE_PHONE;
case InputType.TYPE_CLASS_TEXT: case InputType.TYPE_CLASS_TEXT:
if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) { if (Utils.isEmailVariation(variation)) {
return KeyboardId.MODE_WEB_EMAIL;
} else if (Utils.isEmailVariation(variation)) {
return KeyboardId.MODE_EMAIL; return KeyboardId.MODE_EMAIL;
} else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) {
return KeyboardId.MODE_URL; return KeyboardId.MODE_URL;
@ -497,9 +493,6 @@ public class Utils {
return KeyboardId.MODE_IM; return KeyboardId.MODE_IM;
} else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
return KeyboardId.MODE_TEXT; 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 { } else {
return KeyboardId.MODE_TEXT; return KeyboardId.MODE_TEXT;
} }
@ -513,6 +506,17 @@ public class Utils {
|| variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; || 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 // Please refer to TextView.isPasswordInputType
public static boolean isPasswordInputType(int inputType) { public static boolean isPasswordInputType(int inputType) {
final int variation = final int variation =