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:com.gh4a.activities.FileViewerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.download_menu, menu);

    if (FileUtils.isImage(mPath) || FileUtils.isMarkdown(mPath)) {
        menu.removeItem(R.id.wrap);//from   ww  w. j  a v  a 2 s .c  o m
    }

    menu.removeItem(R.id.download);
    MenuItem item = menu.add(0, MENU_ITEM_HISTORY, Menu.NONE, R.string.history);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_NEVER);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.andrew.apollo.ui.fragments.LastAddedFragment.java

/**
 * {@inheritDoc}//from  ww  w.  ja v  a  2 s  .  co m
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    mSelectedPosition = info.position;
    // Creat a new song
    mSong = mAdapter.getItem(mSelectedPosition);
    mSelectedId = mSong.mSongId;
    mSongName = mSong.mSongName;
    mAlbumName = mSong.mAlbumName;
    mArtistName = mSong.mArtistName;

    // Play the song
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE,
            getString(R.string.context_menu_play_selection));

    // Play next
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_NEXT, Menu.NONE, getString(R.string.context_menu_play_next));

    // Add the song to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, getString(R.string.add_to_queue));

    // Add the song to a playlist
    final SubMenu subMenu = menu.addSubMenu(GROUP_ID, FragmentMenuItems.ADD_TO_PLAYLIST, Menu.NONE,
            R.string.add_to_playlist);
    MusicUtils.makePlaylistMenu(getActivity(), GROUP_ID, subMenu, true);

    // View more content by the song artist
    menu.add(GROUP_ID, FragmentMenuItems.MORE_BY_ARTIST, Menu.NONE,
            getString(R.string.context_menu_more_by_artist));

    // Make the song a ringtone
    menu.add(GROUP_ID, FragmentMenuItems.USE_AS_RINGTONE, Menu.NONE,
            getString(R.string.context_menu_use_as_ringtone));

    // Delete the song
    menu.add(GROUP_ID, FragmentMenuItems.DELETE, Menu.NONE, getString(R.string.context_menu_delete));
}

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (adapter == null)
        return;/*from  ww w  . jav  a 2  s  . c  om*/
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    Object item = adapter.getItem(info.position);
    if (item instanceof Database.HistoryEntry) {
        Database.HistoryEntry entry = (Database.HistoryEntry) item;
        if (entry.date != 0) {
            menu.add(Menu.NONE, R.id.context_menu_remove_history, 1, R.string.context_menu_remove_history);
            menu.add(Menu.NONE, R.id.context_menu_open_browser, 2, R.string.context_menu_open_browser);
            menu.add(Menu.NONE, R.id.context_menu_favorites_from_fragment, 3,
                    MainApplication.getInstance().database.isFavorite(entry.chan, entry.board, entry.boardPage,
                            entry.thread) ? R.string.context_menu_remove_favorites
                                    : R.string.context_menu_add_favorites);
        }
    }
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.FeedMembersFragment.java

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    Cursor cursor = (Cursor) mContacts.getItem(info.position);
    final Contact c = Helpers.getContact(v.getContext(),
            cursor.getLong(cursor.getColumnIndexOrThrow(Contact._ID)));
    ;/*from   w  ww .  j a  v a 2  s . c o m*/
    menu.setHeaderTitle(c.name);
    String[] menuItems = new String[] { "Delete" };
    for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
    }
}

From source file:com.boko.vimusic.ui.fragments.SongFragment.java

/**
 * {@inheritDoc}/*from  w  w  w.j  a v a2s .  c  o m*/
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    mSelectedPosition = info.position;
    // Creat a new song
    mSong = mAdapter.getItem(mSelectedPosition);
    mSelectedId = mSong;
    mSongName = mSong.getName();
    mAlbumName = mSong.mAlbumName;
    mArtistName = mSong.mArtistName;

    // Play the song
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE,
            getString(R.string.context_menu_play_selection));

    // Play next
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_NEXT, Menu.NONE, getString(R.string.context_menu_play_next));

    // Add the song to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, getString(R.string.add_to_queue));

    // Add the song to a playlist
    final SubMenu subMenu = menu.addSubMenu(GROUP_ID, FragmentMenuItems.ADD_TO_PLAYLIST, Menu.NONE,
            R.string.add_to_playlist);
    MusicUtils.makePlaylistMenu(getActivity(), GROUP_ID, subMenu, true);

    // View more content by the song artist
    menu.add(GROUP_ID, FragmentMenuItems.MORE_BY_ARTIST, Menu.NONE,
            getString(R.string.context_menu_more_by_artist));

    // Make the song a ringtone
    menu.add(GROUP_ID, FragmentMenuItems.USE_AS_RINGTONE, Menu.NONE,
            getString(R.string.context_menu_use_as_ringtone));

    // Delete the song
    menu.add(GROUP_ID, FragmentMenuItems.DELETE, Menu.NONE, getString(R.string.context_menu_delete));
}

