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.money.manager.ex.fragment.PayeeListFragment.java

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

    Cursor cursor = ((SimpleCursorAdapter) getListAdapter()).getCursor();
    cursor.moveToPosition(info.position);
    menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(Payee.PAYEENAME)));

    menu.add(Menu.NONE, ContextMenuIds.EDIT.getId(), Menu.NONE, getString(R.string.edit));
    menu.add(Menu.NONE, ContextMenuIds.DELETE.getId(), Menu.NONE, getString(R.string.delete));
    menu.add(Menu.NONE, ContextMenuIds.VIEW_TRANSACTIONS.getId(), Menu.NONE,
            getString(R.string.view_transactions));
}

From source file:com.tinfoil.sms.settings.QuickPrefsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, 0, 0, "Show current settings");
    return super.onCreateOptionsMenu(menu);
}

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

public static void getMenu(Menu menu) {
    MenuItem mi = menu.add(Menu.NONE, MenuActionItem.MENU_PROFILE, Menu.FIRST + MenuActionItem.MENU_PROFILE,
            R.string.my_profile);//from   w  w w. j  a  v a  2  s  .  c om
    mi.setIcon(R.drawable.ic_avatar);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:moe.johnny.tombstone.ui.PreventFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (!canCreateContextMenu(menu, menuInfo)) {
        return;/*www  .  ja  v a 2 s .  co  m*/
    }
    menu.clear();
    ViewHolder holder = (ViewHolder) ((AdapterContextMenuInfo) menuInfo).targetView.getTag();
    menu.setHeaderTitle(holder.nameView.getText());
    if (holder.icon != null) {
        setHeaderIcon(menu, holder.icon);
    }
    menu.add(Menu.NONE, R.string.app_info, Menu.NONE, R.string.app_info);
    if (holder.checkView.isEnabled() || canPreventAll()) {
        updatePreventMenu(menu, holder.packageName);
    }
    if (getMainIntent(holder.packageName) != null) {
        menu.add(Menu.NONE, R.string.open, Menu.NONE, R.string.open);
    }
    if (holder.canUninstall) {
        menu.add(Menu.NONE, R.string.uninstall, Menu.NONE, R.string.uninstall);
    }
    if (appNotification) {
        menu.add(Menu.NONE, R.string.app_notifications, Menu.NONE, R.string.app_notifications);
    }
}

From source file:com.guayaba.tapir.ui.fragments.profile.PlaylistSongFragment.java

/**
 * {@inheritDoc}//from  ww  w  .ja  v  a2s  .com
 */
@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));

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

    // Remove the song from playlist
    menu.add(GROUP_ID, FragmentMenuItems.REMOVE_FROM_PLAYLIST, Menu.NONE,
            getString(R.string.context_menu_remove_from_playlist));

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

From source file:com.boko.vimusic.ui.fragments.profile.PlaylistSongFragment.java

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

    // Remove the song from playlist
    menu.add(GROUP_ID, FragmentMenuItems.REMOVE_FROM_PLAYLIST, Menu.NONE,
            getString(R.string.context_menu_remove_from_playlist));

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

