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

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

Issue 1138103003: Remember previous keyboard type and use that when switching to "none" type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clear sPreviousOutAttrs when closing keyboard Created 5 years, 7 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56255655afa3fc708003461e24b7fc24b03284a5..fed38198817387d79e2910c421f39da90cb2536d 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
@@ -100,6 +100,7 @@ public class ImeAdapter {
static char[] sSingleCharArray = new char[1];
static KeyCharacterMap sKeyCharacterMap;
+ private static EditorInfo sPreviousOutAttrs;
private long mNativeImeAdapterAndroid;
private InputMethodManagerWrapper mInputMethodManagerWrapper;
@@ -133,7 +134,20 @@ public class ImeAdapter {
public static class AdapterInputConnectionFactory {
public AdapterInputConnection get(View view, ImeAdapter imeAdapter,
Editable editable, EditorInfo outAttrs) {
- return new AdapterInputConnection(view, imeAdapter, editable, outAttrs);
+ AdapterInputConnection conn = new AdapterInputConnection(
+ view, imeAdapter, editable, outAttrs);
+ // When switching between fields, the keyboard first reverts to a "none" type
+ // before changing to the type of the new field. This can cause the keyboard
+ // layout to flicker back to the default layout on older Android versions (<5.0).
+ // To avoid this, we remember the previous settings and return those instead.
+ // http://crbug.com/484139
+ if (imeAdapter.getTextInputType() == TextInputType.NONE && sPreviousOutAttrs != null) {
+ outAttrs.inputType = sPreviousOutAttrs.inputType;
+ outAttrs.imeOptions = sPreviousOutAttrs.imeOptions;
+ } else {
+ sPreviousOutAttrs = outAttrs;
+ }
+ return conn;
}
}
@@ -287,6 +301,7 @@ public class ImeAdapter {
unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver() : null);
}
mViewEmbedder.onDismissInput();
+ sPreviousOutAttrs = null;
}
private boolean hasInputType() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698