思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c

以下内容为反编译后的 LoginAuthActivity.java 源代码,内容仅作参考


package com.cmic.sso.sdk.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import com.cmic.sso.sdk.AuthThemeConfig;
import com.cmic.sso.sdk.auth.AuthnHelper;
import com.cmic.sso.sdk.auth.TokenListener;
import com.cmic.sso.sdk.utils.f;
import com.cmic.sso.sdk.utils.g;
import com.cmic.sso.sdk.utils.i;
import com.cmic.sso.sdk.utils.n;
import com.cmic.sso.sdk.utils.u;
import com.cmic.sso.sdk.utils.w;
import com.cmic.sso.sdk.utils.z;
import com.googlecode.mp4parser.authoring.tracks.DTSTrackImpl;
import java.lang.ref.WeakReference;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginAuthActivity extends Activity implements View.OnClickListener {
    public static final String a = LoginAuthActivity.class.getSimpleName();
    public Handler b;
    public Context c;
    public RelativeLayout d;
    public com.cmic.sso.sdk.widget.a e;
    public com.cmic.sso.sdk.widget.a f;
    public com.cmic.sso.sdk.widget.a g;
    public Bundle h;
    public com.cmic.sso.sdk.auth.a i;
    public CheckBox k;
    public LinearLayout l;
    public RelativeLayout m;
    public TokenListener q;
    public LinearLayout s;
    public String t;
    public AuthThemeConfig u;
    public int v;
    public int w;
    public boolean x;
    public Dialog y;
    public String j = "";
    public long n = 0;
    public int o = 0;
    public a p = null;
    public boolean r = true;

    public static class a extends Handler {
        public WeakReference<LoginAuthActivity> a;

        public a(LoginAuthActivity loginAuthActivity) {
            this.a = new WeakReference<>(loginAuthActivity);
        }

        private void a(Message message) {
            LoginAuthActivity loginAuthActivity = this.a.get();
            if (loginAuthActivity == null || message.what != 13) {
                return;
            }
            loginAuthActivity.c();
            loginAuthActivity.k();
        }

        @Override
        public void handleMessage(Message message) {
            try {
                a(message);
            } catch (Exception e) {
                com.cmic.sso.sdk.c.a.a.add(e);
                e.printStackTrace();
            }
        }
    }

    public static class b extends u.a {
        public WeakReference<LoginAuthActivity> a;
        public WeakReference<c> b;

        public b(LoginAuthActivity loginAuthActivity, c cVar) {
            this.a = new WeakReference<>(loginAuthActivity);
            this.b = new WeakReference<>(cVar);
        }

        public boolean b() {
            c cVar = this.b.get();
            if (this.a.get() == null || cVar == null) {
                return false;
            }
            return cVar.a(false);
        }

        @Override
        public void a() {
            final LoginAuthActivity loginAuthActivity = this.a.get();
            if (!loginAuthActivity.r) {
                loginAuthActivity.i.a(loginAuthActivity.h, String.valueOf(3), new com.cmic.sso.sdk.auth.b() {
                    @Override
                    public void a(String str, String str2, Bundle bundle, JSONObject jSONObject) {
                        if (b.this.b()) {
                            if ("103000".equals(str)) {
                                loginAuthActivity.i.a(loginAuthActivity.h, new com.cmic.sso.sdk.auth.b() {
                                    @Override
                                    public void a(String str3, String str4, Bundle bundle2, JSONObject jSONObject2) {
                                        if (b.this.b()) {
                                            long j = bundle2.getLong("loginTime");
                                            if (j != 0) {
                                                bundle2.putLong("loginTime", System.currentTimeMillis() - j);
                                            }
                                            String string = bundle2.getString("phonescrip");
                                            if (!"103000".equals(str3) || TextUtils.isEmpty(string)) {
                                                loginAuthActivity.r = false;
                                                com.cmic.sso.sdk.utils.c.a("authClickFailed");
                                            } else {
                                                com.cmic.sso.sdk.utils.c.a("authClickSuccess");
                                                loginAuthActivity.r = true;
                                            }
                                            loginAuthActivity.a(str3, str4, bundle2, jSONObject2);
                                            try {
                                                Thread.sleep(1000L);
                                            } catch (InterruptedException e) {
                                                e.printStackTrace();
                                            }
                                            loginAuthActivity.p.sendEmptyMessage(13);
                                        }
                                    }
                                });
                                return;
                            }
                            loginAuthActivity.r = false;
                            loginAuthActivity.a(str, str2, bundle, jSONObject);
                            try {
                                Thread.sleep(1000L);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            loginAuthActivity.p.sendEmptyMessage(13);
                        }
                    }
                });
            } else {
                loginAuthActivity.i.a(loginAuthActivity.h, new com.cmic.sso.sdk.auth.b() {
                    @Override
                    public void a(String str, String str2, Bundle bundle, JSONObject jSONObject) {
                        if (b.this.b()) {
                            long j = bundle.getLong("loginTime");
                            String string = bundle.getString("phonescrip");
                            if (j != 0) {
                                bundle.putLong("loginTime", System.currentTimeMillis() - j);
                            }
                            if (!"103000".equals(str) || TextUtils.isEmpty(string)) {
                                loginAuthActivity.r = false;
                                com.cmic.sso.sdk.utils.c.a("authClickFailed");
                            } else {
                                com.cmic.sso.sdk.utils.c.a("authClickSuccess");
                                loginAuthActivity.r = true;
                            }
                            loginAuthActivity.a(str, str2, bundle, jSONObject);
                            try {
                                Thread.sleep(1000L);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            loginAuthActivity.p.sendEmptyMessage(13);
                        }
                    }
                });
            }
        }
    }

    public class c implements Runnable {
        public Bundle b;
        public boolean c;

        public c(Bundle bundle) {
            this.b = bundle;
        }

        @Override
        public void run() {
            if (a(true)) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("resultCode", "102507");
                    jSONObject.put("resultString", "请求超时");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                LoginAuthActivity.this.r = false;
                com.cmic.sso.sdk.utils.c.a("authClickFailed");
                LoginAuthActivity.this.p.sendEmptyMessage(13);
                long j = this.b.getLong("loginTime");
                if (j != 0) {
                    this.b.putLong("loginTime", System.currentTimeMillis() - j);
                }
                LoginAuthActivity.this.a("102507", "请求超时", this.b, jSONObject);
            }
        }

        public synchronized boolean a(boolean z) {
            boolean z2;
            z2 = this.c;
            this.c = z;
            return !z2;
        }
    }

    private void m() {
        try {
            if (this.o >= 5) {
                Toast.makeText(this.c, "网络不稳定,请返回重试其他登录方式", 1).show();
                this.d.setClickable(true);
                return;
            }
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            StringBuilder sb = new StringBuilder();
            for (StackTraceElement stackTraceElement : stackTrace) {
                f.a("stack", stackTraceElement.getClassName());
                String className = stackTraceElement.getClassName();
                if (!TextUtils.isEmpty(className) && className.contains("com.cmic.sso.sdk.activity") && !sb.toString().contains(className)) {
                    sb.append(className);
                    sb.append(";");
                }
            }
            this.h.putString("caller", sb.toString());
            this.h.putLong("loginTime", System.currentTimeMillis());
            String string = this.h.getString("traceId", "");
            if (!TextUtils.isEmpty(string) && i.a(string)) {
                String b2 = z.b();
                this.h.putString("traceId", b2);
                i.a(b2, this.q);
            }
            b();
            l();
            c cVar = new c(this.h);
            this.b.postDelayed(cVar, AuthnHelper.getInstance(this).getOverTime());
            u.a(new b(this, cVar));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    @RequiresApi(api = 21)
    public void onClick(View view) {
        try {
            int id2 = view.getId();
            if (id2 == 17476) {
                this.o++;
                m();
            } else if (id2 == 26214) {
                a(false);
            } else if (id2 == 34952) {
                if (this.k.isChecked()) {
                    this.k.setChecked(false);
                } else {
                    this.k.setChecked(true);
                }
            }
        } catch (Exception e) {
            com.cmic.sso.sdk.c.a.a.add(e);
            e.printStackTrace();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            if (bundle != null) {
                finish();
            }
            this.c = this;
            this.u = AuthnHelper.getInstance(this.c).getAuthThemeConfig();
            if (this.u != null && this.u.getThemeId() != -1) {
                setTheme(this.u.getThemeId());
            }
            com.cmic.sso.sdk.utils.c.a("authPageIn");
            this.n = System.currentTimeMillis();
            this.i = com.cmic.sso.sdk.auth.a.a(this);
            d();
            f();
        } catch (Exception e) {
            com.cmic.sso.sdk.c.a.a.add(e);
            f.a(a, e.toString());
            e.printStackTrace();
            a("200025", "发生未知错误", this.h, null);
        }
    }

    @Override
    public void onDestroy() {
        try {
            this.b.removeCallbacksAndMessages(null);
            com.cmic.sso.sdk.utils.c.a("timeOnAuthPage", (System.currentTimeMillis() - this.n) + "");
            if (this.k.isChecked()) {
                com.cmic.sso.sdk.utils.c.a("authPrivacyState", "1");
            } else {
                com.cmic.sso.sdk.utils.c.a("authPrivacyState", "0");
            }
            if (!this.h.getBoolean("isLoginSwitch", false)) {
                com.cmic.sso.sdk.utils.c.a("timeOnAuthPage", (System.currentTimeMillis() - this.n) + "");
                com.cmic.sso.sdk.utils.c.a(this.c, this.h);
                com.cmic.sso.sdk.utils.c.a();
            }
            this.y = null;
            g.a().c();
            this.p.removeCallbacksAndMessages(null);
        } catch (Exception e) {
            f.a(a, "LoginAuthActivity clear failed");
            com.cmic.sso.sdk.c.a.a.add(e);
            e.printStackTrace();
        }
        super.onDestroy();
    }

    @Override
    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (i == 4 && !keyEvent.isCanceled() && keyEvent.getRepeatCount() == 0) {
            if (this.u.getBackPressedListener() != null) {
                this.u.getBackPressedListener().onBackPressed();
            }
            a(false);
            return true;
        }
        return true;
    }

    @Override
    public void onResume() {
        super.onResume();
        try {
            if (this.h != null) {
                this.h.putString("loginMethod", "loginAuth");
            }
            AuthnHelper.getInstance(this).loginPageInCallBack("200087", null);
        } catch (Exception e) {
            com.cmic.sso.sdk.c.a.a.add(e);
            a("200025", "发生未知错误", this.h, null);
        }
    }

    private void d() {
        String str;
        this.h = getIntent().getExtras();
        if (this.h == null) {
            this.h = new Bundle();
        }
        this.q = i.c(this.h.getString("traceId", ""));
        getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
        this.b = new Handler(getMainLooper());
        this.p = new a(this);
        this.j = this.h.getString("securityphone");
        String str2 = a;
        f.b(str2, "mSecurityPhone value is " + this.j);
        String string = this.h.getString("operatorType", "");
        String str3 = a;
        f.b(str3, "operator value is " + string);
        if (string.equals("1")) {
            this.t = "中国移动认证服务条款";
            str = "http://wap.cmpassport.com/resources/html/contract.html";
        } else if (string.equals("3")) {
            this.t = "中国电信天翼账号服务条款";
            str = "https://e.189.cn/sdk/agreement/detail.do";
        } else {
            this.t = "中国联通认证服务协议";
            str = "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true";
        }
        this.e = new com.cmic.sso.sdk.widget.a(this.c, 16973840, null, str);
        this.e.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                    LoginAuthActivity.this.e.dismiss();
                }
                return true;
            }
        });
        if (!TextUtils.isEmpty(this.u.getClauseUrl())) {
            this.f = new com.cmic.sso.sdk.widget.a(this.c, 16973840, this.u.getClauseName(), this.u.getClauseUrl());
            this.f.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                    if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        LoginAuthActivity.this.f.dismiss();
                    }
                    return true;
                }
            });
        }
        if (!TextUtils.isEmpty(this.u.getClauseUrl2())) {
            this.g = new com.cmic.sso.sdk.widget.a(this.c, 16973840, this.u.getClauseName2(), this.u.getClauseUrl2());
            this.g.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                    if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        LoginAuthActivity.this.g.dismiss();
                    }
                    return true;
                }
            });
        }
        g.a().a(new g.a() {
            @Override
            public void a() {
                LoginAuthActivity.this.b.removeCallbacksAndMessages(null);
                if (LoginAuthActivity.this.e != null && LoginAuthActivity.this.e.isShowing()) {
                    LoginAuthActivity.this.e.dismiss();
                }
                if (LoginAuthActivity.this.f != null && LoginAuthActivity.this.f.isShowing()) {
                    LoginAuthActivity.this.f.dismiss();
                }
                LoginAuthActivity.this.a(true);
            }
        });
    }

    private void e() {
        int i;
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.m.getLayoutParams();
        if (this.u.getNumFieldOffsetY() <= 0 && this.u.getNumFieldOffsetY_B() >= 0) {
            if (this.u.getNumFieldOffsetY_B() > 0 && (this.v - this.m.getMeasuredHeight()) - w.a(this.c, this.u.getNumFieldOffsetY_B()) > 0) {
                f.b(a, "numberField_bottom");
                layoutParams.addRule(12, -1);
                layoutParams.setMargins(0, 0, 0, w.a(this.c, this.u.getNumFieldOffsetY_B()));
            } else {
                layoutParams.addRule(10, -1);
            }
        } else {
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.m.measure(makeMeasureSpec, makeMeasureSpec);
            String str = a;
            f.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.m.getMeasuredHeight());
            if (this.u.getNumFieldOffsetY() > 0 && (this.v - this.m.getMeasuredHeight()) - w.a(this.c, this.u.getNumFieldOffsetY()) > 0) {
                f.b(a, "numberField_top");
                layoutParams.addRule(10, -1);
                layoutParams.setMargins(0, w.a(this.c, this.u.getNumFieldOffsetY()), 0, 0);
            } else {
                layoutParams.addRule(12, -1);
            }
        }
        this.m.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.d.getLayoutParams();
        int logBtnMarginLeft = this.u.getLogBtnMarginLeft() < 0 ? 0 : this.u.getLogBtnMarginLeft();
        int logBtnMarginRight = this.u.getLogBtnMarginRight() < 0 ? 0 : this.u.getLogBtnMarginRight();
        if (this.u.getLogBtnOffsetY() <= 0 && this.u.getLogBtnOffsetY_B() >= 0) {
            if (this.u.getLogBtnOffsetY_B() > 0 && this.v - w.a(this.c, this.u.getLogBtnHeight() + this.u.getLogBtnOffsetY_B()) > 0) {
                f.b(a, "logBtn_bottom");
                layoutParams2.addRule(12, -1);
                layoutParams2.setMargins(w.a(this.c, logBtnMarginLeft), 0, w.a(this.c, logBtnMarginRight), w.a(this.c, this.u.getLogBtnOffsetY_B()));
            } else {
                layoutParams2.addRule(10, -1);
                layoutParams2.setMargins(w.a(this.c, logBtnMarginLeft), 0, w.a(this.c, logBtnMarginRight), 0);
            }
        } else if (this.u.getLogBtnOffsetY() > 0 && this.v - w.a(this.c, this.u.getLogBtnHeight() + this.u.getLogBtnOffsetY()) > 0) {
            f.b(a, "logBtn_top");
            layoutParams2.addRule(10, -1);
            layoutParams2.setMargins(w.a(this.c, logBtnMarginLeft), w.a(this.c, this.u.getLogBtnOffsetY()), w.a(this.c, logBtnMarginRight), 0);
        } else {
            layoutParams2.addRule(12, -1);
            layoutParams2.setMargins(w.a(this.c, logBtnMarginLeft), 0, w.a(this.c, logBtnMarginRight), 0);
        }
        this.d.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.l.getLayoutParams();
        if (this.u.getPrivacyMarginLeft() >= 0) {
            i = this.u.getCheckedImgWidth() > 30 ? this.u.getPrivacyMarginLeft() : this.u.getPrivacyMarginLeft() - (30 - this.u.getCheckedImgWidth());
        } else {
            i = this.u.getCheckedImgWidth() > 30 ? 0 : -(30 - this.u.getCheckedImgWidth());
        }
        int privacyMarginRight = this.u.getPrivacyMarginRight() < 0 ? 0 : this.u.getPrivacyMarginRight();
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.l.measure(makeMeasureSpec2, makeMeasureSpec2);
        if (this.u.getPrivacyOffsetY() <= 0 && this.u.getPrivacyOffsetY_B() >= 0) {
            if (this.u.getPrivacyOffsetY_B() > 0 && this.v - w.a(this.c, this.l.getMeasuredHeight() + this.u.getPrivacyOffsetY_B()) > 0) {
                String str2 = a;
                f.b(str2, "privacy_bottom=" + this.l.getMeasuredHeight());
                layoutParams3.addRule(12, -1);
                layoutParams3.setMargins(w.a(this.c, (float) i), 0, w.a(this.c, (float) privacyMarginRight), w.a(this.c, (float) this.u.getPrivacyOffsetY_B()));
            } else {
                layoutParams3.addRule(10, -1);
                layoutParams3.setMargins(w.a(this.c, i), 0, w.a(this.c, privacyMarginRight), 0);
                f.b(a, "privacy_top");
            }
        } else if (this.u.getPrivacyOffsetY() > 0 && this.v - w.a(this.c, this.l.getMeasuredHeight() + this.u.getPrivacyOffsetY()) > 0) {
            String str3 = a;
            f.b(str3, "privacy_top = " + this.l.getMeasuredHeight());
            layoutParams3.addRule(10, -1);
            layoutParams3.setMargins(w.a(this.c, (float) i), w.a(this.c, (float) this.u.getPrivacyOffsetY()), w.a(this.c, (float) privacyMarginRight), 0);
        } else {
            String str4 = a;
            f.b(str4, "privacy_bottom=" + i);
            layoutParams3.addRule(12, -1);
            layoutParams3.setMargins(w.a(this.c, (float) i), 0, w.a(this.c, (float) privacyMarginRight), 0);
        }
        this.l.setLayoutParams(layoutParams3);
    }

    private void f() {
        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().addFlags(DTSTrackImpl.BUFFER);
            getWindow().addFlags(134217728);
            if (this.u.getStatusBarColor() != 0) {
                getWindow().addFlags(Integer.MIN_VALUE);
                getWindow().clearFlags(DTSTrackImpl.BUFFER);
                getWindow().setStatusBarColor(this.u.getStatusBarColor());
                getWindow().setNavigationBarColor(this.u.getStatusBarColor());
            }
        }
        if (Build.VERSION.SDK_INT >= 23) {
            if (this.u.isLightColor()) {
                getWindow().getDecorView().setSystemUiVisibility(8192);
            } else {
                getWindow().getDecorView().setSystemUiVisibility(0);
            }
        }
        RelativeLayout relativeLayout = new RelativeLayout(this);
        relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        View contentView = this.u.getContentView();
        if (contentView != null) {
            ViewParent parent = contentView.getParent();
            if (parent != null) {
                ((ViewGroup) parent).removeView(contentView);
            }
            relativeLayout.addView(contentView);
        } else if (this.u.getLayoutResID() != -1) {
            getLayoutInflater().inflate(this.u.getLayoutResID(), relativeLayout);
        }
        setContentView(relativeLayout);
        int requestedOrientation = getRequestedOrientation();
        this.v = w.b(this.c);
        this.w = w.a(this.c);
        if ((requestedOrientation == 1 && this.w > this.v) || (requestedOrientation == 0 && this.w < this.v)) {
            int i = this.w;
            this.w = this.v;
            this.v = i;
        }
        String str = a;
        f.d(str, "orientation = " + requestedOrientation + "--screenWidth = " + this.w + "--screenHeight = " + this.v);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        if (this.u.getWindowWidth() != 0) {
            getWindow().getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
            getWindowManager().getDefaultDisplay().getSize(new Point());
            attributes.width = w.a(this.c, this.u.getWindowWidth());
            attributes.height = w.a(this.c, this.u.getWindowHeight());
            this.w = attributes.width;
            this.v = attributes.height;
            attributes.x = this.u.getWindowX();
            if (this.u.getWindowBottom() == 1) {
                getWindow().setGravity(80);
            } else {
                attributes.y = this.u.getWindowY();
            }
            getWindow().setAttributes(attributes);
        }
        relativeLayout.setFitsSystemWindows(true);
        relativeLayout.setClipToPadding(true);
        try {
            g();
            relativeLayout.addView(this.m);
            relativeLayout.addView(h());
            relativeLayout.addView(i());
            e();
            this.d.setOnClickListener(this);
            this.s.setOnClickListener(this);
            this.k.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                    if (z) {
                        LoginAuthActivity.this.d.setEnabled(true);
                        try {
                            LoginAuthActivity.this.k.setBackgroundResource(n.a(LoginAuthActivity.this, LoginAuthActivity.this.u.getCheckedImgPath()));
                            return;
                        } catch (Exception unused) {
                            LoginAuthActivity.this.k.setBackgroundResource(n.a(LoginAuthActivity.this, "umcsdk_check_image"));
                            return;
                        }
                    }
                    LoginAuthActivity.this.d.setEnabled(false);
                    try {
                        LoginAuthActivity.this.k.setBackgroundResource(n.a(LoginAuthActivity.this, LoginAuthActivity.this.u.getUncheckedImgPath()));
                    } catch (Exception unused2) {
                        LoginAuthActivity.this.k.setBackgroundResource(n.a(LoginAuthActivity.this, "umcsdk_uncheck_image"));
                    }
                }
            });
            k();
            try {
                if (this.u.isPrivacyState()) {
                    this.k.setChecked(true);
                    this.k.setBackgroundResource(n.a(this, this.u.getCheckedImgPath()));
                    this.d.setEnabled(true);
                } else {
                    this.k.setChecked(false);
                    this.d.setEnabled(false);
                    this.k.setBackgroundResource(n.a(this, this.u.getUncheckedImgPath()));
                }
            } catch (Exception unused) {
                this.k.setChecked(false);
            }
        } catch (Exception e) {
            com.cmic.sso.sdk.c.a.a.add(e);
            e.printStackTrace();
            f.a(a, e.toString());
            a("200040", "UI资源加载异常", this.h, null);
        }
    }

    private void g() {
        this.m = new RelativeLayout(this);
        this.m.setId(13107);
        this.m.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        TextView textView = new TextView(this);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        textView.setGravity(15);
        int numberOffsetX = this.u.getNumberOffsetX();
        if (numberOffsetX == 0) {
            layoutParams.addRule(13);
        } else if (numberOffsetX > 0) {
            float f = numberOffsetX;
            if ((this.w - textView.getWidth()) - w.a(this.c, f) > 0) {
                layoutParams.setMargins(w.a(this.c, f), 0, 0, 0);
            } else {
                f.b(a, "RelativeLayout.ALIGN_PARENT_RIGHT");
                layoutParams.addRule(11);
            }
        }
        try {
            textView.setTextSize(2, this.u.getNumberSize());
        } catch (Exception unused) {
            textView.setTextSize(2, 18.0f);
        }
        textView.setText(this.j);
        textView.setId(30583);
        this.m.addView(textView, layoutParams);
        try {
            textView.setTextColor(this.u.getNumberColor());
        } catch (Exception unused2) {
            textView.setTextColor(-13421773);
        }
        int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.m.measure(makeMeasureSpec, makeMeasureSpec);
        f.b(a, "mPhoneLayout.getMeasuredHeight()=" + this.m.getMeasuredHeight());
    }

    private RelativeLayout h() {
        this.d = new RelativeLayout(this);
        this.d.setId(17476);
        this.d.setLayoutParams(new RelativeLayout.LayoutParams(w.a(this.c, this.u.getLogBtnWidth()), w.a(this.c, this.u.getLogBtnHeight())));
        TextView textView = new TextView(this);
        textView.setTextSize(2, this.u.getLogBtnTextSize());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(13);
        textView.setLayoutParams(layoutParams);
        this.d.addView(textView);
        textView.setText(this.u.getLogBtnText());
        try {
            textView.setTextColor(this.u.getLogBtnTextColor());
        } catch (Exception unused) {
            textView.setTextColor(-1);
        }
        try {
            this.d.setBackgroundResource(n.a(this.c, this.u.getLogBtnBackgroundPath()));
        } catch (Exception e) {
            e.printStackTrace();
            this.d.setBackgroundResource(n.a(this.c, "umcsdk_login_btn_bg"));
        }
        return this.d;
    }

    private LinearLayout i() {
        this.l = new LinearLayout(this);
        this.l.setOrientation(0);
        this.l.setHorizontalGravity(1);
        this.l.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        int checkedImgWidth = this.u.getCheckedImgWidth();
        int checkedImgHeight = this.u.getCheckedImgHeight();
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(w.a(this.c, checkedImgWidth > 30 ? checkedImgWidth : 30.0f), w.a(this.c, checkedImgHeight > 30 ? checkedImgHeight : 30.0f));
        this.s = new LinearLayout(this);
        this.s.setOrientation(0);
        this.s.setId(34952);
        this.s.setLayoutParams(layoutParams);
        this.k = new CheckBox(this);
        this.k.setChecked(false);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(w.a(this.c, this.u.getCheckedImgWidth()), w.a(this.c, this.u.getCheckedImgHeight()));
        layoutParams2.setMargins(w.a(this.c, checkedImgWidth > 30 ? 0.0f : 30 - checkedImgWidth), 0, 0, 0);
        this.k.setLayoutParams(layoutParams2);
        this.s.addView(this.k);
        this.l.addView(this.s);
        TextView textView = new TextView(this);
        textView.setTextSize(2, this.u.getPrivacyTextSize());
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams3.setMargins(w.a(this.c, 5.0f), 0, 0, w.a(this.c, 5.0f));
        textView.setLayoutParams(layoutParams3);
        this.l.addView(textView);
        textView.setTextColor(this.u.getClauseBaseColor());
        textView.setText(w.a(this, j(), this.t, this.e, this.f, this.g));
        textView.setLineSpacing(8.0f, 1.0f);
        textView.setIncludeFontPadding(false);
        if (this.u.isPrivacyTextGravityCenter()) {
            textView.setGravity(17);
        }
        textView.setHighlightColor(getResources().getColor(17170445));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        this.k.setButtonDrawable(new ColorDrawable());
        try {
            this.k.setBackgroundResource(n.a(this, this.u.getUncheckedImgPath()));
        } catch (Exception unused) {
            this.k.setBackgroundResource(n.a(this, "umcsdk_uncheck_image"));
        }
        return this.l;
    }

    private String j() {
        if (this.u.getPrivacy().contains(AuthThemeConfig.PLACEHOLDER2)) {
            this.t = "《" + this.t + "》";
            return this.u.getPrivacy().replace(AuthThemeConfig.PLACEHOLDER2, this.t);
        }
        return this.u.getPrivacy().replace(AuthThemeConfig.PLACEHOLDER, this.t);
    }

    public void k() {
        this.d.setClickable(true);
        this.k.setClickable(true);
    }

    private void l() {
        this.d.setClickable(false);
        this.k.setClickable(false);
    }

    public void c() {
        try {
            f.a(a, "loginClickComplete");
            if (this.u.getLoginClickListener() != null && this.x) {
                this.x = false;
                this.u.getLoginClickListener().onLoginClickComplete(this.c, null);
            } else if (this.y != null && this.y.isShowing()) {
                this.y.dismiss();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void b() {
        f.a(a, "loginClickStart");
        try {
            this.x = true;
            if (this.u.getLoginClickListener() != null) {
                this.u.getLoginClickListener().onLoginClickStart(this.c, null);
            } else if (this.y != null) {
                this.y.show();
                return;
            } else {
                this.y = new AlertDialog.Builder(this).create();
                this.y.setCancelable(false);
                this.y.setCanceledOnTouchOutside(false);
                this.y.setOnKeyListener(new DialogInterface.OnKeyListener() {
                    @Override
                    public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                        return i == 4;
                    }
                });
                RelativeLayout relativeLayout = new RelativeLayout(this.y.getContext());
                relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
                ImageView imageView = new ImageView(this.y.getContext());
                imageView.setImageResource(n.a(this.c, "dialog_loading"));
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(80, 80);
                layoutParams.addRule(13, -1);
                relativeLayout.addView(imageView, layoutParams);
                if (this.y.getWindow() != null) {
                    this.y.getWindow().setDimAmount(0.0f);
                }
                this.y.show();
                this.y.setContentView(relativeLayout);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        f.a(a, "loginClickStart");
    }

    public void a(boolean z) {
        try {
            com.cmic.sso.sdk.utils.c.a("authPageOut");
            a("200020", "登录页面关闭", this.h, null);
        } catch (Exception e) {
            com.cmic.sso.sdk.c.a.a.add(e);
            e.printStackTrace();
        }
    }

    public void a(String str, String str2, Bundle bundle, JSONObject jSONObject) {
        try {
            this.b.removeCallbacksAndMessages(null);
            if ("103000".equals(str)) {
                if (AuthnHelper.getInstance(this) != null && i.c(bundle.getString("traceId")) != null) {
                    AuthnHelper.getInstance(this).callBackResult(str, str2, bundle, jSONObject, null, true);
                }
            } else if ("200020".equals(str)) {
                if (AuthnHelper.getInstance(this) != null) {
                    if (i.c(bundle.getString("traceId")) != null) {
                        AuthnHelper.getInstance(this).callBackResult(str, str2, bundle, jSONObject, null);
                        a();
                    } else {
                        a();
                    }
                }
            } else {
                AuthnHelper.getInstance(this).callBackResult(str, str2, bundle, jSONObject, null, true);
            }
        } catch (Exception e) {
            f.a(a, "CallbackResult:未知错误");
            e.printStackTrace();
        }
    }

    public void a() {
        this.b.removeCallbacksAndMessages(null);
        com.cmic.sso.sdk.widget.a aVar = this.e;
        if (aVar != null && aVar.isShowing()) {
            this.e.dismiss();
        }
        com.cmic.sso.sdk.widget.a aVar2 = this.f;
        if (aVar2 != null && aVar2.isShowing()) {
            this.f.dismiss();
        }
        c();
        this.y = null;
        finish();
        if (this.u.getAuthPageActOut() == null || this.u.getActivityIn() == null) {
            return;
        }
        overridePendingTransition(n.b(this, this.u.getAuthPageActOut()), n.b(this, this.u.getActivityIn()));
    }
}