Search in sources :

Example 1 with ShareAction

use of com.umeng.socialize.ShareAction in project AnkiChinaAndroid by ankichinateam.

the class WebViewActivity method shareUrl.

public void shareUrl(String url, String title, String desc, String thumb, SHARE_MEDIA share_media) {
    UMWeb web = new UMWeb(url);
    web.setTitle(title);
    web.setThumb(new UMImage(this, thumb));
    web.setDescription(desc);
    new ShareAction(this).withMedia(web).setPlatform(share_media).setCallback(new UMShareListener() {

        @Override
        public void onStart(SHARE_MEDIA share_media) {
        }

        @Override
        public void onResult(SHARE_MEDIA share_media) {
        }

        @Override
        public void onError(SHARE_MEDIA share_media, Throwable throwable) {
        }

        @Override
        public void onCancel(SHARE_MEDIA share_media) {
        }
    }).share();
}
Also used : UMShareListener(com.umeng.socialize.UMShareListener) SHARE_MEDIA(com.umeng.socialize.bean.SHARE_MEDIA) ShareAction(com.umeng.socialize.ShareAction) UMImage(com.umeng.socialize.media.UMImage) UMWeb(com.umeng.socialize.media.UMWeb)

Example 2 with ShareAction

use of com.umeng.socialize.ShareAction in project WeexErosFramework by bmfe.

the class DefaultShareAdapter method startUmweb.

private void startUmweb(ShareInfoBean shareInfo, SHARE_MEDIA mPlatform, UMShareListener shareListener) {
    if (!BMWXEnvironment.mPlatformConfig.getUmeng().isUmengAvailable()) {
        shareListener.onError(mPlatform, new Exception("未设置umeng三方appKey"));
        return;
    }
    mUMWeb = new UMWeb(shareInfo.getUrl());
    mUMWeb.setTitle(shareInfo.getTitle());
    mUMWeb.setDescription(shareInfo.getContent());
    String image = shareInfo.getImage();
    if (TextUtils.isEmpty(image)) {
        mUMWeb.setThumb(new UMImage(mAct, R.drawable.place_holder));
    } else {
        mUMWeb.setThumb(new UMImage(mAct, image));
    }
    new ShareAction(mAct).setPlatform(mPlatform).withMedia(mUMWeb).setCallback(shareListener).share();
}
Also used : ShareAction(com.umeng.socialize.ShareAction) UMImage(com.umeng.socialize.media.UMImage) UMWeb(com.umeng.socialize.media.UMWeb)

Example 3 with ShareAction

use of com.umeng.socialize.ShareAction in project SmartCampus by Vegen.

the class ShareUtils method shareWeb.

/**
 * 分享链接
 */
public static void shareWeb(final Activity activity, String WebUrl, String title, String description, String imageUrl, int imageID) {
    // 连接地址
    UMWeb web = new UMWeb(WebUrl);
    // 标题
    web.setTitle(title);
    // 描述
    web.setDescription(description);
    if (TextUtils.isEmpty(imageUrl)) {
        // 本地缩略图
        web.setThumb(new UMImage(activity, imageID));
    } else {
        // 网络缩略图
        web.setThumb(new UMImage(activity, imageUrl));
    }
    new ShareAction(activity).setDisplayList(SHARE_MEDIA.QQ, SHARE_MEDIA.QZONE, SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.WEIXIN_FAVORITE, SHARE_MEDIA.SINA).withText(title).withMedia(web).setCallback(new UMShareListener() {

        @Override
        public void onStart(SHARE_MEDIA share_media) {
        }

        @Override
        public void onResult(final SHARE_MEDIA share_media) {
            activity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (share_media.name().equals("WEIXIN_FAVORITE")) {
                        Toast.makeText(activity, share_media + " 收藏成功", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(activity, share_media + " 分享成功", Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }

        @Override
        public void onError(final SHARE_MEDIA share_media, final Throwable throwable) {
            if (throwable != null) {
                Log.d("throw", "throw:" + throwable.getMessage());
            }
            activity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    Toast.makeText(activity, share_media + " 分享失败", Toast.LENGTH_SHORT).show();
                }
            });
        }

        @Override
        public void onCancel(final SHARE_MEDIA share_media) {
            activity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    Toast.makeText(activity, share_media + " 分享取消", Toast.LENGTH_SHORT).show();
                }
            });
        }
    }).open();
}
Also used : UMShareListener(com.umeng.socialize.UMShareListener) SHARE_MEDIA(com.umeng.socialize.bean.SHARE_MEDIA) ShareAction(com.umeng.socialize.ShareAction) UMImage(com.umeng.socialize.media.UMImage) UMWeb(com.umeng.socialize.media.UMWeb)

