com.tencent.open.utils.Util Java Examples

The following examples show how to use com.tencent.open.utils.Util. 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: SocialApiIml.java    From letv with Apache License 2.0 6 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled"})
public void writeEncryToken(Context context) {
    String str = "tencent&sdk&qazxc***14969%%";
    String accessToken = this.mToken.getAccessToken();
    String appId = this.mToken.getAppId();
    String openId = this.mToken.getOpenId();
    String str2 = "qzone3.4";
    if (accessToken == null || accessToken.length() <= 0 || appId == null || appId.length() <= 0 || openId == null || openId.length() <= 0) {
        str = null;
    } else {
        str = Util.encrypt(str + accessToken + appId + openId + str2);
    }
    com.tencent.open.c.b bVar = new com.tencent.open.c.b(context);
    WebSettings settings = bVar.getSettings();
    settings.setDomStorageEnabled(true);
    settings.setJavaScriptEnabled(true);
    settings.setDatabaseEnabled(true);
    accessToken = "<!DOCTYPE HTML><html lang=\"en-US\"><head><meta charset=\"UTF-8\"><title>localStorage Test</title><script type=\"text/javascript\">document.domain = 'qq.com';localStorage[\"" + this.mToken.getOpenId() + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + this.mToken.getAppId() + "\"]=\"" + str + "\";</script></head><body></body></html>";
    str = ServerSetting.getInstance().getEnvUrl(context, ServerSetting.DEFAULT_LOCAL_STORAGE_URI);
    bVar.loadDataWithBaseURL(str, accessToken, "text/html", "utf-8", str);
}
 
Example #2
Source File: QQShare.java    From letv with Apache License 2.0 6 votes vote down vote up
private StringBuffer a(StringBuffer stringBuffer, Bundle bundle) {
    f.c(f.d, "fillShareToQQParams() --start");
    String str = "...";
    bundle.putString("action", SystemUtils.QQ_SHARE_CALLBACK_ACTION);
    bundle.putString("appId", this.mToken.getAppId());
    bundle.putString("sdkp", "a");
    bundle.putString("sdkv", Constants.SDK_VERSION);
    bundle.putString("status_os", VERSION.RELEASE);
    bundle.putString("status_machine", Build.MODEL);
    String str2 = WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT;
    if (bundle.containsKey(str2) && bundle.getString(str2).length() > 40) {
        bundle.putString(str2, bundle.getString(str2).substring(0, 40) + str);
    }
    str2 = "summary";
    if (bundle.containsKey(str2) && bundle.getString(str2).length() > 80) {
        bundle.putString(str2, bundle.getString(str2).substring(0, 80) + str);
    }
    stringBuffer.append("&" + Util.encodeUrl(bundle).replaceAll("\\+", "%20"));
    f.c(f.d, "fillShareToQQParams() --end");
    return stringBuffer;
}
 
Example #3
Source File: SocialApiIml.java    From letv with Apache License 2.0 6 votes vote down vote up
private void a(Activity activity, String str, Bundle bundle, String str2, IUiListener iUiListener) {
    f.b(f.d, "-->handleIntentWithH5 " + str + " params=" + bundle);
    Intent targetActivityIntent = getTargetActivityIntent("com.tencent.open.agent.AgentActivity");
    Object cVar = new c(this, activity, iUiListener, str, str2, bundle);
    Intent targetActivityIntent2 = getTargetActivityIntent("com.tencent.open.agent.EncryTokenActivity");
    if (targetActivityIntent2 == null || targetActivityIntent == null || targetActivityIntent.getComponent() == null || targetActivityIntent2.getComponent() == null || !targetActivityIntent.getComponent().getPackageName().equals(targetActivityIntent2.getComponent().getPackageName())) {
        String encrypt = Util.encrypt("tencent&sdk&qazxc***14969%%" + this.mToken.getAccessToken() + this.mToken.getAppId() + this.mToken.getOpenId() + "qzone3.4");
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(SocialConstants.PARAM_ENCRY_EOKEN, encrypt);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        cVar.onComplete(jSONObject);
        return;
    }
    targetActivityIntent2.putExtra("oauth_consumer_key", this.mToken.getAppId());
    targetActivityIntent2.putExtra("openid", this.mToken.getOpenId());
    targetActivityIntent2.putExtra("access_token", this.mToken.getAccessToken());
    targetActivityIntent2.putExtra(Constants.KEY_ACTION, SocialConstants.ACTION_CHECK_TOKEN);
    this.mActivityIntent = targetActivityIntent2;
    if (hasActivityForIntent()) {
        startAssitActivity(activity, (IUiListener) cVar);
    }
}
 
