本文整理汇总了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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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); // 发送请求消息到微博,唤起微博分享界面
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}