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


Java ImageObject.setImageObject方法代码示例

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


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

示例1: share

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的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: c

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
private ImageObject c() {
    ImageObject imageObject = new ImageObject();
    try {
        if (f.getImageData() != null) {
            this.b = 2097152;
            imageObject.setImageObject(a((Context) this, f.getImageData()));
            return imageObject;
        } else if (TextUtils.isEmpty(f.getImagePath())) {
            return imageObject;
        } else {
            this.b = 10485760;
            imageObject.setImageObject(a((Context) this, f.getImagePath()));
            return imageObject;
        }
    } catch (Throwable th) {
        Ln.e(th);
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:SinaActivity.java

示例3: createMessage

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
@Override
protected WeiboMultiMessage createMessage() {
	WeiboMultiMessage message = super.createMessage();
	final ImageObject object = new ImageObject();
	final ShareParams.ShareImage image = getShareParams().getImage();
	switch (image.getSource()) {
		case Bitmap:
			object.setImageObject(image.getImageBitmap());
			break;
		case File:
			object.imagePath = image.getImageFile().getAbsolutePath();
			break;
		case Http:
			object.imageData = ShareImageUtils.getCompressData(image);
			break;
	}
	message.imageObject = object;
	return message;
}
 
开发者ID:Joy-Whale,项目名称:EasyShare,代码行数:20,代码来源:SinaWeiboShareImageAndTextMessage.java

示例4: share

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

示例5: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 *
 * @return 图片消息对象。
 */
private ImageObject getImageObj(String imageUrl) {
    ImageObject imageObject = new ImageObject();
    Bitmap bmp = BitmapFactory.decodeFile(imageUrl);
    imageObject.setImageObject(bmp);
    return imageObject;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:WeiboShareManager.java

示例6: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 * 
 * @return 图片消息对象。
 */
private ImageObject getImageObj() {
    ImageObject imageObject = new ImageObject();
    BitmapDrawable bitmapDrawable = (BitmapDrawable) mImageView.getDrawable();
    //设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。
    Bitmap  bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo);
    imageObject.setImageObject(bitmap);
    return imageObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:14,代码来源:WBShareActivity.java

示例7: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 * 
 * @return 图片消息对象。
 */
private ImageObject getImageObj() {
    ImageObject imageObject = new ImageObject();
    BitmapDrawable bitmapDrawable = (BitmapDrawable) mImageView.getDrawable();
    imageObject.setImageObject(bitmapDrawable.getBitmap());
    return imageObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:12,代码来源:WBShareResponseActivity.java

示例8: shareLocalImage

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

示例9: shareMindtoWeibo

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

示例10: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 * 
 * @return 图片消息对象。
 */
private ImageObject getImageObj() {
	Bitmap bitmap = BitmapUtil.getBitmapFromCache(mJoke.getImgUrl());
	if(bitmap == null) {
		return null;
	}
    ImageObject imageObject = new ImageObject();
    imageObject.setImageObject(bitmap);
    imageObject.title = title;
    imageObject.description = description;
    imageObject.actionUrl = targetUrl + mJoke.getId();
    return imageObject;
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:18,代码来源:SharePopWindow.java

示例11: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 *
 * @return 图片消息对象。
 */
private ImageObject getImageObj(Bitmap bmp) {
    ImageObject imageObject = new ImageObject();
    imageObject.setImageObject(bmp);
    return imageObject;
}
 
开发者ID:markzhai,项目名称:AndroidProjectFrom0,代码行数:11,代码来源:WeiboSharePlugin.java

示例12: share

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
@Override
    public void share(Activity activity, IShareMedia shareMedia, ShareListener shareListener) {
        this.mActivity = activity;
        this.mShareListener = shareListener;

        this.mSsoHandler = new SsoHandler(mActivity, mAuthInfo);

        WeiboMultiMessage weiboMessage = new WeiboMultiMessage();

        if(shareMedia instanceof ShareTextImageMedia) {       //文字图片分享
            ShareTextImageMedia shareTextImageMedia = (ShareTextImageMedia) shareMedia;

            if(shareTextImageMedia.getText().length() > 0) {
                TextObject textObject = new TextObject();
                textObject.text = shareTextImageMedia.getText();
                weiboMessage.textObject = textObject;
            }

            if(shareTextImageMedia.getImage() != null) {
                ImageObject imageObject = new ImageObject();
                imageObject.setImageObject(shareTextImageMedia.getImage());
                weiboMessage.imageObject = imageObject;
            }
        } else {
            if(this.mShareListener != null) {
                this.mShareListener.onError(this.mConfig.getName(), "weibo is not support this shareMedia");
            }
            return ;
        }

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

        Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(mContext.getApplicationContext());
        String token = "";
        if (accessToken != null) {
            token = accessToken.getToken();
        }
        mWeiboShareAPI.sendRequest(mActivity, request, mAuthInfo, token, new WeiboAuthListener() {

            @Override
            public void onWeiboException( WeiboException arg0 ) {
            }

            @Override
            public void onComplete( Bundle bundle ) {
                // TODO Auto-generated method stub
                Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle);
                AccessTokenKeeper.writeAccessToken(mContext.getApplicationContext(), newToken);
            }

            @Override
            public void onCancel() {
            }
        });

//        mWeiboShareAPI.sendRequest(mActivity, request);
    }
 
开发者ID:tsy12321,项目名称:SocialSDKAndroid,代码行数:60,代码来源:SinaWBHandler.java

示例13: shareToXinLangWeibo

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 分享到新浪微博
 * @param activity      上下文
 * @param shareContent  分享内容
 */
static void shareToXinLangWeibo(Activity activity, ShareContent shareContent) {
	DebugLog.d(TAG, "shareToXinLangWeibo() shareContent = " + shareContent);
	
	IWeiboShareAPI weiboShareAPI = WeiboShareSDK.createWeiboAPI(activity, MyApp.getApp().d());
	weiboShareAPI.registerApp();
	
	if (weiboShareAPI.isWeiboAppSupportAPI()) {
           int supportApi = weiboShareAPI.getWeiboAppSupportAPI();
           if (supportApi >= 10351 /*ApiUtils.BUILD_INT_VER_2_2*/) {
           	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
           	
           	TextObject textObject = new TextObject();
               textObject.text = shareContent.getSummary();
           	weiboMessage.textObject = textObject;
           	
           	ImageObject imageObject = new ImageObject();
               imageObject.setImageObject(((BitmapDrawable)activity.getResources().getDrawable(R.drawable.ic_logo)).getBitmap());
           	weiboMessage.imageObject = imageObject;
           	
           	WebpageObject mediaObject = new WebpageObject();
               mediaObject.identify = Utility.generateGUID();
               mediaObject.title = shareContent.getTitle();
               mediaObject.description = shareContent.getSummary();
               
               // 设置 Bitmap 类型的图片到视频对象里
               mediaObject.setThumbImage(((BitmapDrawable)activity.getResources().getDrawable(R.drawable.ic_logo)).getBitmap());
               mediaObject.actionUrl = shareContent.getLinkUrl();
               mediaObject.defaultText = shareContent.getSummary();
           	weiboMessage.mediaObject = mediaObject;
           	
           	// 2. 初始化从第三方到微博的消息请求
               SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
               // 用transaction唯一标识一个请求
               request.transaction = String.valueOf(System.currentTimeMillis());
               request.multiMessage = weiboMessage;
               
               // 3. 发送请求消息到微博,唤起微博分享界面
               weiboShareAPI.sendRequest(activity, request);
           } else {
               
           }
       } else {
           Toast.makeText(activity, R.string.third_party_weibo_hint, Toast.LENGTH_SHORT).show();
       }
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:51,代码来源:ShareUtils.java

示例14: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 创建图片消息对象。
 *
 * @return 图片消息对象。
 */
private ImageObject getImageObj(Bitmap bitmap) {
    ImageObject imageObject = new ImageObject();
    imageObject.setImageObject(bitmap);
    return imageObject;
}
 
开发者ID:henjue,项目名称:sharesdk,代码行数:11,代码来源:WeiboShareManager.java

示例15: sendMultiWeiboMessage

import com.sina.weibo.sdk.api.ImageObject; //导入方法依赖的package包/类
/**
 * 分享多种消息到微博
 * @param article
 */
private void sendMultiWeiboMessage(Article article){

    Log.i(TAG, "sendMultiWeiboMessage>>" + article.getDescription());
    // 分享文本
    TextObject textObject = new TextObject();
    // 分享图片
    ImageObject imageObject = new ImageObject();
    // 分享网页链接
    WebpageObject webObject = new WebpageObject();
    // 分享消息
    WeiboMultiMessage message = new WeiboMultiMessage();
    // 文本内容
    if(article.getType() == Article.DUANZI){

        String desp = extractTextFromHtml(article.getDescription());

        textObject.text = "[段子]" + desp +  article.getLink();

        message.textObject = textObject;
    }else{

        textObject.text = article.getTitle() + article.getDescription();

        webObject.identify = Utility.generateGUID();
        webObject.title = article.getTitle();
        webObject.description = article.getTitle();

        webObject.defaultText = article.getTitle();

        message.textObject = textObject;

        if(!TextUtils.isEmpty(article.getImgUrl())){
            //图片地址非空
            Bitmap bm = getBitmapFromCache(article.getImgUrl());
            if(bm != null){
                imageObject.setImageObject(bm);
                message.imageObject = imageObject;

                webObject.setThumbImage(bm);
                webObject.actionUrl = article.getDescription();

                //message.textObject = null;
                //message.mediaObject = webObject;
            }
        }
    }

    // 分享请求
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = message;

    // 发起请求
    mWeiboShareAPI.sendRequest(this, request);
}
 
开发者ID:zjupure,项目名称:SneezeReader,代码行数:60,代码来源:ShareActivity.java


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