Example #4
Source File: AppbarJsBridge.java    From letv with Apache License 2.0 6 votes vote down vote up
public void setWebView(Uri uri, int i, String str, String str2) {
    boolean z = true;
    try {
        Object queryParameter = uri.getQueryParameter("title");
        int parseIntValue = Util.parseIntValue(uri.getQueryParameter("buttonVisible"), 0);
        if (!TextUtils.isEmpty(queryParameter)) {
            ((AppbarActivity) this.b).setAppbarTitle(queryParameter);
        }
        AppbarActivity appbarActivity = (AppbarActivity) this.b;
        if (parseIntValue != 1) {
            z = false;
        }
        appbarActivity.setShareVisibility(z);
        f.b(f.d, "-->setWebView : url = " + uri + " -- buttonVisiable = " + parseIntValue);
        response(str2, i, str, "");
    } catch (Exception e) {
        responseFail(str2, i, str, -3);
    }
}
 
Example #5
Source File: AuthDialog.java    From letv with Apache License 2.0 6 votes vote down vote up
private boolean f() {
    AuthMap instance = AuthMap.getInstance();
    String makeKey = instance.makeKey();
    Auth auth = new Auth();
    auth.listener = this.d;
    auth.dialog = this;
    auth.key = makeKey;
    String str = instance.set(auth);
    String substring = this.b.substring(0, this.b.indexOf("?"));
    Bundle parseUrl = Util.parseUrl(this.b);
    parseUrl.putString("token_key", makeKey);
    parseUrl.putString("serial", str);
    parseUrl.putString("browser", "1");
    this.b = substring + "?" + Util.encodeUrl(parseUrl);
    return Util.openBrowser(this.l, this.b);
}
 
Example #6
Source File: AuthActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
private void execAuthCallback(Bundle bundle, String str) {
    AuthMap instance = AuthMap.getInstance();
    String string = bundle.getString("serial");
    Auth auth = instance.get(string);
    if (auth != null) {
        if (str.indexOf("://cancel") != -1) {
            auth.listener.onCancel();
            auth.dialog.dismiss();
        } else {
            String string2 = bundle.getString("access_token");
            if (string2 != null) {
                bundle.putString("access_token", instance.decode(string2, auth.key));
            }
            JSONObject decodeUrlToJson = Util.decodeUrlToJson(new JSONObject(), Util.encodeUrl(bundle));
            String optString = decodeUrlToJson.optString("cb");
            if ("".equals(optString)) {
                auth.listener.onComplete(decodeUrlToJson);
                auth.dialog.dismiss();
            } else {
                auth.dialog.callJs(optString, decodeUrlToJson.toString());
            }
        }
        instance.remove(string);
    }
    finish();
}
 
Example #7
Source File: RecordActivity.java    From Android-Application-ZJB with Apache License 2.0 6 votes vote down vote up
@Override
public void onCancel() { // 录音取消
    timer.cancel();
    setSaveClickable(false);
    // 取消之后,有本地录音,则应该显示播放界面
    if (Util.isEmpty(mViewModel.gDownloadRecordPath)) {
        timeTv.setText("00:00");
        noticeTv.setText("");
        stateRecordNotExit();
    } else {
        mViewModel.gNowPath = mViewModel.gDownloadRecordPath;
        mPlayerUtil.setResource(mViewModel.gNowPath);
        Logger.i("onCancel", "not ok  2 " + mPlayerUtil.getDuration());
        second2TextShow(mPlayerUtil.getDuration() / 1000);
        stateRecordExit();
    }
}
 
Example #8
Source File: AuthAgent.java    From letv with Apache License 2.0 6 votes vote down vote up
protected void a(IUiListener iUiListener) {
    f.c(f.d, "reportDAU() -- start");
    String str = "tencent&sdk&qazxc***14969%%";
    String str2 = "qzone3.4";
    Object accessToken = this.mToken.getAccessToken();
    Object openId = this.mToken.getOpenId();
    Object appId = this.mToken.getAppId();
    Object obj = "";
    if (!(TextUtils.isEmpty(accessToken) || TextUtils.isEmpty(openId) || TextUtils.isEmpty(appId))) {
        obj = Util.encrypt(str + accessToken + appId + openId + str2);
    }
    if (TextUtils.isEmpty(obj)) {
        f.e(f.d, "reportDAU -- encrytoken is null");
        return;
    }
    Bundle composeCGIParams = composeCGIParams();
    composeCGIParams.putString("encrytoken", obj);
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://openmobile.qq.com/user/user_login_statis", composeCGIParams, "POST", null);
    f.c(f.d, "reportDAU() -- end");
}
 
