use of javax.microedition.lcdui.CommandListener in project J2ME-Loader by nikita36078.
the class MicroActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (current != null) {
int id = item.getItemId();
if (item.getGroupId() == R.id.action_group_common_settings) {
if (id == R.id.action_exit_midlet) {
showExitConfirmation();
} else if (current instanceof Canvas && ContextHolder.getVk() != null) {
VirtualKeyboard vk = ContextHolder.getVk();
switch(id) {
case R.id.action_layout_edit_mode:
vk.switchLayoutEditMode(VirtualKeyboard.LAYOUT_KEYS);
break;
case R.id.action_layout_scale_mode:
vk.switchLayoutEditMode(VirtualKeyboard.LAYOUT_SCALES);
break;
case R.id.action_layout_edit_finish:
vk.switchLayoutEditMode(VirtualKeyboard.LAYOUT_EOF);
break;
case R.id.action_layout_switch:
vk.switchLayout();
break;
case R.id.action_hide_buttons:
showHideButtonDialog();
break;
}
}
return true;
}
CommandListener listener = current.getCommandListener();
if (listener == null) {
return false;
}
for (Command cmd : current.getCommands()) {
if (cmd.hashCode() == id) {
current.postEvent(CommandActionEvent.getInstance(listener, cmd, current));
return true;
}
}
}
return super.onOptionsItemSelected(item);
}
Aggregations