Example usage for android.widget ShareActionProvider DEFAULT_SHARE_HISTORY_FILE_NAME

List of usage examples for android.widget ShareActionProvider DEFAULT_SHARE_HISTORY_FILE_NAME

Introduction

In this page you can find the example usage for android.widget ShareActionProvider DEFAULT_SHARE_HISTORY_FILE_NAME.

Prototype

String DEFAULT_SHARE_HISTORY_FILE_NAME

To view the source code for android.widget ShareActionProvider DEFAULT_SHARE_HISTORY_FILE_NAME.

Click Source Link

Document

The default name for storing share history.

Usage

From source file:com.cmput301.recipebot.ui.AbstractRecipeActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.activity_recipe, menu);
    MenuItem actionItem = menu.findItem(R.id.recipe_menu_share);
    mShareActionProvider = (com.actionbarsherlock.widget.ShareActionProvider) actionItem.getActionProvider();
    mShareActionProvider.setShareHistoryFileName(
            com.actionbarsherlock.widget.ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    if (mRecipe != null) {
        new WriteRecipeToFileTask().execute(mRecipe);
    }//  www  .  ja va 2  s  . co m
    return super.onCreateOptionsMenu(menu);
}

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/*from ww w.  j av a2s.  co  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:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void prepareShareActionItem(MenuItem shareItem) {
    shareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
    shareActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    shareActionProvider.setOnShareTargetSelectedListener(shareTargetSelectedListener);
    shareActionProvider.setShareIntent(prepareShareIntent(video));
}