Java Code Examples for android.support.v7.widget.ShareActionProvider#setOnShareTargetSelectedListener()
The following examples show how to use
android.support.v7.widget.ShareActionProvider#setOnShareTargetSelectedListener() .
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: CatViewerActivity.java From android-aop-analytics with Apache License 2.0 | 5 votes |
private void initShareActionProvider(Menu menu) { MenuItem shareMenuItem = menu.findItem(R.id.action_share); ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareMenuItem); Intent shareIntent = new Intent(Intent.ACTION_VIEW); shareIntent.setType(catImage.getType()); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(catImage.getLink())); actionProvider.setShareIntent(shareIntent); actionProvider.setOnShareTargetSelectedListener((source, intent) -> { trackSharingAction(analyticsTrackerHelper, AnalyticsTags.CATEGORY_ACTION, AnalyticsTags.ACTION_SHARE); return true; }); }