Java Code Examples for com.sina.weibo.sdk.utils.LogUtil#d()

The following examples show how to use com.sina.weibo.sdk.utils.LogUtil#d() . 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: VersionCheckHandler.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean check(Context context, WeiboMultiMessage weibomultimessage)
{
    LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMultiMessage package : ")).append(mPackageName).toString());
    ApiUtils.WeiboInfo weiboinfo;
    if (mPackageName != null && mPackageName.length() != 0)
    {
        if ((weiboinfo = ApiUtils.queryWeiboInfoByPackage(context, mPackageName)) != null)
        {
            LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMultiMessage WeiboInfo supportApi : ")).append(weiboinfo.supportApi).toString());
            if (weiboinfo.supportApi >= 10351)
            {
                if (weiboinfo.supportApi < 10352 && weibomultimessage.mediaObject != null && (weibomultimessage.mediaObject instanceof CmdObject))
                {
                    weibomultimessage.mediaObject = null;
                }
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 6 votes vote down vote up
private boolean initDataFromIntent(Intent data) {
    Bundle bundle = data.getExtras();
    this.mRequestParam = createBrowserRequestParam(bundle);
    if (this.mRequestParam != null) {
        this.mUrl = this.mRequestParam.getUrl();
        this.mSpecifyTitle = this.mRequestParam.getSpecifyTitle();
    } else {
        String url = bundle.getString("key_url");
        String specifyTitle = bundle.getString("key_specify_title");
        if (!TextUtils.isEmpty(url) && url.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
            this.mUrl = url;
            this.mSpecifyTitle = specifyTitle;
        }
    }
    if (TextUtils.isEmpty(this.mUrl)) {
        return false;
    }
    LogUtil.d(TAG, "LOAD URL : " + this.mUrl);
    return true;
}
 
Example 3
Source File: VersionCheckHandler.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean check(Context context, WeiboMessage weibomessage)
{
    LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage package : ")).append(mPackageName).toString());
    ApiUtils.WeiboInfo weiboinfo;
    if (mPackageName != null && mPackageName.length() != 0)
    {
        if ((weiboinfo = ApiUtils.queryWeiboInfoByPackage(context, mPackageName)) != null)
        {
            LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage WeiboInfo supportApi : ")).append(weiboinfo.supportApi).toString());
            if (weiboinfo.supportApi < 10351 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof VoiceObject))
            {
                weibomessage.mediaObject = null;
            }
            if (weiboinfo.supportApi < 10352 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof CmdObject))
            {
                weibomessage.mediaObject = null;
            }
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void sendBroadcast(Context context, String s, String s1, String s2, Bundle bundle)
{
    Intent intent = new Intent(s);
    String s3 = context.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s1);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(context, s3)));
    if (!TextUtils.isEmpty(s2))
    {
        intent.setPackage(s2);
    }
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
    context.sendBroadcast(intent, "com.sina.weibo.permission.WEIBO_SDK_PERMISSION");
}
 
Example 5
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public WeiboShareAPIImpl(Context context, String s, boolean flag)
{
    mWeiboInfo = null;
    mNeedDownloadWeibo = true;
    mDownloadConfirmDialog = null;
    mContext = context;
    mAppKey = s;
    mNeedDownloadWeibo = flag;
    mWeiboInfo = ApiUtils.queryWeiboInfo(mContext);
    if (mWeiboInfo != null)
    {
        LogUtil.d("WeiboApiImpl", mWeiboInfo.toString());
        return;
    } else
    {
        LogUtil.d("WeiboApiImpl", "WeiboInfo: is null");
        return;
    }
}
 
Example 6
Source File: ApiUtils.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public static boolean containSign(Signature asignature[], String s)
{
    if (asignature != null && s != null)
    {
        int i = asignature.length;
        int j = 0;
        while (j < i) 
        {
            if (s.equals(MD5.hexdigest(asignature[j].toByteArray())))
            {
                LogUtil.d("ApiUtils", "check pass");
                return true;
            }
            j++;
        }
    }
    return false;
}
 
Example 7
Source File: BaseHandler.java    From LoginSharePay with Apache License 2.0 5 votes vote down vote up
public void authorizeCallBack(int requestCode, int resultCode, Intent data) {
    if ('胍' == requestCode) {
        if (resultCode == -1) {
            if (!SecurityHelper.checkResponseAppLegal(this.mAuthFragment.getContext(), WeiboAppManager.getInstance(this.mAuthFragment.getContext()).getWbAppInfo(), data)) {
                this.authListener.onFailure(new WbConnectErrorMessage("your install weibo app is counterfeit", "8001"));
                return;
            }

            String error = Utility.safeString(data.getStringExtra("error"));
            String error_type = Utility.safeString(data.getStringExtra("error_type"));
            String error_description = Utility.safeString(data.getStringExtra("error_description"));
            LogUtil.d("WBAgent", "error: " + error + ", error_type: " + error_type + ", error_description: " + error_description);
            if (TextUtils.isEmpty(error) && TextUtils.isEmpty(error_type) && TextUtils.isEmpty(error_description)) {
                Bundle bundle = data.getExtras();
                Oauth2AccessToken accessToken = Oauth2AccessToken.parseAccessToken(bundle);
                if (accessToken != null && accessToken.isSessionValid()) {
                    LogUtil.d("WBAgent", "Login Success! " + accessToken.toString());
                    AccessTokenKeeper.writeAccessToken(this.mAuthFragment.getContext(), accessToken);
                    this.authListener.onSuccess(accessToken);
                }
            } else if (!"access_denied".equals(error) && !"OAuthAccessDeniedException".equals(error)) {
                LogUtil.d("WBAgent", "Login failed: " + error);
                this.authListener.onFailure(new WbConnectErrorMessage(error_type, error_description));
            } else {
                LogUtil.d("WBAgent", "Login canceled by user.");
                this.authListener.cancel();
            }
        } else if (resultCode == 0) {
            if (data != null) {
                this.authListener.cancel();
            } else {
                this.authListener.cancel();
            }
        }
    }

}
 
Example 8
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public boolean handleWeiboResponse(Intent intent, IWeiboHandler.Response response)
{
    String s = intent.getStringExtra("_weibo_appPackage");
    if (s == null)
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild appPackage is null");
        return false;
    }
    if (!(response instanceof Activity))
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild handler is not Activity");
        return false;
    }
    String s1 = ((Activity)response).getCallingPackage();
    LogUtil.d("WeiboApiImpl", (new StringBuilder("responseListener() callPkg : ")).append(s1).toString());
    if (intent.getStringExtra("_weibo_transaction") == null)
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild intent TRAN is null");
        return false;
    }
    if (!ApiUtils.validateWeiboSign(mContext, s))
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild appPackage validateSign faild");
        return false;
    } else
    {
        response.onResponse(new SendMessageToWeiboResponse(intent.getExtras()));
        return true;
    }
}
 
