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:net.movelab.cmlibrary.MapMyData.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    menu.clear();//from ww  w . j  a v a 2  s .c o m

    menu.add(0, LOCATE_NOW, Menu.NONE, R.string.menu_locate_now);
    menu.add(0, SETTINGS, Menu.NONE, R.string.menu_settings);
    menu.add(0, CENTER, Menu.NONE, R.string.menu_center_map);
    menu.add(0, SAVE_MAP, Menu.NONE, R.string.menu_map_save);
    menu.add(0, SHARE_MAP, Menu.NONE, R.string.menu_map_share);

    menu.add(0, LIFELINE, Menu.NONE, R.string.lifeline_button);
    menu.add(0, LIST_DATA, Menu.NONE, R.string.list_data_button);
    menu.add(0, SAVE_CSV, Menu.NONE, R.string.save_data_button);
    menu.add(0, FLUSH_GPS, Menu.NONE, R.string.menu_flush_gps);
    menu.add(0, RATE, Menu.NONE, R.string.menu_rate);
    menu.add(0, SHARE, Menu.NONE, R.string.menu_share);

    if (shareData)
        menu.add(0, ASP, Menu.NONE, R.string.menu_asp);
    menu.add(0, ABOUT, Menu.NONE, R.string.about);

    return true;
}

From source file:nya.miku.wishmaster.ui.GalleryActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    this.menu = menu;
    MenuItem itemUpdate = menu.add(Menu.NONE, R.id.menu_update, 1, R.string.menu_update);
    MenuItem itemSave = menu.add(Menu.NONE, R.id.menu_save_attachment, 2, R.string.menu_save_attachment);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        itemUpdate.setIcon(ThemeUtils.getActionbarIcon(getTheme(), getResources(), R.attr.actionRefresh));
        itemSave.setIcon(ThemeUtils.getActionbarIcon(getTheme(), getResources(), R.attr.actionSave));
        CompatibilityImpl.setShowAsActionIfRoom(itemUpdate);
        CompatibilityImpl.setShowAsActionIfRoom(itemSave);
    } else {/*ww w  .  ja  va  2 s .  c  o m*/
        itemUpdate.setIcon(R.drawable.ic_menu_refresh);
        itemSave.setIcon(android.R.drawable.ic_menu_save);
    }
    menu.add(Menu.NONE, R.id.menu_open_external, 3, R.string.menu_open).setIcon(R.drawable.ic_menu_set_as);
    menu.add(Menu.NONE, R.id.menu_share, 4, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share);
    menu.add(Menu.NONE, R.id.menu_share_link, 5, R.string.menu_share_link)
            .setIcon(android.R.drawable.ic_menu_share);
    menu.add(Menu.NONE, R.id.menu_search_google, 6, R.string.menu_search_google)
            .setIcon(android.R.drawable.ic_menu_search);
    menu.add(Menu.NONE, R.id.menu_open_browser, 7, R.string.menu_open_browser)
            .setIcon(R.drawable.ic_menu_browser);
    updateMenu();

    return true;
}

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (v.getId() == R.id.sidebar_tabs_list) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        TabModel model = tabsAdapter.getItem(info.position);
        if (tabsAdapter.getCount() > 1) {
            menu.add(Menu.NONE, R.id.context_menu_move, 1, R.string.context_menu_move);
        }/*from w  ww.ja  v  a  2s .  c om*/
        if (model.webUrl != null) {
            menu.add(Menu.NONE, R.id.context_menu_copy_url, 2, R.string.context_menu_copy_url);
            menu.add(Menu.NONE, R.id.context_menu_share_link, 3, R.string.context_menu_share_link);
        }
        if (canFavorite(model)) {
            menu.add(Menu.NONE, R.id.context_menu_favorites, 4,
                    isFavorite(model) ? R.string.context_menu_remove_favorites
                            : R.string.context_menu_add_favorites);
        }
        if (model.type == TabModel.TYPE_NORMAL && model.pageModel != null
                && model.pageModel.type == UrlPageModel.TYPE_THREADPAGE) {
            boolean backgroundAutoupdateEnabled = MainApplication.getInstance().settings.isAutoupdateEnabled()
                    && MainApplication.getInstance().settings.isAutoupdateBackground();
            menu.add(Menu.NONE, R.id.context_menu_autoupdate_background, 5,
                    backgroundAutoupdateEnabled ? R.string.context_menu_autoupdate_background
                            : R.string.context_menu_autoupdate_background_off)
                    .setCheckable(true).setChecked(model.autoupdateBackground);
        }
        if (model.autoupdateBackground && TabsTrackerService.getCurrentUpdatingTabId() == -1) {
            menu.add(Menu.NONE, R.id.context_menu_autoupdate_now, 6, R.string.context_menu_autoupdate_now);
        }
    }
}

