Example usage for android.view MenuItem setTitle

List of usage examples for android.view MenuItem setTitle

Introduction

In this page you can find the example usage for android.view MenuItem setTitle.

Prototype


public MenuItem setTitle(@StringRes int title);

Source Link

Document

Change the title associated with this item.

Usage

From source file:org.getlantern.firetweet.util.Utils.java

public static void setMenuForStatus(final Context context, final Menu menu, final ParcelableStatus status,
        final ParcelableCredentials account) {
    if (context == null || menu == null || status == null)
        return;/*from ww w . j  a  v  a  2  s  .  c o  m*/
    final Resources resources = context.getResources();
    final int retweetHighlight = resources.getColor(R.color.highlight_retweet);
    final int favoriteHighlight = resources.getColor(R.color.highlight_favorite);
    final boolean isMyRetweet = isMyRetweet(status);
    final MenuItem delete = menu.findItem(MENU_DELETE);
    if (delete != null) {
        delete.setVisible(status.account_id == status.user_id && !isMyRetweet);
    }
    final MenuItem retweet = menu.findItem(MENU_RETWEET);
    if (retweet != null) {
        retweet.setVisible(!status.user_is_protected || isMyRetweet);
        ActionIconDrawable.setMenuHighlight(retweet, new FiretweetMenuInfo(isMyRetweet, retweetHighlight));
        retweet.setTitle(isMyRetweet ? R.string.cancel_retweet : R.string.retweet);
    }
    final MenuItem retweetSubItem = menu.findItem(R.id.retweet_submenu);
    if (retweetSubItem != null) {
        ActionIconDrawable.setMenuHighlight(retweetSubItem,
                new FiretweetMenuInfo(isMyRetweet, retweetHighlight));
    }
    final MenuItem favorite = menu.findItem(MENU_FAVORITE);
    if (favorite != null) {
        ActionIconDrawable.setMenuHighlight(favorite,
                new FiretweetMenuInfo(status.is_favorite, favoriteHighlight));
        favorite.setTitle(status.is_favorite ? R.string.unfavorite : R.string.favorite);
    }
    final MenuItem translate = menu.findItem(MENU_TRANSLATE);
    if (translate != null) {
        final boolean isOfficialKey = isOfficialCredentials(context, account);
        final SharedPreferencesWrapper prefs = SharedPreferencesWrapper.getInstance(context,
                SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
        final boolean forcePrivateApis = prefs.getBoolean(KEY_FORCE_USING_PRIVATE_APIS, false);
        setMenuItemAvailability(menu, MENU_TRANSLATE, forcePrivateApis || isOfficialKey);
    }
    menu.removeGroup(MENU_GROUP_STATUS_EXTENSION);
    addIntentToMenuForExtension(context, menu, MENU_GROUP_STATUS_EXTENSION, INTENT_ACTION_EXTENSION_OPEN_STATUS,
            EXTRA_STATUS, EXTRA_STATUS_JSON, status);
    //final MenuItem shareItem = menu.findItem(R.id.share);
    //final ActionProvider shareProvider = MenuItemCompat.getActionProvider(shareItem);
    /*
    if (shareProvider instanceof SupportStatusShareProvider) {
    ((SupportStatusShareProvider) shareProvider).setStatus(status);
    } else if (shareProvider instanceof ShareActionProvider) {
    final Intent shareIntent = createStatusShareIntent(context, status);
    ((ShareActionProvider) shareProvider).setShareIntent(shareIntent);
    final Menu shareSubMenu = shareItem.getSubMenu();
    final Intent shareIntent = createStatusShareIntent(context, status);
    shareSubMenu.removeGroup(MENU_GROUP_STATUS_SHARE);
    addIntentToMenu(context, shareSubMenu, shareIntent, MENU_GROUP_STATUS_SHARE);
    } */

}

From source file:com.ichi2.anki2.Reviewer.java

/** Handles item selections. */
@Override/*from www. j  av a2  s.  c o m*/
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    case android.R.id.home:
        closeReviewer(AnkiDroidApp.RESULT_TO_HOME, true);
        return true;

    case MENU_WHITEBOARD:
        // Toggle mShowWhiteboard value
        mShowWhiteboard = !mShowWhiteboard;
        if (mShowWhiteboard) {
            // Show whiteboard
            mWhiteboard.setVisibility(View.VISIBLE);
            item.setTitle(R.string.hide_whiteboard);
            MetaDB.storeWhiteboardState(this, mCurrentCard.getDid(), 1);
        } else {
            // Hide whiteboard
            mWhiteboard.setVisibility(View.GONE);
            item.setTitle(R.string.show_whiteboard);
            MetaDB.storeWhiteboardState(this, mCurrentCard.getDid(), 0);
        }
        return true;

    case MENU_CLEAR_WHITEBOARD:
        mWhiteboard.clear();
        return true;

    case MENU_EDIT:
        return editCard();

    case MENU_REMOVE_BURY:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 0));
        return true;

    case MENU_REMOVE_SUSPEND_CARD:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 1));
        return true;

    case MENU_REMOVE_SUSPEND_NOTE:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 2));
        return true;

    case MENU_REMOVE_DELETE:
        showDeleteNoteDialog();
        return true;

    case MENU_SEARCH:
        lookUpOrSelectText();
        return true;

    case MENU_MARK:
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_MARK_CARD, mMarkCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 0));
        return true;

    case MENU_UNDO:
        undo();
        return true;

    case MENU_RECORD:
        toggleRecording();
        return true;

    case MENU_RECORD_REPLAY:
        playRecording();
        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.hichinaschool.flashcards.anki.Reviewer.java

