diff options
author | Tarun Nainani <tnainani@codeaurora.org> | 2014-04-28 19:38:28 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2014-04-28 22:03:26 -0700 |
commit | d530673c1e7656b3ec57790a72021635ef3c83e7 (patch) | |
tree | ddc807f57b771b9e8e314fdda4cb7adb50dc8c8b /src/com/android/browser/UrlInputView.java | |
parent | 2d7e1c7b7f696702edaff00c25ddc9b2008cfde8 (diff) | |
download | android_packages_apps_Gello-d530673c1e7656b3ec57790a72021635ef3c83e7.tar.gz android_packages_apps_Gello-d530673c1e7656b3ec57790a72021635ef3c83e7.tar.bz2 android_packages_apps_Gello-d530673c1e7656b3ec57790a72021635ef3c83e7.zip |
Bug fix: Chinese keyboard not setting to english alphabet by default.
Return BrowserInputConnection only in case of AOSP keyboard. In case
of other Keyboards (for ex Chinese etc) we return the base class
input connection.
Change-Id: I9d3d3e5a086e8edddbcbb4f1626e9e433e509c11
Diffstat (limited to 'src/com/android/browser/UrlInputView.java')
-rw-r--r-- | src/com/android/browser/UrlInputView.java | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java index 9cdc4233..c8f2d401 100644 --- a/src/com/android/browser/UrlInputView.java +++ b/src/com/android/browser/UrlInputView.java @@ -16,10 +16,14 @@ package com.android.browser; +import android.content.ContentResolver; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.inputmethodservice.InputMethodService; +import android.provider.Settings.Secure; +import android.os.Build; import android.text.Editable; import android.text.InputFilter; import android.text.InputFilter.LengthFilter; @@ -34,7 +38,9 @@ import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; +import android.view.inputmethod.InputMethodSubtype; import android.text.InputType; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -50,6 +56,7 @@ import com.android.browser.search.SearchEngine; import com.android.browser.search.SearchEngineInfo; import com.android.browser.search.SearchEngines; +import java.util.List; /** * url/search input view * handling suggestions @@ -60,6 +67,7 @@ public class UrlInputView extends AutoCompleteTextView static final String TYPED = "browser-type"; static final String SUGGESTED = "browser-suggest"; + static final String LATIN_INPUTMETHOD_PACKAGE_NAME = "com.android.inputmethod.latin"; static final int POST_DELAY = 100; static final int URL_MAX_LENGTH = 2048; @@ -107,14 +115,32 @@ public class UrlInputView extends AutoCompleteTextView this(context, attrs, 0); } + private String getCurrentImeInfo(){ + InputMethodManager imm = + (InputMethodManager) mContext.getSystemService(mContext.INPUT_METHOD_SERVICE); + List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList(); + + final int n = mInputMethodProperties.size(); + for (int i = 0; i < n; i++) { + InputMethodInfo imeInfo = mInputMethodProperties.get(i); + if (imeInfo.getId().equals(Secure.getString(mContext.getContentResolver(), + Secure.DEFAULT_INPUT_METHOD))) { + return imeInfo.getPackageName(); + } + } + return null; + } + @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - BrowserInputConnection browserInputConnection = - new BrowserInputConnection(this, false); - outAttrs.actionLabel = null; - outAttrs.inputType = InputType.TYPE_NULL; - outAttrs.imeOptions = EditorInfo.IME_ACTION_GO; - return browserInputConnection; + String imeInfo = getCurrentImeInfo(); + if(imeInfo != null && imeInfo.equals(LATIN_INPUTMETHOD_PACKAGE_NAME) + && (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)) { + outAttrs.imeOptions = EditorInfo.IME_ACTION_GO; + return new BrowserInputConnection(this, false); + } + else + return super.onCreateInputConnection(outAttrs); } public UrlInputView(Context context) { |