List of usage examples for android.view MenuItem getGroupId
public int getGroupId();
From source file:io.github.hidroh.materialistic.SearchActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getGroupId() == R.id.menu_sort_group) { item.setChecked(true);//from w ww . j a va2 s . c o m sort(item.getItemId() == R.id.menu_sort_recent); return true; } return super.onOptionsItemSelected(item); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void wrapMenuItemIcon(@NonNull MenuItem item, int itemColor, int... excludeGroups) { if (ArrayUtils.contains(excludeGroups, item.getGroupId())) return;/*from w w w. ja v a2 s . c om*/ final Drawable icon = item.getIcon(); if (icon == null) return; icon.mutate(); final Drawable.Callback callback = icon.getCallback(); final ActionIconDrawable newIcon = new ActionIconDrawable(icon, itemColor); newIcon.setCallback(callback); item.setIcon(newIcon); }
From source file:com.cyanogenmod.eleven.utils.ArtistPopupMenuHelper.java
@Override public boolean onMenuItemClick(MenuItem item) { boolean handled = super.onMenuItemClick(item); if (!handled && item.getGroupId() == getGroupId()) { switch (item.getItemId()) { case FragmentMenuItems.CHANGE_IMAGE: PhotoSelectionDialog/* w ww. j a v a2s. c o m*/ .newInstance(getArtistName(), PhotoSelectionDialog.ProfileType.ARTIST, getArtistName()) .show(mFragmentManager, "PhotoSelectionDialog"); return true; } } return handled; }
From source file:csci4176.toptentoday.MainActivity.java
public void onNavItemSelected(MenuItem menuItem) { switch (menuItem.getGroupId()) { case R.id.pref_filter_group: String stringToStore = menuItem.getTitle().toString().toLowerCase(); SharedPreferences prefs = this.getSharedPreferences("prefs", Context.MODE_PRIVATE); SharedPreferences.Editor edit = prefs.edit(); Set<String> filterSet = prefs.getStringSet("filter-list", new HashSet<String>(Arrays.asList("all-sections"))); filterSet.add(stringToStore);/*from w w w. j a va 2s .c o m*/ if (menuItem.getItemId() == R.id.pref_filter_all) { filterSet = new HashSet<String>(Arrays.asList("all-sections")); } edit.putStringSet("filter-list", filterSet); edit.commit(); adapter.getArticles().refresh(); return; default: } switch (menuItem.getItemId()) { case R.id.nav_licenses: Intent intent = new Intent(this, Licenses.class); startActivity(intent); break; } mDrawer.closeDrawers(); }
From source file:com.cyanogenmod.eleven.utils.AlbumPopupMenuHelper.java
@Override public boolean onMenuItemClick(MenuItem item) { boolean handled = super.onMenuItemClick(item); if (!handled && item.getGroupId() == getGroupId()) { switch (item.getItemId()) { case FragmentMenuItems.CHANGE_IMAGE: String key = ImageFetcher.generateAlbumCacheKey(mAlbum.mAlbumName, getArtistName()); PhotoSelectionDialog.newInstance(mAlbum.mAlbumName, PhotoSelectionDialog.ProfileType.ALBUM, key) .show(mFragmentManager, "PhotoSelectionDialog"); return true; }//from w ww .j a v a2 s .com } return handled; }
From source file:com.powermonitor.epitech.ConfigProfiles.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getGroupId() != 1) { return false; }//from w ww. j a v a 2 s .c om if (item.getItemId() == 0) { Intent i = new Intent(this.getActivity(), EditProfile.class); i.putExtra(EXTRA_PROFILE_ID, selectedItem.getId()); startActivity(i); } else if (item.getItemId() == 1) { Communication.INSTANCE.deleteProfile(selectedItem.getId(), this.deleteRequestHandler); } return true; }
From source file:lewa.support.v7.internal.view.menu.BaseMenuWrapper.java
final void internalRemoveGroup(final int groupId) { if (mMenuItems == null) { return;/*from w w w . ja v a 2s . co m*/ } Iterator<android.view.MenuItem> iterator = mMenuItems.keySet().iterator(); android.view.MenuItem menuItem; while (iterator.hasNext()) { menuItem = iterator.next(); if (groupId == menuItem.getGroupId()) { iterator.remove(); } } }
From source file:com.vrem.wifianalyzer.navigation.NavigationMenuViewTest.java
@Test public void testNavigationMenuView() throws Exception { // execute/*from w w w.j av a 2s.c om*/ final Menu menu = navigationView.getMenu(); // validate assertEquals(NavigationMenu.values().length, menu.size()); IterableUtils.forEach(EnumUtils.values(NavigationGroup.class), new Closure<NavigationGroup>() { @Override public void execute(final NavigationGroup navigationGroup) { IterableUtils.forEach(navigationGroup.getNavigationMenus(), new Closure<NavigationMenu>() { @Override public void execute(NavigationMenu navigationMenu) { MenuItem actual = menu.getItem(navigationMenu.ordinal()); assertEquals(navigationGroup.ordinal(), actual.getGroupId()); assertEquals(mainActivity.getResources().getString(navigationMenu.getTitle()), actual.getTitle()); assertEquals(navigationMenu.ordinal(), actual.getItemId()); assertEquals(navigationMenu.ordinal(), actual.getOrder()); } }); } }); }
From source file:android.support.v7.internal.view.menu.BaseMenuWrapper.java
final void internalRemoveGroup(final int groupId) { if (mMenuItems == null) { return;// w w w . j a va 2s. c o m } Iterator<SupportMenuItem> iterator = mMenuItems.keySet().iterator(); android.view.MenuItem menuItem; while (iterator.hasNext()) { menuItem = iterator.next(); if (groupId == menuItem.getGroupId()) { iterator.remove(); } } }