Reuse language_selection_title string resource for option dialog
Bug: 3385831 Change-Id: I23f587815f7fca3190bd0aa669bb6a2378d34ea8
This commit is contained in:
parent
17bc97c134
commit
85996b472a
1 changed files with 25 additions and 18 deletions
|
@ -97,10 +97,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// Key events coming any faster than this are long-presses.
|
// Key events coming any faster than this are long-presses.
|
||||||
private static final int QUICK_PRESS = 200;
|
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 int mSuggestionVisibility;
|
||||||
private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE
|
private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE
|
||||||
= R.string.prefs_suggestion_visibility_show_value;
|
= R.string.prefs_suggestion_visibility_show_value;
|
||||||
|
@ -2226,15 +2222,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSubtypeSelectorAndSettings() {
|
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
|
@Override
|
||||||
public void onClick(DialogInterface di, int position) {
|
public void onClick(DialogInterface di, int position) {
|
||||||
di.dismiss();
|
di.dismiss();
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case POS_SETTINGS:
|
case 0:
|
||||||
launchSettings();
|
launchSettings();
|
||||||
break;
|
break;
|
||||||
case POS_METHOD:
|
case 1:
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
|
android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
@ -2246,36 +2248,41 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
showOptionsMenuInternal(title, items, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOptionsMenu() {
|
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
|
@Override
|
||||||
public void onClick(DialogInterface di, int position) {
|
public void onClick(DialogInterface di, int position) {
|
||||||
di.dismiss();
|
di.dismiss();
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case POS_SETTINGS:
|
case 0:
|
||||||
launchSettings();
|
launchSettings();
|
||||||
break;
|
break;
|
||||||
case POS_METHOD:
|
case 1:
|
||||||
mImm.showInputMethodPicker();
|
mImm.showInputMethodPicker();
|
||||||
break;
|
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);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setCancelable(true);
|
builder.setCancelable(true);
|
||||||
builder.setIcon(R.drawable.ic_dialog_keyboard);
|
builder.setIcon(R.drawable.ic_dialog_keyboard);
|
||||||
builder.setNegativeButton(android.R.string.cancel, null);
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
CharSequence itemSettings = getString(R.string.english_ime_settings);
|
builder.setItems(items, listener);
|
||||||
CharSequence itemInputMethod = getString(R.string.selectInputMethod);
|
builder.setTitle(title);
|
||||||
builder.setItems(new CharSequence[] {
|
|
||||||
itemInputMethod, itemSettings}, listener);
|
|
||||||
builder.setTitle(mResources.getString(R.string.english_ime_input_options));
|
|
||||||
mOptionsDialog = builder.create();
|
mOptionsDialog = builder.create();
|
||||||
mOptionsDialog.setCanceledOnTouchOutside(true);
|
mOptionsDialog.setCanceledOnTouchOutside(true);
|
||||||
Window window = mOptionsDialog.getWindow();
|
Window window = mOptionsDialog.getWindow();
|
||||||
|
|
Loading…
Reference in a new issue