aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java43
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java12
-rw-r--r--java/src/com/android/inputmethod/latin/SubtypeSwitcher.java11
3 files changed, 46 insertions, 20 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index bbe3f78f2..d90137d95 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -97,10 +97,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Key events coming any faster than this are long-presses.
private static final int QUICK_PRESS = 200;
- // Contextual menu positions
- private static final int POS_METHOD = 0;
- private static final int POS_SETTINGS = 1;
-
private int mSuggestionVisibility;
private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE
= R.string.prefs_suggestion_visibility_show_value;
@@ -2216,15 +2212,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
private void showSubtypeSelectorAndSettings() {
- showOptionsMenuInternal(new DialogInterface.OnClickListener() {
+ final CharSequence title = getString(R.string.english_ime_input_options);
+ final CharSequence[] items = new CharSequence[] {
+ // TODO: Should use new string "Select active input modes".
+ getString(R.string.language_selection_title),
+ getString(R.string.english_ime_settings),
+ };
+ final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface di, int position) {
di.dismiss();
switch (position) {
- case POS_SETTINGS:
+ case 0:
launchSettings();
break;
- case POS_METHOD:
+ case 1:
Intent intent = new Intent(
android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
@@ -2236,36 +2238,41 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
}
}
- });
+ };
+ showOptionsMenuInternal(title, items, listener);
}
private void showOptionsMenu() {
- showOptionsMenuInternal(new DialogInterface.OnClickListener() {
+ final CharSequence title = getString(R.string.english_ime_input_options);
+ final CharSequence[] items = new CharSequence[] {
+ getString(R.string.selectInputMethod),
+ getString(R.string.english_ime_settings),
+ };
+ final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface di, int position) {
di.dismiss();
switch (position) {
- case POS_SETTINGS:
+ case 0:
launchSettings();
break;
- case POS_METHOD:
+ case 1:
mImm.showInputMethodPicker();
break;
}
}
- });
+ };
+ showOptionsMenuInternal(title, items, listener);
}
- private void showOptionsMenuInternal(DialogInterface.OnClickListener listener) {
+ private void showOptionsMenuInternal(CharSequence title, CharSequence[] items,
+ DialogInterface.OnClickListener listener) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setIcon(R.drawable.ic_dialog_keyboard);
builder.setNegativeButton(android.R.string.cancel, null);
- CharSequence itemSettings = getString(R.string.english_ime_settings);
- CharSequence itemInputMethod = getString(R.string.selectInputMethod);
- builder.setItems(new CharSequence[] {
- itemInputMethod, itemSettings}, listener);
- builder.setTitle(mResources.getString(R.string.english_ime_input_options));
+ builder.setItems(items, listener);
+ builder.setTitle(title);
mOptionsDialog = builder.create();
mOptionsDialog.setCanceledOnTouchOutside(true);
Window window = mOptionsDialog.getWindow();
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index 653dbeaba..12338ce61 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -75,6 +75,7 @@ public class Settings extends PreferenceActivity
private CheckBoxPreference mQuickFixes;
private ListPreference mVoicePreference;
private ListPreference mSettingsKeyPreference;
+ private ListPreference mShowCorrectionSuggestionsPreference;
private ListPreference mAutoCorrectionThreshold;
private CheckBoxPreference mBigramSuggestion;
private boolean mVoiceOn;
@@ -102,6 +103,8 @@ public class Settings extends PreferenceActivity
mQuickFixes = (CheckBoxPreference) findPreference(PREF_QUICK_FIXES);
mVoicePreference = (ListPreference) findPreference(PREF_VOICE_SETTINGS_KEY);
mSettingsKeyPreference = (ListPreference) findPreference(PREF_SETTINGS_KEY);
+ mShowCorrectionSuggestionsPreference =
+ (ListPreference) findPreference(PREF_SHOW_SUGGESTIONS_SETTING);
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
prefs.registerOnSharedPreferenceChangeListener(this);
@@ -188,6 +191,7 @@ public class Settings extends PreferenceActivity
updateVoiceModeSummary();
}
updateSettingsKeySummary();
+ updateShowCorrectionSuggestionsSummary();
}
@Override
@@ -212,6 +216,7 @@ public class Settings extends PreferenceActivity
.equals(mVoiceModeOff));
updateVoiceModeSummary();
updateSettingsKeySummary();
+ updateShowCorrectionSuggestionsSummary();
}
@Override
@@ -230,6 +235,13 @@ public class Settings extends PreferenceActivity
return false;
}
+ private void updateShowCorrectionSuggestionsSummary() {
+ mShowCorrectionSuggestionsPreference.setSummary(
+ getResources().getStringArray(R.array.prefs_suggestion_visibilities)
+ [mShowCorrectionSuggestionsPreference.findIndexOfValue(
+ mShowCorrectionSuggestionsPreference.getValue())]);
+ }
+
private void updateSettingsKeySummary() {
mSettingsKeyPreference.setSummary(
getResources().getStringArray(R.array.settings_key_modes)
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 7a1ac2e27..c1e14ad18 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -288,11 +288,18 @@ public class SubtypeSwitcher {
////////////////////////////
public void switchToShortcutIME() {
- IBinder token = mService.getWindow().getWindow().getAttributes().token;
+ final IBinder token = mService.getWindow().getWindow().getAttributes().token;
if (token == null || mShortcutInfo == null) {
return;
}
- mImm.setInputMethodAndSubtype(token, mShortcutInfo.getId(), mShortcutSubtype);
+ final String imiId = mShortcutInfo.getId();
+ final InputMethodSubtype subtype = mShortcutSubtype;
+ new Thread("SwitchToShortcutIME") {
+ @Override
+ public void run() {
+ mImm.setInputMethodAndSubtype(token, imiId, subtype);
+ }
+ }.start();
}
public Drawable getShortcutIcon() {