翰林优商.apk(点击下载) / 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 com.cmic.sso.sdk.AuthThemeConfig;
import com.cmic.sso.sdk.h.g;
import com.cmic.sso.sdk.h.n;
import com.cmic.sso.sdk.h.u;
import com.cmic.sso.sdk.h.w;
import com.cmic.sso.sdk.h.y;
import java.lang.ref.WeakReference;
import org.json.JSONException;
import org.json.JSONObject;

public class LoginAuthActivity extends Activity implements View.OnClickListener {
    protected static final String a = "LoginAuthActivity";
    private Handler b;
    private Context c;
    private RelativeLayout d;
    private com.cmic.sso.sdk.widget.a e;
    private com.cmic.sso.sdk.widget.a f;
    private com.cmic.sso.sdk.widget.a g;
    private com.cmic.sso.sdk.a h;
    private com.mobile.auth.e.f i;
    private String j = "";
    private CheckBox k;
    private LinearLayout l;
    private RelativeLayout m;
    private long n = 0;
    private int o = 0;
    private g p = null;
    private com.mobile.auth.e.e q;
    private boolean r = true;
    private LinearLayout s;
    private String t;
    private AuthThemeConfig u;
    private int v;
    private int w;
    private boolean x;
    private Dialog y;

    /* access modifiers changed from: package-private */
    public class a implements DialogInterface.OnKeyListener {
        a() {
        }

        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
            if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                LoginAuthActivity.this.e.dismiss();
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class b implements DialogInterface.OnKeyListener {
        b() {
        }

        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
            if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                LoginAuthActivity.this.f.dismiss();
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class c implements DialogInterface.OnKeyListener {
        c() {
        }

        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
            if (i == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                LoginAuthActivity.this.g.dismiss();
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class d implements g.a {
        d() {
        }
    }

    /* access modifiers changed from: package-private */
    public class e implements CompoundButton.OnCheckedChangeListener {
        e() {
        }

        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            CheckBox checkBox;
            LoginAuthActivity loginAuthActivity;
            String str;
            if (z) {
                LoginAuthActivity.this.d.setEnabled(true);
                try {
                    CheckBox checkBox2 = LoginAuthActivity.this.k;
                    LoginAuthActivity loginAuthActivity2 = LoginAuthActivity.this;
                    checkBox2.setBackgroundResource(n.b(loginAuthActivity2, loginAuthActivity2.u.getCheckedImgPath()));
                } catch (Exception unused) {
                    checkBox = LoginAuthActivity.this.k;
                    loginAuthActivity = LoginAuthActivity.this;
                    str = "umcsdk_check_image";
                    checkBox.setBackgroundResource(n.b(loginAuthActivity, str));
                }
            } else {
                LoginAuthActivity.this.d.setEnabled(true ^ TextUtils.isEmpty(LoginAuthActivity.this.u.getCheckTipText()));
                try {
                    CheckBox checkBox3 = LoginAuthActivity.this.k;
                    LoginAuthActivity loginAuthActivity3 = LoginAuthActivity.this;
                    checkBox3.setBackgroundResource(n.b(loginAuthActivity3, loginAuthActivity3.u.getUncheckedImgPath()));
                } catch (Exception unused2) {
                    checkBox = LoginAuthActivity.this.k;
                    loginAuthActivity = LoginAuthActivity.this;
                    str = "umcsdk_uncheck_image";
                    checkBox.setBackgroundResource(n.b(loginAuthActivity, str));
                }
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class f implements DialogInterface.OnKeyListener {
        f(LoginAuthActivity loginAuthActivity) {
        }

        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
            return i == 4;
        }
    }

    /* access modifiers changed from: package-private */
    public static class g extends Handler {
        WeakReference<LoginAuthActivity> a;

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

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

        public void handleMessage(Message message) {
            try {
                a(message);
            } catch (Exception e) {
                com.mobile.auth.i.a.a.add(e);
                e.printStackTrace();
            }
        }
    }

    /* access modifiers changed from: package-private */
    public static class h extends u.a {
        WeakReference<LoginAuthActivity> a;
        WeakReference<i> b;

        class a implements com.mobile.auth.e.g {
            final /* synthetic */ LoginAuthActivity a;

            /* renamed from: com.cmic.sso.sdk.activity.LoginAuthActivity$h$a$a  reason: collision with other inner class name */
            class C0027a implements com.mobile.auth.e.g {
                C0027a() {
                }

                @Override // com.mobile.auth.e.g
                public void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
                    if (h.this.b()) {
                        long b = aVar.b("loginTime");
                        if (b != 0) {
                            aVar.b("loginTime", System.currentTimeMillis() - b);
                        }
                        String c = aVar.c("phonescrip");
                        if (!"103000".equals(str) || TextUtils.isEmpty(c)) {
                            a.this.a.r = false;
                            com.cmic.sso.sdk.h.c.a("authClickFailed");
                        } else {
                            com.cmic.sso.sdk.h.c.a("authClickSuccess");
                            a.this.a.r = true;
                        }
                        a.this.a.a(str, str2, aVar, jSONObject);
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        a.this.a.p.sendEmptyMessage(13);
                    }
                }
            }

            a(LoginAuthActivity loginAuthActivity) {
                this.a = loginAuthActivity;
            }

            @Override // com.mobile.auth.e.g
            public void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
                if (h.this.b()) {
                    if ("103000".equals(str)) {
                        this.a.i.a(this.a.h, new C0027a());
                        return;
                    }
                    this.a.r = false;
                    this.a.a(str, str2, aVar, jSONObject);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    this.a.p.sendEmptyMessage(13);
                }
            }
        }

        class b implements com.mobile.auth.e.g {
            final /* synthetic */ LoginAuthActivity a;

            b(LoginAuthActivity loginAuthActivity) {
                this.a = loginAuthActivity;
            }

            @Override // com.mobile.auth.e.g
            public void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
                if (h.this.b()) {
                    long b2 = aVar.b("loginTime");
                    String c = aVar.c("phonescrip");
                    if (b2 != 0) {
                        aVar.b("loginTime", System.currentTimeMillis() - b2);
                    }
                    if (!"103000".equals(str) || TextUtils.isEmpty(c)) {
                        this.a.r = false;
                        com.cmic.sso.sdk.h.c.a("authClickFailed");
                    } else {
                        com.cmic.sso.sdk.h.c.a("authClickSuccess");
                        this.a.r = true;
                    }
                    this.a.a(str, str2, aVar, jSONObject);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    this.a.p.sendEmptyMessage(13);
                }
            }
        }

        protected h(LoginAuthActivity loginAuthActivity, i iVar) {
            this.a = new WeakReference<>(loginAuthActivity);
            this.b = new WeakReference<>(iVar);
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private boolean b() {
            i iVar = this.b.get();
            if (this.a.get() == null || iVar == null) {
                return false;
            }
            return iVar.a(false);
        }

        @Override // com.cmic.sso.sdk.h.u.a
        public void a() {
            LoginAuthActivity loginAuthActivity = this.a.get();
            if (!loginAuthActivity.r) {
                loginAuthActivity.i.a(loginAuthActivity.h, "3", new a(loginAuthActivity));
            } else {
                loginAuthActivity.i.a(loginAuthActivity.h, new b(loginAuthActivity));
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class i implements Runnable {
        private com.cmic.sso.sdk.a b;
        private boolean c;

        i(com.cmic.sso.sdk.a aVar) {
            this.b = aVar;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private synchronized boolean a(boolean z) {
            boolean z2;
            z2 = this.c;
            this.c = z;
            return !z2;
        }

        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.h.c.a("authClickFailed");
                LoginAuthActivity.this.p.sendEmptyMessage(13);
                long b2 = this.b.b("loginTime");
                if (b2 != 0) {
                    this.b.b("loginTime", System.currentTimeMillis() - b2);
                }
                LoginAuthActivity.this.a("102507", "请求超时", this.b, jSONObject);
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
        try {
            this.b.removeCallbacksAndMessages(null);
            if ("103000".equals(str)) {
                if (com.mobile.auth.e.a.a(this) != null && com.cmic.sso.sdk.h.i.c(aVar.c("traceId")) != null) {
                    com.mobile.auth.e.a.a(this).a(str, str2, aVar, jSONObject, (Throwable) null, true);
                }
            } else if (!"200020".equals(str)) {
                com.mobile.auth.e.a.a(this).a(str, str2, aVar, jSONObject, (Throwable) null, true);
            } else if (com.mobile.auth.e.a.a(this) == null) {
            } else {
                if (com.cmic.sso.sdk.h.i.c(aVar.c("traceId")) != null) {
                    com.mobile.auth.e.a.a(this).a(str, str2, aVar, jSONObject, null);
                    a();
                    return;
                }
                a();
            }
        } catch (Exception e2) {
            com.cmic.sso.sdk.h.f.a(a, "CallbackResult:未知错误");
            e2.printStackTrace();
        }
    }

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

    private void d() {
        String str;
        com.cmic.sso.sdk.a d2 = com.cmic.sso.sdk.h.i.d(getIntent().getStringExtra("traceId"));
        this.h = d2;
        if (d2 == null) {
            this.h = new com.cmic.sso.sdk.a(0);
        }
        this.q = com.cmic.sso.sdk.h.i.c(this.h.a("traceId", ""));
        getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
        this.b = new Handler(getMainLooper());
        this.p = new g(this);
        this.j = this.h.c("securityphone");
        String str2 = a;
        com.cmic.sso.sdk.h.f.b(str2, "mSecurityPhone value is " + this.j);
        String a2 = this.h.a("operatorType", "");
        com.cmic.sso.sdk.h.f.b(str2, "operator value is ".concat(String.valueOf(a2)));
        if (a2.equals("1")) {
            this.t = "中国移动认证服务条款";
            str = "http://wap.cmpassport.com/resources/html/contract.html";
        } else if (a2.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";
        }
        com.cmic.sso.sdk.widget.a aVar = new com.cmic.sso.sdk.widget.a(this.c, 16973840, null, str);
        this.e = aVar;
        aVar.setOnKeyListener(new a());
        if (!TextUtils.isEmpty(this.u.getClauseUrl())) {
            com.cmic.sso.sdk.widget.a aVar2 = new com.cmic.sso.sdk.widget.a(this.c, 16973840, this.u.getClauseName(), this.u.getClauseUrl());
            this.f = aVar2;
            aVar2.setOnKeyListener(new b());
        }
        if (!TextUtils.isEmpty(this.u.getClauseUrl2())) {
            com.cmic.sso.sdk.widget.a aVar3 = new com.cmic.sso.sdk.widget.a(this.c, 16973840, this.u.getClauseName2(), this.u.getClauseUrl2());
            this.g = aVar3;
            aVar3.setOnKeyListener(new c());
        }
        com.cmic.sso.sdk.h.g.a().a(new d());
    }

    /* JADX WARNING: Removed duplicated region for block: B:35:0x01b1  */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x01cf  */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x01fe  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0286  */
    private void e() {
        RelativeLayout.LayoutParams layoutParams;
        int privacyMarginLeft;
        int max;
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.m.getLayoutParams();
        if (this.u.getNumFieldOffsetY() > 0 || this.u.getNumFieldOffsetY_B() < 0) {
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.m.measure(makeMeasureSpec, makeMeasureSpec);
            String str = a;
            com.cmic.sso.sdk.h.f.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.m.getMeasuredHeight());
            if (this.u.getNumFieldOffsetY() <= 0 || (this.v - this.m.getMeasuredHeight()) - w.a(this.c, (float) this.u.getNumFieldOffsetY()) <= 0) {
                layoutParams2.addRule(12, -1);
            } else {
                com.cmic.sso.sdk.h.f.b(str, "numberField_top");
                layoutParams2.addRule(10, -1);
                layoutParams2.setMargins(0, w.a(this.c, (float) this.u.getNumFieldOffsetY()), 0, 0);
            }
        } else if (this.u.getNumFieldOffsetY_B() <= 0 || (this.v - this.m.getMeasuredHeight()) - w.a(this.c, (float) this.u.getNumFieldOffsetY_B()) <= 0) {
            layoutParams2.addRule(10, -1);
        } else {
            com.cmic.sso.sdk.h.f.b(a, "numberField_bottom");
            layoutParams2.addRule(12, -1);
            layoutParams2.setMargins(0, 0, 0, w.a(this.c, (float) this.u.getNumFieldOffsetY_B()));
        }
        this.m.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.d.getLayoutParams();
        int max2 = Math.max(this.u.getLogBtnMarginLeft(), 0);
        int max3 = Math.max(this.u.getLogBtnMarginRight(), 0);
        if (this.u.getLogBtnOffsetY() > 0 || this.u.getLogBtnOffsetY_B() < 0) {
            if (this.u.getLogBtnOffsetY() <= 0 || this.v - w.a(this.c, (float) (this.u.getLogBtnHeight() + this.u.getLogBtnOffsetY())) <= 0) {
                layoutParams3.addRule(12, -1);
            } else {
                com.cmic.sso.sdk.h.f.b(a, "logBtn_top");
                layoutParams3.addRule(10, -1);
                layoutParams3.setMargins(w.a(this.c, (float) max2), w.a(this.c, (float) this.u.getLogBtnOffsetY()), w.a(this.c, (float) max3), 0);
                this.d.setLayoutParams(layoutParams3);
                layoutParams = (RelativeLayout.LayoutParams) this.l.getLayoutParams();
                privacyMarginLeft = this.u.getPrivacyMarginLeft() >= 0 ? this.u.getCheckedImgWidth() > 30 ? this.u.getPrivacyMarginLeft() : this.u.getPrivacyMarginLeft() - (30 - this.u.getCheckedImgWidth()) : this.u.getCheckedImgWidth() > 30 ? 0 : -(30 - this.u.getCheckedImgWidth());
                max = Math.max(this.u.getPrivacyMarginRight(), 0);
                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() > 0 || (this.v - this.l.getMeasuredHeight()) - w.a(this.c, (float) this.u.getPrivacyOffsetY()) <= 0) {
                        com.cmic.sso.sdk.h.f.b(a, "privacy_bottom=".concat(String.valueOf(privacyMarginLeft)));
                        layoutParams.addRule(12, -1);
                        layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), 0, w.a(this.c, (float) max), 0);
                    } else {
                        String str2 = a;
                        com.cmic.sso.sdk.h.f.b(str2, "privacy_top = " + this.l.getMeasuredHeight());
                        layoutParams.addRule(10, -1);
                        layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), w.a(this.c, (float) this.u.getPrivacyOffsetY()), w.a(this.c, (float) max), 0);
                    }
                } else if (this.u.getPrivacyOffsetY_B() <= 0 || (this.v - this.l.getMeasuredHeight()) - w.a(this.c, (float) this.u.getPrivacyOffsetY_B()) <= 0) {
                    layoutParams.addRule(10, -1);
                    layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), 0, w.a(this.c, (float) max), 0);
                    com.cmic.sso.sdk.h.f.b(a, "privacy_top");
                } else {
                    String str3 = a;
                    com.cmic.sso.sdk.h.f.b(str3, "privacy_bottom=" + this.l.getMeasuredHeight());
                    layoutParams.addRule(12, -1);
                    layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), 0, w.a(this.c, (float) max), w.a(this.c, (float) this.u.getPrivacyOffsetY_B()));
                }
                this.l.setLayoutParams(layoutParams);
            }
        } else if (this.u.getLogBtnOffsetY_B() <= 0 || this.v - w.a(this.c, (float) (this.u.getLogBtnHeight() + this.u.getLogBtnOffsetY_B())) <= 0) {
            layoutParams3.addRule(10, -1);
        } else {
            com.cmic.sso.sdk.h.f.b(a, "logBtn_bottom");
            layoutParams3.addRule(12, -1);
            layoutParams3.setMargins(w.a(this.c, (float) max2), 0, w.a(this.c, (float) max3), w.a(this.c, (float) this.u.getLogBtnOffsetY_B()));
            this.d.setLayoutParams(layoutParams3);
            layoutParams = (RelativeLayout.LayoutParams) this.l.getLayoutParams();
            if (this.u.getPrivacyMarginLeft() >= 0) {
            }
            max = Math.max(this.u.getPrivacyMarginRight(), 0);
            int makeMeasureSpec22 = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.l.measure(makeMeasureSpec22, makeMeasureSpec22);
            if (this.u.getPrivacyOffsetY() <= 0) {
            }
            if (this.u.getPrivacyOffsetY() > 0) {
            }
            com.cmic.sso.sdk.h.f.b(a, "privacy_bottom=".concat(String.valueOf(privacyMarginLeft)));
            layoutParams.addRule(12, -1);
            layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), 0, w.a(this.c, (float) max), 0);
            this.l.setLayoutParams(layoutParams);
        }
        layoutParams3.setMargins(w.a(this.c, (float) max2), 0, w.a(this.c, (float) max3), 0);
        this.d.setLayoutParams(layoutParams3);
        layoutParams = (RelativeLayout.LayoutParams) this.l.getLayoutParams();
        if (this.u.getPrivacyMarginLeft() >= 0) {
        }
        max = Math.max(this.u.getPrivacyMarginRight(), 0);
        int makeMeasureSpec222 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.l.measure(makeMeasureSpec222, makeMeasureSpec222);
        if (this.u.getPrivacyOffsetY() <= 0) {
        }
        if (this.u.getPrivacyOffsetY() > 0) {
        }
        com.cmic.sso.sdk.h.f.b(a, "privacy_bottom=".concat(String.valueOf(privacyMarginLeft)));
        layoutParams.addRule(12, -1);
        layoutParams.setMargins(w.a(this.c, (float) privacyMarginLeft), 0, w.a(this.c, (float) max), 0);
        this.l.setLayoutParams(layoutParams);
    }

    private void f() {
        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().addFlags(67108864);
            getWindow().addFlags(134217728);
            if (this.u.getStatusBarColor() != 0) {
                getWindow().addFlags(Integer.MIN_VALUE);
                getWindow().clearFlags(67108864);
                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);
        int a2 = w.a(this.c);
        this.w = a2;
        if ((requestedOrientation == 1 && a2 > this.v) || (requestedOrientation == 0 && a2 < this.v)) {
            this.w = this.v;
            this.v = a2;
        }
        String str = a;
        com.cmic.sso.sdk.h.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, (float) this.u.getWindowWidth());
            int a3 = w.a(this.c, (float) this.u.getWindowHeight());
            attributes.height = a3;
            this.w = attributes.width;
            this.v = a3;
            attributes.x = w.a(this.c, (float) this.u.getWindowX());
            if (this.u.getWindowBottom() == 1) {
                getWindow().setGravity(80);
            } else {
                attributes.y = w.a(this.c, (float) 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 e());
            k();
            try {
                if (this.u.isPrivacyState()) {
                    this.k.setChecked(true);
                    this.k.setBackgroundResource(n.b(this, this.u.getCheckedImgPath()));
                    this.d.setEnabled(true);
                    return;
                }
                this.k.setChecked(false);
                this.d.setEnabled(!TextUtils.isEmpty(this.u.getCheckTipText()));
                this.k.setBackgroundResource(n.b(this, this.u.getUncheckedImgPath()));
            } catch (Exception unused) {
                this.k.setChecked(false);
            }
        } catch (Exception e2) {
            com.mobile.auth.i.a.a.add(e2);
            e2.printStackTrace();
            com.cmic.sso.sdk.h.f.a(a, e2.toString());
            a("200040", "UI资源加载异常", this.h, null);
        }
    }

    private void g() {
        int i2;
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.m = relativeLayout;
        relativeLayout.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) {
            i2 = 13;
        } else {
            if (numberOffsetX > 0) {
                float f2 = (float) numberOffsetX;
                if ((this.w - textView.getWidth()) - w.a(this.c, f2) > 0) {
                    layoutParams.setMargins(w.a(this.c, f2), 0, 0, 0);
                } else {
                    com.cmic.sso.sdk.h.f.b(a, "RelativeLayout.ALIGN_PARENT_RIGHT");
                    i2 = 11;
                }
            }
            textView.setTextSize(2, (float) this.u.getNumberSize());
            textView.setText(this.j);
            textView.setId(30583);
            this.m.addView(textView, layoutParams);
            textView.setTextColor(this.u.getNumberColor());
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.m.measure(makeMeasureSpec, makeMeasureSpec);
            String str = a;
            com.cmic.sso.sdk.h.f.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.m.getMeasuredHeight());
        }
        layoutParams.addRule(i2);
        try {
            textView.setTextSize(2, (float) 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 makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.m.measure(makeMeasureSpec2, makeMeasureSpec2);
        String str2 = a;
        com.cmic.sso.sdk.h.f.b(str2, "mPhoneLayout.getMeasuredHeight()=" + this.m.getMeasuredHeight());
    }

    private RelativeLayout h() {
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.d = relativeLayout;
        relativeLayout.setId(17476);
        this.d.setLayoutParams(new RelativeLayout.LayoutParams(w.a(this.c, (float) this.u.getLogBtnWidth()), w.a(this.c, (float) this.u.getLogBtnHeight())));
        TextView textView = new TextView(this);
        textView.setTextSize(2, (float) 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.b(this.c, this.u.getLogBtnBackgroundPath()));
        } catch (Exception e2) {
            e2.printStackTrace();
            this.d.setBackgroundResource(n.b(this.c, "umcsdk_login_btn_bg"));
        }
        return this.d;
    }

    private LinearLayout i() {
        LinearLayout linearLayout = new LinearLayout(this);
        this.l = linearLayout;
        linearLayout.setOrientation(0);
        this.l.setHorizontalGravity(1);
        this.l.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        int checkedImgWidth = this.u.getCheckedImgWidth();
        int checkedImgHeight = this.u.getCheckedImgHeight();
        float f2 = 30.0f;
        int a2 = w.a(this.c, checkedImgWidth > 30 ? (float) checkedImgWidth : 30.0f);
        Context context = this.c;
        if (checkedImgHeight > 30) {
            f2 = (float) checkedImgHeight;
        }
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(a2, w.a(context, f2));
        LinearLayout linearLayout2 = new LinearLayout(this);
        this.s = linearLayout2;
        linearLayout2.setOrientation(0);
        this.s.setId(34952);
        this.s.setLayoutParams(layoutParams);
        CheckBox checkBox = new CheckBox(this);
        this.k = checkBox;
        checkBox.setChecked(false);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(w.a(this.c, (float) this.u.getCheckedImgWidth()), w.a(this.c, (float) this.u.getCheckedImgHeight()));
        layoutParams2.setMargins(w.a(this.c, checkedImgWidth > 30 ? 0.0f : (float) (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, (float) 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.b(this, this.u.getUncheckedImgPath()));
        } catch (Exception unused) {
            this.k.setBackgroundResource(n.b(this, "umcsdk_uncheck_image"));
        }
        return this.l;
    }

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

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void k() {
        this.d.setClickable(true);
        this.k.setClickable(true);
    }

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

    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) {
                com.cmic.sso.sdk.h.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.b("caller", sb.toString());
            this.h.b("loginTime", System.currentTimeMillis());
            String a2 = this.h.a("traceId", "");
            if (!TextUtils.isEmpty(a2) && com.cmic.sso.sdk.h.i.a(a2)) {
                String b2 = y.b();
                this.h.b("traceId", b2);
                com.cmic.sso.sdk.h.i.a(b2, this.q);
            }
            b();
            l();
            i iVar = new i(this.h);
            this.b.postDelayed(iVar, com.mobile.auth.e.a.a(this).b());
            u.a(new h(this, iVar));
        } catch (Exception e2) {
            e2.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) {
            overridePendingTransition(n.c(this, this.u.getActivityIn()), n.c(this, this.u.getAuthPageActOut()));
        }
    }

    public void b() {
        com.cmic.sso.sdk.h.f.a(a, "loginClickStart");
        try {
            this.x = true;
            if (this.u.getLoginClickListener() != null) {
                this.u.getLoginClickListener().a(this.c, null);
            } else {
                Dialog dialog = this.y;
                if (dialog != null) {
                    dialog.show();
                    return;
                }
                AlertDialog create = new AlertDialog.Builder(this).create();
                this.y = create;
                create.setCancelable(false);
                this.y.setCanceledOnTouchOutside(false);
                this.y.setOnKeyListener(new f(this));
                RelativeLayout relativeLayout = new RelativeLayout(this.y.getContext());
                relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
                ImageView imageView = new ImageView(this.y.getContext());
                imageView.setImageResource(n.b(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 e2) {
            e2.printStackTrace();
        }
        com.cmic.sso.sdk.h.f.a(a, "loginClickStart");
    }

    public void c() {
        try {
            com.cmic.sso.sdk.h.f.a(a, "loginClickComplete");
            if (this.u.getLoginClickListener() == null || !this.x) {
                Dialog dialog = this.y;
                if (dialog != null && dialog.isShowing()) {
                    this.y.dismiss();
                    return;
                }
                return;
            }
            this.x = false;
            this.u.getLoginClickListener().b(this.c, null);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void onClick(View view) {
        try {
            int id = view.getId();
            if (id != 17476) {
                if (id == 26214) {
                    a(false);
                } else if (id != 34952) {
                } else {
                    if (this.k.isChecked()) {
                        this.k.setChecked(false);
                    } else {
                        this.k.setChecked(true);
                    }
                }
            } else if (this.k.isChecked() || TextUtils.isEmpty(this.u.getCheckTipText())) {
                this.o++;
                m();
            } else {
                Toast.makeText(this.c, this.u.getCheckTipText(), 1).show();
            }
        } catch (Exception e2) {
            com.mobile.auth.i.a.a.add(e2);
            e2.printStackTrace();
        }
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            if (bundle != null) {
                finish();
            }
            this.c = this;
            AuthThemeConfig a2 = com.mobile.auth.e.a.a(this).a();
            this.u = a2;
            if (a2 != null) {
                if (a2.getThemeId() != -1) {
                    setTheme(this.u.getThemeId());
                }
                if (!(this.u.getAuthPageActIn() == null || this.u.getActivityOut() == null)) {
                    overridePendingTransition(n.c(this, this.u.getAuthPageActIn()), n.c(this, this.u.getActivityOut()));
                }
            }
            com.cmic.sso.sdk.h.c.a("authPageIn");
            this.n = System.currentTimeMillis();
            this.i = com.mobile.auth.e.f.a(this);
            d();
            f();
        } catch (Exception e2) {
            com.mobile.auth.i.a.a.add(e2);
            com.cmic.sso.sdk.h.f.a(a, e2.toString());
            e2.printStackTrace();
            a("200025", "发生未知错误", this.h, null);
        }
    }

    /* access modifiers changed from: protected */
    public void onDestroy() {
        try {
            this.b.removeCallbacksAndMessages(null);
            StringBuilder sb = new StringBuilder();
            sb.append(System.currentTimeMillis() - this.n);
            com.cmic.sso.sdk.h.c.a("timeOnAuthPage", sb.toString());
            com.cmic.sso.sdk.h.c.a("authPrivacyState", this.k.isChecked() ? "1" : "0");
            if (!this.h.a("isLoginSwitch", false)) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(System.currentTimeMillis() - this.n);
                com.cmic.sso.sdk.h.c.a("timeOnAuthPage", sb2.toString());
                com.cmic.sso.sdk.h.c.a(this.c.getApplicationContext(), this.h);
                com.cmic.sso.sdk.h.c.a();
            }
            this.y = null;
            com.cmic.sso.sdk.h.g.a().b();
            this.p.removeCallbacksAndMessages(null);
        } catch (Exception e2) {
            com.cmic.sso.sdk.h.f.a(a, "LoginAuthActivity clear failed");
            com.mobile.auth.i.a.a.add(e2);
            e2.printStackTrace();
        }
        super.onDestroy();
    }

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

    /* access modifiers changed from: protected */
    public void onResume() {
        super.onResume();
        try {
            com.cmic.sso.sdk.a aVar = this.h;
            if (aVar != null) {
                aVar.b("loginMethod", "loginAuth");
            }
            com.mobile.auth.e.a.a(this).a("200087", null);
        } catch (Exception e2) {
            com.mobile.auth.i.a.a.add(e2);
            a("200025", "发生未知错误", this.h, null);
        }
    }
}