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.ksharkapps.musicnow.ui.fragments.profile.AlbumSongFragment.java

/**
 * {@inheritDoc}/*w w  w .  j ava 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;
    if (info.position > 0) {
        mSelectedPosition = info.position - 1;
        // 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 the song
        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);

        // 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.ksharkapps.musicnow.ui.fragments.profile.GenreSongFragment.java

/**
 * {@inheritDoc}/*  w w  w  . j ava 2s  .  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;
    if (info.position > 0) {

        mSelectedPosition = info.position - 1;
        // 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 the song
        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:ru.mtuci.musicanalyzer.apollo.ui.fragments.profile.GenreSongFragment.java

/**
 * {@inheritDoc}/*w w  w  . j av 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 - 1;
    // 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));

    // 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.BoardsListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem itemUpdate = menu.add(Menu.NONE, R.id.menu_update, 101, resources.getString(R.string.menu_update));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        itemUpdate.setIcon(ThemeUtils.getActionbarIcon(activity.getTheme(), resources, R.attr.actionRefresh));
        CompatibilityImpl.setShowAsActionIfRoom(itemUpdate);
    } else {/*w w  w  . ja  v  a 2 s.  c  o m*/
        itemUpdate.setIcon(R.drawable.ic_menu_refresh);
    }

    if (quickAccessList == null)
        return;
    for (QuickAccess.Entry entry : quickAccessList)
        if (entry.boardName == null && entry.chan != null
                && entry.chan.getChanName().equals(chan.getChanName()))
            return;
    menu.add(Menu.NONE, R.id.menu_quickaccess_add, 102, resources.getString(R.string.menu_quickaccess_add))
            .setIcon(R.drawable.ic_menu_add_bookmark);
}

From source file:org.catnut.fragment.OAuthFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem refresh = menu.add(Menu.NONE, R.id.refresh, Menu.NONE, getString(R.string.refresh));
    refresh.setIcon(R.drawable.ic_action_retry);
    refresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:com.cachirulop.moneybox.fragment.MovementsFragment.java

/**
 * Creates a context menu for the list of movements, showing an option for
 * delete the movement and another to get the movement.
 *///from  www .  ja  v  a  2s .c  o  m
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    if (v.getId() == R.id.lvMovements) {
        AdapterView.AdapterContextMenuInfo info;
        ListView listView;
        Movement selected;

        listView = (ListView) getActivity().findViewById(R.id.lvMovements);
        info = (AdapterView.AdapterContextMenuInfo) menuInfo;

        selected = (Movement) ((MoneyboxMovementAdapter) listView.getAdapter()).getItem(info.position);

        MenuItem item;

        menu.setHeaderTitle(selected.getInsertDateFormatted());
        item = menu.add(Menu.NONE, CONTEXT_MENU_GET, 0, R.string.get_from_moneybox);
        item.setEnabled(MovementsManager.canGetMovement(selected));

        item = menu.add(Menu.NONE, CONTEXT_MENU_DROP, 1, R.string.drop_to_moneybox_again);
        item.setEnabled(MovementsManager.canDropMovement(selected));

        item = menu.add(Menu.NONE, CONTEXT_MENU_DELETE, 2, R.string.delete);
        item.setEnabled(MovementsManager.canDeleteMovement(selected));
    }
}

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

private void populateMenu(Menu menu) {
    menu.add(Menu.NONE, ABOUT_ID, Menu.NONE, R.string.about_arxiv_droid);
    menu.add(Menu.NONE, HISTORY_ID, Menu.NONE, R.string.view_history);
    menu.add(Menu.NONE, PREF_ID, Menu.NONE, R.string.preferences);
    menu.add(Menu.NONE, DONATE_ID, Menu.NONE, R.string.donate);
}

From source file:com.glabs.homegenie.fragments.GroupsViewFragment.java

public void UpdateCurrentGroupMenu() {
    StartActivity rootactivity = (StartActivity) getActivity();
    Menu menu = rootactivity.getActionMenu();
    if (menu != null) {
        MenuItem automation = menu.findItem(R.id.menu_automation);
        if (automation != null) {
            automation.setEnabled(false);
            Menu submenu = automation.getSubMenu();
            if (submenu == null)
                return;
            ////w  w  w.  ja  va 2  s  .c o m
            submenu.removeGroup(Menu.NONE);
            if (mGroupPrograms.size() > 0) {
                for (Module program : mGroupPrograms) {
                    MenuItem prg = submenu.add(Menu.NONE, Menu.NONE, Menu.NONE, program.getDisplayName());
                    prg.setIcon(R.drawable.ic_action_flash_on);
                    MenuCompat.setShowAsAction(prg, SHOW_AS_ACTION_IF_ROOM | SHOW_AS_ACTION_WITH_TEXT);
                    final String paddress = program.Address;
                    String groupname = "";
                    try {
                        groupname = Uri.encode(mAdapter.getGroup(mCurrentGroup).Name, "UTF-8");
                    } catch (Exception e) {
                    }
                    final String gname = groupname;
                    prg.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                        @Override
                        public boolean onMenuItemClick(MenuItem menuItem) {
                            String apicall = "HomeAutomation.HomeGenie/Automation/Programs.Run/" + paddress
                                    + "/" + gname + "/" + new Date().getTime();
                            Control.callServiceApi(apicall, null);
                            return true;
                        }
                    });
                }
                automation.setEnabled(true);
            }
        }
        //
        //            MenuItem recordMacro = submenu.add(1, Menu.NONE, Menu.NONE, "Record macro");
        //            recordMacro.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        //                @Override
        //                public boolean onMenuItemClick(MenuItem menuItem) {
        //                    StartActivity sa = (StartActivity)getActivity();
        //                    sa.openMacroRecordMenu();
        //                    return true;
        //                }
        //            });
        //            rootactivity.supportInvalidateOptionsMenu();
    }
}

From source file:com.chaosinmotion.securechat.activities.MainActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.main_list) {
        String[] menuItems = getResources().getStringArray(R.array.context_menu);
        for (int i = 0; i < menuItems.length; ++i) {
            menu.add(Menu.NONE, i, i, menuItems[i]);
        }/*from www. j  ava 2 s  .  c  o  m*/
    }
}

From source file:com.guayaba.tapir.ui.fragments.QueueFragment.java

/**
 * {@inheritDoc}/*from   w  w  w . j a va2 s.  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.mSongId;
    mSongName = mSong.mSongName;
    mAlbumName = mSong.mAlbumName;
    mArtistName = mSong.mArtistName;

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

    // 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);

    // Remove the song from the queue
    menu.add(GROUP_ID, FragmentMenuItems.REMOVE_FROM_QUEUE, Menu.NONE, getString(R.string.remove_from_queue));

    // 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));
}