/** Handles item selections. */
@Override/*from  w  w w. j a v a2  s. co  m*/
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    case android.R.id.home:
        closeReviewer(AnkiDroidApp.RESULT_TO_HOME, true);
        return true;

    case MENU_WHITEBOARD:
        // Toggle mShowWhiteboard value
        mShowWhiteboard = !mShowWhiteboard;
        if (mShowWhiteboard) {
            // Show whiteboard
            mWhiteboard.setVisibility(View.VISIBLE);
            item.setTitle(R.string.hide_whiteboard);
            MetaDB.storeWhiteboardState(this, mCurrentCard.getDid(), 1);
        } else {
            // Hide whiteboard
            mWhiteboard.setVisibility(View.GONE);
            item.setTitle(R.string.show_whiteboard);
            MetaDB.storeWhiteboardState(this, mCurrentCard.getDid(), 0);
        }
        return true;

    case MENU_CLEAR_WHITEBOARD:
        mWhiteboard.clear();
        return true;

    case MENU_EDIT:
        return editCard();

    case MENU_REMOVE_BURY_CARD:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 4));
        return true;

    case MENU_REMOVE_BURY_NOTE:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 0));
        return true;

    case MENU_REMOVE_SUSPEND_CARD:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 1));
        return true;

    case MENU_REMOVE_SUSPEND_NOTE:
        setNextCardAnimation(false);
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_NOTE, mDismissCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 2));
        return true;

    case MENU_REMOVE_DELETE:
        showDeleteNoteDialog();
        return true;

    case MENU_SEARCH:
        lookUpOrSelectText();
        return true;

    case MENU_MARK:
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_MARK_CARD, mMarkCardHandler,
                new DeckTask.TaskData(mSched, mCurrentCard, 0));
        return true;

    case MENU_UNDO:
        undo();
        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.amaze.carbonfilemanager.activities.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem s = menu.findItem(R.id.view);
    MenuItem search = menu.findItem(R.id.search);
    MenuItem paste = menu.findItem(R.id.paste);
    String fragmentName;//  ww  w . j  a  v a  2s  .c  o m
    Fragment fragment;
    try {
        fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);
        fragmentName = fragment.getClass().getName();
    } catch (Exception e) {
        return true;
    }
    if (fragmentName.contains("TabFragment")) {
        setActionBarTitle("Amaze");
        if (useGridView) {
            s.setTitle(getResources().getString(R.string.gridview));
        } else {
            s.setTitle(getResources().getString(R.string.listview));
        }
        try {
            TabFragment tabFragment = (TabFragment) fragment;
            MainFragment ma = ((MainFragment) tabFragment.getTab());
            if (ma.IS_LIST)
                s.setTitle(R.string.gridview);
            else
                s.setTitle(R.string.listview);
            updatePath(ma.CURRENT_PATH, ma.results, ma.openMode, ma.folder_count, ma.file_count);
        } catch (Exception e) {
        }

        initiatebbar();
        if (SDK_INT >= 21)
            toolbar.setElevation(0);
        invalidatePasteButton(paste);
        search.setVisible(true);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.VISIBLE);
        menu.findItem(R.id.search).setVisible(true);
        menu.findItem(R.id.home).setVisible(true);
        menu.findItem(R.id.history).setVisible(true);
        menu.findItem(R.id.sethome).setVisible(true);
        menu.findItem(R.id.sort).setVisible(true);
        if (showHidden)
            menu.findItem(R.id.hiddenitems).setVisible(true);
        menu.findItem(R.id.view).setVisible(true);
        menu.findItem(R.id.extract).setVisible(false);
        invalidatePasteButton(menu.findItem(R.id.paste));
        findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE);
    } else if (fragmentName.contains("AppsList") || fragmentName.contains("ProcessViewer")
            || fragmentName.contains(FTPServerFragment.class.getName())) {
        appBarLayout.setExpanded(true);
        menu.findItem(R.id.sethome).setVisible(false);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.GONE);
        findViewById(R.id.buttonbarframe).setVisibility(View.GONE);
        menu.findItem(R.id.search).setVisible(false);
        menu.findItem(R.id.home).setVisible(false);
        menu.findItem(R.id.history).setVisible(false);
        menu.findItem(R.id.extract).setVisible(false);
        if (fragmentName.contains("ProcessViewer"))
            menu.findItem(R.id.sort).setVisible(false);
        else {
            menu.findItem(R.id.dsort).setVisible(false);
            menu.findItem(R.id.sortby).setVisible(false);
        }
        menu.findItem(R.id.hiddenitems).setVisible(false);
        menu.findItem(R.id.view).setVisible(false);
        menu.findItem(R.id.paste).setVisible(false);
    } else if (fragmentName.contains("ZipViewer")) {
        menu.findItem(R.id.sethome).setVisible(false);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.GONE);
        TextView textView = (TextView) mainActivity.pathbar.findViewById(R.id.fullpath);
        pathbar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });
        menu.findItem(R.id.search).setVisible(false);
        menu.findItem(R.id.home).setVisible(false);
        menu.findItem(R.id.history).setVisible(false);
        menu.findItem(R.id.sort).setVisible(false);
        menu.findItem(R.id.hiddenitems).setVisible(false);
        menu.findItem(R.id.view).setVisible(false);
        menu.findItem(R.id.paste).setVisible(false);
        menu.findItem(R.id.extract).setVisible(true);
    }
    return super.onPrepareOptionsMenu(menu);
}

