com.sina.weibo.sdk.utils.UIUtils Java Examples

The following examples show how to use com.sina.weibo.sdk.utils.UIUtils. 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: GarbageCleanActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void scanGarbageFile() {
    if (this.mCleanService != null) {
        LogInfo.log("wuxinrong", "执行扫描...");
        performScan();
    } else if (!bindTMSLiteService()) {
        UIUtils.showToast((Context) this, getString(2131100938), 3000);
    }
}
 
Example #2
Source File: WeiboAuth.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void startDialog(WeiboAuthListener weiboauthlistener, int i)
{
    if (weiboauthlistener == null)
    {
        return;
    }
    LinkedHashMap linkedhashmap = new LinkedHashMap();
    linkedhashmap.put("client_id", mAuthInfo.mAppKey);
    linkedhashmap.put("redirect_uri", mAuthInfo.mRedirectUrl);
    linkedhashmap.put("scope", mAuthInfo.mScope);
    linkedhashmap.put("response_type", "code");
    linkedhashmap.put("display", "mobile");
    if (1 == i)
    {
        linkedhashmap.put("packagename", mAuthInfo.mPackageName);
        linkedhashmap.put("key_hash", mAuthInfo.mKeyHash);
    }
    String s = (new StringBuilder("https://open.weibo.cn/oauth2/authorize?")).append(Utility.packUrl(linkedhashmap)).toString();
    if (!NetworkHelper.hasInternetPermission(mContext))
    {
        UIUtils.showAlert(mContext, "Error", "Application requires permission to access the Internet");
        return;
    }
    if (NetworkHelper.isNetworkAvailable(mContext))
    {
        (new WeiboDialog(mContext, s, weiboauthlistener, this)).show();
        return;
    } else
    {
        String s1 = ResourceManager.getString(mContext, 2);
        LogUtil.i("Weibo_web_login", (new StringBuilder("String: ")).append(s1).toString());
        UIUtils.showToast(mContext, s1, 0);
        return;
    }
}
 
Example #3
Source File: BaseHandler.java    From LoginSharePay with Apache License 2.0 4 votes vote down vote up
protected void startWebAuth() {
    AuthInfo authInfo = WbSdk.getAuthInfo();
    WeiboParameters requestParams = new WeiboParameters(authInfo.getAppKey());
    requestParams.put("client_id", authInfo.getAppKey());
    requestParams.put("redirect_uri", authInfo.getRedirectUrl());
    requestParams.put("scope", authInfo.getScope());
    requestParams.put("response_type", "code");
    requestParams.put("version", "0041005000");
    requestParams.put("luicode", "10000360");
    Oauth2AccessToken token = AccessTokenKeeper.readAccessToken(this.mAuthFragment.getContext());
    if (token != null && !TextUtils.isEmpty(token.getToken())) {
        requestParams.put("trans_token", token.getToken());
        requestParams.put("trans_access_token", token.getToken());
    }

    requestParams.put("lfid", "OP_" + authInfo.getAppKey());
    String aid = Utility.getAid(this.mAuthFragment.getContext(), authInfo.getAppKey());
    if (!TextUtils.isEmpty(aid)) {
        requestParams.put("aid", aid);
    }

    requestParams.put("packagename", authInfo.getPackageName());
    requestParams.put("key_hash", authInfo.getKeyHash());
    String url = "https://open.weibo.cn/oauth2/authorize?" + requestParams.encodeUrl();
    if (!NetworkHelper.hasInternetPermission(this.mAuthFragment.getContext())) {
        UIUtils.showAlert(this.mAuthFragment.getContext(), "Error", "Application requires permission to access the Internet");
    } else {
        String mAuthListenerKey = null;
        if (this.authListener != null) {
            WeiboCallbackManager manager = WeiboCallbackManager.getInstance();
            mAuthListenerKey = manager.genCallbackKey();
            manager.setWeiboAuthListener(mAuthListenerKey, this.authListener);
        }

        AuthWebViewRequestParam param = new AuthWebViewRequestParam(authInfo, WebRequestType.AUTH, mAuthListenerKey, "微博登录", url, this.mAuthFragment.getContext());
        Intent intent = new Intent(this.mAuthFragment.getContext(), WeiboSdkWebActivity.class);
        Bundle bundle = new Bundle();
        param.fillBundle(bundle);
        intent.putExtras(bundle);
        this.mAuthFragment.startActivity(intent);
    }

}