当前位置: 首页>>代码示例>>Java>>正文


Java SendMultiMessageToWeiboRequest类代码示例

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


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

示例1: a

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void a() {
    WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
    if (!TextUtils.isEmpty(f.getText())) {
        weiboMultiMessage.textObject = d();
    }
    if (!(f.getImageData() == null && TextUtils.isEmpty(f.getImagePath()))) {
        weiboMultiMessage.imageObject = c();
    }
    if (!TextUtils.isEmpty(f.getUrl())) {
        weiboMultiMessage.mediaObject = b();
    }
    SendMultiMessageToWeiboRequest sendMultiMessageToWeiboRequest = new SendMultiMessageToWeiboRequest();
    sendMultiMessageToWeiboRequest.transaction = String.valueOf(System.currentTimeMillis());
    sendMultiMessageToWeiboRequest.multiMessage = weiboMultiMessage;
    this.e.sendRequest(this, sendMultiMessageToWeiboRequest, this.d, this.a, this);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:SinaActivity.java

示例2: shareToWeibo

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
public static void shareToWeibo(String transaction, Activity activity, String title, String summary, Bitmap img) {
    ImageObject imageObject = new ImageObject();
    imageObject.imageData = bmpToByteArray(img);

    TextObject textObject = new TextObject();
    textObject.text = title + "\n" + summary + Constants.SUMMARY;

    WeiboMultiMessage message = new WeiboMultiMessage();
    message.textObject = textObject;
    message.imageObject = imageObject;

    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = transaction;
    request.multiMessage = message;

    AuthInfo authInfo = new AuthInfo(activity, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE);
    Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(APP_CONTEXT);
    String token = "";
    if (accessToken != null) {
        token = accessToken.getToken();
    }
    IWeiboShareAPI api = getWbApi();
    api.sendRequest(activity, request, authInfo, token, weiboAuthListener);
}
 
开发者ID:qiujuer,项目名称:UPMiss,代码行数:25,代码来源:Share.java

示例3: share

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
/**
 * 分享文章到新浪微博
 * 
 * @param title
 * @param url
 */
public void share(Activity activity, String title, String url) {
    WeiboMultiMessage weiboMessage = new WeiboMultiMessage();// 初始化微博的分享消息
    TextObject textObject = new TextObject();
    textObject.text = "《" + title + "》" + "这篇文章不错, 文章地址 : " + url
            + "。本文来自: 开发技术前线, http://www.devtf.cn 。";
    weiboMessage.textObject = textObject;
    ImageObject imageObject = new ImageObject();
    imageObject.setImageObject(BitmapFactory.decodeResource(activity.getResources(),
            R.drawable.ic_launcher));
    weiboMessage.imageObject = imageObject;
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = weiboMessage;
    mWeiboShareAPI.sendRequest(activity, request); // 发送请求消息到微博,唤起微博分享界面
}
 
开发者ID:hehonghui,项目名称:the-tech-frontier-app,代码行数:22,代码来源:SharePresenter.java

示例4: sendText

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
public void sendText(String text) throws MalformedURLException, IOException {
	// String text = getData(json, "text");
	// String image_path = getData(json, "image");
	Log.d(TAG, "app key : " + appKey);
	mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(
			this.cordova.getActivity(), appKey);
	mWeiboShareAPI.registerApp(); // 将应用注册到微博客户端
	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();// 初始化微博的分享消息
	if (text != null) {
		TextObject textObject = new TextObject();
		textObject.text = text;
		weiboMessage.textObject = textObject;
	}
	SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
	request.transaction = String.valueOf(System.currentTimeMillis());
	request.multiMessage = weiboMessage;
	mWeiboShareAPI.sendRequest(this.cordova.getActivity(), request); // 发送请求消息到微博,唤起微博分享界面
}
 
开发者ID:mrichie,项目名称:pg-weibo,代码行数:19,代码来源:QyWeibo.java

示例5: shareText

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareText(ShareContent shareContent) {

        //初始化微博的分享消息
        WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
        weiboMultiMessage.textObject = getTextObj(shareContent.getContent());
        //初始化从第三方到微博的消息请求
        SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
        request.transaction = ShareUtil.buildTransaction("sinatext");
        request.multiMessage = weiboMultiMessage;
        allInOneShare(mContext, request);

    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WeiboShareManager.java

示例6: sharePicture

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void sharePicture(ShareContent shareContent) {

        WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
        weiboMultiMessage.imageObject = getImageObj(shareContent.getImageUrl());
        //初始化从第三方到微博的消息请求
        SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
        request.transaction = ShareUtil.buildTransaction("sinapic");
        request.multiMessage = weiboMultiMessage;
        allInOneShare(mContext, request);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:WeiboShareManager.java

示例7: shareWebPage

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareWebPage(ShareContent shareContent) {

        WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
        weiboMultiMessage.textObject = getTextObj(shareContent.getContent());
        weiboMultiMessage.imageObject = getImageObj(shareContent.getImageUrl());
        // 初始化从第三方到微博的消息请求
        SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
        // 用transaction唯一标识一个请求
        request.transaction = ShareUtil.buildTransaction("sinawebpage");
        request.multiMessage = weiboMultiMessage;
        allInOneShare(mContext, request);

    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:WeiboShareManager.java

示例8: shareMusic

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareMusic(ShareContent shareContent) {
    WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
    weiboMultiMessage.mediaObject = getMusicObj(shareContent);
    //初始化从第三方到微博的消息请求
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = ShareUtil.buildTransaction("sinamusic");
    request.multiMessage = weiboMultiMessage;
    allInOneShare(mContext, request);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboShareManager.java

示例9: allInOneShare

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void allInOneShare(final Context context, SendMultiMessageToWeiboRequest request) {

        AuthInfo authInfo = new AuthInfo(context, mSinaAppKey, REDIRECT_URL, SCOPE);
        Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
        String token = "";
        if (accessToken != null) {
            token = accessToken.getToken();
        }

        mSinaAPI.sendRequest((Activity) context, request, authInfo, token, new WeiboAuthListener() {

            @Override
            public void onWeiboException(WeiboException arg0) {
                Toast.makeText(context, context.getString(
                        R.string.share_failed), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onComplete(Bundle bundle) {
                Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle);
                AccessTokenKeeper.writeAccessToken(context, newToken);
                Toast.makeText(context, context.getString(
                        R.string.share_success), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onCancel() {
                Toast.makeText(context, context.getString(
                        R.string.share_cancel), Toast.LENGTH_SHORT).show();

            }
        });

    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:WeiboShareManager.java

示例10: share

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
@Override
public void share(@NonNull final ShareData data, @NonNull final OnCallback<String> callback) {

    if (!mApi.isWeiboAppInstalled()) {
        callback.onFailed(mActivity, ResultCode.RESULT_FAILED, "您未安装微博!");
        return;
    }

    WeiboMultiMessage message = new WeiboMultiMessage();

    if (data.hasText()) {
        message.textObject = toText(data.hasUrl() ? (data.text + " " + data.url) : data.text);
    }

    if (data.media instanceof MoImage) {
        message.imageObject = toImage(((MoImage) data.media).resource);
    }

    if (message.textObject == null && message.imageObject == null) {
        // unsupported
        callback.onFailed(mActivity, ResultCode.RESULT_FAILED, "不支持的分享类型");
        return;
    }

    mCallback = callback;
    mCallback.onStarted(mActivity);

    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = message;
    request.packageName = mActivity.getPackageName();

    mApi.sendRequest(mActivity, request);
}
 
开发者ID:czy1121,项目名称:sdk3rd,代码行数:35,代码来源:WBShare.java

示例11: shareTo

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private static void shareTo(final Context context, final String appKey, final String redirectUrl, final String scop, final String title, final String desc,
                            final String imageUrl, final String shareUrl, final WeiboAuthListener listener) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            WeiboMultiMessage msg = new WeiboMultiMessage();
            TextObject text = new TextObject();
            text.text = desc;
            msg.textObject = text;
            WebpageObject web = new WebpageObject();
            web.description = desc;
            byte[] thumb = SocialUtils.getHtmlByteArray(imageUrl);
            if (null != thumb)
                web.thumbData = SocialUtils.compressBitmap(thumb, 32);
            else
                web.thumbData = SocialUtils.compressBitmap(SocialUtils.getDefaultShareImage(context), 32);
            web.actionUrl = shareUrl;
            web.identify = imageUrl;
            web.title = title;
            msg.mediaObject = web;

            SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
            request.transaction = String.valueOf(System.currentTimeMillis());
            request.multiMessage = msg;

            AuthInfo authInfo = new AuthInfo(context, appKey, redirectUrl, scop);
            Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
            String token = "";
            if (accessToken != null) {
                token = accessToken.getToken();
            }
            getInstance(context, appKey).sendRequest((Activity) context, request, authInfo, token, listener);
        }
    }).start();

}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:37,代码来源:WeiboShareProxy.java

示例12: shareLocalImage

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareLocalImage(IWeiboShareAPI api, Share share, Callback callback) {
    WeiboMultiMessage msg = new WeiboMultiMessage();
    ImageObject img = new ImageObject();
    img.setImageObject(share.getThumbBitmap());
    msg.imageObject = img;
    SendMultiMessageToWeiboRequest multRequest = new SendMultiMessageToWeiboRequest();
    multRequest.multiMessage = msg;
    //以当前时间戳为唯一识别符
    multRequest.transaction = String.valueOf(System.currentTimeMillis());
    if (api.sendRequest(activity, multRequest)) {
        callback.onSuccess();
    } else {
        callback.onFailed();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:16,代码来源:OpenBuilder.java

示例13: sendWeiboMultiMsg

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void sendWeiboMultiMsg(Activity activity, WeiboMultiMessage message) {
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = message;
    boolean isSendSuccess = mWeiboShareAPI.sendRequest(activity, request);
    if (!isSendSuccess) {
        mOnShareListener.onFailure(new SocialException("sina分享发送失败,检查参数"));
    }
}
 
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:10,代码来源:WbPlatform.java

示例14: shareSongtoWeibo

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareSongtoWeibo() {
    TextObject textObject = new TextObject();
    textObject.text = "推荐一首好歌:" + mInfo.getArtist() +
            "的《" + mInfo.getTitle() + "》," + " 来自@" + getResources().getString(R.string.app_name) + "安卓客户端";
    WeiboMultiMessage msg = new WeiboMultiMessage();
    msg.textObject  = textObject;
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = msg;
    mWeiboApi.sendRequest(ShareDialog.this, request);
}
 
开发者ID:rRemix,项目名称:APlayer,代码行数:12,代码来源:ShareDialog.java

示例15: shareMindtoWeibo

import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest; //导入依赖的package包/类
private void shareMindtoWeibo(){
//        TextObject textObject = new TextObject();
//        textObject.text = "推荐一首好歌:" + mInfo.getArtist() +
//                "的《" + mInfo.getDisplayname() + "》," + " 来自@" + getResources().getString(R.string.app_name) + "安卓客户端";
        ImageObject imageObject = new ImageObject();
        imageObject.imagePath = mImageUrl;
        imageObject.setImageObject(RecordShareActivity.getBg());
        WeiboMultiMessage msg = new WeiboMultiMessage();
        msg.imageObject = imageObject;
        SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
        request.transaction = String.valueOf(System.currentTimeMillis());
        request.multiMessage = msg;
        mWeiboApi.sendRequest(ShareDialog.this, request);
    }
 
开发者ID:rRemix,项目名称:APlayer,代码行数:15,代码来源:ShareDialog.java


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