From source file:org.petero.droidfish.DroidFish.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item = menu.findItem(R.id.item_file_menu);
    item.setTitle(R.string.option_file);
    return true;// www.  j  a v  a 2 s  .  c  om
}

From source file:org.mozilla.gecko.BrowserApp.java

private void updateAddonMenuItem(int id, JSONObject options) {
    // Set attribute for the menu item in cache, if available
    if (mAddonMenuItemsCache != null && !mAddonMenuItemsCache.isEmpty()) {
        for (MenuItemInfo item : mAddonMenuItemsCache) {
            if (item.id == id) {
                item.label = options.optString("name", item.label);
                item.checkable = options.optBoolean("checkable", item.checkable);
                item.checked = options.optBoolean("checked", item.checked);
                item.enabled = options.optBoolean("enabled", item.enabled);
                item.visible = options.optBoolean("visible", item.visible);
                item.added = (mMenu != null);
                break;
            }//from w  w  w  . j  av a2  s.  c o m
        }
    }

    if (mMenu == null) {
        return;
    }

    final MenuItem menuItem = mMenu.findItem(id);
    if (menuItem != null) {
        menuItem.setTitle(options.optString("name", menuItem.getTitle().toString()));
        menuItem.setCheckable(options.optBoolean("checkable", menuItem.isCheckable()));
        menuItem.setChecked(options.optBoolean("checked", menuItem.isChecked()));
        menuItem.setEnabled(options.optBoolean("enabled", menuItem.isEnabled()));
        menuItem.setVisible(options.optBoolean("visible", menuItem.isVisible()));
    }
}