Example #9
Source File: QQAvatar.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
    if (i2 == -1) {
        int intExtra = intent.getIntExtra(Constants.KEY_ERROR_CODE, 0);
        if (intExtra == 0) {
            String stringExtra = intent.getStringExtra(Constants.KEY_RESPONSE);
            if (stringExtra != null) {
                try {
                    this.a.onComplete(Util.parseJson(stringExtra));
                    return;
                } catch (JSONException e) {
                    this.a.onError(new UiError(-4, Constants.MSG_JSON_ERROR, stringExtra));
                    return;
                }
            }
            this.a.onComplete(new JSONObject());
            return;
        }
        this.a.onError(new UiError(intExtra, intent.getStringExtra(Constants.KEY_ERROR_MSG), intent.getStringExtra(Constants.KEY_ERROR_DETAIL)));
        return;
    }
    this.a.onCancel();
}
 
Example #10
Source File: PKDialog.java    From letv with Apache License 2.0 6 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
    Util.logd(PKDialog.TAG, "Redirect URL: " + str);
    if (str.startsWith(ServerSetting.getInstance().getEnvUrl((Context) PKDialog.this.mWeakContext.get(), ServerSetting.DEFAULT_REDIRECT_URI))) {
        PKDialog.this.mListener.onComplete(Util.parseUrlToJson(str));
        PKDialog.this.dismiss();
        return true;
    } else if (str.startsWith("auth://cancel")) {
        PKDialog.this.mListener.onCancel();
        PKDialog.this.dismiss();
        return true;
    } else if (!str.startsWith("auth://close")) {
        return false;
    } else {
        PKDialog.this.dismiss();
        return true;
    }
}
 
Example #11
Source File: TDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void onComplete(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #12
Source File: QzoneShare.java    From letv with Apache License 2.0 5 votes vote down vote up
private StringBuffer a(StringBuffer stringBuffer, Bundle bundle) {
    f.c(f.d, "fillShareToQQParams() --start");
    ArrayList stringArrayList = bundle.getStringArrayList("imageUrl");
    Object string = bundle.getString("appName");
    int i = bundle.getInt("req_type", 1);
    String string2 = bundle.getString("title");
    String string3 = bundle.getString("summary");
    bundle.putString("appId", this.mToken.getAppId());
    bundle.putString("sdkp", "a");
    bundle.putString("sdkv", Constants.SDK_VERSION);
    bundle.putString("status_os", VERSION.RELEASE);
    bundle.putString("status_machine", Build.MODEL);
    String str = "...";
    if (!Util.isEmpty(string2) && string2.length() > 40) {
        bundle.putString("title", string2.substring(0, 40) + "...");
    }
    if (!Util.isEmpty(string3) && string3.length() > 80) {
        bundle.putString("summary", string3.substring(0, 80) + "...");
    }
    if (!TextUtils.isEmpty(string)) {
        bundle.putString("site", string);
    }
    if (stringArrayList != null) {
        int size = stringArrayList.size();
        String[] strArr = new String[size];
        for (int i2 = 0; i2 < size; i2++) {
            strArr[i2] = (String) stringArrayList.get(i2);
        }
        bundle.putStringArray("imageUrl", strArr);
    }
    bundle.putString("type", String.valueOf(i));
    stringBuffer.append("&" + Util.encodeUrl(bundle).replaceAll("\\+", "%20"));
    f.c(f.d, "fillShareToQQParams() --end");
    return stringBuffer;
}
 
Example #13
Source File: d.java    From letv with Apache License 2.0 5 votes vote down vote up
public void a(int i, String str, String str2, String str3, String str4, Long l, int i2, int i3, String str5) {
    long j;
    long elapsedRealtime = SystemClock.elapsedRealtime() - l.longValue();
    if (l.longValue() == 0 || elapsedRealtime < 0) {
        j = 0;
    } else {
        j = elapsedRealtime;
    }
    StringBuffer stringBuffer = new StringBuffer("http://c.isdspeed.qq.com/code.cgi");
    stringBuffer.append("?domain=mobile.opensdk.com&cgi=opensdk&type=").append(i).append("&code=").append(i2).append("&time=").append(j).append("&rate=").append(i3).append("&uin=").append(str2).append("&data=");
    g.a().a(stringBuffer.toString(), "GET", Util.composeHaboCgiReportParams(String.valueOf(i), String.valueOf(i2), String.valueOf(j), String.valueOf(i3), str, str2, str3, str4, str5), true);
}
 
Example #14
Source File: TDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
    Util.logd("TDialog", "Redirect URL: " + str);
    if (str.startsWith(ServerSetting.getInstance().getEnvUrl((Context) TDialog.this.c.get(), ServerSetting.DEFAULT_REDIRECT_URI))) {
        TDialog.this.f.onComplete(Util.parseUrlToJson(str));
        if (TDialog.this.isShowing()) {
            TDialog.this.dismiss();
        }
        return true;
    } else if (str.startsWith("auth://cancel")) {
        TDialog.this.f.onCancel();
        if (TDialog.this.isShowing()) {
            TDialog.this.dismiss();
        }
        return true;
    } else if (str.startsWith("auth://close")) {
        if (TDialog.this.isShowing()) {
            TDialog.this.dismiss();
        }
        return true;
    } else if (str.startsWith("download://")) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(Uri.decode(str.substring("download://".length()))));
        intent.addFlags(268435456);
        if (!(TDialog.this.c == null || TDialog.this.c.get() == null)) {
            ((Context) TDialog.this.c.get()).startActivity(intent);
        }
        return true;
    } else if (str.startsWith(AuthConstants.PROGRESS_URI)) {
        return true;
    } else {
        return false;
    }
}
 
