Example usage for android.view Menu NONE

List of usage examples for android.view Menu NONE

Introduction

In this page you can find the example usage for android.view Menu NONE.

Prototype

int NONE

To view the source code for android.view Menu NONE.

Click Source Link

Document

Value to use for group and item identifier integers when you don't care about them.

Usage

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryCursorAdapter.java

public void getMenu(Menu menu, File f) {
    MenuItem mi;//  w  w  w.  ja v a  2  s .c  o  m

    if (f.isFile()) {
        mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST, R.string.share);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

        mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    if (f.canWrite() && downloadPath != null && f.getPath().startsWith(downloadPath)) {
        mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

}

From source file:org.chromium.chrome.browser.preferences.Preferences.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    // By default, every screen in Settings shows a "Help & feedback" menu item.
    MenuItem help = menu.add(Menu.NONE, R.id.menu_id_help_general, Menu.CATEGORY_SECONDARY, R.string.menu_help);
    help.setIcon(R.drawable.ic_help_and_feedback);
    return true;//www .  java2  s .  c  o m
}

From source file:com.nttec.everychan.ui.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (!MainApplication.getInstance().settings.showSidePanel() && Build.VERSION.SDK_INT < 11) {
        menu.add(Menu.NONE, R.id.menu_open_close_drawer, Menu.FIRST, R.string.menu_open_drawer)
                .setIcon(R.drawable.ic_menu_windows);
    }//from   w  ww.  jav a  2  s  .  c  o  m
    if (tabsAdapter != null && tabsAdapter.getSelectedItem() >= 0) {
        TabModel tab = tabsAdapter.getItem(tabsAdapter.getSelectedItem());
        if (canFavorite(tab)) {
            menu.add(Menu.NONE, R.id.menu_favorites, 201, R.string.menu_add_favorites)
                    .setIcon(R.drawable.ic_menu_add_bookmark);
        }
        if (tab.webUrl != null) {
            menu.add(Menu.NONE, R.id.menu_open_browser, 202, R.string.menu_open_browser)
                    .setIcon(R.drawable.ic_menu_browser);
        }
    }
    menu.add(Menu.NONE, R.id.menu_settings, 203, R.string.menu_preferences)
            .setIcon(android.R.drawable.ic_menu_preferences);
    Menu subMenu = menu.addSubMenu(Menu.NONE, R.id.menu_sub_settings, 203, R.string.menu_preferences)
            .setIcon(android.R.drawable.ic_menu_preferences);
    subMenu.add(Menu.NONE, R.id.menu_sub_settings_suspend, 1, R.string.menu_sub_preferences_suspend);
    subMenu.add(Menu.NONE, R.id.menu_sub_settings_autoupdate, 2, R.string.menu_sub_preferences_autoupdate)
            .setCheckable(true);
    subMenu.add(Menu.NONE, R.id.menu_sub_settings_maskpictures, 3, R.string.menu_sub_preferences_maskpictures)
            .setCheckable(true);
    subMenu.add(Menu.NONE, R.id.menu_sub_settings_all, 4, R.string.menu_sub_preferences_all);
    return super.onCreateOptionsMenu(menu);
}

From source file:org.alfresco.mobile.android.application.fragments.config.ConfigMenuEditorFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();/* www.j  av  a  2s.  c o  m*/
    menu.add(Menu.NONE, R.id.config_menu_save, Menu.FIRST, "Save");
    menu.add(Menu.NONE, R.id.config_menu_send, Menu.FIRST, "Send");
    menu.add(Menu.NONE, R.id.config_menu_reset, Menu.FIRST, "Reset");
    menu.add(Menu.NONE, R.id.config_menu_clear, Menu.FIRST, "Clear");
}

From source file:com.nttec.everychan.ui.NewTabFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (list.size() > 1) {
        menu.add(Menu.NONE, R.id.context_menu_quickaccess_move, 1, R.string.context_menu_move);
    }//from w  w  w  . jav a 2 s  . c  om
    QuickAccess.Entry entry = adapter.getItem(((AdapterView.AdapterContextMenuInfo) menuInfo).position);
    if (entry.chan == null)
        return;
    menu.add(Menu.NONE, R.id.context_menu_quickaccess_remove, 2, R.string.context_menu_quickaccess_remove);
}

From source file:me.piebridge.prevent.ui.PreventActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();/*w ww  . j a v  a 2  s  .  com*/
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
        preventMenu = menu.add(Menu.NONE, R.string.prevent, Menu.NONE, R.string.prevent);
        preventMenu.setIcon(R.drawable.ic_menu_block);
        preventMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        preventMenu.setVisible(false);
        removeMenu = menu.add(Menu.NONE, R.string.remove, Menu.NONE, R.string.remove);
        removeMenu.setIcon(R.drawable.ic_menu_star);
        removeMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        removeMenu.setVisible(false);
    }
    menu.add(Menu.NONE, R.string.switch_theme, Menu.NONE, R.string.switch_theme);
    menu.add(Menu.NONE, R.string.system_log, Menu.NONE, R.string.system_log);
    menu.add(Menu.NONE, R.string.advanced_settings, Menu.NONE, R.string.advanced_settings);
    menu.add(Menu.NONE, R.string.user_guide, Menu.NONE, R.string.user_guide);
    return super.onCreateOptionsMenu(menu);
}