From source file:com.univ.helsinki.app.MainActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.listview) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

        String[] menuItems = getResources().getStringArray(R.array.listitem_menu_array);
        for (int i = 0; i < menuItems.length; i++) {
            menu.add(Menu.NONE, i, i, menuItems[i]);
        }//from  w w  w  .j a v  a  2 s .  c o  m
    }
}

From source file:nl.spellenclubeindhoven.dominionshuffle.SelectActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem item = menu.add(Menu.NONE, MENU_SORT, Menu.NONE, R.string.menu_sort);
    item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);

    item = menu.add(Menu.NONE, MENU_CLEAR_ALL, Menu.NONE, R.string.menu_clear_all);
    item.setIcon(R.drawable.clear_all);/*from  w ww. ja  v a  2  s.c om*/

    item = menu.add(Menu.NONE, MENU_LOAD, Menu.NONE, R.string.menu_load);
    item.setIcon(android.R.drawable.ic_menu_upload);

    item = menu.add(Menu.NONE, MENU_SAVE, Menu.NONE, R.string.menu_save);
    item.setIcon(android.R.drawable.ic_menu_save);

    item = menu.add(Menu.NONE, MENU_SETTINGS, Menu.NONE, R.string.menu_settings);
    item.setIcon(R.drawable.globe);

    item = menu.add(Menu.NONE, MENU_LAST_RESULT, Menu.NONE, R.string.menu_last_result);
    item.setIcon(R.drawable.last_result);

    item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, R.string.menu_about);
    item.setIcon(android.R.drawable.stat_sys_warning);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.googlecode.android_scripting.activity.ScriptManager.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    menu.add(Menu.NONE, MenuId.RENAME.getId(), Menu.NONE, getString(R.string.s_Rename));
    menu.add(Menu.NONE, MenuId.DELETE.getId(), Menu.NONE, getString(R.string.s_Delete));
    menu.add(Menu.NONE, MenuId.DECOMPILE.getId(), Menu.NONE, getString(R.string.s_Decompile));
    menu.add(Menu.NONE, MenuId.BUILD.getId(), Menu.NONE, getString(R.string.s_Build));
}

From source file:in.shick.diode.user.ProfileActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    int rowId = (int) info.id;
    ThingInfo item = mThingsAdapter.getItem(rowId);

    // Mark the message/comment as selected
    mVoteTargetThingInfo = item;/*from w  w  w. j a v a2  s  . c o  m*/

    if (item.isThreadKind()) {
        menu.add(0, Constants.DIALOG_THREAD_CLICK, Menu.NONE, R.string.goto_thread);
    } else {
        menu.add(0, Constants.DIALOG_COMMENT_CLICK, Menu.NONE, R.string.view_context);
        if (mVoteTargetThingInfo.getLink_id() != null) {
            // Don't add the thread link if the link_id is null for some reason.
            menu.add(1, Constants.DIALOG_THREAD_CLICK, Menu.NONE, R.string.goto_thread);
        }
        // Lazy-load the URL list to make the list-loading more 'snappy'.
        if (mVoteTargetThingInfo.getUrls() != null && mVoteTargetThingInfo.getUrls().isEmpty()) {
            Markdown.getURLs(mVoteTargetThingInfo.getBody(), mVoteTargetThingInfo.getUrls());
        }
        if (mVoteTargetThingInfo.getUrls() != null && !mVoteTargetThingInfo.getUrls().isEmpty()) {
            menu.add(0, Constants.DIALOG_LINKS, Menu.NONE, R.string.links_menu_item);
        }
    }
}

From source file:fr.pasteque.client.Configure.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    int i = 0;//w  w w.  j  a va  2s  .  c o  m
    MenuItem imp = menu.add(Menu.NONE, MENU_IMPORT_ID, i++, this.getString(R.string.menu_cfg_import));
    imp.setIcon(android.R.drawable.ic_menu_revert);
    MenuItem exp = menu.add(Menu.NONE, MENU_EXPORT_ID, i++, this.getString(R.string.menu_cfg_export));
    exp.setIcon(android.R.drawable.ic_menu_edit);
    MenuItem dbg = menu.add(Menu.NONE, MENU_DEBUG_ID, i, this.getString(R.string.menu_cfg_debug));
    dbg.setIcon(android.R.drawable.ic_menu_report_image);
    return true;
}

From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java

/**
 * Run during fragment initialization, this sets up the song info popup menu.
 *
 * @param view The view in which to setup the song info View for this class.
 * @return The song info view used as a field in this class.
 *///from   ww w . j ava 2s  .c  o m
