Bug 746142 - Part 2 - Use inputmode attribute to vary the virtual keyboard on Android. f=mounir r=cpeterson
This commit is contained in:
@@ -86,6 +86,7 @@ class GeckoInputConnection
|
||||
private static final Timer mIMETimer = new Timer("GeckoInputConnection Timer");
|
||||
private static int mIMEState;
|
||||
private static String mIMETypeHint = "";
|
||||
private static String mIMEModeHint = "";
|
||||
private static String mIMEActionHint = "";
|
||||
|
||||
private String mCurrentInputMethod;
|
||||
@@ -804,6 +805,20 @@ class GeckoInputConnection
|
||||
else if (mIMETypeHint.equalsIgnoreCase("time"))
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_DATETIME
|
||||
| InputType.TYPE_DATETIME_VARIATION_TIME;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("numeric"))
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER |
|
||||
InputType.TYPE_NUMBER_FLAG_SIGNED |
|
||||
InputType.TYPE_NUMBER_FLAG_DECIMAL;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("digit"))
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("uppercase"))
|
||||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("lowercase"))
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("titlecase"))
|
||||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
|
||||
else if (mIMEModeHint.equalsIgnoreCase("autocapitalized"))
|
||||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
|
||||
if (mIMEActionHint.equalsIgnoreCase("go"))
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
|
||||
@@ -1030,7 +1045,7 @@ class GeckoInputConnection
|
||||
});
|
||||
}
|
||||
|
||||
public void notifyIMEEnabled(final int state, final String typeHint, final String actionHint) {
|
||||
public void notifyIMEEnabled(final int state, final String typeHint, final String modeHint, final String actionHint) {
|
||||
postToUiThread(new Runnable() {
|
||||
public void run() {
|
||||
View v = getView();
|
||||
@@ -1041,6 +1056,7 @@ class GeckoInputConnection
|
||||
In addition, the IME UI is hidden */
|
||||
mIMEState = state;
|
||||
mIMETypeHint = (typeHint == null) ? "" : typeHint;
|
||||
mIMEModeHint = (modeHint == null) ? "" : modeHint;
|
||||
mIMEActionHint = (actionHint == null) ? "" : actionHint;
|
||||
IMEStateUpdater.enableIME();
|
||||
}
|
||||
@@ -1441,13 +1457,14 @@ private static final class DebugGeckoInputConnection extends GeckoInputConnectio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyIMEEnabled(int state, String typeHint, String actionHint) {
|
||||
public void notifyIMEEnabled(int state, String typeHint, String modeHint, String actionHint) {
|
||||
Log.d(LOGTAG, "IME: >notifyIMEEnabled(state=" + state + ", typeHint=\"" + typeHint
|
||||
+ "\", actionHint=\"" + actionHint + "\"");
|
||||
+ "\", modeHint=\"" + modeHint + "\", actionHint=\""
|
||||
+ actionHint + "\"");
|
||||
GeckoApp.assertOnGeckoThread();
|
||||
if (state < IME_STATE_DISABLED || state > IME_STATE_PLUGIN)
|
||||
throw new IllegalArgumentException("Unexpected IMEState=" + state);
|
||||
super.notifyIMEEnabled(state, typeHint, actionHint);
|
||||
super.notifyIMEEnabled(state, typeHint, modeHint, actionHint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user