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:de.stadtrallye.rallyesoft.ConnectionAssistantActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem scan_qr = menu.add(Menu.NONE, R.id.scan_qr_login, 10, R.string.scan_barcode);
    scan_qr.setIcon(R.drawable.ic_scan_qr_light);
    scan_qr.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    return true;/*from   ww w . j a v  a2  s . c o  m*/
}

From source file:it.sasabz.android.sasabus.classes.dialogs.SelectFavoritenDialog.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == android.R.id.list) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        menu.setHeaderTitle(list.get(info.position).toString());
        menu.add(Menu.NONE, 0, 0, R.string.delete);
    }//  w  ww .j  a va2  s  . co m
}

From source file:com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();/*from   w  w w  .  ja  v a2 s.  c  o m*/
    menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants.DATA_TABLE_SAVINGS_ACCOUNTS_NAME);
    menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getResources().getString(R.string.documents));
    super.onPrepareOptionsMenu(menu);
}

From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java

/**
 * @param menu/*from  w  ww . j a v  a2s  .  c  o  m*/
 * @param v
 * @param menuInfo
 * 
 *            Create a context menu for the list view Depending upon the
 *            item selected, shows the user different options
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

    // Get the selected item from the listview adapter
    final KeyValuePair kvp = m_adapter.getItem(info.position);

    // Set the header to the selected text
    menu.setHeaderTitle(kvp.getValue());

    // Add the default options (copy to clipboard)
    menu.add(Menu.NONE, MENU_ID_COPY_TO_CLIPBOARD, Menu.NONE, R.string.copyToClipboard)
            .setIcon(android.R.drawable.ic_menu_view);

    // Handle the special cases
    switch (kvp.get_type()) {
    case EMAIL:
        menu.add(Menu.NONE, MENU_ID_EMAIL, Menu.NONE, R.string.send_email)
                .setIcon(android.R.drawable.sym_action_email);
        break;
    case MOBILE:
        menu.add(Menu.NONE, MENU_ID_SMS, Menu.NONE, getString(R.string.send_sms_to) + kvp.getValue())
                .setIcon(android.R.drawable.ic_menu_send);
    case PHONE:
        menu.add(Menu.NONE, MENU_ID_CALL, Menu.NONE, getString(R.string.call_) + kvp.getValue())
                .setIcon(android.R.drawable.ic_menu_call);
        menu.add(Menu.NONE, MENU_ID_EDIT_BEFORE_CALL, Menu.NONE, R.string.edit_number_before_call)
                .setIcon(android.R.drawable.ic_menu_edit);
    case OTHER:
    case UNDEFINED:
        break;
    }
}

From source file:com.pdftron.pdf.controls.UserBookmarkDialogFragment.java

public void onShowPopupMenu(final int position, View anchor) {
    PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
    Menu menu = popupMenu.getMenu();

    final UserBookmarkItem bItem = mBookmarkViewAdapter.getItem(position);
    String[] menuItems = getResources().getStringArray(R.array.user_bookmark_dialog_context_menu);
    menu.add(Menu.NONE, CONTEXT_MENU_EDIT_ITEM, CONTEXT_MENU_EDIT_ITEM, menuItems[CONTEXT_MENU_EDIT_ITEM]);
    menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ITEM, CONTEXT_MENU_DELETE_ITEM,
            menuItems[CONTEXT_MENU_DELETE_ITEM]);
    menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ALL, CONTEXT_MENU_DELETE_ALL, menuItems[CONTEXT_MENU_DELETE_ALL]);
    MenuItem.OnMenuItemClickListener listener = new MenuItem.OnMenuItemClickListener() {
        @Override/*from   ww w .j  av a 2  s .  co m*/
        public boolean onMenuItemClick(MenuItem item) {
            onPopupItemSelected(item, position);
            return true;
        }
    };
    menu.getItem(CONTEXT_MENU_EDIT_ITEM).setOnMenuItemClickListener(listener);
    menu.getItem(CONTEXT_MENU_DELETE_ITEM).setOnMenuItemClickListener(listener);
    menu.getItem(CONTEXT_MENU_DELETE_ALL).setOnMenuItemClickListener(listener);
    popupMenu.show();
}

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

/**
 * {@inheritDoc}/*ww w. j  ava 2 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 = Long.valueOf(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 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(getSherlockActivity(), 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.fimagena.filepicker.FilePickerFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.picker_actions, menu);
    MenuItem item = menu.findItem(R.id.action_createdir);
    item.setVisible(mParams.get(ALLOW_CREATE_DIR));

    // FIXME: Ensure the icon is visible on the light background. This is a hack and should be done through the theme!
    TypedValue value = new TypedValue();
    getActivity().getTheme().resolveAttribute(R.attr.colorAccent, value, true);
    menu.findItem(R.id.action_createdir).getIcon().mutate().setColorFilter(value.data,
            PorterDuff.Mode.SRC_ATOP);/*  w w  w  . ja  v a  2  s  .  c  om*/

    for (int root = 0; root < mFileSystemRoots.length; root++)
        menu.add(Menu.NONE, root, Menu.NONE, "Switch to " + mFileSystemRoots[root].getName());
}

From source file:ru.mtuci.musicanalyzer.apollo.ui.fragments.QueueFragment.java

/**
 * {@inheritDoc}//from   w  w w. ja  v  a 2 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 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.zapto.park.ParkActivity.java

public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    MenuItem item1 = menu.add(Menu.NONE, 1, Menu.NONE, "Create Employee");
    item1.setIcon(android.R.drawable.ic_menu_myplaces);

    MenuItem item4 = menu.add(Menu.NONE, 4, Menu.NONE, "Update Log");
    item4.setIcon(android.R.drawable.ic_menu_more);

    MenuItem item3 = menu.add(Menu.NONE, 3, Menu.NONE, "View Log");
    item3.setIcon(android.R.drawable.ic_menu_gallery);

    MenuItem item2 = menu.add(Menu.NONE, 2, Menu.NONE, "Settings");
    item2.setIcon(android.R.drawable.ic_menu_manage);

    MenuItem item5 = menu.add(Menu.NONE, 5, Menu.NONE, "Send Emails");
    item5.setIcon(android.R.drawable.ic_menu_more);

    MenuItem item6 = menu.add(Menu.NONE, 6, Menu.NONE, "SMTP Settings");
    item6.setIcon(android.R.drawable.ic_menu_more);

    /*/* w  w w  .j av  a2 s  .c om*/
    MenuItem item5 = menu.add(Menu.NONE, 5, Menu.NONE, "Get Dirs");
    item5.setIcon(android.R.drawable.ic_menu_manage);
    */
    return true;
}

From source file:mtmo.test.mediadrm.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, MENU_ID_MENU1, Menu.NONE, "Switch Mode");
    return super.onCreateOptionsMenu(menu);
}