private View getSongInfo(final View view) {
    final View songInfo = view.findViewById(R.id.songInfo);

    final PopupMenu popupMenu = new PopupMenu(mActivity, songInfo);
    final Menu menu = popupMenu.getMenu();
    menu.add(Menu.NONE, POPUP_ALBUM, Menu.NONE, R.string.goToAlbum);
    menu.add(Menu.NONE, POPUP_ARTIST, Menu.NONE, R.string.goToArtist);
    menu.add(Menu.NONE, POPUP_ALBUM_ARTIST, Menu.NONE, R.string.goToAlbumArtist);
    menu.add(Menu.NONE, POPUP_FOLDER, Menu.NONE, R.string.goToFolder);
    menu.add(Menu.NONE, POPUP_CURRENT, Menu.NONE, R.string.goToCurrent);
    menu.add(Menu.NONE, POPUP_SHARE, Menu.NONE, R.string.share);
    popupMenu.setOnMenuItemClickListener(this);
    mPopupMenuTouchListener = PopupMenuCompat.getDragToOpenListener(popupMenu);

    final PopupMenu popupMenuStream = new PopupMenu(mActivity, songInfo);
    final Menu menuStream = popupMenuStream.getMenu();
    menuStream.add(Menu.NONE, POPUP_STREAM, Menu.NONE, R.string.goToStream);
    menuStream.add(Menu.NONE, POPUP_CURRENT, Menu.NONE, R.string.goToCurrent);
    menuStream.add(Menu.NONE, POPUP_SHARE, Menu.NONE, R.string.share);
    popupMenuStream.setOnMenuItemClickListener(this);
    mPopupMenuStreamTouchListener = PopupMenuCompat.getDragToOpenListener(popupMenuStream);

    songInfo.setOnClickListener(new OnClickListener() {

        /**
         * Checks whether the album artist should be on the popup menu for the current track.
         *
         * @return True if the album artist popup menu entry should be visible, false otherwise.
         */
        private boolean isAlbumArtistVisible() {
            boolean albumArtistEnabled = false;
            final String albumArtist = mCurrentSong.getAlbumArtist();

            if (albumArtist != null && !albumArtist.isEmpty()) {
                final String artist = mCurrentSong.getArtist();

                if (isArtistVisible() && !albumArtist.equals(artist)) {
                    albumArtistEnabled = true;
                }
            }

            return albumArtistEnabled;
        }

        /**
         * Checks whether the album should be on the popup menu for the current track.
         *
         * @return True if the album popup menu entry should be visible, false otherwise.
         */
        private boolean isAlbumVisible() {
            final boolean isAlbumVisible;
            final String album = mCurrentSong.getAlbum();

            if (album != null && !album.isEmpty()) {
                isAlbumVisible = true;
            } else {
                isAlbumVisible = false;
            }

            return isAlbumVisible;
        }

        /**
         * Checks whether the artist should be on the popup menu for the current track.
         *
         * @return True if the artist popup menu entry should be visible, false otherwise.
         */
        private boolean isArtistVisible() {
            final boolean isArtistVisible;
            final String artist = mCurrentSong.getArtist();

            if (artist != null && !artist.isEmpty()) {
                isArtistVisible = true;
            } else {
                isArtistVisible = false;
            }

            return isArtistVisible;
        }

        /**
         * This method checks the dynamic entries for visibility prior to showing the song info
         * popup menu.
         *
         * @param v The view for the song info popup menu.
         */
        @Override
        public void onClick(final View v) {
            if (mCurrentSong != null) {
                if (mCurrentSong.isStream()) {
                    popupMenuStream.show();
                } else {
                    // Enable / Disable menu items that need artist and album defined.
                    menu.findItem(POPUP_ALBUM).setVisible(isAlbumVisible());
                    menu.findItem(POPUP_ARTIST).setVisible(isArtistVisible());
                    menu.findItem(POPUP_ALBUM_ARTIST).setVisible(isAlbumArtistVisible());
                    popupMenu.show();
                }
            }
        }
    });

    return songInfo;
}

From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    int rowId = (int) info.id;
    ThingInfo item = mMessagesAdapter.getItem(rowId);

    // Mark the message/comment as selected
    mVoteTargetThingInfo = item;//from  w  w  w  .  j a v a 2  s  . c  om
    mVoteTargetView = v;
    mReplyTargetName = item.getName();

    if (item.isWas_comment()) {
        // TODO: include the context!
        menu.add(0, Constants.DIALOG_COMMENT_CLICK, Menu.NONE, "Go to comment");
    } else {
        menu.add(0, Constants.DIALOG_MESSAGE_CLICK, Menu.NONE, "Reply");
    }
}