下面列出了android.view.inputmethod.InputMethodManager#showInputMethodPicker ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.item_help: {
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.homepage)));
startActivity(browserIntent);
break;
}
case R.id.item_replacements: {
startActivity(new Intent(this, ReplacementsListActivity.class));
break;
}
case R.id.item_settings: {
startActivity(new Intent(this, SettingsActivity.class));
break;
}
case R.id.item_select: {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
break;
}
case R.id.item_tf: {
String url = "market://details?id=de.onyxbits.textfiction";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
break;
}
}
return false;
}
@Override
protected void onResume() {
super.onResume();
final InputMethodManager service = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
service.showInputMethodPicker();
finish();
}
public void onChooseKeyboardsButtonClick(View view) {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
}
public void keyboardClick(View view) {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
}
@Override
public void onSystemKeyboardRequest() {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
}
@Override
public void onSystemKeyboardRequest() {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
}
private void showSystemKeyboardChooser() {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
mImePickerState = ImePickerAction.CHOOSING;
}
private void showChooseKeyboardDialog() {
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (im == null) return;
im.showInputMethodPicker();
}
@Override
public void onReceive(Context context, Intent intent) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
}
@Override
public void onPress(int primaryCode) {
// SEE: res/xml/keyboarddef.xml for the definitions.
switch (primaryCode) {
case 0: {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
break;
}
case 1: {
/*
* Intent intent = new Intent(this, SettingsActivity.class);
* intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
* startActivity(intent);
*/
break;
}
case 2: {
try {
InputConnection con = getCurrentInputConnection();
CharSequence txt = con.getSelectedText(0);
if (txt == null) {
txt = getCurrentInputConnection().getExtractedText(
new ExtractedTextRequest(), 0).text;
}
TelnetEditorShell.self.showText(txt + "");
Toast.makeText(this, R.string.msg_sent, Toast.LENGTH_SHORT).show();
}
catch (Exception exp) {
Toast.makeText(this, R.string.err_noclient, Toast.LENGTH_SHORT)
.show();
}
break;
}
case 3: {
try {
if (TelnetEditorShell.self != null) {
TelnetEditorShell.self.disconnect();
Toast.makeText(this, R.string.msg_client_disconnected,
Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(this, R.string.err_noclient, Toast.LENGTH_SHORT)
.show();
}
}
catch (Exception e) {
}
}
}
}