Java Code Examples for com.sina.weibo.sdk.utils.LogUtil

The following examples show how to use com.sina.weibo.sdk.utils.LogUtil. These examples are extracted from open source projects. 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 Project: letv   Source File: WeiboParameters.java    License: Apache License 2.0 6 votes vote down vote up
public String encodeUrl() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (String key : this.mParams.keySet()) {
        if (first) {
            first = false;
        } else {
            sb.append("&");
        }
        String value = this.mParams.get(key);
        if (value instanceof String) {
            String param = value;
            if (!TextUtils.isEmpty(param)) {
                try {
                    sb.append(URLEncoder.encode(key, "UTF-8") + SearchCriteria.EQ + URLEncoder.encode(param, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            }
            LogUtil.i("encodeUrl", sb.toString());
        }
    }
    return sb.toString();
}
 
Example 2
Source Project: letv   Source File: WeiboSdkBrowser.java    License: 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 Project: LoginSharePay   Source File: WbShareHandler.java    License: Apache License 2.0 6 votes vote down vote up
private void startClientShare(WeiboMultiMessage message) {
    Bundle data = new Bundle();
    data.putInt("_weibo_command_type", 1);
    data.putString("_weibo_transaction", String.valueOf(System.currentTimeMillis()));
    data.putLong("callbackId", 0L);
    data.putAll(message.toBundle(data));
    Intent intent = new Intent();
    intent.setClass(this.context, WbShareTransActivity.class);
    intent.putExtra("startPackage", WeiboAppManager.getInstance(this.context).getWbAppInfo().getPackageName());
    intent.putExtra("startAction", "com.sina.weibo.sdk.action.ACTION_WEIBO_ACTIVITY");
    intent.putExtra("startFlag", 0);
    intent.putExtra("startActivity", this.context.getClass().getName());
    intent.putExtra("progressColor", this.progressColor);
    intent.putExtra("progressId", this.progressId);
    if(data != null) {
        intent.putExtras(data);
    }

    try {
        this.context.startActivity(intent);
    } catch (Exception var5) {
        LogUtil.v("weibo sdk error ", var5.toString());
    }

}
 
Example 4
Source Project: MiBandDecompiled   Source File: MusicObject.java    License: Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example 5
Source Project: MiBandDecompiled   Source File: VoiceObject.java    License: Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example 6
Source Project: MiBandDecompiled   Source File: ApiUtils.java    License: 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 Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: 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 8
Source Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: 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 9
Source Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: Apache License 2.0 6 votes vote down vote up
public boolean sendRequest(BaseRequest baserequest)
{
    if (baserequest == null)
    {
        LogUtil.e("WeiboApiImpl", "sendRequest faild act == null or request == null");
    } else
    if (checkEnvironment(mNeedDownloadWeibo))
    {
        VersionCheckHandler versioncheckhandler = new VersionCheckHandler(mWeiboInfo.packageName);
        if (!baserequest.check(mContext, versioncheckhandler))
        {
            LogUtil.e("WeiboApiImpl", "sendRequest faild request check faild");
            return false;
        } else
        {
            Bundle bundle = new Bundle();
            baserequest.toBundle(bundle);
            return shareWithWeibo((Activity)mContext, "com.sina.weibo.sdk.action.ACTION_WEIBO_ACTIVITY", mWeiboInfo.packageName, mAppKey, bundle);
        }
    }
    return false;
}
 
Example 10
Source Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: Apache License 2.0 6 votes vote down vote up
public boolean sendResponse(BaseResponse baseresponse)
{
    if (baseresponse == null)
    {
        LogUtil.e("WeiboApiImpl", "sendResponse failed response null");
        return false;
    }
    if (!baseresponse.check(mContext, new VersionCheckHandler()))
    {
        LogUtil.e("WeiboApiImpl", "sendResponse checkArgs fail");
        return false;
    } else
    {
        Bundle bundle = new Bundle();
        baseresponse.toBundle(bundle);
        sendBroadcast(mContext, "com.sina.weibo.sdk.Intent.ACTION_WEIBO_RESPONSE", mAppKey, baseresponse.reqPackageName, bundle);
        return true;
    }
}
 
Example 11
Source Project: MiBandDecompiled   Source File: VersionCheckHandler.java    License: 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 12
Source Project: MiBandDecompiled   Source File: VersionCheckHandler.java    License: 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 13
Source Project: MiBandDecompiled   Source File: WeiboMessage.java    License: Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (mediaObject == null)
    {
        LogUtil.e("Weibo.WeiboMessage", "checkArgs fail, mediaObject is null");
        return false;
    }
    if (mediaObject != null && !mediaObject.checkArgs())
    {
        LogUtil.e("Weibo.WeiboMessage", "checkArgs fail, mediaObject is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example 14
Source Project: MiBandDecompiled   Source File: WeiboMultiMessage.java    License: Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (textObject != null && !textObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, textObject is invalid");
        return false;
    }
    if (imageObject != null && !imageObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, imageObject is invalid");
        return false;
    }
    if (mediaObject != null && !mediaObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, mediaObject is invalid");
        return false;
    }
    if (textObject == null && imageObject == null && mediaObject == null)
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, textObject and imageObject and mediaObject is null");
        return false;
    } else
    {
        return true;
    }
}
 
Example 15
Source Project: MiBandDecompiled   Source File: VideoObject.java    License: Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example 16
Source Project: AssistantBySDK   Source File: InviteAPI.java    License: 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 17
Source Project: AssistantBySDK   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example 18
Source Project: AssistantBySDK   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example 19
Source Project: letv   Source File: WeiboSdkBrowser.java    License: 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 20
Source Project: letv   Source File: WeiboSdkBrowser.java    License: 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 21
Source Project: letv   Source File: WeiboSdkBrowser.java    License: 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 22
Source Project: letv   Source File: WeiboSdkBrowser.java    License: Apache License 2.0 5 votes vote down vote up
public void removeJavascriptInterface(WebView webView) {
    if (VERSION.SDK_INT < 11) {
        try {
            webView.getClass().getDeclaredMethod("removeJavascriptInterface", new Class[0]).invoke("searchBoxJavaBridge_", new Object[0]);
        } catch (Exception e) {
            LogUtil.e(TAG, e.toString());
        }
    }
}
 
Example 23
Source Project: LoginSharePay   Source File: BaseHandler.java    License: 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 24
Source Project: Simpler   Source File: InviteAPI.java    License: 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 25
Source Project: Simpler   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example 26
Source Project: Simpler   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example 27
Source Project: QiQuYing   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example 28
Source Project: QiQuYing   Source File: AbsOpenAPI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example 29
Source Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: 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 30
Source Project: MiBandDecompiled   Source File: WeiboShareAPIImpl.java    License: Apache License 2.0 5 votes vote down vote up
public boolean handleWeiboRequest(Intent intent, IWeiboHandler.Request request)
{
    if (intent == null || request == null)
    {
        return false;
    }
    String s = intent.getStringExtra("_weibo_appPackage");
    String s1 = intent.getStringExtra("_weibo_transaction");
    if (s == null)
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild appPackage validateSign faild");
        request.onRequest(null);
        return false;
    }
    if (s1 == null)
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild intent TRAN is null");
        request.onRequest(null);
        return false;
    }
    if (!ApiUtils.validateWeiboSign(mContext, s))
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild appPackage validateSign faild");
        request.onRequest(null);
        return false;
    } else
    {
        request.onRequest(new ProvideMessageForWeiboRequest(intent.getExtras()));
        return true;
    }
}