From source file:com.ichi2.anki2.Reviewer.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    Resources res = getResources();

    UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_MARK, Menu.NONE, R.string.menu_mark_card,
            R.drawable.ic_menu_mark);/*  www  .  j av  a  2  s .  c  o m*/
    UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_UNDO, Menu.NONE, R.string.undo,
            R.drawable.ic_menu_revert_disabled);
    UIUtils.addMenuItem(menu, Menu.NONE, MENU_EDIT, Menu.NONE, R.string.menu_edit_card,
            R.drawable.ic_menu_edit);
    if (mPrefWhiteboard) {
        if (mShowWhiteboard) {
            UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE,
                    R.string.hide_whiteboard, R.drawable.ic_menu_compose);
        } else {
            UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE,
                    R.string.show_whiteboard, R.drawable.ic_menu_compose);
        }
        UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_CLEAR_WHITEBOARD, Menu.NONE,
                R.string.clear_whiteboard, R.drawable.ic_menu_clear_playlist);
    }

    if (mPrefRecord) {
        // TODO proper icon
        final MenuItem recorderItem = UIUtils.addMenuItem(menu, Menu.NONE, MENU_RECORD, Menu.NONE,
                Recorder.recording() ? R.string.record_stop : R.string.record_start,
                R.drawable.ic_circle_pressed);
        final MenuItem replayItem = UIUtils.addMenuItem(menu, Menu.NONE, MENU_RECORD_REPLAY, Menu.NONE,
                R.string.record_play, R.drawable.ic_circle_normal);
        // disable unless something is recorded
        replayItem.setEnabled(false);
        // set relevant listeners
        Recorder.setRecordingStartedListener(new Recorder.RecordingStartedListener() {

            @Override
            public void onRecordingStarted() {
                recorderItem.setTitle(R.string.record_stop);
            }
        });
        Recorder.setRecordingFinishedListener(new Recorder.RecordingFinishedListener() {

            @Override
            public void onRecordingFinished() {
                recorderItem.setTitle(R.string.record_start);
                replayItem.setEnabled(true);
            }
        });
        Recorder.setRecorderResetListener(new Recorder.RecorderResetListener() {

            @Override
            public void onRecorderReset() {
                replayItem.setEnabled(false);
            }
        });
    }

    SubMenu removeDeckSubMenu = menu.addSubMenu(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.menu_dismiss_note);
    removeDeckSubMenu.setIcon(R.drawable.ic_menu_stop);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY, Menu.NONE, R.string.menu_bury_note);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_CARD, Menu.NONE, R.string.menu_suspend_card);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_NOTE, Menu.NONE, R.string.menu_suspend_note);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_DELETE, Menu.NONE, R.string.menu_delete_note);
    if (mPrefTextSelection) {
        MenuItem item = menu.add(Menu.NONE, MENU_SEARCH, Menu.NONE, res.getString(R.string.menu_select));
        item.setIcon(R.drawable.ic_menu_search);
        item.setEnabled(Lookup.isAvailable());
    }
    return true;
}

