Introduce web and email mode (DO NOT MERGE)

This change introduces new keyboard mode "webEmail" to honor
InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS. In this mode, both
'@' key and TAB key appear on the keyboard.

The keyboard layouts will be modified with other change.

Bug: 4490948
Change-Id: I66f9bda4907da448db097e9c900199dfa700b16a
main
Tadashi G. Takaoka 2011-05-26 19:19:13 +09:00
parent b0598460cf
commit f5d9649680
4 changed files with 27 additions and 14 deletions

View File

@ -167,6 +167,8 @@
<enum name="im" value="3" /> <enum name="im" value="3" />
<enum name="web" value="4" /> <enum name="web" value="4" />
<enum name="phone" value="5" /> <enum name="phone" value="5" />
<enum name="number" value="6" />
<enum name="webEmail" value="7" />
</attr> </attr>
<attr name="passwordInput" format="boolean" /> <attr name="passwordInput" format="boolean" />
<attr name="hasSettingsKey" format="string" /> <attr name="hasSettingsKey" format="string" />

View File

@ -36,6 +36,8 @@ public class KeyboardId {
public static final int MODE_WEB = 4; public static final int MODE_WEB = 4;
public static final int MODE_PHONE = 5; public static final int MODE_PHONE = 5;
public static final int MODE_NUMBER = 6; 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;
@ -159,6 +161,7 @@ public class KeyboardId {
case MODE_WEB: return "web"; 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;
} }
@ -182,6 +185,7 @@ public class KeyboardId {
case EditorInfo.IME_ACTION_SEARCH: action = "actionSearch"; break; case EditorInfo.IME_ACTION_SEARCH: action = "actionSearch"; break;
case EditorInfo.IME_ACTION_SEND: action = "actionSend"; break; case EditorInfo.IME_ACTION_SEND: action = "actionSend"; break;
case EditorInfo.IME_ACTION_DONE: action = "actionDone"; break; case EditorInfo.IME_ACTION_DONE: action = "actionDone"; break;
case EditorInfo.IME_ACTION_NEXT: action = "actionNext"; break;
case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break; case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break;
default: action = "actionUnknown(" + actionNo + ")"; break; default: action = "actionUnknown(" + actionNo + ")"; break;
} }

View File

@ -16,15 +16,6 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
import com.android.inputmethod.latin.Utils.RingCharBuffer;
import com.android.inputmethod.voice.VoiceIMEConnector;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -72,6 +63,15 @@ import android.widget.FrameLayout;
import android.widget.HorizontalScrollView; import android.widget.HorizontalScrollView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
import com.android.inputmethod.latin.Utils.RingCharBuffer;
import com.android.inputmethod.voice.VoiceIMEConnector;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
@ -85,7 +85,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final String TAG = LatinIME.class.getSimpleName(); private static final String TAG = LatinIME.class.getSimpleName();
private static final boolean PERF_DEBUG = false; private static final boolean PERF_DEBUG = false;
private static final boolean TRACE = false; private static final boolean TRACE = false;
private static boolean DEBUG = LatinImeLogger.sDBG; private static boolean DEBUG;
/** /**
* The private IME option used to indicate that no microphone should be * The private IME option used to indicate that no microphone should be
@ -390,6 +390,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mKeyboardSwitcher = KeyboardSwitcher.getInstance(); mKeyboardSwitcher = KeyboardSwitcher.getInstance();
mAccessibilityUtils = AccessibilityUtils.getInstance(); mAccessibilityUtils = AccessibilityUtils.getInstance();
DEBUG = LatinImeLogger.sDBG;
final Resources res = getResources(); final Resources res = getResources();
mResources = res; mResources = res;
@ -532,8 +533,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final KeyboardSwitcher switcher = mKeyboardSwitcher; final KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getInputView(); LatinKeyboardView inputView = switcher.getInputView();
if(DEBUG) { if (DEBUG) {
Log.d(TAG, "onStartInputView: " + inputView); Log.d(TAG, "onStartInputView: inputType=" + ((attribute == null) ? "none"
: String.format("0x%08x", attribute.inputType)));
} }
// In landscape mode, this method gets called without the input view being created. // In landscape mode, this method gets called without the input view being created.
if (inputView == null) { if (inputView == null) {

View File

@ -25,6 +25,7 @@ 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;
@ -38,6 +39,7 @@ 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;
@ -485,7 +487,9 @@ 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 (Utils.isEmailVariation(variation)) { if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) {
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;
@ -493,7 +497,8 @@ 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) { } else if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
|| variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD) {
return KeyboardId.MODE_WEB; return KeyboardId.MODE_WEB;
} else { } else {
return KeyboardId.MODE_TEXT; return KeyboardId.MODE_TEXT;