List of usage examples for android.view Menu NONE
int NONE
To view the source code for android.view Menu NONE.
Click Source Link
From source file:edu.cmu.cylab.starslinger.view.PickRecipientsActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.layout.recipcontext, menu); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; menu.add(Menu.NONE, R.id.item_key_details, Menu.NONE, R.string.menu_Details); menu.add(Menu.NONE, R.id.item_delete_recipient, Menu.NONE, R.string.menu_delete); if (mContacts.get(info.position).getSource() != RecipientDbAdapter.RECIP_SOURCE_INVITED) { if (!mContacts.get(info.position).isValidContactLink()) { menu.add(Menu.NONE, R.id.item_link_contact_add, Menu.NONE, R.string.menu_link_contact_add); } else {/* w w w.j a va2 s . c o m*/ menu.add(Menu.NONE, R.id.item_link_contact_change, Menu.NONE, R.string.menu_link_contact_change); } if (mContacts.get(info.position).isValidContactLink()) { menu.add(Menu.NONE, R.id.item_edit_contact, Menu.NONE, R.string.menu_EditContact); } } }
From source file:com.nttec.everychan.ui.gallery.GalleryActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; MenuItem itemUpdate = menu.add(Menu.NONE, R.id.menu_update, 1, R.string.menu_update); MenuItem itemSave = menu.add(Menu.NONE, R.id.menu_save_attachment, 2, R.string.menu_save_attachment); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { itemUpdate.setIcon(ThemeUtils.getActionbarIcon(getTheme(), getResources(), R.attr.actionRefresh)); itemSave.setIcon(ThemeUtils.getActionbarIcon(getTheme(), getResources(), R.attr.actionSave)); CompatibilityImpl.setShowAsActionIfRoom(itemUpdate); CompatibilityImpl.setShowAsActionIfRoom(itemSave); } else {//ww w . ja v a 2 s .c om itemUpdate.setIcon(R.drawable.ic_menu_refresh); itemSave.setIcon(android.R.drawable.ic_menu_save); } menu.add(Menu.NONE, R.id.menu_open_external, 3, R.string.menu_open).setIcon(R.drawable.ic_menu_set_as); menu.add(Menu.NONE, R.id.menu_share, 4, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share); menu.add(Menu.NONE, R.id.menu_share_link, 5, R.string.menu_share_link) .setIcon(android.R.drawable.ic_menu_share); menu.add(Menu.NONE, R.id.menu_reverse_search, 6, R.string.menu_reverse_search) .setIcon(android.R.drawable.ic_menu_search); menu.add(Menu.NONE, R.id.menu_open_browser, 7, R.string.menu_open_browser) .setIcon(R.drawable.ic_menu_browser); updateMenu(); return true; }
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
/** * re-populates the account list.// www .j a v a2s . c om * * @param accounts list of accounts */ private void repopulateAccountList(Account[] accounts) { // remove all accounts from list mNavigationView.getMenu().removeGroup(R.id.drawer_menu_accounts); // add all accounts to list for (int i = 0; i < accounts.length; i++) { if (!getAccount().name.equals(accounts[i].name)) { MenuItem accountMenuItem = mNavigationView.getMenu().add(R.id.drawer_menu_accounts, Menu.NONE, MENU_ORDER_ACCOUNT, accounts[i].name); ThumbnailsCacheManager.GetAvatarTask task = new ThumbnailsCacheManager.GetAvatarTask( accountMenuItem, accounts[i], mMenuAccountAvatarRadiusDimension, false); task.execute(); } } // re-add add-account and manage-accounts mNavigationView.getMenu().add(R.id.drawer_menu_accounts, R.id.drawer_menu_account_add, MENU_ORDER_ACCOUNT_FUNCTION, getResources().getString(R.string.prefs_add_account)) .setIcon(R.drawable.ic_plus_grey); mNavigationView .getMenu().add(R.id.drawer_menu_accounts, R.id.drawer_menu_account_manage, MENU_ORDER_ACCOUNT_FUNCTION, getResources().getString(R.string.drawer_manage_accounts)) .setIcon(R.drawable.ic_group); // adding sets menu group back to visible, so safety check and setting invisible showMenu(); }
From source file:com.cyanogenmod.effem.FmRadio.java
/** * Sets up the options menu when the menu button is pushed, dynamic * population of the station select menu *//*from w w w .jav a 2 s . c o m*/ public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); boolean result = super.onCreateOptionsMenu(menu); // Create and populate the band selection menu SubMenu subMenu = menu.addSubMenu(BASE_OPTION_MENU, FM_BAND, Menu.NONE, R.string.band_select); subMenu.setIcon(android.R.drawable.ic_menu_mapmode); subMenu.add(BAND_SELECTION_MENU, BAND_US, Menu.NONE, R.string.band_us); subMenu.add(BAND_SELECTION_MENU, BAND_EU, Menu.NONE, R.string.band_eu); subMenu.add(BAND_SELECTION_MENU, BAND_JAPAN, Menu.NONE, R.string.band_ja); subMenu.add(BAND_SELECTION_MENU, BAND_CHINA, Menu.NONE, R.string.band_ch); subMenu.setGroupCheckable(BAND_SELECTION_MENU, true, true); subMenu.getItem(mSelectedBand).setChecked(true); // Create and populate the speaker/headset selection menu if speaker supported if (context.getResources().getBoolean(R.bool.speaker_supported)) { subMenu = menu.addSubMenu(BASE_OPTION_MENU, OUTPUT_SOUND, Menu.NONE, R.string.output_select); subMenu.setIcon(android.R.drawable.ic_menu_mapmode); subMenu.add(LOUDSPEAKER_SELECTION_MENU, OUTPUT_HEADSET, Menu.NONE, R.string.output_select_default); subMenu.add(LOUDSPEAKER_SELECTION_MENU, OUTPUT_SPEAKER, Menu.NONE, R.string.output_select_loudspeaker); subMenu.setGroupCheckable(LOUDSPEAKER_SELECTION_MENU, true, true); subMenu.getItem(mSelectedOutput).setChecked(true); } // Create the station select menu subMenu = menu.addSubMenu(BASE_OPTION_MENU, STATION_SELECT, Menu.NONE, R.string.station_select); subMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); // Dynamically populate the station select menu if (mMenuAdapter.isEmpty()) { subMenu.setGroupEnabled(STATION_SELECTION_MENU, false); } else { subMenu.setGroupEnabled(STATION_SELECTION_MENU, true); for (int i = 0; i < mMenuAdapter.getCount(); i++) { subMenu.add(STATION_SELECTION_MENU, STATION_SELECT_MENU_ITEMS + i, Menu.NONE, mMenuAdapter.getItem(i).toString()); } } return result; }
From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; int rowId = (int) info.id; ThingInfo item = mThingsAdapter.getItem(rowId); // Mark the message/comment as selected mVoteTargetThingInfo = item;/*from w ww . j a va2s . co m*/ mVoteTargetView = v; if (item.getName().startsWith(Constants.THREAD_KIND)) { menu.add(0, Constants.DIALOG_THREAD_CLICK, Menu.NONE, "Go to thread"); } else { // TODO: include the context! menu.add(0, Constants.DIALOG_COMMENT_CLICK, Menu.NONE, "Go to comment"); } }
From source file:com.dhara.googlecalendartrial.MainActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; String title = mEventList.get(info.position).getDescription(); menu.setHeaderTitle(title);/*from www .j av a2s. co m*/ menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.delete_event)); }
From source file:com.appunite.appunitevideoplayer.PlayerActivity.java
private void configurePopupWithTracks(PopupMenu popup, final OnMenuItemClickListener customActionClickListener, final int trackType) { if (player == null) { return;/*from w w w .ja va2 s.c o m*/ } int trackCount = player.getTrackCount(trackType); if (trackCount == 0) { return; } popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { return (customActionClickListener != null && customActionClickListener.onMenuItemClick(item)) || onTrackItemClick(item, trackType); } }); Menu menu = popup.getMenu(); // ID_OFFSET ensures we avoid clashing with Menu.NONE (which equals 0) menu.add(MENU_GROUP_TRACKS, DemoPlayer.TRACK_DISABLED + ID_OFFSET, Menu.NONE, R.string.off); for (int i = 0; i < trackCount; i++) { menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE, buildTrackName(player.getTrackFormat(trackType, i))); } menu.setGroupCheckable(MENU_GROUP_TRACKS, true, true); menu.findItem(player.getSelectedTrack(trackType) + ID_OFFSET).setChecked(true); }
From source file:biz.bokhorst.xprivacy.ActivityApp.java
@Override public boolean onCreateOptionsMenu(final Menu menu) { MenuInflater inflater = getMenuInflater(); if (inflater != null && PrivacyService.checkClient()) { inflater.inflate(R.menu.app, menu); // Add all contact groups menu.findItem(R.id.menu_contacts).getSubMenu().add(-1, R.id.menu_contacts, Menu.NONE, getString(R.string.menu_all)); // Add other contact groups in the background new AsyncTask<Object, Object, Object>() { @Override/*www.ja va 2 s .c om*/ protected Object doInBackground(Object... arg0) { try { String where = ContactsContract.Groups.GROUP_VISIBLE + " = 1"; where += " AND " + ContactsContract.Groups.SUMMARY_COUNT + " > 0"; Cursor cursor = getContentResolver().query(ContactsContract.Groups.CONTENT_SUMMARY_URI, new String[] { ContactsContract.Groups._ID, ContactsContract.Groups.TITLE, ContactsContract.Groups.ACCOUNT_NAME, ContactsContract.Groups.SUMMARY_COUNT }, where, null, ContactsContract.Groups.TITLE + ", " + ContactsContract.Groups.ACCOUNT_NAME); if (cursor != null) try { while (cursor.moveToNext()) { int id = cursor.getInt(cursor.getColumnIndex(ContactsContract.Groups._ID)); String title = cursor .getString(cursor.getColumnIndex(ContactsContract.Groups.TITLE)); String account = cursor .getString(cursor.getColumnIndex(ContactsContract.Groups.ACCOUNT_NAME)); menu.findItem(R.id.menu_contacts).getSubMenu().add(id, R.id.menu_contacts, Menu.NONE, title + "/" + account); } } finally { cursor.close(); } } catch (Throwable ex) { Util.bug(null, ex); } return null; } }.executeOnExecutor(mExecutor); return true; } else return false; }
From source file:io.jawg.osmcontributor.ui.activities.MapActivity.java
@Subscribe(threadMode = ThreadMode.MAIN) public void onPleaseInitializeDrawer(PleaseInitializeDrawer event) { Timber.d("initializing drawer with poiType"); if (filtersItemList == null) { filtersItemList = new ArrayList<>(); }/*from ww w .j ava 2 s .co m*/ List<PoiType> poiTypes = event.getPoiTypes(); poiTypesHidden = event.getPoiTypeHidden(); poiAccessibilityTypesHidden = new ArrayList<>(); filters.clear(); for (PoiType poiType : poiTypes) { Long id = poiType.getId(); filters.add(new PoiTypeFilter(poiType.getName(), id, poiType.getIcon(), !poiTypesHidden.contains(id))); } Collections.sort(filters); Menu menu = filterView.getMenu(); int order = 1; for (PoiTypeFilter poiTypeFilter : filters) { PoiTypeFilter nextPoiTypeFilter = null; if (order < filters.size()) { nextPoiTypeFilter = filters.get(order); } // Add only menu if not present if (menu.findItem(poiTypeFilter.getPoiTypeId().intValue()) == null) { filtersItemList.add(menu .add(Menu.NONE, poiTypeFilter.getPoiTypeId().intValue(), (nextPoiTypeFilter != null ? (poiTypeFilter.compareTo(nextPoiTypeFilter) > 0 ? order - 1 : order) : order), poiTypeFilter.getPoiTypeName()) .setChecked(poiTypeFilter.isActive()) .setIcon(bitmapHandler.getDrawable(poiTypeFilter.getPoiTypeIconName()))); } order++; } // Remove only filter removed by user if (filters.size() < filtersItemList.size()) { List<MenuItem> temp = new ArrayList<>(filters.size()); for (MenuItem menuItem : filtersItemList) { PoiTypeFilter poiTypeFilter = new PoiTypeFilter("", (long) menuItem.getItemId(), "", true); if (!filters.contains(poiTypeFilter)) { menu.removeItem(poiTypeFilter.getPoiTypeId().intValue()); } else { temp.add(menuItem); } } filtersItemList.clear(); filtersItemList.addAll(temp); temp.clear(); } selectAllMenuItem.setChecked(poiTypesHidden.isEmpty()); }