本文整理汇总了Java中com.umeng.socialize.weixin.media.WeiXinShareContent类的典型用法代码示例。如果您正苦于以下问题:Java WeiXinShareContent类的具体用法?Java WeiXinShareContent怎么用?Java WeiXinShareContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WeiXinShareContent类属于com.umeng.socialize.weixin.media包,在下文中一共展示了WeiXinShareContent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWeixinContent
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
public void setWeixinContent(String title, String desc, String contentUrl, UMImage image) {
WeiXinShareContent weixinContent = new WeiXinShareContent();
weixinContent.setShareContent(desc);
weixinContent.setTitle(title);
weixinContent.setTargetUrl(contentUrl);
weixinContent.setShareImage(image);
mController.setShareMedia(weixinContent);
}
示例2: initSocial
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
protected void initSocial(){
mShareController.getConfig().removePlatform(SHARE_MEDIA.RENREN,
SHARE_MEDIA.DOUBAN, SHARE_MEDIA.QZONE, SHARE_MEDIA.SINA,
SHARE_MEDIA.TENCENT);
//设置新浪SSO handler
mShareController.getConfig().setSsoHandler(new SinaSsoHandler());
String appId = AppContext.getInstance().getMetaData("WEIXIN_ID");
String appSecret = AppContext.getInstance().getMetaData("WEIXIN_SECRET");
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(this, appId, appSecret);
wxHandler.addToSocialSDK();
// 设置微信朋友分享内容
WeiXinShareContent weiXinShareContent = new WeiXinShareContent();
weiXinShareContent.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
weiXinShareContent.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
weiXinShareContent.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
weiXinShareContent.setTargetUrl(BaseClient.URL_USER_ABOUT);
mShareController.setShareMedia(weiXinShareContent);
// 添加微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(this, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
// 设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
circleMedia.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
circleMedia.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
circleMedia.setTargetUrl(BaseClient.URL_USER_ABOUT);
// 设置分享内容
mShareController.setShareMedia(circleMedia);
}
示例3: shareToWeiChat
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
private void shareToWeiChat() {
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(getActivity(),
Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
wxHandler.addToSocialSDK();
// 设置微信好友分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
// 设置分享文字
weixinContent.setShareContent(getShareContent());
// 设置title
weixinContent.setTitle(getShareTitle());
// 设置分享内容跳转URL
weixinContent.setTargetUrl(getShareUrl());
// 设置分享图片
weixinContent.setShareImage(new UMImage(getActivity(), R.drawable.ima_app_icon));
mController.setShareMedia(weixinContent);
mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN,
new SnsPostListener() {
@Override
public void onStart() {
AppContext.showToastShort(R.string.tip_start_share);
}
@Override
public void onComplete(SHARE_MEDIA arg0, int arg1,
SocializeEntity arg2) {
AppContext.showToastShort(R.string.tip_share_done);
}
});
}
示例4: shareToWeiChat
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
private void shareToWeiChat() {
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(getActivity(),
Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
wxHandler.addToSocialSDK();
// 设置微信好友分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
// 设置分享文字
weixinContent.setShareContent(getShareContent());
// 设置title
weixinContent.setTitle(getShareTitle());
// 设置分享内容跳转URL
weixinContent.setTargetUrl(getShareUrl());
// 设置分享图片
// weixinContent.setShareImage(localImage);
mController.setShareMedia(weixinContent);
mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN,
new SnsPostListener() {
@Override
public void onStart() {
AppContext.showToastShort(R.string.tip_start_share);
}
@Override
public void onComplete(SHARE_MEDIA arg0, int arg1,
SocializeEntity arg2) {
AppContext.showToastShort(R.string.tip_share_done);
}
});
}
示例5: onShareItemSelected
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
public void onShareItemSelected() {
final UMSocialService socialService = UMServiceFactory.getUMSocialService("com.umeng.share");
// Remove Tencent Weibo and QZone from share panel.
socialService.getConfig().removePlatform(SHARE_MEDIA.TENCENT);
socialService.getConfig().removePlatform(SHARE_MEDIA.QZONE);
String webLink = this.topicInfo.getLinks().getWebURL();
String shareContent = this.topicInfo.getTitle() + " " + webLink;
String title = getString(R.string.share_topic, this.topicInfo.getUser().getData().getName());
socialService.setShareContent(shareContent);
if (!BuildConfig.QQ_APPID.isEmpty() && !BuildConfig.QQ_APPKEY.isEmpty()) {
// Add QQ
UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(this, BuildConfig.QQ_APPID, BuildConfig.QQ_APPKEY);
qqSsoHandler.addToSocialSDK();
QQShareContent qqShareContent = new QQShareContent();
qqShareContent.setShareContent(shareContent);
qqShareContent.setTitle(title);
qqShareContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());
socialService.setShareMedia(qqShareContent);
} else {
socialService.getConfig().removePlatform(SHARE_MEDIA.QQ);
}
if (!BuildConfig.WX_APPID.isEmpty() && !BuildConfig.WX_SECRET.isEmpty()) {
// Add WeiChat
UMWXHandler wxHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
wxHandler.addToSocialSDK();
// Add WeChat Circle
UMWXHandler wxCircleHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
//设置微信分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
weixinContent.setShareContent(shareContent);
weixinContent.setTitle(title);
weixinContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());
weixinContent.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
socialService.setShareMedia(weixinContent);
Logger.d(topicInfo.getUser().getData().getAvatar());
//设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(shareContent);
circleMedia.setTitle(title);
circleMedia.setTargetUrl(this.topicInfo.getLinks().getWebURL());
circleMedia.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
socialService.setShareMedia(circleMedia);
}else{
socialService.getConfig().removePlatform(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE);
}
socialService.openShare(this, false);
}
示例6: setShareContent
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
/**
* 根据不同的平台设置不同的分享内容</br>
*/
private void setShareContent(Context context, String content, String targetUrl, String title, String imageUrl) {
// 配置SSO
mController.getConfig().setSsoHandler(new SinaSsoHandler());
QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler((Activity) context, "1104980016", "Dz9oJR8HGlmg6Prr");
qZoneSsoHandler.addToSocialSDK();
mController.setShareContent(content);
UMImage urlImage = new UMImage(context, imageUrl);
//微信分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
weixinContent.setShareContent(content);
weixinContent.setTitle(title);
weixinContent.setTargetUrl(targetUrl);
weixinContent.setShareMedia(urlImage);
mController.setShareMedia(weixinContent);
// 设置朋友圈分享的内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(content);
circleMedia.setTitle(title);
circleMedia.setShareMedia(urlImage);
circleMedia.setTargetUrl(targetUrl);
mController.setShareMedia(circleMedia);
// 设置QQ空间分享内容
QZoneShareContent qzone = new QZoneShareContent();
qzone.setShareContent(content);
qzone.setTargetUrl(targetUrl);
qzone.setTitle(title);
qzone.setShareImage(urlImage);
mController.setShareMedia(qzone);
// QQ分享内容
QQShareContent qqShareContent = new QQShareContent();
qqShareContent.setShareContent(content);
qqShareContent.setTitle(title);
qqShareContent.setShareMedia(urlImage);
qqShareContent.setTargetUrl(targetUrl);
mController.setShareMedia(qqShareContent);
//新浪分享内容
SinaShareContent sinaContent = new SinaShareContent();
sinaContent.setShareContent(content);
sinaContent.setShareImage(urlImage);
mController.setShareMedia(sinaContent);
}
示例7: onItemClick
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
//qq好友分享
QQShareContent qqContent = new QQShareContent();
//分享文字
qqContent.setShareContent(Constants.ShareLink+getArguments().getString(ITEMID));
qqContent.setTitle("藤书坊");
//分享的图片
qqContent.setShareImage(new UMImage(getActivity(), getArguments().getString(IMGURL)));
qqContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
controller.setShareMedia(qqContent);
shareMessage(SHARE_MEDIA.QQ);
break;
case 1:
//qq空间分享
QZoneShareContent qZoneContent = new QZoneShareContent();
qZoneContent.setShareContent("以书会友,以书交友");
qZoneContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
qZoneContent.setTitle("藤书坊");
qZoneContent.setShareImage(new UMImage(getActivity(), getArguments().getString(IMGURL)));
controller.setShareMedia(qZoneContent);
shareMessage(SHARE_MEDIA.QZONE);
break;
case 2:
//新浪微博分享
controller.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
controller.setShareContent("以书会友,以书交友" +Constants.ShareLink + getArguments().getString(ITEMID));
shareMessage(SHARE_MEDIA.SINA);
break;
case 3:
//威信好友分享
//设置微信好友分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
//设置分享文字
weixinContent.setShareContent("以书会友,以书交友");
//设置title
weixinContent.setTitle("藤书坊");
//设置分享内容跳转URL
weixinContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
//设置分享图片
weixinContent.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
controller.setShareMedia(weixinContent);
shareMessage(SHARE_MEDIA.WEIXIN);
break;
case 4:
//朋友圈分享
//设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent("以书会友,以书交友");
//设置朋友圈title
circleMedia.setTitle("藤书坊");
circleMedia.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
circleMedia.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
controller.setShareMedia(circleMedia);
shareMessage(SHARE_MEDIA.WEIXIN_CIRCLE);
break;
default:
break;
}
}
示例8: shareContent
import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入依赖的package包/类
public void shareContent() {
// 本地图片
UMImage localImage = new UMImage(this, R.drawable.ic_leyidao);
// 配置SSO
mController.getConfig().setSsoHandler(new SinaSsoHandler());
// QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(this,
// "100424468", "c7394704798a158208a74ab60104f0ba");
WeiXinShareContent weixinContent = new WeiXinShareContent();
weixinContent.setShareContent(content);
weixinContent.setTitle(title);
weixinContent.setTargetUrl(website);
weixinContent.setShareMedia(localImage);
mController.setShareMedia(weixinContent);
// 设置朋友圈分享的内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(content);
circleMedia.setTitle(title);
circleMedia.setShareMedia(localImage);
circleMedia.setTargetUrl(website);
mController.setShareMedia(circleMedia);
// 设置QQ空间分享内容
QZoneShareContent qzone = new QZoneShareContent();
qzone.setShareContent(content);
qzone.setTargetUrl(website);
qzone.setTitle(title);
qzone.setShareMedia(localImage);
mController.setShareMedia(qzone);
// 设置QQ分享内容
QQShareContent qqShareContent = new QQShareContent();
qqShareContent.setShareContent(content);
qqShareContent.setTitle(title);
qqShareContent.setShareMedia(localImage);
qqShareContent.setTargetUrl(website);
mController.setShareMedia(qqShareContent);
// 设置短信分享内容
SmsShareContent sms = new SmsShareContent();
sms.setShareContent(content);
sms.setShareImage(localImage);
mController.setShareMedia(sms);
// 设置新浪微博分享内容
SinaShareContent sinaContent = new SinaShareContent();
sinaContent.setShareContent(content);
sinaContent.setShareImage(localImage);
mController.setShareMedia(sinaContent);
}