List of usage examples for android.view MenuItem getMenuInfo
public ContextMenuInfo getMenuInfo();
From source file:org.steveleach.scoresheet.ui.ScoresheetActivity.java
/** * Return the list position for a context menu selection on an item in a ListView. *///from w ww .j ava2 s . com public static int listContextMenuPosition(MenuItem item) { return ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position; }
From source file:com.tnc.android.graphite.fragments.SavedGraphsFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); adapter.remove(graphs.get(info.position)); listener.onDelete(info.position);//from www . ja v a 2 s . c om return super.onContextItemSelected(item); }
From source file:org.hedgewars.hedgeroid.LobbyPlayerlistFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); Player player = adapter.getItem(info.position); switch (item.getItemId()) { case R.id.player_info: netplay.sendPlayerInfoQuery(player.name); return true; case R.id.player_follow: netplay.sendFollowPlayer(player.name); return true; default:/*from ww w. java 2 s . c o m*/ return super.onContextItemSelected(item); } }
From source file:org.hedgewars.hedgeroid.RoomPlayerlistFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); PlayerInRoom player = adapter.getItem(info.position); switch (item.getItemId()) { case R.id.player_info: netplay.sendPlayerInfoQuery(player.player.name); return true; case R.id.player_kick: netplay.sendKick(player.player.name); return true; default:// w ww. ja v a 2 s . c o m return super.onContextItemSelected(item); } }
From source file:can.yrt.onebusaway.MyRouteListFragmentBase.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DEFAULT: // Fake a click onListItemClick(getListView(), info.targetView, info.position, info.id); return true; case CONTEXT_MENU_SHOW_ON_MAP: HomeActivity.start(getActivity(), QueryUtils.RouteList.getId(getListView(), info.position)); return true; case CONTEXT_MENU_SHOW_URL: UIHelp.goToUrl(getActivity(), QueryUtils.RouteList.getUrl(getListView(), info.position)); return true; default:/*ww w . j a v a 2s . c om*/ return super.onContextItemSelected(item); } }
From source file:org.onebusaway.android.ui.MyRecentRoutesFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DELETE: ObaContract.Routes.markAsUnused(getActivity(), Uri.withAppendedPath(ObaContract.Routes.CONTENT_URI, QueryUtils.RouteList.getId(getListView(), info.position))); return true; default:/*from ww w . j a v a 2 s .c om*/ return super.onContextItemSelected(item); } }
From source file:org.onebusaway.android.ui.MyRouteListFragmentBase.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DEFAULT: // Fake a click onListItemClick(getListView(), info.targetView, info.position, info.id); return true; case CONTEXT_MENU_SHOW_ON_MAP: HomeActivity.start(getActivity(), QueryUtils.RouteList.getId(getListView(), info.position)); return true; case CONTEXT_MENU_SHOW_URL: UIUtils.goToUrl(getActivity(), QueryUtils.RouteList.getUrl(getListView(), info.position)); return true; default:/*from w w w. j a v a 2 s . c o m*/ return super.onContextItemSelected(item); } }
From source file:org.onebusaway.android.ui.MyRecentStopsFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DELETE: ObaContract.Stops.markAsUnused(getActivity(), Uri.withAppendedPath(ObaContract.Stops.CONTENT_URI, QueryUtils.StopList.getId(getListView(), info.position))); return true; default://from w w w .j a v a 2s. co m return super.onContextItemSelected(item); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void applyColorFilterToMenuIcon(final Menu menu, final int color, final int popupColor, final int highlightColor, final Mode mode, final int... excludedGroups) { for (int i = 0, j = menu.size(); i < j; i++) { final MenuItem item = menu.getItem(i); final Drawable icon = item.getIcon(); final ContextMenuInfo info = item.getMenuInfo(); if (icon != null && !ArrayUtils.contains(excludedGroups, item.getGroupId())) { icon.mutate();/*from ww w. ja v a 2s . co m*/ if (info instanceof TwidereMenuInfo) { final TwidereMenuInfo sInfo = (TwidereMenuInfo) info; icon.setColorFilter(sInfo.isHighlight() ? sInfo.getHighlightColor(highlightColor) : color, mode); } else { icon.setColorFilter(color, mode); } } if (item.hasSubMenu()) { // SubMenu item is always in popup applyColorFilterToMenuIcon(item.getSubMenu(), popupColor, popupColor, highlightColor, mode, excludedGroups); } } }
From source file:org.melato.bus.android.activity.StopsActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); RStop rstop = getRStop(info.position); return new StopActions(this).showRStop(rstop, item.getItemId()); }