List of usage examples for android.view ContextMenu setHeaderTitle
public ContextMenu setHeaderTitle(CharSequence title);
From source file:com.money.manager.ex.recurring.transactions.RecurringTransactionListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; // take a cursor and move to position Cursor cursor = ((AllDataAdapter) getListAdapter()).getCursor(); if (cursor != null) { cursor.moveToPosition(info.position); // set title and inflate menu menu.setHeaderTitle(getActivity().getTitle()); getActivity().getMenuInflater().inflate(R.menu.contextmenu_repeating_transactions, menu); }/*w ww. j a va 2 s. c om*/ }
From source file:com.sip.pwc.sipphone.ui.account.AccountsEditListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final SipProfile account = profileFromContextMenuInfo(menuInfo); if (account == null) { return;/*from ww w . j a v a 2 s. c o m*/ } WizardUtils.WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard); // Setup the menu header menu.setHeaderTitle(account.display_name); if (wizardInfos != null) { menu.setHeaderIcon(wizardInfos.icon); } menu.add(0, MENU_ITEM_ACTIVATE, 0, account.active ? R.string.deactivate_account : R.string.activate_account); menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account); menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account); menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard); }
From source file:org.jitsi.android.gui.contactlist.ContactListFragment.java
/** * Inflates contact context menu.//from w w w. j ava 2 s . c o m * @param menu the menu to inflate into. * @param inflater the menu inflater. * @param group clicked group index. * @param child clicked contact index. */ private void createContactCtxMenu(ContextMenu menu, MenuInflater inflater, int group, int child) { // Inflate contact list context menu inflater.inflate(R.menu.contact_menu, menu); // Remembers clicked contact clickedContact = ((MetaContact) contactListAdapter.getChild(group, child)); menu.setHeaderTitle(clickedContact.getDisplayName()); // Checks if close chats options should be visible boolean closeChatsVisible = ChatSessionManager.getActiveChat(clickedContact) != null; menu.findItem(R.id.close_chat).setVisible(closeChatsVisible); menu.findItem(R.id.close_all_chats).setVisible(closeChatsVisible); // Checks if the re-request authorization item should be visible Contact contact = clickedContact.getDefaultContact(); if (contact == null) { logger.warn("No default contact for: " + clickedContact); return; } ProtocolProviderService pps = contact.getProtocolProvider(); if (pps == null) { logger.warn("No protocol provider found for: " + contact); return; } OperationSetExtendedAuthorizations authOpSet = pps .getOperationSet(OperationSetExtendedAuthorizations.class); boolean reRequestVisible = false; if (authOpSet != null && authOpSet.getSubscriptionStatus(contact) != null && !authOpSet.getSubscriptionStatus(contact) .equals(OperationSetExtendedAuthorizations.SubscriptionStatus.Subscribed)) { reRequestVisible = true; } menu.findItem(R.id.re_request_auth).setVisible(reRequestVisible); }
From source file:net.voxcorp.voxmobile.ui.account.AccountsEditListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final SipProfile account = profileFromContextMenuInfo(menuInfo); if (account == null) { return;/*from w ww.j a v a 2s . c om*/ } WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard); // Setup the menu header menu.setHeaderTitle(account.display_name); if (wizardInfos != null) { menu.setHeaderIcon(wizardInfos.icon); } menu.add(0, MENU_ITEM_ACTIVATE, 0, account.active ? R.string.deactivate_account : R.string.activate_account); menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account); menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account); if (!VoXMobile.isVoXMobile(account.proxies)) { menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard); } }
From source file:ivl.android.moneybalance.ExpenseListActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (v.getId() == R.id.expense_list) { ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo; int group = ExpandableListView.getPackedPositionGroup(info.packedPosition); int child = ExpandableListView.getPackedPositionChild(info.packedPosition); if (child != -1) { Expense expense = (Expense) adapter.getChild(group, child); menu.setHeaderTitle(expense.getTitle()); menu.add(0, ITEM_DELETE, 0, R.string.menu_delete); }//from ww w . ja v a 2 s .co m } }
From source file:org.braiden.fpm2.PasswordItemListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.password_item_list); // register the adapter for building view for each element of our list BaseAdapter adapter = new FpmCryptListAdapter(getFpmApplication(), getListView()); setListAdapter(adapter);/*w ww. j av a 2 s . c o m*/ getListView().setTextFilterEnabled(true); // get all the categories List<String> allCategories = new ArrayList<String>(20); allCategories.add(getString(R.string.all_category)); allCategories.add(getString(R.string.default_category)); if (getFpmApplication().isCryptOpen()) { isCategoryPickerInitialized = true; allCategories.addAll(getFpmApplication().getCategories()); } // populate the category picker with default values, and any other categories (if availible) categoryPicker = (Spinner) findViewById(R.id.category_picker); final ArrayAdapter<String> categoryData = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, allCategories); categoryData.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); categoryPicker.setAdapter(categoryData); // on change of picker, we force ListView's filter to be re-applied categoryPicker.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItem, int position, long id) { Log.d(TAG, "categoryPicker#onItemSelected(position=" + position + ", id=" + id + ")."); CharSequence textFilter = getListView().getTextFilter(); PasswordItemFilter filter = (PasswordItemFilter) ((Filterable) getListAdapter()).getFilter(); String category = null; if (position == 1) { category = CATEGORY_DEFAULT; } else if (position != 0) { category = (String) categoryPicker.getItemAtPosition(position); } filter.setCategory(category); if (getFpmApplication().isCryptOpen()) { filter.filter(textFilter); } } @Override public void onNothingSelected(AdapterView<?> parentView) { CharSequence textFilter = getListView().getTextFilter(); PasswordItemFilter filter = (PasswordItemFilter) ((Filterable) getListAdapter()).getFilter(); filter.setCategory(null); if (getFpmApplication().isCryptOpen()) { filter.filter(textFilter); } } }); receiver = new FpmBroadcastReceiver(this); getListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; PasswordItem item = getFpmApplication().getPasswordItemById(info.id); getMenuInflater().inflate(R.menu.password_item_context_menu, menu); if (item != null) { menu.setHeaderTitle(item.getTitle()); } } }); UnlockCryptActivity.unlockIfRequired(this); }
From source file:can.yrt.onebusaway.RouteInfoListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; if (ExpandableListView .getPackedPositionType(info.packedPosition) != ExpandableListView.PACKED_POSITION_TYPE_CHILD) { return;/*from w w w. ja v a 2 s . co m*/ } final TextView text = (TextView) info.targetView.findViewById(R.id.name); menu.setHeaderTitle(text.getText()); menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.route_info_context_get_stop_info); menu.add(0, CONTEXT_MENU_SHOWONMAP, 0, R.string.route_info_context_showonmap); }
From source file:org.liberty.android.fantastischmemo.ui.StudyActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.memoscreen_context_menu, menu); menu.setHeaderTitle(R.string.menu_text); }
From source file:com.audiokernel.euphonyrmt.SearchActivity.java
@Override public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; switch (mPager.getCurrentItem()) { case 0:/*w w w . j a va2 s . c om*/ final Artist artist = mArtistResults.get((int) info.id); menu.setHeaderTitle(artist.mainText()); setContextForObject(artist); break; case 1: final Album album = mAlbumResults.get((int) info.id); menu.setHeaderTitle(album.mainText()); setContextForObject(album); break; case 2: final Music music = mSongResults.get((int) info.id); final MenuItem gotoAlbumItem = menu.add(Menu.NONE, GOTO_ALBUM, 0, R.string.goToAlbum); gotoAlbumItem.setOnMenuItemClickListener(this); menu.setHeaderTitle(music.mainText()); setContextForObject(music); break; default: break; } final MenuItem addItem = menu.add(Menu.NONE, ADD, 0, getString(mAddString)); final MenuItem addAndReplaceItem = menu.add(Menu.NONE, ADD_REPLACE, 0, R.string.addAndReplace); final MenuItem addReplacePlayItem = menu.add(Menu.NONE, ADD_REPLACE_PLAY, 0, R.string.addAndReplacePlay); final MenuItem addAndPlayItem = menu.add(Menu.NONE, ADD_PLAY, 0, R.string.addAndPlay); addItem.setOnMenuItemClickListener(this); addAndReplaceItem.setOnMenuItemClickListener(this); addReplacePlayItem.setOnMenuItemClickListener(this); addAndPlayItem.setOnMenuItemClickListener(this); }
From source file:com.mahali.gpslogger.MainActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (v.getId() == R.id.sessionListView) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(sessionList.get(info.position).getFileName()); String[] menuItems = getResources().getStringArray(R.array.sessionLongMenu); for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); }//w ww . j a va 2 s . co m } }