Example 9
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private boolean shareWithWeibo(Activity activity, String s, String s1, String s2, Bundle bundle)
{
    if (activity == null || TextUtils.isEmpty(s) || TextUtils.isEmpty(s1) || TextUtils.isEmpty(s2))
    {
        LogUtil.e("ActivityHandler", "send fail, invalid arguments");
        return false;
    }
    Intent intent = new Intent();
    intent.setPackage(s1);
    intent.setAction(s);
    String s3 = activity.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s2);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(activity, s3)));
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    try
    {
        LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
        activity.startActivityForResult(intent, 765);
    }
    catch (ActivityNotFoundException activitynotfoundexception)
    {
        LogUtil.e("WeiboApiImpl", "Failed, target ActivityNotFound");
        return false;
    }
    return true;
}
 
Example 10
Source File: InviteAPI.java    From Simpler with Apache License 2.0 5 votes vote down vote up
/**
 * 向好友发送邀请。支持登录用户向自己的微博互粉好友发送私信邀请、礼物。
 * 
 * @param uid      被邀请人的 Uid,需要为当前用户互粉好友
 * @param jsonData 邀请数据。以 {@link JSONObject} 数据填充
 * @param listener 邀请接口对应的回调
 */
public void sendInvite(String uid, JSONObject jsonData, RequestListener listener) {
    if (!TextUtils.isEmpty(uid) 
            && jsonData != null 
            && !TextUtils.isEmpty(jsonData.toString())) {
        
        WeiboParameters params = new WeiboParameters(mAppKey);
        params.put("uid", uid);
        params.put("data", jsonData.toString());
        requestAsync(INVITE_URL, params, HTTPMETHOD_POST, listener);
    } else {
        LogUtil.d(TAG, "Invite args error!");
    }
}
 
Example 11
Source File: InviteAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 向好友发送邀请。支持登录用户向自己的微博互粉好友发送私信邀请、礼物。
 * 
 * @param uid      被邀请人的 Uid,需要为当前用户互粉好友
 * @param jsonData 邀请数据。以 {@link JSONObject} 数据填充
 * @param listener 邀请接口对应的回调
 */
public void sendInvite(String uid, JSONObject jsonData, RequestListener listener) {
    if (!TextUtils.isEmpty(uid) 
            && jsonData != null 
            && !TextUtils.isEmpty(jsonData.toString())) {
        
        WeiboParameters params = new WeiboParameters(mAppKey);
        params.put("uid", uid);
        params.put("data", jsonData.toString());
        requestAsync(INVITE_URL, params, HTTPMETHOD_POST, listener);
    } else {
        LogUtil.d(TAG, "Invite args error!");
    }
}
 
Example 12
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onPageFinishedCallBack(WebView view, String url) {
    LogUtil.d(TAG, "onPageFinished URL: " + url);
    if (this.isErrorPage) {
        promptError();
        return;
    }
    this.isErrorPage = false;
    hiddenErrorPrompt();
}
 
Example 13
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onPageStartedCallBack(WebView view, String url, Bitmap favicon) {
    LogUtil.d(TAG, "onPageStarted URL: " + url);
    this.mUrl = url;
    if (!isWeiboCustomScheme(url)) {
        this.mHtmlTitle = "";
    }
}
 