From source file:com.iiordanov.bVNC.RemoteCanvasActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    canvas.getKeyboard().setAfterMenu(true);
    switch (item.getItemId()) {
    case R.id.itemInfo:
        canvas.showConnectionInfo();/*from ww w . ja  v a 2 s  .  co  m*/
        return true;
    case R.id.itemSpecialKeys:
        showDialog(R.layout.metakey);
        return true;
    case R.id.itemColorMode:
        selectColorModel();
        return true;
    // Following sets one of the scaling options
    case R.id.itemZoomable:
    case R.id.itemOneToOne:
    case R.id.itemFitToScreen:
        AbstractScaling.getById(item.getItemId()).setScaleTypeForActivity(this);
        item.setChecked(true);
        showPanningState(false);
        return true;
    case R.id.itemCenterMouse:
        canvas.getPointer().warpMouse(canvas.absoluteXPosition + canvas.getVisibleWidth() / 2,
                canvas.absoluteYPosition + canvas.getVisibleHeight() / 2);
        return true;
    case R.id.itemDisconnect:
        canvas.closeConnection();
        finish();
        return true;
    case R.id.itemEnterText:
        showDialog(R.layout.entertext);
        return true;
    case R.id.itemCtrlAltDel:
        canvas.getKeyboard().sendMetaKey(MetaKeyBean.keyCtrlAltDel);
        return true;
    /*        case R.id.itemFollowMouse:
    boolean newFollow = !connection.getFollowMouse();
    item.setChecked(newFollow);
    connection.setFollowMouse(newFollow);
    if (newFollow) {
        vncCanvas.panToMouse();
    }
    connection.save(database.getWritableDatabase());
    database.close();
    return true;
            case R.id.itemFollowPan:
    boolean newFollowPan = !connection.getFollowPan();
    item.setChecked(newFollowPan);
    connection.setFollowPan(newFollowPan);
    connection.save(database.getWritableDatabase());
    database.close();
    return true;
             
            case R.id.itemArrowLeft:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowLeft);
    return true;
            case R.id.itemArrowUp:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowUp);
    return true;
            case R.id.itemArrowRight:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowRight);
    return true;
            case R.id.itemArrowDown:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowDown);
    return true;
    */
    case R.id.itemSendKeyAgain:
        sendSpecialKeyAgain();
        return true;
    // Disabling Manual/Wiki Menu item as the original does not correspond to this project anymore.
    //case R.id.itemOpenDoc:
    //    Utils.showDocumentation(this);
    //    return true;
    case R.id.itemExtraKeys:
        if (connection.getExtraKeysToggleType() == Constants.EXTRA_KEYS_ON) {
            connection.setExtraKeysToggleType(Constants.EXTRA_KEYS_OFF);
            item.setTitle(R.string.extra_keys_enable);
            setExtraKeysVisibility(View.GONE, false);
        } else {
            connection.setExtraKeysToggleType(Constants.EXTRA_KEYS_ON);
            item.setTitle(R.string.extra_keys_disable);
            setExtraKeysVisibility(View.VISIBLE, false);
            extraKeysHidden = false;
        }
        setKeyStowDrawableAndVisibility();
        connection.save(database.getWritableDatabase());
        database.close();
        return true;
    case R.id.itemHelpInputMode:
        showDialog(R.id.itemHelpInputMode);
        return true;
    default:
        AbstractInputHandler input = getInputHandlerById(item.getItemId());
        if (input != null) {
            inputHandler = input;
            connection.setInputMode(input.getName());
            if (input.getName().equals(SimulatedTouchpadInputHandler.TOUCHPAD_MODE)) {
                connection.setFollowMouse(true);
                connection.setFollowPan(true);
            } else {
                connection.setFollowMouse(false);
                connection.setFollowPan(false);
            }

            item.setChecked(true);
            showPanningState(true);
            connection.save(database.getWritableDatabase());
            database.close();
            return true;
        }
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.iiordanov.runsoft.bVNC.RemoteCanvasActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    canvas.getKeyboard().setAfterMenu(true);
    switch (item.getItemId()) {
    case R.id.itemInfo:
        canvas.showConnectionInfo();//from www.j  a v  a  2  s.  co  m
        return true;
    case R.id.itemSpecialKeys:
        showDialog(R.layout.metakey);
        return true;
    //        case R.id.itemColorMode:
    //            selectColorModel();
    //            return true;
    // Following sets one of the scaling options
    case R.id.itemZoomable:
    case R.id.itemOneToOne:
    case R.id.itemFitToScreen:
        AbstractScaling.getById(item.getItemId()).setScaleTypeForActivity(this);
        item.setChecked(true);
        showPanningState(false);
        return true;
    case R.id.itemCenterMouse:
        canvas.getPointer().warpMouse(canvas.absoluteXPosition + canvas.getVisibleWidth() / 2,
                canvas.absoluteYPosition + canvas.getVisibleHeight() / 2);
        return true;
    case R.id.itemDisconnect:

        canvas.closeConnection();
        finish();
        return true;
    //        case R.id.itemEnterText:
    //            showDialog(R.layout.entertext);
    //            return true;
    case R.id.itemCtrlAltDel:
        canvas.getKeyboard().sendMetaKey(MetaKeyBean.keyCtrlAltDel);
        return true;
    /*        case R.id.itemFollowMouse:
    boolean newFollow = !connection.getFollowMouse();
    item.setChecked(newFollow);
    connection.setFollowMouse(newFollow);
    if (newFollow) {
        vncCanvas.panToMouse();
    }
    connection.save(database.getWritableDatabase());
    database.close();
    return true;
            case R.id.itemFollowPan:
    boolean newFollowPan = !connection.getFollowPan();
    item.setChecked(newFollowPan);
    connection.setFollowPan(newFollowPan);
    connection.save(database.getWritableDatabase());
    database.close();
    return true;
             
            case R.id.itemArrowLeft:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowLeft);
    return true;
            case R.id.itemArrowUp:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowUp);
    return true;
            case R.id.itemArrowRight:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowRight);
    return true;
            case R.id.itemArrowDown:
    vncCanvas.sendMetaKey(MetaKeyBean.keyArrowDown);
    return true;
    */
    case R.id.itemSendKeyAgain:
        sendSpecialKeyAgain();
        return true;
    // Disabling Manual/Wiki Menu item as the original does not correspond to this project anymore.
    //case R.id.itemOpenDoc:
    //    Utils.showDocumentation(this);
    //    return true;
    case R.id.itemExtraKeys:
        if (connection.getExtraKeysToggleType() == Constants.EXTRA_KEYS_ON) {
            connection.setExtraKeysToggleType(Constants.EXTRA_KEYS_OFF);
            item.setTitle(R.string.extra_keys_enable);
            setExtraKeysVisibility(View.GONE, false);
        } else {
            connection.setExtraKeysToggleType(Constants.EXTRA_KEYS_ON);
            item.setTitle(R.string.extra_keys_disable);
            setExtraKeysVisibility(View.VISIBLE, false);
            extraKeysHidden = false;
        }
        setKeyStowDrawableAndVisibility();
        connection.save(database.getWritableDatabase());
        database.close();
        return true;
    case R.id.itemHelpInputMode:
        showDialog(R.id.itemHelpInputMode);
        return true;
    default:
        AbstractInputHandler input = getInputHandlerById(item.getItemId());
        if (input != null) {
            inputHandler = input;
            connection.setInputMode(input.getName());
            if (input.getName().equals(SimulatedTouchpadInputHandler.TOUCHPAD_MODE)) {
                connection.setFollowMouse(true);
                connection.setFollowPan(true);
            } else {
                connection.setFollowMouse(false);
                connection.setFollowPan(false);
            }

            item.setChecked(true);
            showPanningState(true);
            connection.save(database.getWritableDatabase());
            database.close();
            return true;
        }
    }
    return super.onOptionsItemSelected(item);
}