aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-01-25 11:48:06 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-01-25 11:48:06 +0900
commit85996b472a0ec5fc31e57c52aa46c8c7794689bb (patch)
tree78c5627edf2892bc8d3f844a2178ee737f89efa7 /java/src
parent17bc97c134bd83f3511910a02bc5ea18c86cc50a (diff)
downloadlatinime-85996b472a0ec5fc31e57c52aa46c8c7794689bb.tar.gz
latinime-85996b472a0ec5fc31e57c52aa46c8c7794689bb.tar.xz
latinime-85996b472a0ec5fc31e57c52aa46c8c7794689bb.zip
Reuse language_selection_title string resource for option dialog
Bug: 3385831 Change-Id: I23f587815f7fca3190bd0aa669bb6a2378d34ea8
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java43
1 files changed, 25 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 198d34f4a..84415ecee 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;
@@ -2226,15 +2222,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
@@ -2246,36 +2248,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();