Java Code Examples for android.support.v4.view.MenuItemCompat#setActionProvider()
The following examples show how to use
android.support.v4.view.MenuItemCompat#setActionProvider() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileExplorerAction.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add(0, R.id.select_all, 0, R.string.select_all).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.cut, 0, R.string.cut).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, R.id.copy, 0, R.string.copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem pasteMenu = menu.add(0, R.id.paste, 0, R.string.paste); pasteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); pasteMenu.setEnabled(fileClipboard.canPaste()); renameMenu = menu.add(0, R.id.rename, 0, R.string.rename); renameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareMenu = menu.add(0, R.id.share, 0, R.string.share); shareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareActionProvider = new ShareActionProvider(context); shareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(shareMenu, shareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true; }
Example 2
Source File: FileExplorerAction.java From 920-text-editor-v2 with Apache License 2.0 | 6 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add(0, R.id.select_all, 0, R.string.select_all).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.cut, 0, R.string.cut).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, R.id.copy, 0, R.string.copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem pasteMenu = menu.add(0, R.id.paste, 0, R.string.paste); pasteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); pasteMenu.setEnabled(fileClipboard.canPaste()); renameMenu = menu.add(0, R.id.rename, 0, R.string.rename); renameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareMenu = menu.add(0, R.id.share, 0, R.string.share); shareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareActionProvider = new ShareActionProvider(context); shareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(shareMenu, shareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); copyPathMenu = menu.add(0, R.id.copy_path, 0, R.string.copy_path); copyPathMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true; }
Example 3
Source File: CollectionActivity.java From Jager with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu (Menu menu) { getMenuInflater ().inflate (R.menu.collection_menu, menu); MenuItem item = menu.findItem (R.id.menu_collection_share); ShareActionProvider shareActionProvider = new ShareActionProvider (this); shareActionProvider.setShareIntent (getShareIntent ()); MenuItemCompat.setActionProvider (item, shareActionProvider); return true; }
Example 4
Source File: ImgViewer.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.image_view, menu); MenuItem item = menu.findItem(R.id.share_it); shareActionProvider = new ShareActionProvider(ImgViewer.this); MenuItemCompat.setActionProvider(item, shareActionProvider); // Fetch and store ShareActionProvider return true; }