List of usage examples for android.view MenuItem getGroupId
public int getGroupId();
From source file:com.andrew.apollo.ui.fragments.profile.AlbumSongFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getSherlockActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getSherlockActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getSherlockActivity()).addSongId(Long.valueOf(mSelectedId), mSongName, mAlbumName, mArtistName); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getSherlockActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getSherlockActivity(), mSelectedId); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); refresh();/*from www.j ava 2 s . com*/ return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.andrew.apollo.ui.fragments.profile.FavoriteFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getSherlockActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getSherlockActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getSherlockActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getSherlockActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getSherlockActivity(), mSelectedId); return true; case FragmentMenuItems.REMOVE_FROM_FAVORITES: FavoritesStore.getInstance(getSherlockActivity()).removeItem(Long.valueOf(mSelectedId)); getLoaderManager().restartLoader(LOADER, null, this); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); SystemClock.sleep(10);// w w w .jav a 2 s . co m mAdapter.notifyDataSetChanged(); getLoaderManager().restartLoader(LOADER, null, this); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.guayaba.tapir.ui.fragments.profile.FavoriteFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.PLAY_NEXT: MusicUtils.playNext(new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId); return true; case FragmentMenuItems.REMOVE_FROM_FAVORITES: FavoritesStore.getInstance(getActivity()).removeItem(mSelectedId); getLoaderManager().restartLoader(LOADER, null, this); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); SystemClock.sleep(10);/* w w w. j av a 2 s . c om*/ mAdapter.notifyDataSetChanged(); getLoaderManager().restartLoader(LOADER, null, this); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:se.eliga.aves.birdlist.BirdListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.isCheckable()) { if (R.id.filtering_group == item.getGroupId()) { item.setChecked(!item.isChecked()); } else if (R.id.sort_order_group == item.getGroupId()) { swedishSortItem.setChecked(false); englishSortItem.setChecked(false); latinSortItem.setChecked(false); phylogeneticSortItem.setChecked(false); populationSortItem.setChecked(false); item.setChecked(true);/*from w ww . ja va 2s .com*/ } BirdListAdapter birdListAdapter = (BirdListAdapter) getListAdapter(); switch (item.getItemId()) { case R.id.alphabetic_latin: birdListAdapter.setSortOption(BirdListAdapter.SortOption.SCIENTIFIC); break; case R.id.alphabetic_swedish: birdListAdapter.setSortOption(BirdListAdapter.SortOption.SWEDISH); break; case R.id.alphabetic_english: birdListAdapter.setSortOption(BirdListAdapter.SortOption.ENGLISH); break; case R.id.phylogenic_sort: birdListAdapter.setSortOption(BirdListAdapter.SortOption.PHYLOGENETIC); break; case R.id.population_sort: birdListAdapter.setSortOption(BirdListAdapter.SortOption.POPULATION); break; } birdListAdapter.setShowBreeding(breedingItem.isChecked()); birdListAdapter.setShowBreedingUnclear(breedingUnclearItem.isChecked()); birdListAdapter.setShowMigrant(migrantItem.isChecked()); birdListAdapter.setShowRare(rareItem.isChecked()); birdListAdapter.setShowRegularVisitor(regularVisitorItem.isChecked()); birdListAdapter.setShowUnseen(unseenItem.isChecked()); birdListAdapter.setShowUnclassified(unclassifiedItem.isChecked()); birdListAdapter.setShowNonSpontaneous(nonSpontaneousItem.isChecked()); birdListAdapter.refresh(); birdListAdapter.notifyDataSetChanged(); } SharedPreferences settings = getActivity().getSharedPreferences(Constants.BIRD_APP_SETTINGS, 0); saveFilterPreferences(settings); return true; }
From source file:com.boko.vimusic.ui.fragments.profile.AlbumSongFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new Song[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.PLAY_NEXT: MusicUtils.playNext(new Song[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new Song[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getActivity()).addSong(mSelectedId.getId(), mSelectedId.getHost(), mSongName, mAlbumName, mArtistName); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new Song[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final String mPlaylistId = item.getIntent().getStringExtra("playlist"); MusicUtils.addToPlaylist(getActivity(), new Song[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId.getId()); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.getName(), new Song[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); refresh();/* w w w .j a v a 2s . c om*/ return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.boko.vimusic.ui.fragments.profile.LastAddedFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new Song[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.PLAY_NEXT: MusicUtils.playNext(new Song[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new Song[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getActivity()).addSong(mSelectedId.getId(), mSelectedId.getHost(), mSongName, mAlbumName, mArtistName); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new Song[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final String mPlaylistId = item.getIntent().getStringExtra("playlist"); MusicUtils.addToPlaylist(getActivity(), new Song[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId.getId()); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.getName(), new Song[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); SystemClock.sleep(10);//w w w.ja va 2s .c o m mAdapter.notifyDataSetChanged(); getLoaderManager().restartLoader(LOADER, null, this); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:ru.mtuci.musicanalyzer.apollo.ui.fragments.profile.GenreSongFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getActivity()).addSongId(mSelectedId, mSongName, mAlbumName, mArtistName);/*from w ww . ja va2s . c om*/ return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); refresh(); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.guayaba.tapir.ui.fragments.profile.GenreSongFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.PLAY_NEXT: MusicUtils.playNext(new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getActivity()).addSongId(mSelectedId, mSongName, mAlbumName, mArtistName);/*from www.j a v a 2 s. co m*/ return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); refresh(); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.boko.vimusic.ui.fragments.profile.FavoriteFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getActivity(), new Song[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.PLAY_NEXT: MusicUtils.playNext(new Song[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getActivity(), new Song[] { mSelectedId }); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new Song[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final String mPlaylistId = item.getIntent().getStringExtra("playlist"); MusicUtils.addToPlaylist(getActivity(), new Song[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getActivity(), mSelectedId.getId()); return true; case FragmentMenuItems.REMOVE_FROM_FAVORITES: FavoritesStore.getInstance(getActivity()).removeSong(mSelectedId.getId(), mSelectedId.getHost()); getLoaderManager().restartLoader(LOADER, null, this); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.getName(), new Song[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); SystemClock.sleep(10);//from ww w.j a v a2 s. c om mAdapter.notifyDataSetChanged(); getLoaderManager().restartLoader(LOADER, null, this); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.andrew.apollo.ui.fragments.profile.GenreSongFragment.java
@Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: MusicUtils.playAll(getSherlockActivity(), new long[] { mSelectedId }, 0, false); return true; case FragmentMenuItems.ADD_TO_QUEUE: MusicUtils.addToQueue(getSherlockActivity(), new long[] { mSelectedId }); return true; case FragmentMenuItems.ADD_TO_FAVORITES: FavoritesStore.getInstance(getSherlockActivity()).addSongId(Long.valueOf(mSelectedId), mSongName, mAlbumName, mArtistName); return true; case FragmentMenuItems.NEW_PLAYLIST: CreateNewPlaylist.getInstance(new long[] { mSelectedId }).show(getFragmentManager(), "CreatePlaylist"); return true; case FragmentMenuItems.PLAYLIST_SELECTED: final long mPlaylistId = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(getSherlockActivity(), new long[] { mSelectedId }, mPlaylistId); return true; case FragmentMenuItems.MORE_BY_ARTIST: NavUtils.openArtistProfile(getSherlockActivity(), mArtistName); return true; case FragmentMenuItems.USE_AS_RINGTONE: MusicUtils.setRingtone(getSherlockActivity(), mSelectedId); return true; case FragmentMenuItems.DELETE: DeleteDialog.newInstance(mSong.mSongName, new long[] { mSelectedId }, null) .show(getFragmentManager(), "DeleteDialog"); refresh();//ww w .java 2s.com return true; default: break; } } return super.onContextItemSelected(item); }