@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo i = (AdapterView.AdapterContextMenuInfo) menuInfo; MenuInflater inflater = getMenuInflater(); if (mMostVisited) { inflater.inflate(R.menu.historycontext, menu); } else { inflater.inflate(R.menu.bookmarkscontext, menu); } if (0 == i.position && !mMostVisited) { menu.setGroupVisible(R.id.CONTEXT_MENU, false); if (mAddHeader == null) { mAddHeader = new AddNewBookmark(BrowserBookmarksPage.this); } else if (mAddHeader.getParent() != null) { ((ViewGroup) mAddHeader.getParent()).removeView(mAddHeader); } mAddHeader.setUrl(getIntent().getStringExtra("url")); menu.setHeaderView(mAddHeader); return; } if (mMostVisited) { if ((mViewMode == BookmarkViewMode.LIST && ((HistoryItem) i.targetView).isBookmark()) || mBookmarksAdapter.getIsBookmark(i.position)) { MenuItem item = menu.findItem(R.id.save_to_bookmarks_menu_id); item.setTitle(R.string.remove_from_bookmarks); } } else { // The historycontext menu has no ADD_MENU group. menu.setGroupVisible(R.id.ADD_MENU, false); } if (mDisableNewWindow) { menu.findItem(R.id.new_window_context_menu_id).setVisible(false); } if (mContextHeader == null) { mContextHeader = new BookmarkItem(BrowserBookmarksPage.this); } else if (mContextHeader.getParent() != null) { ((ViewGroup) mContextHeader.getParent()).removeView(mContextHeader); } if (mViewMode == BookmarkViewMode.GRID) { mBookmarksAdapter.populateBookmarkItem(mContextHeader, i.position); } else { BookmarkItem b = (BookmarkItem) i.targetView; b.copyTo(mContextHeader); } menu.setHeaderView(mContextHeader); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo; ViewHolder vh = (ViewHolder) acmi.targetView.getTag(); menu.setHeaderTitle(vh.gamertag.getText()); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.xbl_friends_of_friend_list_context, menu); menu.setGroupVisible(R.id.menu_group_gold, mAccount.isGold()); menu.setGroupVisible(R.id.menu_group_friend, false); menu.setGroupVisible(R.id.menu_group_nonfriend, true); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo; XboxLiveFriendListItem item = (XboxLiveFriendListItem) acmi.targetView; ViewHolder vh = (ViewHolder) acmi.targetView.getTag(); menu.setHeaderTitle(vh.gamertag.getText()); getActivity().getMenuInflater().inflate(R.menu.xbl_friend_list_context, menu); int statusCode = Friends.getStatusCode(getActivity(), item.mFriendId); if (statusCode == XboxLive.STATUS_INVITE_RCVD) { menu.setGroupVisible(R.id.menu_group_invite_rcvd, true); menu.setGroupVisible(R.id.menu_group_invite_sent, false); menu.setGroupVisible(R.id.menu_group_friend, false); menu.setGroupVisible(R.id.menu_group_gold, false); } else if (statusCode == XboxLive.STATUS_INVITE_SENT) { menu.setGroupVisible(R.id.menu_group_invite_rcvd, false); menu.setGroupVisible(R.id.menu_group_invite_sent, true); menu.setGroupVisible(R.id.menu_group_friend, false); menu.setGroupVisible(R.id.menu_group_gold, false); } else { menu.setGroupVisible(R.id.menu_group_invite_rcvd, false); menu.setGroupVisible(R.id.menu_group_invite_sent, false); menu.setGroupVisible(R.id.menu_group_friend, true); menu.setGroupVisible(R.id.menu_group_gold, mAccount.isGold()); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.audio_list_browser, menu); if (!Util.isPhone()) menu.setGroupVisible(R.id.phone_only, false); }