Example 4 with ShareAction

use of com.umeng.socialize.ShareAction in project ManPinAPP by AnyMarvel.

the class PersonFragment method onClick.

@Override
public void onClick(View v) {
    int id = v.getId();
    String linkUrl;
    switch(id) {
        case R.id.guanyuwomen:
            Intent settingIntent = new Intent(getActivity(), SettingAboutActivity.class);
            requireActivity().startActivity(settingIntent);
            break;
        case R.id.manpin_weixin_xiaobian_layout:
            Intent intent = new Intent(getActivity(), ManpinWXActivity.class);
            startActivity(intent);
            break;
        case R.id.person_booksource_layout:
            Intent intent2 = new Intent(getActivity(), BookSourceActivity.class);
            startActivity(intent2);
            break;
        case R.id.person_fenxiang_layout:
            UMWeb weburl = new UMWeb("http://aimanpin.com");
            weburl.setDescription("官方网址:\n \n http://aimanpin.com ");
            weburl.setTitle("漫品官网");
            weburl.setThumb(new UMImage(requireContext(), R.drawable.ic_launcher_share_background));
            new ShareAction(requireActivity()).withMedia(weburl).setDisplayList(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.WEIXIN_FAVORITE, SHARE_MEDIA.QQ, SHARE_MEDIA.QZONE, SHARE_MEDIA.SINA).open();
            break;
        case R.id.manpin_person_music_layout:
            jumpLinkUrl("http://tool.liumingye.cn/music/?page=searchPage");
            break;
        case R.id.manpin_person_travel:
            jumpLinkUrl("http://quanjingke.com/vmindex");
            break;
        case R.id.manpin_person_wallpaper:
            jumpLinkUrl("https://www.logosc.cn/so/");
            break;
        case R.id.manpin_person_games:
            jumpLinkUrl("https://www.yikm.net");
            break;
        default:
            break;
    }
}
Also used : Intent(android.content.Intent) ShareAction(com.umeng.socialize.ShareAction) UMImage(com.umeng.socialize.media.UMImage) UMWeb(com.umeng.socialize.media.UMWeb)

Example 5 with ShareAction

use of com.umeng.socialize.ShareAction in project AnkiChinaAndroid by ankichinateam.

the class PosterActivity method shareUrl.

public void shareUrl(View view, SHARE_MEDIA share_media) {
    Bitmap bitmap = createBitmapFromView(view);
    UMImage imagelocal = new UMImage(this, bitmap);
    imagelocal.setThumb(new UMImage(this, bitmap));
    new ShareAction(this).withMedia(imagelocal).setPlatform(share_media).setCallback(new UMShareListener() {

        @Override
        public void onStart(SHARE_MEDIA share_media) {
        }

        @Override
        public void onResult(SHARE_MEDIA share_media) {
        }

        @Override
        public void onError(SHARE_MEDIA share_media, Throwable throwable) {
        }

        @Override
        public void onCancel(SHARE_MEDIA share_media) {
        }
    }).share();
}
Also used : Bitmap(android.graphics.Bitmap) UMShareListener(com.umeng.socialize.UMShareListener) SHARE_MEDIA(com.umeng.socialize.bean.SHARE_MEDIA) ShareAction(com.umeng.socialize.ShareAction) UMImage(com.umeng.socialize.media.UMImage)

Aggregations

ShareAction (com.umeng.socialize.ShareAction)5 UMImage (com.umeng.socialize.media.UMImage)5 UMWeb (com.umeng.socialize.media.UMWeb)4 UMShareListener (com.umeng.socialize.UMShareListener)3 SHARE_MEDIA (com.umeng.socialize.bean.SHARE_MEDIA)3 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1