com.sina.weibo.sdk.api.WebpageObject Java Examples
The following examples show how to use
com.sina.weibo.sdk.api.WebpageObject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginShare.java From LoginSharePay with Apache License 2.0 | 6 votes |
@Override protected WebpageObject getMediaObject(WeiboMessageBody weiboMessageBody) { WebpageObject mediaObject = new WebpageObject(); mediaObject.identify = Utility.generateGUID(); mediaObject.title = weiboMessageBody.getTitle(); mediaObject.description = weiboMessageBody.getDescription(); // 设置 Bitmap 类型的图片到视频对象里 设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。 Bitmap bmp = BitmapFactory.decodeFile(weiboMessageBody.getLocalImage()); Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, Util.THUMB_SIZE, Util.THUMB_SIZE, true); if (!bmp.equals(thumbBmp)) bmp.recycle(); mediaObject.setThumbImage(thumbBmp); mediaObject.actionUrl = weiboMessageBody.getActionUrl(); mediaObject.defaultText = "Webpage 默认文案"; return mediaObject; }
Example #2
Source File: WBShare.java From sdk3rd with Apache License 2.0 | 5 votes |
WebpageObject toWeb(ShareData data) { WebpageObject mo = new WebpageObject(); mo.identify = Utility.generateGUID(); mo.title = data.title; mo.description = data.description; // Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo); // 设置 Bitmap 类型的图片到视频对象里 设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。 mo.setThumbImage(data.thumb.toBitmap()); mo.actionUrl = data.url; mo.defaultText = "Webpage 默认文案"; return mo; }
Example #3
Source File: WBHelper.java From SocialHelper with Apache License 2.0 | 5 votes |
private WebpageObject getWebPageObj(Bundle params) { WebpageObject webpageObject = new WebpageObject(); webpageObject.identify = Utility.generateGUID(); webpageObject.actionUrl = params.getString(WBShareEntity.KEY_WB_WEB_URL); if (addTitleSummaryAndThumb(webpageObject, params)) { return null; } return webpageObject; }
Example #4
Source File: WbPlatform.java From SocialSdkLibrary with Apache License 2.0 | 5 votes |
private WebpageObject getWebObj(ShareObj obj, byte[] thumbData) { WebpageObject mediaObject = new WebpageObject(); mediaObject.identify = Utility.generateGUID(); mediaObject.title = obj.getTitle(); mediaObject.description = obj.getSummary(); // 注意:最终压缩过的缩略图大小不得超过 32kb。 mediaObject.thumbData = thumbData; mediaObject.actionUrl = obj.getTargetUrl(); mediaObject.defaultText = obj.getSummary(); return mediaObject; }
Example #5
Source File: WeiboShareManager.java From sharesdk with Apache License 2.0 | 5 votes |
/** * 创建多媒体(网页)消息对象。 * * @return 多媒体(网页)消息对象。 */ private WebpageObject getWebpageObj(Message.Web message) { WebpageObject mediaObject = new WebpageObject(); mediaObject.identify = UUID.randomUUID().toString(); mediaObject.title = message.getTitle(); mediaObject.description = message.getDescription(); mediaObject.setThumbImage(message.getImage()); mediaObject.actionUrl = message.getURL(); mediaObject.defaultText = message.getDescription(); return mediaObject; }
Example #6
Source File: SharePopWindow.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 创建多媒体(网页)消息对象。 * * @return 多媒体(网页)消息对象。 */ private WebpageObject getWebpageObj() { WebpageObject mediaObject = new WebpageObject(); mediaObject.identify = Utility.generateGUID(); mediaObject.title = ""; mediaObject.description = ""; // 设置 Bitmap 类型的图片到视频对象里 mediaObject.setThumbImage(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher)); mediaObject.actionUrl = targetUrl + mJoke.getId(); mediaObject.schema = ""; return mediaObject; }
Example #7
Source File: WeiboShareProxy.java From ESSocialSDK with Apache License 2.0 | 5 votes |
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(); }
Example #8
Source File: ShareImpl.java From LoginSharePay with Apache License 2.0 | votes |
protected abstract WebpageObject getMediaObject(WeiboMessageBody weiboMessageBody);