use of com.umeng.socialize.bean.SHARE_MEDIA 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();
}
use of com.umeng.socialize.bean.SHARE_MEDIA 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();
}
use of com.umeng.socialize.bean.SHARE_MEDIA 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();
}
Aggregations