diff options
author | 2011-07-17 21:18:47 -0700 | |
---|---|---|
committer | 2011-07-19 22:22:47 -0700 | |
commit | bf9d8348d89be257ccc3db75333bfd4cdf0a9b7e (patch) | |
tree | 8d385533c9f19024c9c8ad392245ee866ac7245f /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | fa9f4d1badee67ceb581391dfab2202e4ccb99c0 (diff) | |
download | latinime-bf9d8348d89be257ccc3db75333bfd4cdf0a9b7e.tar.gz latinime-bf9d8348d89be257ccc3db75333bfd4cdf0a9b7e.tar.xz latinime-bf9d8348d89be257ccc3db75333bfd4cdf0a9b7e.zip |
Support select input method dialog on pre-HC platform
Bug: 4971680
Change-Id: I641b336da54813e13409bd7874aa22e51f790729
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 248f4ddf2..a820a40e3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -29,7 +29,6 @@ import android.inputmethodservice.InputMethodService; import android.media.AudioManager; import android.net.ConnectivityManager; import android.os.Debug; -import android.os.IBinder; import android.os.Message; import android.os.SystemClock; import android.preference.PreferenceActivity; @@ -45,8 +44,6 @@ import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; -import android.view.Window; -import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; @@ -142,8 +139,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private Suggest mSuggest; private CompletionInfo[] mApplicationSpecifiedCompletions; - private AlertDialog mOptionsDialog; - private InputMethodManagerCompatWrapper mImm; private Resources mResources; private SharedPreferences mPrefs; @@ -361,6 +356,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mPrefs = prefs; LatinImeLogger.init(this, prefs); LanguageSwitcherProxy.init(this, prefs); + InputMethodManagerCompatWrapper.init(this); SubtypeSwitcher.init(this, prefs); KeyboardSwitcher.init(this, prefs); Recorrection.init(this, prefs); @@ -368,7 +364,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar super.onCreate(); - mImm = InputMethodManagerCompatWrapper.getInstance(this); + mImm = InputMethodManagerCompatWrapper.getInstance(); mInputMethodId = Utils.getInputMethodId(mImm, getPackageName()); mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mKeyboardSwitcher = KeyboardSwitcher.getInstance(); @@ -2076,7 +2072,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } }; - showOptionsMenuInternal(title, items, listener); + final AlertDialog.Builder builder = new AlertDialog.Builder(this) + .setIcon(R.drawable.ic_dialog_keyboard) + .setNegativeButton(android.R.string.cancel, null) + .setItems(items, listener) + .setTitle(title); + showOptionDialogInternal(builder.create()); } private void showOptionsMenu() { @@ -2099,28 +2100,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } }; - showOptionsMenuInternal(title, items, listener); - } - - private void showOptionsMenuInternal(CharSequence title, CharSequence[] items, - DialogInterface.OnClickListener listener) { - final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken(); - if (windowToken == null) return; - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setCancelable(true); - builder.setIcon(R.drawable.ic_dialog_keyboard); - builder.setNegativeButton(android.R.string.cancel, null); - builder.setItems(items, listener); - builder.setTitle(title); - mOptionsDialog = builder.create(); - mOptionsDialog.setCanceledOnTouchOutside(true); - Window window = mOptionsDialog.getWindow(); - WindowManager.LayoutParams lp = window.getAttributes(); - lp.token = windowToken; - lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; - window.setAttributes(lp); - window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); - mOptionsDialog.show(); + final AlertDialog.Builder builder = new AlertDialog.Builder(this) + .setIcon(R.drawable.ic_dialog_keyboard) + .setNegativeButton(android.R.string.cancel, null) + .setItems(items, listener) + .setTitle(title); + showOptionDialogInternal(builder.create()); } @Override |