Example #15
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void onComplete(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #16
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private static void showTips(Context context, String str) {
    try {
        JSONObject parseJson = Util.parseJson(str);
        int i = parseJson.getInt("type");
        CharSequence string = parseJson.getString("msg");
        if (i == 0) {
            if (sToast == null) {
                sToast = Toast.makeText(context, string, 0);
            } else {
                sToast.setView(sToast.getView());
                sToast.setText(string);
                sToast.setDuration(0);
            }
            sToast.show();
        } else if (i == 1) {
            if (sToast == null) {
                sToast = Toast.makeText(context, string, 1);
            } else {
                sToast.setView(sToast.getView());
                sToast.setText(string);
                sToast.setDuration(1);
            }
            sToast.show();
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example #17
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private static void showProcessDialog(Context context, String str) {
    if (context != null && str != null) {
        try {
            JSONObject parseJson = Util.parseJson(str);
            int i = parseJson.getInt("action");
            parseJson.getString("msg");
            if (i != 1) {
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
 
Example #18
Source File: AppbarJsBridge.java    From letv with Apache License 2.0 5 votes vote down vote up
public void pageControl(Uri uri, int i, String str, String str2) {
    f.b(f.d, "-->pageControl : url = " + uri);
    int parseIntValue = Util.parseIntValue(uri.getQueryParameter("type"));
    if (this.a != null) {
        if (parseIntValue == 1) {
            this.a.goBack();
        } else if (parseIntValue == 2) {
            this.a.goForward();
        } else {
            this.a.reload();
        }
    }
    response(str2, i, str, "");
}
 
Example #19
Source File: AppbarJsBridge.java    From letv with Apache License 2.0 5 votes vote down vote up
public void share(Uri uri, int i, String str, String str2) {
    f.b(f.d, "-->share : url = " + uri);
    String queryParameter = uri.getQueryParameter("title");
    String queryParameter2 = uri.getQueryParameter("summary");
    String queryParameter3 = uri.getQueryParameter("iconUrl");
    if (TextUtils.isEmpty(queryParameter3)) {
        queryParameter3 = "http://qzs.qq.com/open/mobile/jsbridge/demo.htm";
    }
    String queryParameter4 = uri.getQueryParameter("jumpUrl");
    f.b(f.d, "-->share : title = " + queryParameter);
    f.b(f.d, "-->share : summary = " + queryParameter2);
    f.b(f.d, "-->share : iconUrl = " + queryParameter3);
    f.b(f.d, "-->share : jumpUrl = " + queryParameter4);
    ShareModel shareModel = new ShareModel();
    shareModel.a = queryParameter;
    shareModel.b = queryParameter2;
    shareModel.c = queryParameter3;
    shareModel.d = queryParameter4;
    ((AppbarActivity) this.b).setShareModel(shareModel);
    switch (Util.parseIntValue(uri.getQueryParameter("type"), 0)) {
        case 1:
            ((AppbarActivity) this.b).shareToQQ();
            return;
        case 2:
            ((AppbarActivity) this.b).shareToQzone();
            return;
        case 3:
            ((AppbarActivity) this.b).shareToWX();
            return;
        case 4:
            ((AppbarActivity) this.b).shareToTimeline();
            return;
        default:
            ((AppbarActivity) this.b).showFloatingDialog();
            return;
    }
}
 
Example #20
Source File: SocialApiIml.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(Context context, String str, Bundle bundle, String str2, IUiListener iUiListener) {
    f.a(f.d, "OpenUi, showDialog --start");
    CookieSyncManager.createInstance(context);
    bundle.putString("oauth_consumer_key", this.mToken.getAppId());
    if (this.mToken.isSessionValid()) {
        bundle.putString("access_token", this.mToken.getAccessToken());
    }
    String openId = this.mToken.getOpenId();
    if (openId != null) {
        bundle.putString("openid", openId);
    }
    try {
        bundle.putString(Constants.PARAM_PLATFORM_ID, Global.getContext().getSharedPreferences(Constants.PREFERENCE_PF, 0).getString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF));
    } catch (Exception e) {
        e.printStackTrace();
        bundle.putString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF);
    }
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(str2);
    stringBuilder.append(Util.encodeUrl(bundle));
    String stringBuilder2 = stringBuilder.toString();
    f.b(f.d, "OpenUi, showDialog TDialog");
    if (SocialConstants.ACTION_CHALLENGE.equals(str) || SocialConstants.ACTION_BRAG.equals(str)) {
        f.b(f.d, "OpenUi, showDialog PKDialog");
        new PKDialog(this.b, str, stringBuilder2, iUiListener, this.mToken).show();
        return;
    }
    new TDialog(this.b, str, stringBuilder2, iUiListener, this.mToken).show();
}
 
Example #21
Source File: SocialApiIml.java    From letv with Apache License 2.0 5 votes vote down vote up
public void grade(Activity activity, Bundle bundle, IUiListener iUiListener) {
    this.b = activity;
    bundle.putAll(composeActivityParams());
    bundle.putString("version", Util.getAppVersion(activity));
    Intent agentIntentWithTarget = getAgentIntentWithTarget(SocialConstants.ACTIVITY_GRADE);
    String str = "http://qzs.qq.com/open/mobile/rate/sdk_rate.html?";
    if (agentIntentWithTarget == null && a()) {
        this.mProgressDialog = new ProgressDialog(activity);
        this.mProgressDialog.setMessage("请稍候...");
        this.mProgressDialog.show();
        a(activity, SocialConstants.ACTION_GRADE, new a(this, a(bundle, SocialConstants.ACTION_GRADE, str, iUiListener)));
        return;
    }
    a(activity, agentIntentWithTarget, SocialConstants.ACTION_GRADE, bundle, str, iUiListener, true);
}
 
Example #22
Source File: RecordManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void deleteRecord(String str, final IUiListener iUiListener) {
    Bundle composeCGIParams = composeCGIParams();
    IRequestListener tempRequestListener = new TempRequestListener(new IUiListener(this) {
        final /* synthetic */ RecordManager b;

        public void onError(UiError uiError) {
            iUiListener.onError(uiError);
        }

        public void onComplete(Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            try {
                if (jSONObject.getInt("ret") == 0) {
                    iUiListener.onComplete("");
                } else {
                    iUiListener.onError(new UiError(-4, jSONObject.toString(), null));
                }
            } catch (JSONException e) {
                iUiListener.onError(new UiError(-4, e.getMessage(), null));
            }
        }

        public void onCancel() {
            iUiListener.onCancel();
        }
    });
    composeCGIParams.putString("key", Util.toHexString(str));
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://graph.qq.com/weiyun/delete_record", composeCGIParams, "GET", tempRequestListener);
}
 
Example #23
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.save_tv)
private void save(View view) {
	nickName = mNickET.getText().toString().trim();
	if(Util.isEmpty(nickName)) {
		mNickET.requestFocus();
		ToastUtils.showMessage(getApplicationContext(), R.string.nick_null);
		return;
	}
	nickName = ToolsUtils.Html2Text(nickName);
	if(Util.isEmpty(nickName)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	ToolsUtils.hideKeyboard(mNickET);
	if (App.currentUser == null) {
		finishWithAnimation();
		return;
	}
	try {
		ProgressDialogUtils.showProgressDialog(this, "正在处理中...");
		mUserService.setNickAndSex(mHandler, String.valueOf(App.currentUser.getId()), 
				URLEncoder.encode(nickName, "UTF-8"), String.valueOf(mSexFlag));
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
}
 
Example #24
Source File: AuthDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onReceivedError(WebView webView, int i, String str, String str2) {
    super.onReceivedError(webView, i, str, str2);
    f.c(AuthDialog.a, "-->onReceivedError, errorCode: " + i + " | description: " + str);
    if (!Util.checkNetWork(this.a.l)) {
        this.a.c.onError(new UiError(9001, "当前网络不可用,请稍后重试!", str2));
        this.a.dismiss();
    } else if (this.a.p.startsWith(ServerSetting.DOWNLOAD_QQ_URL)) {
        this.a.c.onError(new UiError(i, str, str2));
        this.a.dismiss();
    } else {
        long elapsedRealtime = SystemClock.elapsedRealtime() - this.a.r;
        if (this.a.o >= 1 || elapsedRealtime >= this.a.s) {
            this.a.k.loadUrl(this.a.b());
            return;
        }
        this.a.o = this.a.o + 1;
        this.a.e.postDelayed(new Runnable(this) {
            final /* synthetic */ LoginWebViewClient a;

            {
                this.a = r1;
            }

            public void run() {
                this.a.a.k.loadUrl(this.a.a.p);
            }
        }, 500);
    }
}
 
Example #25
Source File: AuthDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #26
Source File: AuthDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private static void b(Context context, String str) {
    try {
        JSONObject parseJson = Util.parseJson(str);
        int i = parseJson.getInt("type");
        Toast.makeText(context.getApplicationContext(), parseJson.getString("msg"), i).show();
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example #27
Source File: AuthAgent.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(String str) {
    try {
        JSONObject parseJson = Util.parseJson(str);
        Object string = parseJson.getString("access_token");
        Object string2 = parseJson.getString("expires_in");
        Object string3 = parseJson.getString("openid");
        if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3)) {
            this.mToken.setAccessToken(string, string2);
            this.mToken.setOpenId(string3);
        }
    } catch (Exception e) {
    }
}
 
Example #28
Source File: RecordManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void checkRecord(String str, final IUiListener iUiListener) {
    Bundle composeCGIParams = composeCGIParams();
    IRequestListener tempRequestListener = new TempRequestListener(new IUiListener(this) {
        final /* synthetic */ RecordManager b;

        public void onError(UiError uiError) {
            iUiListener.onError(uiError);
        }

        public void onComplete(Object obj) {
            try {
                if (((JSONObject) obj).getInt("ret") == 0) {
                    iUiListener.onComplete(Boolean.TRUE);
                } else {
                    iUiListener.onComplete(Boolean.FALSE);
                }
            } catch (JSONException e) {
                iUiListener.onError(new UiError(-4, e.getMessage(), null));
            }
        }

        public void onCancel() {
            iUiListener.onCancel();
        }
    });
    composeCGIParams.putString("key", Util.toHexString(str));
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://graph.qq.com/weiyun/check_record", composeCGIParams, "GET", tempRequestListener);
}
 
Example #29
Source File: BaseApi.java    From letv with Apache License 2.0 5 votes vote down vote up
protected String getCommonDownloadQQUrl(String str) {
    Bundle composeCGIParams = composeCGIParams();
    StringBuilder stringBuilder = new StringBuilder();
    if (!TextUtils.isEmpty(str)) {
        composeCGIParams.putString("need_version", str);
    }
    stringBuilder.append(ServerSetting.NEED_QQ_VERSION_TIPS_URL);
    stringBuilder.append(Util.encodeUrl(composeCGIParams));
    return stringBuilder.toString();
}
 
Example #30
Source File: BaseApi.java    From letv with Apache License 2.0 5 votes vote down vote up
protected void handleDownloadLastestQQ(Activity activity, Bundle bundle, IUiListener iUiListener) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(ServerSetting.DOWNLOAD_QQ_URL);
    stringBuilder.append(Util.encodeUrl(bundle));
    Context context = activity;
    new TDialog(context, "", stringBuilder.toString(), null, this.mToken).show();
}