From source file:com.github.kanata3249.ffxieq.android.FoodSelectorActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item;//ww w. j av a2  s.  co m

    FoodListView flv;

    item = menu.findItem(R.id.FilterByType);
    SubMenu submenu = item.getSubMenu();
    submenu.removeGroup(R.id.FilterByType);

    flv = (FoodListView) findViewById(R.id.ListView);
    if (flv != null) {
        String types[] = flv.getAvailableFoodTypes();

        if (types == null || types.length == 1) {
            item.setEnabled(false);
        } else {
            item.setEnabled(true);
            submenu.add(R.id.FilterByType, -1, Menu.NONE, getString(R.string.ResetFilterByType));
            for (int i = 0; i < types.length; i++) {
                submenu.add(R.id.FilterByType, i, Menu.NONE, types[i]);
            }
        }

    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:com.androzic.waypoint.WaypointList.java

@Override
public void onPrepareOptionsMenu(final Menu menu) {
    Androzic application = Androzic.getApplication();

    MenuItem sortItem = menu.findItem(mSortMode == 0 ? R.id.action_sort_alpha : R.id.action_sort_size);
    sortItem.setChecked(true);/*from  w  w w .  j  av  a2s .c  o m*/
    Editor editor = PreferenceManager.getDefaultSharedPreferences(application).edit();
    editor.putInt(getString(R.string.wpt_sort), mSortMode);
    editor.commit();

    List<WaypointSet> sets = application.getWaypointSets();
    if (sets.size() > 1) {
        menu.setGroupVisible(R.id.group_sets, true);
        menu.removeGroup(R.id.group_sets);
        for (int i = 1; i < sets.size(); i++)
            menu.add(R.id.group_sets, i, Menu.NONE, sets.get(i).name).setChecked(true);
        menu.setGroupCheckable(R.id.group_sets, true, false);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.actions.NodeActions.java

protected void getMenu(FragmentActivity activity, Menu menu) {
    MenuItem mi;//from w  w w  . j  a  va 2s .  c o  m
    SubMenu createMenu;

    if (selectedFolder.isEmpty()) {
        mi = menu.add(Menu.NONE, R.id.menu_action_download_all, Menu.FIRST, R.string.download);
        mi.setIcon(R.drawable.ic_download_light);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_DOWNLOAD);

        if (!(SessionUtils.getSession(activity) instanceof CloudSession)) {
            mi = menu.add(Menu.NONE, R.id.menu_workflow_review_attachments, Menu.FIRST + 500,
                    R.string.process_start_review);
            mi.setIcon(R.drawable.ic_start_review);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_REVIEW);
        }
    }

    // SYNC
    if (SyncContentManager.getInstance(getActivity()).hasActivateSync(getAccount())
            && !SyncContentManager.getInstance(getActivity()).isSynced(getAccount(), parentFolder)) {
        createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_sync_group, Menu.FIRST, R.string.sync);
        createMenu.setIcon(R.drawable.ic_sync_light);
        createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        removeActionIfNecessary(menu, createMenu.getItem().getItemId(),
                ConfigurableActionHelper.ACTION_NODE_SYNC);

        createMenu.add(Menu.NONE, R.id.menu_action_sync_group_sync, Menu.FIRST + 1, R.string.sync);
        createMenu.add(Menu.NONE, R.id.menu_action_sync_group_unsync, Menu.FIRST + 2, R.string.unsync);
    }

    // FAVORITES
    createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_favorite_group, Menu.FIRST + 135,
            R.string.favorite);
    createMenu.setIcon(R.drawable.ic_favorite_light);
    createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    removeActionIfNecessary(menu, createMenu.getItem().getItemId(),
            ConfigurableActionHelper.ACTION_NODE_FAVORITE);

    createMenu.add(Menu.NONE, R.id.menu_action_favorite_group_favorite, Menu.FIRST + 1, R.string.favorite);
    createMenu.add(Menu.NONE, R.id.menu_action_favorite_group_unfavorite, Menu.FIRST + 2, R.string.unfavorite);

    // LIKE
    AlfrescoSession alfSession = SessionUtils.getSession(activity);
    if (alfSession != null && alfSession.getRepositoryInfo() != null
            && alfSession.getRepositoryInfo().getCapabilities() != null
            && alfSession.getRepositoryInfo().getCapabilities().doesSupportLikingNodes()) {
        createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_like_group, Menu.FIRST + 150, R.string.like);
        createMenu.setIcon(R.drawable.ic_like);
        createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        removeActionIfNecessary(menu, createMenu.getItem().getItemId(),
                ConfigurableActionHelper.ACTION_NODE_LIKE);

        createMenu.add(Menu.NONE, R.id.menu_action_like_group_like, Menu.FIRST + 1, R.string.like);
        createMenu.add(Menu.NONE, R.id.menu_action_like_group_unlike, Menu.FIRST + 2, R.string.unlike);
    }

    if (parentFolder != null && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(),
            parentFolder, ConfigurableActionHelper.ACTION_NODE_DELETE)) {
        mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete);
        mi.setIcon(R.drawable.ic_delete);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_DELETE);
    }
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItemCompat.setShowAsAction(//from  w  w  w. j  a  v  a2 s.co  m
            menu.add(Menu.NONE, MENU_MENU, Menu.NONE, R.string.menu).setIcon(drawable.ic_menu_more),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, MENU_BUTTON, Menu.NONE, R.string.btnIface).setIcon(android.R.drawable.ic_menu_add);
    menu.add(Menu.NONE, MENU_GESTURE, Menu.NONE, R.string.gestIface).setIcon(R.drawable.ic_menu_finger);
    return true;
}