Search in sources :

Example 1 with ShareActionProvider

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;
}
Also used : MenuItem(android.view.MenuItem) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Example 2 with ShareActionProvider

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);
}
Also used : MenuItem(android.view.MenuItem) Intent(android.content.Intent) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Example 3 with ShareActionProvider

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);
}
Also used : MenuItem(android.view.MenuItem) Intent(android.content.Intent) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Example 4 with ShareActionProvider

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);
}
Also used : MenuItem(android.view.MenuItem) Intent(android.content.Intent) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Example 5 with ShareActionProvider

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);
}
Also used : Intent(android.content.Intent) MenuItem(android.view.MenuItem) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Aggregations

ShareActionProvider (android.support.v7.widget.ShareActionProvider)8 Intent (android.content.Intent)7 MenuItem (android.view.MenuItem)6 Media (fr.free.nrw.commons.Media)1 Contribution (fr.free.nrw.commons.contributions.Contribution)1 File (java.io.File)1