• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WeiboMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sina.weibo.sdk.api.WeiboMessage的典型用法代码示例。如果您正苦于以下问题:Java WeiboMessage类的具体用法?Java WeiboMessage怎么用?Java WeiboMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WeiboMessage类属于com.sina.weibo.sdk.api包,在下文中一共展示了WeiboMessage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: share

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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.WeiboMessage; //导入依赖的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: check

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的package包/类
public boolean check(Context context, WeiboMessage weibomessage)
{
    LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage package : ")).append(mPackageName).toString());
    ApiUtils.WeiboInfo weiboinfo;
    if (mPackageName != null && mPackageName.length() != 0)
    {
        if ((weiboinfo = ApiUtils.queryWeiboInfoByPackage(context, mPackageName)) != null)
        {
            LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage WeiboInfo supportApi : ")).append(weiboinfo.supportApi).toString());
            if (weiboinfo.supportApi < 10351 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof VoiceObject))
            {
                weibomessage.mediaObject = null;
            }
            if (weiboinfo.supportApi < 10352 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof CmdObject))
            {
                weibomessage.mediaObject = null;
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:23,代码来源:VersionCheckHandler.java


示例4: sendSingleMessage

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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


示例5: responseSingleMessage

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的package包/类
/**
   * 第三方应用响应微博客户端的请求,提供需要分享的数据。
   * 当{@link IWeiboShareAPI#getWeiboAppSupportAPI()} < 10351 时,只支持分享单条消息,即
   * 文本、图片、网页、音乐、视频中的一种,不支持Voice消息。
   * 
   * @param hasText    分享的内容是否有文本
   * @param hasImage   分享的内容是否有图片
   * @param hasWebpage 分享的内容是否有网页
   * @param hasMusic   分享的内容是否有音乐
   * @param hasVideo   分享的内容是否有视频
   */
  private void responseSingleMessage(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. 初始化从微博到第三方的消息请求
      ProvideMessageForWeiboResponse response = new ProvideMessageForWeiboResponse();
      response.transaction = mBaseRequest.transaction;
      response.reqPackageName = mBaseRequest.packageName;
      response.message = weiboMessage;
      
// 3. 发送响应消息到微博
      mShareWeiboAPI.sendResponse(response);
  }
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:46,代码来源:WBShareResponseActivity.java


示例6: shareWeiboGif

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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


示例7: send

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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


示例8: sendSingleWeiboMessage

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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


示例9: fromBundle

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的package包/类
public void fromBundle(Bundle bundle)
{
    super.fromBundle(bundle);
    message = new WeiboMessage(bundle);
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:6,代码来源:ProvideMessageForWeiboResponse.java


示例10: shareMsg

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的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


示例11: check

import com.sina.weibo.sdk.api.WeiboMessage; //导入依赖的package包/类
public abstract boolean check(Context context, WeiboMessage weibomessage); 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:2,代码来源:IVersionCheckHandler.java



注:本文中的com.sina.weibo.sdk.api.WeiboMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MimeUtility类代码示例发布时间:2022-05-22
下一篇:
Java Decorations类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap