List of usage examples for android.widget ShareActionProvider setShareHistoryFileName
public void setShareHistoryFileName(String shareHistoryFile)
From source file:com.github.jobs.ui.fragment.JobDetailsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); Context themedContext = getActivity().getActionBar().getThemedContext(); ShareActionProvider shareActionProvider = new ShareActionProvider(themedContext); shareActionProvider// ww w.j a v a 2 s . c o m .setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() { @Override public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) { getTracker(getActivity()).trackEvent(CATEGORY_JOBS, ACTION_SHARE, intent.getComponent().getPackageName()); return false; } }); menu.add(0, SHARE, 0, R.string.share).setActionProvider(shareActionProvider) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(SHARE); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); actionProvider.setShareIntent(ShareHelper.getShareIntent(mJob)); }
From source file:pl.bcichecki.rms.client.android.fragments.DevicesListFragment.java
private void performActionShare(final ActionMode mode, MenuItem item, final Device selectedDevice) { ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider(); if (shareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(AppConstants.CONTENT_TEXT_PLAIN); intent.putExtra(Intent.EXTRA_TEXT, new DeviceTextPrettyPrinterPrinter(getActivity()).print(selectedDevice)); shareActionProvider.setShareHistoryFileName(null); shareActionProvider.setShareIntent(intent); Log.d(TAG, "Device " + selectedDevice + " was succesfully shared."); }//from w w w .j av a 2 s .c o m }
From source file:pl.bcichecki.rms.client.android.fragments.EventsListFragment.java
private void performActionShare(ActionMode mode, MenuItem item, Event selectedEvent) { ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider(); if (shareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(AppConstants.CONTENT_TEXT_PLAIN); intent.putExtra(android.content.Intent.EXTRA_TEXT, new EventTextPrettyPrinter(getActivity()).print(selectedEvent)); shareActionProvider.setShareHistoryFileName(null); shareActionProvider.setShareIntent(intent); Log.d(TAG, "Event " + selectedEvent + " was succesfully shared."); }//ww w .j ava2 s. c om }