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


Java ImageObject类代码示例

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


ImageObject类属于com.sina.weibo.sdk.api包,在下文中一共展示了ImageObject类的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: shareToWeibo

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

示例5: 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

示例6: 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

示例7: toImage

import com.sina.weibo.sdk.api.ImageObject; //导入依赖的package包/类
ImageObject toImage(ImageResource resource) {
    ImageObject object = new ImageObject();
    object.imagePath = resource.toUri();
    if (TextUtils.isEmpty(object.imagePath)) {
        object.imageData = resource.toBytes();
    }
    return object;
}
 
开发者ID:czy1121,项目名称:sdk3rd,代码行数:9,代码来源:WBShare.java

示例8: 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

示例9: 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

示例10: shareWeiboGif

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

示例11: 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

示例12: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入依赖的package包/类
private ImageObject getImageObj(String localPath, byte[] data) {
    ImageObject imageObject = new ImageObject();
    //设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。
    imageObject.imageData = data;
    imageObject.imagePath = localPath;
    return imageObject;
}
 
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:8,代码来源:WbPlatform.java

示例13: shareImage

import com.sina.weibo.sdk.api.ImageObject; //导入依赖的package包/类
public void shareImage(WeiboSKShareContent shareContent, Activity activity) {
    // 微博分享图片可以不分享缩略图
    ImageObject imageObject = new ImageObject();
    //imageObject.thumbData = content.thumbData;
    imageObject.title = shareContent.title;
    imageObject.description = shareContent.content;
    imageObject.imageData = getCompressImageData(shareContent, activity);
    imageObject.actionUrl = shareContent.url;
    imageObject.identify = Utility.generateGUID();
    send(imageObject, activity);
}
 
开发者ID:jhwing,项目名称:SKShare,代码行数:12,代码来源:WeiboShare.java

示例14: 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

示例15: getImageObj

import com.sina.weibo.sdk.api.ImageObject; //导入依赖的package包/类
/**
 * 创建图片消息对象。
 *
 * @return 图片消息对象。
 */
private ImageObject getImageObj(ShareImage image) {
    ImageObject imageObject = new ImageObject();

    if (image == null) {
        return imageObject;
    }

    if (image.isLocalImage()) {
        imageObject.imagePath = image.getLocalPath();
    } else {
        imageObject.imageData = mImageHelper.buildThumbData(image);
    }
    return imageObject;
}
 
开发者ID:Bilibili,项目名称:BiliShare,代码行数:20,代码来源:SinaShareHandler.java


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