use of android.support.v7.widget.ShareActionProvider in project V2HOT by djyde.
the class ContentActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.content_activity, menu);
MenuItem item = menu.findItem(R.id.menu_item_share);
ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
shareActionProvider.setShareIntent(getShareIntent());
return true;
}
use of android.support.v7.widget.ShareActionProvider in project wh-app-android by WhiteHouse.
the class ArticleViewFragment method configureOverflow.
private void configureOverflow(boolean favorited) {
MenuItem favoriteItem, unfavoriteItem, shareItem;
ShareActionProvider shareAction;
Intent shareIntent;
mFavorited = favorited;
favoriteItem = mMenu.findItem(R.id.action_favorite);
unfavoriteItem = mMenu.findItem(R.id.action_unfavorite);
shareItem = mMenu.findItem(R.id.action_share);
if (favoriteItem == null || unfavoriteItem == null || shareItem == null) {
return;
}
favoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
favoriteItem.setVisible(!favorited);
unfavoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
unfavoriteItem.setVisible(favorited);
shareAction = ((ShareActionProvider) MenuItemCompat.getActionProvider(shareItem));
shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, mFeedItem.title());
shareIntent.putExtra(Intent.EXTRA_TEXT, mFeedItem.link());
shareIntent.setType("text/plain");
shareAction.setShareIntent(shareIntent);
}
use of android.support.v7.widget.ShareActionProvider in project wh-app-android by WhiteHouse.
the class VideoInfoFragment method configureOverflow.
private void configureOverflow(boolean favorited) {
MenuItem favoriteItem, unfavoriteItem, shareItem;
ShareActionProvider shareAction;
Intent shareIntent;
favoriteItem = mMenu.findItem(R.id.action_favorite);
unfavoriteItem = mMenu.findItem(R.id.action_unfavorite);
shareItem = mMenu.findItem(R.id.action_share);
if (favoriteItem == null || unfavoriteItem == null || shareItem == null) {
return;
}
favoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
favoriteItem.setVisible(!favorited);
unfavoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
unfavoriteItem.setVisible(favorited);
shareAction = ((ShareActionProvider) MenuItemCompat.getActionProvider(shareItem));
shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, mFeedItem.title());
shareIntent.putExtra(Intent.EXTRA_TEXT, mFeedItem.link());
shareIntent.setType("text/plain");
shareAction.setShareIntent(shareIntent);
}
use of android.support.v7.widget.ShareActionProvider in project wh-app-android by WhiteHouse.
the class GalleryFragment method configureOverflow.
private void configureOverflow(boolean favorited) {
MenuItem favoriteItem, unfavoriteItem, shareItem;
ShareActionProvider shareAction;
Intent shareIntent;
favoriteItem = mMenu.findItem(R.id.action_favorite);
unfavoriteItem = mMenu.findItem(R.id.action_unfavorite);
shareItem = mMenu.findItem(R.id.action_share);
if (favoriteItem == null || unfavoriteItem == null || shareItem == null) {
return;
}
favoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
favoriteItem.setVisible(!favorited);
unfavoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
unfavoriteItem.setVisible(favorited);
shareAction = ((ShareActionProvider) MenuItemCompat.getActionProvider(shareItem));
shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, mFeedItems.get(mIndex).title());
shareIntent.putExtra(Intent.EXTRA_TEXT, mFeedItems.get(mIndex).link());
shareIntent.setType("text/plain");
shareAction.setShareIntent(shareIntent);
}
use of android.support.v7.widget.ShareActionProvider in project AisenWeiBo by wangdan.
the class BrowserActivity method onPrepareOptionsMenu.
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.removeGroup(R.id.browser);
getMenuInflater().inflate(R.menu.menu_browser, menu);
String shareContent = String.format("%s %s ", mWebView.getTitle() + "", mWebView.getUrl() + "");
Intent shareIntent = Utils.getShareIntent(shareContent, "", null);
MenuItem shareItem = menu.findItem(R.id.share);
ShareActionProvider shareProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
shareProvider.setShareHistoryFileName("channe_share.xml");
shareProvider.setShareIntent(shareIntent);
return super.onPrepareOptionsMenu(menu);
}
Aggregations