Java Code Examples for com.sina.weibo.sdk.utils.Utility#parseUri()

The following examples show how to use com.sina.weibo.sdk.utils.Utility#parseUri() . 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: WidgetWeiboWebViewClient.java    From letv with Apache License 2.0 6 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (this.mCallBack != null) {
        this.mCallBack.shouldOverrideUrlLoadingCallBack(view, url);
    }
    boolean needClose = url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME);
    if (!url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME) && !url.startsWith(WeiboSdkBrowser.BROWSER_WIDGET_SCHEME)) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    Bundle bundle = Utility.parseUri(url);
    if (!(bundle.isEmpty() || this.mListener == null)) {
        this.mListener.onComplete(bundle);
    }
    if (this.mWidgetCallback != null) {
        this.mWidgetCallback.onWebViewResult(url);
    }
    if (needClose) {
        WeiboSdkBrowser.closeBrowser(this.mAct, this.mWidgetRequestParam.getAuthListenerKey(), this.mWidgetRequestParam.getWidgetRequestCallbackKey());
    }
    return true;
}
 
Example 2
Source File: ShareWeiboWebViewClient.java    From letv with Apache License 2.0 6 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (this.mCallBack != null) {
        this.mCallBack.shouldOverrideUrlLoadingCallBack(view, url);
    }
    if (!url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME)) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    Bundle bundle = Utility.parseUri(url);
    if (!(bundle.isEmpty() || this.mListener == null)) {
        this.mListener.onComplete(bundle);
    }
    String errCode = bundle.getString("code");
    String errMsg = bundle.getString("msg");
    if (TextUtils.isEmpty(errCode)) {
        this.mShareRequestParam.sendSdkCancleResponse(this.mAct);
    } else if ("0".equals(errCode)) {
        this.mShareRequestParam.sendSdkOkResponse(this.mAct);
    } else {
        this.mShareRequestParam.sendSdkErrorResponse(this.mAct, errMsg);
    }
    WeiboSdkBrowser.closeBrowser(this.mAct, this.mShareRequestParam.getAuthListenerKey(), null);
    return true;
}