Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java

Issue 2523753003: Add inputmode to android ImeAdapater. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
index 4a773393b07c6c7d803be65c1ee3b7e06fb36e93..c240c7bcab2b8c141ced02d288d349f9cf9ac8cb 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
@@ -26,6 +26,7 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.blink_public.web.WebInputEventModifier;
import org.chromium.blink_public.web.WebInputEventType;
+import org.chromium.blink_public.web.WebTextInputMode;
import org.chromium.content.browser.RenderCoordinates;
import org.chromium.content.browser.picker.InputDialogContainer;
import org.chromium.ui.base.ime.TextInputType;
@@ -105,6 +106,7 @@ public class ImeAdapter {
private int mTextInputType = TextInputType.NONE;
private int mTextInputFlags;
+ private int mTextInputMode = WebTextInputMode.kDefault;
// Keep the current configuration to detect the change when onConfigurationChanged() is called.
private Configuration mCurrentConfig;
@@ -189,9 +191,9 @@ public class ImeAdapter {
return null;
}
if (mInputConnectionFactory == null) return null;
- setInputConnection(mInputConnectionFactory.initializeAndGet(
- mViewEmbedder.getAttachedView(), this, mTextInputType, mTextInputFlags,
- mLastSelectionStart, mLastSelectionEnd, outAttrs));
+ setInputConnection(mInputConnectionFactory.initializeAndGet(mViewEmbedder.getAttachedView(),
+ this, mTextInputType, mTextInputFlags, mTextInputMode, mLastSelectionStart,
+ mLastSelectionEnd, outAttrs));
if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection: " + mInputConnection);
if (mCursorAnchorInfoController != null) {
@@ -268,21 +270,30 @@ public class ImeAdapter {
* Shows or hides the keyboard based on passed parameters.
* @param textInputType Text input type for the currently focused field in renderer.
* @param textInputFlags Text input flags.
+ * @param textInputMode Text input mode.
* @param showIfNeeded Whether the keyboard should be shown if it is currently hidden.
*/
- public void updateKeyboardVisibility(int textInputType,
- int textInputFlags, boolean showIfNeeded) {
+ public void updateKeyboardVisibility(
+ int textInputType, int textInputFlags, int textInputMode, boolean showIfNeeded) {
if (DEBUG_LOGS) {
Log.w(TAG, "updateKeyboardVisibility: type [%d->%d], flags [%d], show [%b], ",
mTextInputType, textInputType, textInputFlags, showIfNeeded);
}
+ boolean needsRestart = false;
mTextInputFlags = textInputFlags;
+ if (mTextInputMode != textInputMode) {
+ mTextInputMode = textInputMode;
+ needsRestart = true;
+ }
+
if (mTextInputType != textInputType) {
mTextInputType = textInputType;
// No need to restart if we are going to hide anyways.
- if (textInputType != TextInputType.NONE) restartInput();
+ if (textInputType != TextInputType.NONE) needsRestart = true;
}
+ if (needsRestart) restartInput();
+
// There is no API for us to get notified of user's dismissal of keyboard.
// Therefore, we should try to show keyboard even when text input type hasn't changed.
if (textInputType != TextInputType.NONE) {
@@ -491,6 +502,7 @@ public class ImeAdapter {
if (DEBUG_LOGS) Log.w(TAG, "resetAndHideKeyboard");
mTextInputType = TextInputType.NONE;
mTextInputFlags = 0;
+ mTextInputMode = WebTextInputMode.kDefault;
// This will trigger unblocking if necessary.
hideKeyboard();
}

Powered by Google App Engine
This is Rietveld 408576698