com.sina.weibo.sdk.share.WbShareHandler Java Examples

The following examples show how to use com.sina.weibo.sdk.share.WbShareHandler. 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: WBHelper.java    From SocialHelper with Apache License 2.0 6 votes vote down vote up
@Override
public void share(SocialShareCallback callback, ShareEntity shareInfo) {
    this.shareCallback = callback;
    if (baseVerify(callback)) {
        return;
    }
    if (!WbSdk.isWbInstall(activity)) {
        if (callback != null) {
            callback.socialError(activity.getString(R.string.social_wb_uninstall));
        }
        return;
    }
    initShareLister(shareInfo);
    shareHandler = new WbShareHandler(activity);
    shareHandler.registerApp();

    WeiboMultiMessage weiboMessage = getShareMessage(shareInfo.getParams());
    if (weiboMessage == null) {
        return;
    }
    shareHandler.shareMessage(weiboMessage, false);
}
 
Example #2
Source File: Share.java    From UPMiss with GNU General Public License v3.0 6 votes vote down vote up
private static void shareToWeibo(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;

    WbShareHandler wbApi = getWbApi(activity);
    wbApi.shareMessage(message, false);
    // Bind cache
    activity.getWindow().getDecorView().setTag(wbApi);
}
 
Example #3
Source File: WeiboBaseShareInstance.java    From SimpleProject with MIT License 5 votes vote down vote up
public WeiboBaseShareInstance(Activity activity, ShareListener listener) {
	this.activity = activity;
	this.listener = listener;
	ImageLoaderManager.getInstance().init(activity.getApplicationContext(), new FrescoInstance());
	AuthInfo authInfo = new AuthInfo(activity, ShareConstants.APP_WEIBO_KEY, ShareConstants.REDIRECT_URL,
			ShareConstants.SCOPE);
		WbSdk.install(activity, authInfo);

	shareHandler = new WbShareHandler(activity);
	shareHandler.registerApp();
	accessToken = AccessTokenKeeper.readAccessToken(activity);
}
 
Example #4
Source File: WBShare.java    From sdk3rd with Apache License 2.0 5 votes vote down vote up
WBShare(Activity activity, Platform platform) {
    WbSdk.install(activity, new AuthInfo(activity, platform.getAppId(), platform.extra("redirectUrl"), "all"));
    mActivity = activity;
    mPlatform = platform;
    mApi = new WbShareHandler(mActivity);
    mApi.registerApp();
    services.put(this, true);
}
 
Example #5
Source File: WbPlatform.java    From SocialSdkLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispatchShare(Activity activity, int shareTarget, ShareObj obj) {
    mShareHandler = new WbShareHandler(activity);
    if (_SocialSdk.getInst().opts().getWbProgressColor() > 0) {
        mShareHandler.setProgressColor(_SocialSdk.getInst().opts().getWbProgressColor());
    }
    mShareHandler.registerApp();
    
    switch (obj.getType()) {
        case ShareObj.SHARE_TYPE_OPEN_APP:
            shareOpenApp(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_TEXT:
            shareText(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_IMAGE:
            shareImage(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_APP:
            shareWeb(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_WEB:
            shareWeb(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_MUSIC:
            shareWeb(shareTarget, activity, obj);
            break;
        case ShareObj.SHARE_TYPE_VIDEO:
            shareVideo(shareTarget, activity, obj);
            break;
    }
}
 
Example #6
Source File: WeiboShareInstance.java    From ShareLoginPayUtil with Apache License 2.0 4 votes vote down vote up
public WeiboShareInstance(Context context, String appId, String redirectUrl, String scope) {
    AuthInfo authInfo = new AuthInfo(context, appId, redirectUrl, scope);
    WbSdk.install(context, authInfo);
    shareHandler = new WbShareHandler((Activity) context);
    shareHandler.registerApp();
}
 
Example #7
Source File: WeiboShareManager.java    From sharesdk with Apache License 2.0 4 votes vote down vote up
public static WbShareHandler getShareHandler() {
    return mShareHandler;
}