Java Code Examples for com.actionbarsherlock.view.MenuItem#SHOW_AS_ACTION_IF_ROOM

The following examples show how to use com.actionbarsherlock.view.MenuItem#SHOW_AS_ACTION_IF_ROOM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialerFragment.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int action = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem delMenu = menu.add(isDigit ? R.string.switch_to_text : R.string.switch_to_digit);
    delMenu.setIcon(
            isDigit ? R.drawable.ic_menu_switch_txt
                    : R.drawable.ic_menu_switch_digit).setShowAsAction( action );
    delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            setTextDialing(isDigit);
            return true;
        }
    });
}
 
Example 2
Source File: MessageFragment.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem addContactMenu = menu.add(R.string.menu_add_to_contacts);
    addContactMenu.setIcon(R.drawable.ic_add_contact_holo_dark).setShowAsAction(actionRoom);
    addContactMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            Intent it = ContactsWrapper.getInstance().getAddContactIntent(null, remoteFrom);
            startActivity(it);
            return true;
        }
    });
}
 
Example 3
Source File: CallLogListFragment.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem delMenu = menu.add(R.string.callLog_delete_all);
    delMenu.setIcon(R.drawable.ic_ab_trash_dark).setShowAsAction(actionRoom);
    delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            deleteAllCalls();
            return true;
        }
    });
}
 
Example 4
Source File: SipHome.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {

    int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    
    WizardInfo distribWizard = CustomDistribution.getCustomDistributionWizard();
    if (distribWizard != null) {
        menu.add(Menu.NONE, DISTRIB_ACCOUNT_MENU, Menu.NONE, "My " + distribWizard.label)
                .setIcon(distribWizard.icon)
                .setShowAsAction(actionRoom);
    }
    if (CustomDistribution.distributionWantsOtherAccounts()) {
        int accountRoom = actionRoom;
        if(Compatibility.isCompatible(13)) {
            accountRoom |= MenuItem.SHOW_AS_ACTION_WITH_TEXT;
        }
        menu.add(Menu.NONE, ACCOUNTS_MENU, Menu.NONE,
                (distribWizard == null) ? R.string.accounts : R.string.other_accounts)
                .setIcon(R.drawable.ic_menu_account_list)
                .setAlphabeticShortcut('a')
                .setShowAsAction( accountRoom );
    }
    menu.add(Menu.NONE, PARAMS_MENU, Menu.NONE, R.string.prefs)
            .setIcon(android.R.drawable.ic_menu_preferences)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    menu.add(Menu.NONE, HELP_MENU, Menu.NONE, R.string.help)
            .setIcon(android.R.drawable.ic_menu_help)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    menu.add(Menu.NONE, CLOSE_MENU, Menu.NONE, R.string.menu_disconnect)
            .setIcon(R.drawable.ic_lock_power_off)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    return super.onCreateOptionsMenu(menu);
}