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.metinkale.prayerapp.compass.Main.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    mRefresh = menu.add(Menu.NONE, Menu.NONE, 1, R.string.refresh);
    mSwitch = menu.add(Menu.NONE, Menu.NONE, 0, R.string.switchCompass);
    MenuItemCompat.setShowAsAction(mRefresh, MenuItemCompat.SHOW_AS_ACTION_NEVER);
    MenuItemCompat.setShowAsAction(mSwitch, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);

    mSwitch.setIcon(MaterialDrawableBuilder.with(this).setIcon(MaterialDrawableBuilder.IconValue.MAP)
            .setColor(Color.WHITE).setToActionbarSize().build());
    return true;//w  ww  .  j a  v  a2  s  . c om
}

From source file:com.todoroo.astrid.actfm.CommentsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (menu.size() > 0) {
        return;/*  w  w w  .ja v a 2  s  . c  o  m*/
    }

    MenuItem item;
    boolean showCommentsRefresh = false;
    if (showCommentsRefresh) {
        Activity activity = getActivity();
        if (activity instanceof TaskListActivity) {
            TaskListActivity tla = (TaskListActivity) activity;
            showCommentsRefresh = tla.getTaskEditFragment() == null;
        }
    }
    if (showCommentsRefresh) {
        item = menu.add(Menu.NONE, MENU_REFRESH_ID, Menu.NONE, R.string.ENA_refresh_comments);
        item.setIcon(R.drawable.icn_menu_refresh_dark);
    }
}

From source file:net.sourceforge.kalimbaradio.androidapp.activity.SelectPlaylistActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    menu.add(Menu.NONE, MENU_ITEM_PLAY_ALL, MENU_ITEM_PLAY_ALL, R.string.common_play_now);
}

From source file:com.pentacog.mctracker.MCServerTrackerActivity.java

/**
 * @see android.app.Activity#onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
 *///from w  w w .j  a v a2  s.  co  m
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.server_context, menu);
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;

    Server server = serverList.getItem(info.position);

    if (!server.favorite) {
        menu.add(Menu.NONE, 124, Menu.NONE, R.string.favorites_add);

    } else {
        menu.add(Menu.NONE, 124, Menu.NONE, R.string.favorites_remove);
    }

}

From source file:com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();//from  w ww  . ja  v a  2  s  .c o  m
    menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants.DATA_TABLE_LOAN_NAME);
    menu.add(Menu.NONE, MENU_ITEM_LOAN_TRANSACTIONS, Menu.NONE,
            getResources().getString(R.string.transactions));
    menu.add(Menu.NONE, MENU_ITEM_REPAYMENT_SCHEDULE, Menu.NONE,
            getResources().getString(R.string.loan_repayment_schedule));
    menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getResources().getString(R.string.documents));
    menu.add(Menu.NONE, MENU_ITEM_CHARGES, Menu.NONE, getResources().getString(R.string.charges));
    super.onPrepareOptionsMenu(menu);
}

From source file:com.activiti.android.app.fragments.HelpDialogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();//from   w w w .j ava2  s  .co m

    refreshIcon = menu.add(Menu.NONE, R.id.menu_refresh, Menu.FIRST, R.string.refresh);
    refreshIcon.setIcon(R.drawable.ic_refresh_white);
    refreshIcon.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:org.alfresco.mobile.android.application.fragments.help.HelpDialogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (!MenuFragmentHelper.canDisplayFragmentMenu(getActivity())) {
        return;//from  w ww . j  ava 2s  .  c om
    }
    menu.clear();

    refreshIcon = menu.add(Menu.NONE, R.id.menu_refresh, Menu.FIRST, R.string.refresh);
    refreshIcon.setIcon(R.drawable.ic_refresh);
    refreshIcon.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:com.mifos.mifosxdroid.online.clientdetails.ClientDetailsFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();//  ww  w .j a  v  a  2  s . c  om
    if (isClientActive) {
        menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants.DATA_TABLE_CLIENTS_NAME);
        menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint));
        menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges));
        menu.add(Menu.NONE, MENU_ITEM_ADD_SAVINGS_ACCOUNT, Menu.NONE, getString(R.string.savings_account));
        menu.add(Menu.NONE, MENU_ITEM_ADD_LOAN_ACCOUNT, Menu.NONE, getString(R.string.add_loan));
        menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getString(R.string.documents));
        menu.add(Menu.NONE, MENU_ITEM_IDENTIFIERS, Menu.NONE, getString(R.string.identifiers));
        menu.add(Menu.NONE, MENU_ITEM_SURVEYS, Menu.NONE, getString(R.string.survey));
    }
    super.onPrepareOptionsMenu(menu);
}

From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, MENU_PAGEOVERVIEW, Menu.NONE, "Pageoverview");
    return super.onCreateOptionsMenu(menu);
}

From source file:com.andrew.apollo.ui.fragments.profile.ApolloFragment.java

@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
        final ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    // Get the position of the selected item
    final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    int mSelectedPosition = info.position - mAdapter.getOffset();

    // Create a new song
    mItem = mAdapter.getItem(mSelectedPosition);

    // TODO: Remove these mutable properties, parametrize the onMenuEvent handlers.
    if (mItem instanceof Song) {
        Song mSong = (Song) mItem;//from   w  w w .j av  a 2s .  c o  m
        mSelectedId = mSong.mSongId;
        mSongName = mSong.mSongName;
        mAlbumName = mSong.mAlbumName;
        mArtistName = mSong.mArtistName;
        mSongList = null;
    } else if (mItem instanceof Album) {
        Album mAlbum = (Album) mItem;
        mSelectedId = mAlbum.mAlbumId;
        mSongName = null;
        mAlbumName = mAlbum.mAlbumName;
        mArtistName = mAlbum.mArtistName;
        mSongList = MusicUtils.getSongListForAlbum(getActivity(), mAlbum.mAlbumId);
    } else if (mItem instanceof Artist) {
        Artist mArtist = (Artist) mItem;
        mSelectedId = mArtist.mArtistId;
        mSongName = null;
        mArtistName = mArtist.mArtistName;
        mSongList = MusicUtils.getSongListForArtist(getActivity(), mArtist.mArtistId);
    } else if (mItem instanceof Genre) {
        Genre mGenre = (Genre) mItem;
        mSelectedId = mGenre.mGenreId;
        mSongList = MusicUtils.getSongListForGenre(getActivity(), mGenre.mGenreId);
    } else if (mItem instanceof Playlist) {
        Playlist mPlaylist = (Playlist) mItem;
        mSelectedId = mPlaylist.mPlaylistId;
        if (mSelectedId == PlaylistLoader.FAVORITE_PLAYLIST_ID) {
            mSongList = MusicUtils.getSongListForFavorites(getActivity());
        } else if (mSelectedId == PlaylistLoader.LAST_ADDED_PLAYLIST_ID) {
            mSongList = MusicUtils.getSongListForLastAdded(getActivity());
        } else {
            mSongList = MusicUtils.getSongListForPlaylist(getActivity(), mPlaylist.mPlaylistId);
        }

    }

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

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

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

    // Add the song to favorite's playlist
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_FAVORITES, Menu.NONE, R.string.add_to_favorites);

    // Add the song/album 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);

    if (mItem instanceof Song) {
        menu.add(GROUP_ID, FragmentMenuItems.USE_AS_RINGTONE, Menu.NONE,
                getString(R.string.context_menu_use_as_ringtone));
    }

    // More by artist
    menu.add(GROUP_ID, FragmentMenuItems.MORE_BY_ARTIST, Menu.NONE,
            getString(R.string.context_menu_more_by_artist));

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