From source file:com.commonsware.android.arXiv.arXiv.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, SEARCH_ID, Menu.NONE, R.string.search).setIcon(R.drawable.ic_action_action_search)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    populateMenu(menu);/*from  w  w w  . j av  a 2  s .  c om*/
    this.menu = menu;
    return (super.onCreateOptionsMenu(menu));
}

From source file:com.money.manager.ex.currency.recycler.CurrencyRecyclerListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    RecyclerViewContextMenuInfo info = (RecyclerViewContextMenuInfo) menuInfo;
    Currency currency = getCurrencyAtPosition(info.position);
    menu.setHeaderTitle(currency.getName());

    // compose context menu
    String[] menuItems = getResources().getStringArray(R.array.context_menu_currencies);
    for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
    }//  w w  w  .j a  va2  s .  c om
}

From source file:de.stadtrallye.rallyesoft.fragments.TasksOverviewFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem refreshMenuItem = menu.add(Menu.NONE, R.id.refresh_menu, 30, R.string.refresh);
    refreshMenuItem.setIcon(R.drawable.ic_refresh_light);
    refreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    MenuItem resize = menu.add(Menu.NONE, R.id.resize_menu, 40, R.string.resize);
    resize.setIcon(R.drawable.ic_center_light);
    resize.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:com.boko.vimusic.ui.fragments.ThemeFragment.java

/**
 * {@inheritDoc}//  w  ww  .ja  v a 2  s . c  o m
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    if (info.position > 0) {
        // Open to the theme's Play Store page
        menu.add(Menu.NONE, OPEN_IN_PLAY_STORE, Menu.NONE, getString(R.string.context_menu_open_in_play_store));
    }
    super.onCreateContextMenu(menu, v, menuInfo);
}

From source file:uk.ac.horizon.artcodes.activity.NavigationActivity.java

private void updateAccounts() {
    final Menu menu = binding.navigation.getMenu();
    final MenuItem libraries = menu.findItem(R.id.nav_libraries);
    final SubMenu subMenu = libraries.getSubMenu();

    while (subMenu.size() > 0) {
        subMenu.removeItem(subMenu.getItem(0).getItemId());
    }// ww w  . j  a  v  a  2 s .  c  o  m

    final List<Account> accounts = getServer().getAccounts();
    for (int index = 0; index < accounts.size(); index++) {
        final Account account = accounts.get(index);
        final MenuItem menuItem = subMenu.add(R.id.navigation, index, Menu.NONE, account.getDisplayName());
        if (account.getId().equals("local")) {
            menuItem.setIcon(R.drawable.ic_folder_24dp);
        } else {
            menuItem.setIcon(R.drawable.ic_cloud_24dp);
        }
        menuItem.setCheckable(true);
    }

    final MenuItem menuItem = subMenu.add(R.id.navigation, R.id.nav_addaccount, Menu.NONE,
            R.string.nav_addaccount);
    menuItem.setIcon(R.drawable.ic_add_24dp);

    for (int i = 0, count = binding.navigation.getChildCount(); i < count; i++) {
        final View child = binding.navigation.getChildAt(i);
        if (child != null && child instanceof ListView) {
            final ListView menuView = (ListView) child;
            final HeaderViewListAdapter adapter = (HeaderViewListAdapter) menuView.getAdapter();
            final BaseAdapter wrapped = (BaseAdapter) adapter.getWrappedAdapter();
            wrapped.notifyDataSetChanged();
        }
    }

    getServer().loadRecent(new LoadCallback<List<String>>() {
        @Override
        public void loaded(List<String> item) {
            final MenuItem recent = menu.findItem(R.id.nav_recent);
            if (recent != null) {
                recent.setVisible(!item.isEmpty());
            }
        }

        @Override
        public void error(Throwable e) {
            GoogleAnalytics.trackException(e);
        }
    });
    getServer().loadStarred(new LoadCallback<List<String>>() {
        @Override
        public void loaded(List<String> item) {
            final MenuItem starred = menu.findItem(R.id.nav_starred);
            if (starred != null) {
                starred.setVisible(!item.isEmpty());
            }
        }

        @Override
        public void error(Throwable e) {
            GoogleAnalytics.trackException(e);
        }
    });
}