List of usage examples for android.content Intent CATEGORY_ALTERNATIVE
String CATEGORY_ALTERNATIVE
To view the source code for android.content Intent CATEGORY_ALTERNATIVE.
Click Source Link
From source file:org.openintents.shopping.ui.ShoppingActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); boolean drawerOpen = mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mDrawerListsView); boolean holoSearch = PreferenceActivity.getUsingHoloSearchFromPrefs(this); // TODO: supposed to hide content-related actions when the drawer is open. // TODO: Add item-specific menu items (see NotesList.java example) // like edit, strike-through, delete. // Add menu option for auto adding items from string array in intent // extra if they exist if (mExtraItems == null) { menu.removeItem(MENU_INSERT_FROM_EXTRAS); }/*w w w .jav a 2 s. com*/ // Selected list: long listId = getSelectedListId(); // set menu title for change mode MenuItem menuItem = menu.findItem(MENU_PICK_ITEMS); if (mItemsView.mMode == MODE_ADD_ITEMS) { menuItem.setTitle(R.string.menu_start_shopping); menuItem.setIcon(android.R.drawable.ic_menu_myplaces); } else { menu.findItem(MENU_PICK_ITEMS).setTitle(R.string.menu_pick_items); menuItem.setIcon(android.R.drawable.ic_menu_add); } menuItem = menu.findItem(MENU_SEARCH_ADD); if (menuItem != null) { menuItem.setVisible(holoSearch && !drawerOpen); if (!holoSearch) { mAddPanel.setVisibility(View.VISIBLE); } View searchView = menuItem.getActionView(); int searchImgId = getResources().getIdentifier("android:id/search_button", null, null); View imageView = searchView.findViewById(searchImgId); if (imageView instanceof ImageView) { ((ImageView) imageView).setImageResource(android.R.drawable.ic_menu_add); } } menuItem = menu.findItem(MENU_SYNC_WEAR); if (menuItem != null) { menuItem.setVisible(mItemsView.isWearSupportAvailable()); } menuItem = menu.findItem(MENU_MARK_ALL_ITEMS).setVisible(mItemsView.mNumUnchecked > 0); menuItem = menu.findItem(MENU_UNMARK_ALL_ITEMS).setVisible(mItemsView.mNumChecked > 0); menuItem = menu.findItem(MENU_CLEAN_UP_LIST).setEnabled(mItemsView.mNumChecked > 0).setVisible(!drawerOpen); // Delete list is possible, if we have more than one list: // AND // the current list is not the default list (listId == 0) - issue #105 // TODO: Later, the default list should be user-selectable, // and not deletable. // TODO ??? /* * menu.setItemShown(MENU_DELETE_LIST, mCursorListFilter.count() > 1 && * listId != 1); // 1 is hardcoded number of default first list. */ // The following code is put from onCreateOptionsMenu to // onPrepareOptionsMenu, // because the URI of the shopping list can change if the user switches // to another list. // Generate any additional actions that can be performed on the // overall list. This allows other applications to extend // our menu with their own actions. Intent intent = new Intent(null, getIntent().getData()); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); // menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, // new ComponentName(this, NoteEditor.class), null, intent, 0, null); // Workaround to add icons: MenuIntentOptionsWithIcons menu2 = new MenuIntentOptionsWithIcons(this, menu); menu2.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(this, org.openintents.shopping.ShoppingActivity.class), null, intent, 0, null); return true; }