Example 14
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
private void startShare() {
    LogUtil.d(TAG, "Enter startShare()............");
    final ShareRequestParam req = this.mRequestParam;
    if (req.hasImage()) {
        LogUtil.d(TAG, "loadUrl hasImage............");
        new AsyncWeiboRunner(this).requestAsync(ShareRequestParam.UPLOAD_PIC_URL, req.buildUploadPicParam(new WeiboParameters(req.getAppKey())), "POST", new RequestListener() {
            public void onWeiboException(WeiboException e) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onWeiboException " + e.getMessage());
                req.sendSdkErrorResponse(WeiboSdkBrowser.this, e.getMessage());
                WeiboSdkBrowser.this.finish();
            }

            public void onComplete(String response) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onComplete : " + response);
                UploadPicResult result = UploadPicResult.parse(response);
                if (result == null || result.getCode() != 1 || TextUtils.isEmpty(result.getPicId())) {
                    req.sendSdkErrorResponse(WeiboSdkBrowser.this, "upload pic faild");
                    WeiboSdkBrowser.this.finish();
                    return;
                }
                WeiboSdkBrowser.this.openUrl(req.buildUrl(result.getPicId()));
            }
        });
        return;
    }
    openUrl(this.mUrl);
}
 
Example 15
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 4 votes vote down vote up
public void onReceivedSslErrorCallBack(WebView view, SslErrorHandler handler, SslError error) {
    LogUtil.d(TAG, "onReceivedSslErrorCallBack.........");
}
 
Example 16
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 4 votes vote down vote up
public void onReceivedErrorCallBack(WebView view, int errorCode, String description, String failingUrl) {
    LogUtil.d(TAG, "onReceivedError: errorCode = " + errorCode + ", description = " + description + ", failingUrl = " + failingUrl);
    handleReceivedError(view, errorCode, description, failingUrl);
}
 
Example 17
Source File: SsoHandler.java    From letv with Apache License 2.0 4 votes vote down vote up
public void authorizeCallBack(int requestCode, int resultCode, Intent data) {
    LogUtil.d(TAG, "requestCode: " + requestCode + ", resultCode: " + resultCode + ", data: " + data);
    String error;
    Bundle bundle;
    Oauth2AccessToken accessToken;
    if (requestCode == this.mSSOAuthRequestCode) {
        if (resultCode == -1) {
            if (SecurityHelper.checkResponseAppLegal(this.mAuthActivity, this.mWeiboInfo, data)) {
                error = data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE);
                if (error == null) {
                    error = data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_TYPE);
                }
                if (error == null) {
                    bundle = data.getExtras();
                    accessToken = Oauth2AccessToken.parseAccessToken(bundle);
                    if (accessToken == null || !accessToken.isSessionValid()) {
                        LogUtil.d(TAG, "Failed to receive access token by SSO");
                        this.mWebAuthHandler.anthorize(this.mAuthListener);
                        return;
                    }
                    LogUtil.d(TAG, "Login Success! " + accessToken.toString());
                    this.mAuthListener.onComplete(bundle);
                } else if (error.equals("access_denied") || error.equals("OAuthAccessDeniedException")) {
                    LogUtil.d(TAG, "Login canceled by user.");
                    this.mAuthListener.onCancel();
                } else {
                    String description = data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_DESCRIPTION);
                    if (description != null) {
                        error = new StringBuilder(String.valueOf(error)).append(NetworkUtils.DELIMITER_COLON).append(description).toString();
                    }
                    LogUtil.d(TAG, "Login failed: " + error);
                    this.mAuthListener.onWeiboException(new WeiboDialogException(error, resultCode, description));
                }
            }
        } else if (resultCode != 0) {
        } else {
            if (data != null) {
                LogUtil.d(TAG, "Login failed: " + data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE));
                this.mAuthListener.onWeiboException(new WeiboDialogException(data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE), data.getIntExtra(NativeProtocol.BRIDGE_ARG_ERROR_CODE, -1), data.getStringExtra("failing_url")));
                return;
            }
            LogUtil.d(TAG, "Login canceled by user.");
            this.mAuthListener.onCancel();
        }
    } else if (requestCode != REQUEST_CODE_MOBILE_REGISTER) {
    } else {
        if (resultCode == -1) {
            bundle = data.getExtras();
            accessToken = Oauth2AccessToken.parseAccessToken(bundle);
            if (accessToken != null && accessToken.isSessionValid()) {
                LogUtil.d(TAG, "Login Success! " + accessToken.toString());
                this.mAuthListener.onComplete(bundle);
            }
        } else if (resultCode != 0) {
        } else {
            if (data != null) {
                LogUtil.d(TAG, "Login failed: " + data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE));
                error = data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE);
                if (error == null) {
                    error = data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_TYPE);
                }
                if (error != null) {
                    this.mAuthListener.onWeiboException(new WeiboDialogException(data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE), data.getIntExtra(NativeProtocol.BRIDGE_ARG_ERROR_CODE, -1), data.getStringExtra(NativeProtocol.BRIDGE_ARG_ERROR_DESCRIPTION)));
                    return;
                }
                return;
            }
            LogUtil.d(TAG, "Login canceled by user.");
            this.mAuthListener.onCancel();
        }
    }
}