本文整理汇总了Java中com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest类的典型用法代码示例。如果您正苦于以下问题:Java SendMessageToWeiboRequest类的具体用法?Java SendMessageToWeiboRequest怎么用?Java SendMessageToWeiboRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SendMessageToWeiboRequest类属于com.sina.weibo.sdk.api.share包,在下文中一共展示了SendMessageToWeiboRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: share
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
public void share(Activity activity, Bitmap bitmap, int ShareType) {
ImageObject imageobj = new ImageObject();
if (bitmap != null) {
imageobj.setImageObject(bitmap);
// TODO 更高效的处理图片
Bitmap thumBmp = Bitmap.createScaledBitmap(bitmap, THUMB_SIZE, THUMB_SIZE, true);
imageobj.setThumbImage(thumBmp);
}
WeiboMessage multmess = new WeiboMessage();
multmess.mediaObject = imageobj;
SendMessageToWeiboRequest multRequest = new SendMessageToWeiboRequest();
multRequest.message = multmess;
multRequest.transaction = String.valueOf(System.currentTimeMillis());
mWeibo.sendRequest(activity, multRequest);
}
开发者ID:junchenChow,项目名称:exciting-app,代码行数:18,代码来源:ShareSina.java
示例2: sendSingleMessage
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
/**
* 第三方应用发送请求消息到微博,唤起微博分享界面。
* 当{@link IWeiboShareAPI#getWeiboAppSupportAPI()} < 10351 时,只支持分享单条消息,即
* 文本、图片、网页、音乐、视频中的一种,不支持Voice消息。
*
* @param hasText 分享的内容是否有文本
* @param hasImage 分享的内容是否有图片
*/
private void sendSingleMessage(boolean hasText, boolean hasImage, String content, String imageUrl) {
// 1. 初始化微博的分享消息
// 用户可以分享文本、图片、网页、音乐、视频中的一种
WeiboMessage weiboMessage = new WeiboMessage();
if (hasText) {
weiboMessage.mediaObject = getTextObj(content);
}
if (hasImage) {
weiboMessage.mediaObject = getImageObj(imageUrl);
}
// 2. 初始化从第三方到微博的消息请求
SendMessageToWeiboRequest request = new SendMessageToWeiboRequest();
// 用transaction唯一标识一个请求
request.transaction = String.valueOf(System.currentTimeMillis());
request.message = weiboMessage;
// 3. 发送请求消息到微博,唤起微博分享界面
mWeiboShareAPI.sendRequest(mActivity, request);
}
开发者ID:maoruibin,项目名称:ChinaShare,代码行数:28,代码来源:SinaShareImpl.java
示例3: sendSingleMessage
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
/**
* 第三方应用发送请求消息到微博,唤起微博分享界面。
* 当{@link IWeiboShareAPI#getWeiboAppSupportAPI()} < 10351 时,只支持分享单条消息,即
* 文本、图片、网页、音乐、视频中的一种,不支持Voice消息。
*
* @param hasText 分享的内容是否有文本
* @param hasImage 分享的内容是否有图片
* @param hasWebpage 分享的内容是否有网页
* @param hasMusic 分享的内容是否有音乐
* @param hasVideo 分享的内容是否有视频
*/
private void sendSingleMessage(boolean hasText, boolean hasImage, boolean hasWebpage,
boolean hasMusic, boolean hasVideo/*, boolean hasVoice*/) {
// 1. 初始化微博的分享消息
// 用户可以分享文本、图片、网页、音乐、视频中的一种
WeiboMessage weiboMessage = new WeiboMessage();
if (hasText) {
weiboMessage.mediaObject = getTextObj();
}
if (hasImage) {
weiboMessage.mediaObject = getImageObj();
}
if (hasWebpage) {
weiboMessage.mediaObject = getWebpageObj();
}
if (hasMusic) {
weiboMessage.mediaObject = getMusicObj();
}
if (hasVideo) {
weiboMessage.mediaObject = getVideoObj();
}
/*if (hasVoice) {
weiboMessage.mediaObject = getVoiceObj();
}*/
// 2. 初始化从第三方到微博的消息请求
SendMessageToWeiboRequest request = new SendMessageToWeiboRequest();
// 用transaction唯一标识一个请求
request.transaction = String.valueOf(System.currentTimeMillis());
request.message = weiboMessage;
// 3. 发送请求消息到微博,唤起微博分享界面
mWeiboShareAPI.sendRequest(WBShareActivity.this, request);
}
开发者ID:ligongzai,项目名称:QianXun,代码行数:46,代码来源:WBShareActivity.java
示例4: shareWeiboGif
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
private void shareWeiboGif(Activity activity, String url) {
if (mWeibo == null) {
mWeibo = WeiboShareSDK.createWeiboAPI(activity, BuildConfig.SINA_APP_KEY);
mWeibo.registerApp();
}
ImageObject imageobj = new ImageObject();
imageobj.imageData = Util.bmpToByteArray(GlideBitmapFactory.decodeFile(url), true);
WeiboMessage multmess = new WeiboMessage();
multmess.mediaObject = imageobj;
SendMessageToWeiboRequest multRequest = new SendMessageToWeiboRequest();
multRequest.message = multmess;
multRequest.transaction = String.valueOf(System.currentTimeMillis());
mWeibo.sendRequest(activity, multRequest);
}
开发者ID:junchenChow,项目名称:exciting-app,代码行数:16,代码来源:ShareSina.java
示例5: send
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
private void send(BaseMediaObject mediaObject, Activity activity) {
WeiboMessage weiboMessage = new WeiboMessage();
weiboMessage.mediaObject = mediaObject;
SendMessageToWeiboRequest request = new SendMessageToWeiboRequest();
request.transaction = String.valueOf(System.currentTimeMillis());
request.message = weiboMessage;
mWeiboShareAPI.sendRequest(activity, request);
}
开发者ID:jhwing,项目名称:SKShare,代码行数:9,代码来源:WeiboShare.java
示例6: sendSingleWeiboMessage
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
/**
* 分享单种消息
* @param article
*/
private void sendSingleWeiboMessage(Article article){
Log.i(TAG, "sendSingleWeiboMessage>>" + article.getDescription());
//分享文本
TextObject textObject = new TextObject();
// 分享图片
ImageObject imageObject = new ImageObject();
//分享网页
WebpageObject webObject = new WebpageObject();
//分享消息
WeiboMessage message = new WeiboMessage();
if(article.getType() == Article.DUANZI){
String desp = extractTextFromHtml(article.getDescription());
textObject.text = "[段子]" + desp + article.getLink();
message.mediaObject = textObject;
}else {
textObject.text = article.getTitle() + article.getDescription();
webObject.identify = Utility.generateGUID();
webObject.title = article.getTitle();
webObject.description = article.getTitle();
webObject.defaultText = article.getTitle();
// default
message.mediaObject = textObject;
if(!TextUtils.isEmpty(article.getImgUrl())){
//图片地址非空
Bitmap bm = getBitmapFromCache(article.getImgUrl());
if(bm != null) {
imageObject.setImageObject(bm);
webObject.setThumbImage(bm);
bm.recycle();
webObject.actionUrl = article.getDescription();
message.mediaObject = webObject;
}
}
}
//分享请求
SendMessageToWeiboRequest request = new SendMessageToWeiboRequest();
request.transaction = String.valueOf(System.currentTimeMillis());
request.message = message;
//发送请求
mWeiboShareAPI.sendRequest(this, request);
}
开发者ID:zjupure,项目名称:SneezeReader,代码行数:61,代码来源:ShareActivity.java
示例7: shareMsg
import com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest; //导入依赖的package包/类
public boolean shareMsg(Activity ctx, AbsShareMsg msg, CallbackListener listener) {
if(supportClientShare()){
WeiboMessage weiboMessage = new WeiboMessage();
weiboMessage.mediaObject = getTextObject(msg);
// 2. 初始化从第三方到微博的消息请求
SendMessageToWeiboRequest request = new SendMessageToWeiboRequest();
// 用transaction唯一标识一个请求
request.transaction = String.valueOf(System.currentTimeMillis());
request.message = weiboMessage;
// 3. 发送请求消息到微博,唤起微博分享界面
return mWeiboShareAPI.sendRequest(request);
}
if(mAccessToken !=null && mAccessToken.isSessionValid()){
if(needReInit){
mStatusesAPI = new StatusesAPI(mAccessToken);
}
if (msg instanceof MsgText) {
MsgText mt = (MsgText) msg;
StringBuilder contentBuilder = new StringBuilder();
if(mt.title != null && mt.title.length() > 0){
contentBuilder.append("【").append(mt.title).append("】");
}
if(mt.summary != null && mt.summary.length() > 0){
contentBuilder.append(mt.summary);
}
if(mt.targetUrl != null && mt.targetUrl.length() > 0){
contentBuilder.append(mt.targetUrl);
}
if (msg instanceof MsgImageText) {
String imgurl = ((MsgImageText) mt).imageUrl;
if(imgurl != null && imgurl.length() > 0){
if(imgurl.startsWith("http")){
sendUrlWeiBo(contentBuilder.toString(),imgurl,null,null,null,new MyRequestListener(listener));
}else{
sendImageWeiBo(contentBuilder.toString(),BitmapFactory.decodeFile(imgurl),null,null,new MyRequestListener(listener));
}
}else{
sendImageWeiBo(contentBuilder.toString(),((MsgImageText) mt).image,null,null,new MyRequestListener(listener));
}
}else{
sendImageWeiBo(contentBuilder.toString(),null,null,null,new MyRequestListener(listener));
}
} else if (msg instanceof MsgImage) {
shareImageMsg(ctx, (MsgImage) msg, listener);
}
}else{
sinaOauth(ctx);
}
return false;
}
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:58,代码来源:ShareToSina.java
注:本文中的com.sina.weibo.sdk.api.share.SendMessageToWeiboRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论