List of usage examples for android.view ContextMenu setHeaderTitle
public ContextMenu setHeaderTitle(CharSequence title);
From source file:com.money.manager.ex.investment.watchlist.WatchlistItemsFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; // ignore the header row if the headers are shown. if (hasHeaderRow() && info.position == 0) return;/* w w w . jav a 2s . c o m*/ Cursor cursor = ((StocksCursorAdapter) getListAdapter()).getCursor(); int cursorPosition = hasHeaderRow() ? info.position - 1 : info.position; cursor.moveToPosition(cursorPosition); menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(StockFields.SYMBOL))); MenuHelper menuHelper = new MenuHelper(getActivity(), menu); menuHelper.addToContextMenu(ContextMenuIds.DownloadPrice); menuHelper.addToContextMenu(ContextMenuIds.EditPrice); menuHelper.addToContextMenu(ContextMenuIds.DELETE); }
From source file:org.mozilla.gecko.home.RemoteTabsBaseFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { if (!(menuInfo instanceof RemoteTabsClientContextMenuInfo)) { // Long pressed item was not a RemoteTabsGroup item. Superclass // can handle this. super.onCreateContextMenu(menu, view, menuInfo); return;//from www .j ava 2 s.c o m } // Long pressed item was a remote client; provide the appropriate menu. final MenuInflater inflater = new MenuInflater(view.getContext()); inflater.inflate(R.menu.home_remote_tabs_client_contextmenu, menu); final RemoteTabsClientContextMenuInfo info = (RemoteTabsClientContextMenuInfo) menuInfo; menu.setHeaderTitle(info.client.name); // Hide unused menu items. final boolean isHidden = sState.isClientHidden(info.client.guid); final MenuItem item = menu .findItem(isHidden ? R.id.home_remote_tabs_hide_client : R.id.home_remote_tabs_show_client); item.setVisible(false); }
From source file:nl.sogeti.android.gpstracker.viewer.TrackList.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (menuInfo instanceof AdapterView.AdapterContextMenuInfo) { AdapterView.AdapterContextMenuInfo itemInfo = (AdapterView.AdapterContextMenuInfo) menuInfo; TextView textView = (TextView) itemInfo.targetView.findViewById(R.id.listitem_name); if (textView != null) { menu.setHeaderTitle(textView.getText()); }//from ww w . j a v a 2 s .c o m Object listItem = getListAdapter().getItem(itemInfo.position); if (listItem instanceof Cursor) { menu.add(0, MENU_STATS, 0, R.string.menu_statistics); menu.add(0, MENU_SHARE, 0, R.string.menu_shareTrack); menu.add(0, MENU_RENAME, 0, R.string.menu_renameTrack); menu.add(0, MENU_DELETE, 0, R.string.menu_deleteTrack); } } }
From source file:org.catrobat.catroid.ui.fragment.BackPackSoundFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); if (SoundController.getInstance().isSoundPlaying(mediaPlayer)) { SoundController.getInstance().stopSoundAndUpdateList(mediaPlayer, BackPackListManager.getInstance().getSoundInfoArrayList(), adapter); }/*ww w . j a v a 2 s . c o m*/ selectedSoundInfoBackPack = adapter.getItem(selectedSoundPosition); menu.setHeaderTitle(selectedSoundInfoBackPack.getTitle()); adapter.addCheckedItem(((AdapterContextMenuInfo) menuInfo).position); getSherlockActivity().getMenuInflater().inflate(R.menu.context_menu_unpacking, menu); }
From source file:hku.fyp14017.blencode.ui.fragment.BackPackSoundFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); if (SoundController.getInstance().isSoundPlaying(mediaPlayer)) { SoundController.getInstance().stopSoundAndUpdateList(mediaPlayer, BackPackListManager.getInstance().getSoundInfoArrayList(), adapter); }//from w w w. j a v a 2 s . c o m selectedSoundInfoBackPack = adapter.getItem(selectedSoundPosition); menu.setHeaderTitle(selectedSoundInfoBackPack.getTitle()); adapter.addCheckedItem(((AdapterContextMenuInfo) menuInfo).position); getSherlockActivity().getMenuInflater().inflate(hku.fyp14017.blencode.R.menu.context_menu_unpacking, menu); }
From source file:com.cyanogenmod.eleven.ui.fragments.AudioPlayerFragment.java
/** * Initializes the header bar/*w ww .j a v a 2 s . c om*/ */ private void initHeaderBar() { View headerBar = mRootView.findViewById(R.id.audio_player_header); final int bottomActionBarHeight = getResources().getDimensionPixelSize(R.dimen.bottom_action_bar_height); headerBar.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { // since we only want the top and bottom shadows, pad the horizontal width // to hide the shadows. Can't seem to find a better way to do this int padWidth = (int) (0.2f * view.getWidth()); outline.setRect(-padWidth, -bottomActionBarHeight, view.getWidth() + padWidth, view.getHeight()); } }); // Title text mSongTitle = (TextView) mRootView.findViewById(R.id.header_bar_song_title); mArtistName = (TextView) mRootView.findViewById(R.id.header_bar_artist_title); // Buttons // Search Button View v = mRootView.findViewById(R.id.header_bar_search_button); v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { NavUtils.openSearch(getActivity(), ""); } }); // Add to Playlist Button // Setup the playlist button - add a click listener to show the context mAddToPlaylistButton = (ImageView) mRootView.findViewById(R.id.header_bar_add_button); // Create the context menu when requested mAddToPlaylistButton.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { MusicUtils.makePlaylistMenu(getActivity(), GROUP_ID, menu); menu.setHeaderTitle(R.string.add_to_playlist); } }); // add a click listener to show the context mAddToPlaylistButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // save the current track id mSelectedId = MusicUtils.getCurrentAudioId(); mAddToPlaylistButton.showContextMenu(); } }); // Add the menu button // menu button mMenuButton = (ImageView) mRootView.findViewById(R.id.header_bar_menu_button); mMenuButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPopupMenu(); } }); }
From source file:org.yammp.app.AlbumFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) { if (mCursor == null) return;/*from ww w.j a va2 s .c om*/ getSherlockActivity().getMenuInflater().inflate(R.menu.music_browser_item, menu); AdapterContextMenuInfo adapterinfo = (AdapterContextMenuInfo) info; mSelectedPosition = adapterinfo.position; mCursor.moveToPosition(mSelectedPosition); try { mSelectedId = mCursor.getLong(mIdIdx); } catch (IllegalArgumentException ex) { mSelectedId = adapterinfo.id; } mCurrentArtistNameForAlbum = mCursor.getString(mArtistIdx); mCurrentAlbumName = mCursor.getString(mAlbumIdx); menu.setHeaderTitle(mCurrentAlbumName); }
From source file:com.ovrhere.android.currencyconverter.ui.fragments.MainFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (v.getId() == R.id.currConv_main_listView) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; CurrencyData currency = outputListAdapter.getItem(info.position); if (currency != null) { String title = getString(R.string.currConv_context_currencyAction, currency.getCurrencyCode()); menu.setHeaderTitle(title); menu.add(Menu.CATEGORY_SECONDARY, 0, 0, android.R.string.copy); menu.add(Menu.CATEGORY_SECONDARY, 1, 1, R.string.currConv_context_detailedCopy); }/* ww w . j a va 2s . c om*/ } }
From source file:roommateapp.info.droid.ActivityBuilding.java
/** * Create the context menu.// w ww .ja va2s.co m */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // Set Headline menu.setHeaderTitle(getString(R.string.cmenu_hl)); // Remove default setting, if file was set as default String defaultFile = Preferences.getDefaultFile(getApplicationContext()); if (this.selectedBuilding.getFile().toString().equals(defaultFile)) { menu.add(getString(R.string.cmenu_remstd)); } // Navigation if (!this.selectedBuilding.getLat().equals("") && !this.selectedBuilding.getLng().equals("")) { menu.add(getString(R.string.cmenu_nav)); } // Display building information if (!this.selectedBuilding.getInfo().equals("")) { menu.add(getString(R.string.cmenu_info)); } // Display legend menu.add(getString(R.string.cmenu_legende)); // Display share option menu.add(getString(R.string.cmenu_share)); // Display filter settings menu.add(getString(R.string.cmenu_filter)); }
From source file:com.kyakujin.android.tagnotepad.ui.TagListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info; try {//from w w w .j a va 2 s . c o m info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { Log.e(TAG, "bad AdapterContextMenuInfo", e); return; } Cursor c = (Cursor) mTagListView.getAdapter().getItem(info.position); if (c == null) { return; } android.view.MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_menu_tag_list, menu); mTagName = c.getString(TagsQuery.TAGNAME); menu.setHeaderTitle(mTagName); Intent intent = new Intent(null, ContentUris.withAppendedId(Tags.CONTENT_URI, (int) info.id)); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(getActivity(), TagListFragment.class), null, intent, 0, null); }