本文整理汇总了Java中com.tencent.mm.opensdk.modelmsg.WXImageObject类的典型用法代码示例。如果您正苦于以下问题:Java WXImageObject类的具体用法?Java WXImageObject怎么用?Java WXImageObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WXImageObject类属于com.tencent.mm.opensdk.modelmsg包,在下文中一共展示了WXImageObject类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: share
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
@Override
public void share(final int shareId) {
mapObject.captureMap(new IMapCaptureFinished() {
@Override
public void onMapCaptureFinished(Bitmap bitmap, int status) {
WXImageObject imageObject = new WXImageObject(bitmap);
WXMediaMessage mediaMessage = new WXMediaMessage();
mediaMessage.mediaObject = imageObject;
Bitmap thumb = Bitmap.createScaledBitmap(bitmap,50,50,true);
bitmap.recycle();
mediaMessage.thumbData = ShareUtils.bmpToByteArray(thumb,true);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = ShareUtils.buildTransaction("img");
req.message = mediaMessage;
if(shareId == R.id.btn_share_to_friend){
req.scene = SendMessageToWX.Req.WXSceneSession;
}
else{
req.scene = SendMessageToWX.Req.WXSceneTimeline;
}
CFLog.e("Share","send = "+ mWxApi.sendReq(req));
}
});
}
开发者ID:stdnull,项目名称:RunMap,代码行数:26,代码来源:TrackPresenterImpl.java
示例2: shareImage
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
@Override
protected void shareImage(final ShareParamImage params) throws ShareException {
mImageHelper.downloadImageIfNeed(params, new Runnable() {
@Override
public void run() {
WXImageObject imgObj = buildWXImageObject(params.getImage());
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = imgObj;
msg.thumbData = mImageHelper.buildThumbData(params.getImage());
final SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("imgshareappdata");
req.message = msg;
req.scene = getShareType();
Log.d(TAG, "start share image");
shareOnMainThread(req);
}
});
}
开发者ID:Bilibili,项目名称:BiliShare,代码行数:21,代码来源:BaseWxShareHandler.java
示例3: shareImage
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
private void shareImage(int shareTarget, String localPath, byte[] thumbData) {
// 文件大小不大于10485760 路径长度不大于10240
WXImageObject imgObj = new WXImageObject();
imgObj.imagePath = localPath;
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = imgObj;
msg.thumbData = thumbData;
sendMsgToWx(msg, shareTarget, "image");
}
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:10,代码来源:WxPlatform.java
示例4: shareImage
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
public static void shareImage(Bitmap bitmap, SharePlace sharePlace) {
WXImageObject wxImageObject = new WXImageObject(bitmap);
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = wxImageObject;
Bitmap thumbBmp = Bitmap.createScaledBitmap(bitmap, 100, 100, true);
bitmap.recycle();
msg.thumbData = RxImageTool.bitmap2Bytes(thumbBmp, Bitmap.CompressFormat.PNG);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = WechatPayTools.getCurrTime();
req.message = msg;
switch (sharePlace) {
case Friend:
req.scene = SendMessageToWX.Req.WXSceneSession;
break;
case Zone:
req.scene = SendMessageToWX.Req.WXSceneTimeline;
break;
case Favorites:
req.scene = SendMessageToWX.Req.WXSceneFavorite;
break;
}
if (iwxapi != null) {
iwxapi.sendReq(req);
} else {
throw new NullPointerException("请先调用WechatShare.init()方法");
}
}
开发者ID:vondear,项目名称:RxTools,代码行数:32,代码来源:WechatShareTools.java
示例5: buildWXImageObject
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
protected WXImageObject buildWXImageObject(final ShareImage image) {
WXImageObject imgObj = new WXImageObject();
if (image == null) {
return imgObj;
}
if (image.isLocalImage()) {
imgObj.setImagePath(image.getLocalPath());
} else if (!image.isUnknowImage()) {
imgObj.imageData = mImageHelper.buildThumbData(image, IMAGE_MAX, IMAGE_WIDTH, IMAGE_HEIGHT, false);
}
return imgObj;
}
开发者ID:Bilibili,项目名称:BiliShare,代码行数:16,代码来源:BaseWxShareHandler.java
示例6: shareImage
import com.tencent.mm.opensdk.modelmsg.WXImageObject; //导入依赖的package包/类
@Override
public void shareImage(final int platform, final ShareImageObject shareImageObject,
final Activity activity, final ShareListener listener) {
Flowable.create(new FlowableOnSubscribe<Pair<Bitmap, byte[]>>() {
@Override
public void subscribe(@NonNull FlowableEmitter<Pair<Bitmap, byte[]>> emitter) throws Exception {
try {
String imagePath = ImageDecoder.decode(activity, shareImageObject);
emitter.onNext(Pair.create(BitmapFactory.decodeFile(imagePath),
ImageDecoder.compress2Byte(imagePath, TARGET_SIZE, THUMB_SIZE)));
} catch (Exception e) {
emitter.onError(e);
}
}
}, BackpressureStrategy.BUFFER)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnRequest(new LongConsumer() {
@Override
public void accept(long aLong) {
listener.shareRequest();
}
})
.subscribe(new Consumer<Pair<Bitmap,byte[]>>() {
@Override
public void accept(Pair<Bitmap, byte[]> pair) {
WXImageObject imageObject = new WXImageObject(pair.first);
WXMediaMessage message = new WXMediaMessage();
message.mediaObject = imageObject;
message.thumbData = pair.second;
sendMessage(platform, message, buildTransaction("image"));
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) {
activity.finish();
listener.shareFailure(new Exception(throwable));
}
});
}
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:43,代码来源:WxShareInstance.java
注:本文中的com.tencent.mm.opensdk.modelmsg.WXImageObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论