From source file:org.mythdroid.remote.MusicRemote.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    MenuItemCompat.setShowAsAction(/*from w  w w.j  ava2 s .  c  om*/
            menu.add(Menu.NONE, MENU_SHUFFLE, Menu.NONE, R.string.shuffle).setIcon(R.drawable.ic_menu_refresh),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_REPEAT, Menu.NONE, R.string.repeat).setIcon(drawable.ic_menu_revert),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_EDIT, Menu.NONE, R.string.plEdit).setIcon(drawable.ic_menu_edit),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_OSDMENU, Menu.NONE, R.string.osdMenu).setIcon(drawable.ic_menu_more),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, MENU_VISUALISE, Menu.NONE, R.string.visualiser)
            .setIcon(drawable.ic_menu_upload_you_tube), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, MENU_CHANGE_VISUAL, Menu.NONE, R.string.chVisual)
            .setIcon(drawable.ic_menu_slideshow), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);

    return true;
}

From source file:org.alfresco.mobile.android.application.fragments.person.PersonProfileFragment.java

private void getMenu(Menu menu, int mode) {
    MenuItem mi = null;//  www .  j a  v  a  2s.c o  m
    switch (mode) {
    case MODE_CALL:
        if (person.getTelephoneNumber() != null && !person.getTelephoneNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_TEL, Menu.FIRST + MenuActionItem.MENU_TEL,
                    person.getTelephoneNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getMobileNumber() != null && !person.getMobileNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_MOBILE, Menu.FIRST + MenuActionItem.MENU_MOBILE,
                    person.getMobileNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getCompany() != null && person.getCompany().getTelephoneNumber() != null
                && !person.getCompany().getTelephoneNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_COMPANY_TEL,
                    Menu.FIRST + MenuActionItem.MENU_COMPANY_TEL, person.getCompany().getTelephoneNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
        break;
    case MODE_SKYPE:
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_CHAT, Menu.FIRST + MenuActionItem.MENU_CHAT,
                R.string.start_chat);
        mi.setIcon(R.drawable.ic_im);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        mi = menu.add(Menu.NONE, MenuActionItem.MENU_CALL, Menu.FIRST + MenuActionItem.MENU_CALL,
                R.string.start_call);
        mi.setIcon(R.drawable.ic_call);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        mi = menu.add(Menu.NONE, MenuActionItem.MENU_VIDEOCALL, Menu.FIRST + MenuActionItem.MENU_VIDEOCALL,
                R.string.start_video_call);
        mi.setIcon(R.drawable.ic_videocall);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        break;
    case MODE_EMAIL:
        if (person.getEmail() != null && !person.getEmail().isEmpty()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_EMAIL, Menu.FIRST + MenuActionItem.MENU_EMAIL,
                    person.getEmail());
            mi.setIcon(R.drawable.ic_send_mail);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getCompany() != null && person.getCompany().getEmail() != null
                && !person.getCompany().getEmail().isEmpty()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_COMPANY_EMAIL,
                    Menu.FIRST + MenuActionItem.MENU_COMPANY_EMAIL, person.getCompany().getEmail());
            mi.setIcon(R.drawable.ic_send_mail);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
        break;

    default:
        break;
    }

}

From source file:org.alfresco.mobile.android.application.fragments.user.UserProfileFragment.java

private void getMenu(Menu menu, int mode) {
    MenuItem mi = null;/*from  w  ww  .  ja v  a2 s .  co m*/
    switch (mode) {
    case MODE_CALL:
        if (person.getTelephoneNumber() != null && !person.getTelephoneNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, R.id.menu_user_phone, Menu.FIRST + 6, person.getTelephoneNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getMobileNumber() != null && !person.getMobileNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, R.id.menu_user_mobile, Menu.FIRST + 7, person.getMobileNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getCompany() != null && person.getCompany().getTelephoneNumber() != null
                && !person.getCompany().getTelephoneNumber().isEmpty()) {
            mi = menu.add(Menu.NONE, R.id.menu_user_company_phone, Menu.FIRST + 5,
                    person.getCompany().getTelephoneNumber());
            mi.setIcon(R.drawable.ic_call);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
        break;
    case MODE_SKYPE:
        mi = menu.add(Menu.NONE, R.id.menu_user_chat, Menu.FIRST, R.string.start_chat);
        mi.setIcon(R.drawable.ic_im);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        mi = menu.add(Menu.NONE, R.id.menu_user_call, Menu.FIRST + 1, R.string.start_call);
        mi.setIcon(R.drawable.ic_call);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        mi = menu.add(Menu.NONE, R.id.menu_user_videocall, Menu.FIRST + 2, R.string.start_video_call);
        mi.setIcon(R.drawable.ic_videos);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        break;
    case MODE_EMAIL:
        if (person.getEmail() != null && !person.getEmail().isEmpty()) {
            mi = menu.add(Menu.NONE, R.id.menu_user_email, Menu.FIRST + 3, person.getEmail());
            mi.setIcon(R.drawable.ic_send_mail);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (person.getCompany() != null && person.getCompany().getEmail() != null
                && !person.getCompany().getEmail().isEmpty()) {
            mi = menu.add(Menu.NONE, R.id.menu_user_company_email, Menu.FIRST + 4,
                    person.getCompany().getEmail());
            mi.setIcon(R.drawable.ic_send_mail);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
        break;

    default:
        break;
    }

}

From source file:nya.miku.wishmaster.ui.settings.AutohideActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    if (info.position == 0)
        return;//from  w w w  . j  ava  2  s . com
    menu.add(Menu.NONE, R.id.context_menu_delete, 1, R.string.context_menu_delete_autohide_rule);
}