am f5d96496: Introduce web and email mode (DO NOT MERGE)

* commit 'f5d9649680ae5ee3fe11e839d3111f3351d15285':
  Introduce web and email mode (DO NOT MERGE)
This commit is contained in:
Tadashi G. Takaoka 2011-05-26 11:06:34 -07:00 committed by Android Git Automerger
commit f274c5800b
4 changed files with 27 additions and 14 deletions

View file

@ -167,6 +167,8 @@
<enum name="im" value="3" />
<enum name="web" value="4" />
<enum name="phone" value="5" />
<enum name="number" value="6" />
<enum name="webEmail" value="7" />
</attr>
<attr name="passwordInput" format="boolean" />
<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_PHONE = 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 int mOrientation;
@ -159,6 +161,7 @@ public class KeyboardId {
case MODE_WEB: return "web";
case MODE_PHONE: return "phone";
case MODE_NUMBER: return "number";
case MODE_WEB_EMAIL: return "webEmail";
}
return null;
}
@ -182,6 +185,7 @@ public class KeyboardId {
case EditorInfo.IME_ACTION_SEARCH: action = "actionSearch"; break;
case EditorInfo.IME_ACTION_SEND: action = "actionSend"; 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;
default: action = "actionUnknown(" + actionNo + ")"; break;
}

View file

@ -16,15 +16,6 @@
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.content.BroadcastReceiver;
import android.content.Context;
@ -72,6 +63,15 @@ import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
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.PrintWriter;
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 boolean PERF_DEBUG = 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
@ -390,6 +390,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
mAccessibilityUtils = AccessibilityUtils.getInstance();
DEBUG = LatinImeLogger.sDBG;
final Resources res = getResources();
mResources = res;
@ -532,8 +533,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getInputView();
if(DEBUG) {
Log.d(TAG, "onStartInputView: " + inputView);
if (DEBUG) {
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.
if (inputView == null) {

View file

@ -25,6 +25,7 @@ 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;
@ -38,6 +39,7 @@ 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;
@ -485,7 +487,9 @@ public class Utils {
case InputType.TYPE_CLASS_PHONE:
return KeyboardId.MODE_PHONE;
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;
} else if (variation == InputType.TYPE_TEXT_VARIATION_URI) {
return KeyboardId.MODE_URL;
@ -493,7 +497,8 @@ 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) {
} 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;