CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05

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


package com.cmic.sso.sdk.view;

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.Typeface;
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.view.animation.AnimationUtils;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import cn.tee3.avd.RolePrivilege;
import com.cmic.sso.sdk.view.f;
import com.mobile.auth.gatewayauth.Constant;
import com.mobile.auth.n.n;
import com.mobile.auth.n.q;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginAuthActivity extends Activity implements View.OnClickListener {
    protected static final String a = LoginAuthActivity.class.getSimpleName();
    private com.cmic.sso.sdk.view.a A;
    private int B;
    private int C;
    private boolean D;
    private Dialog E;
    private Handler f7476b;
    private Context f7477c;
    private RelativeLayout f7478d;
    private h f7479e;
    private h f;
    private h g;
    private h h;
    private h i;
    private ArrayList<h> j;
    private ArrayList<String> k;
    private String[] l;
    private com.cmic.sso.sdk.a m;
    private com.mobile.auth.g.c n;
    private CheckBox p;
    private RelativeLayout q;
    private RelativeLayout r;
    private com.mobile.auth.g.b v;
    private RelativeLayout x;
    private String y;
    private String z;
    private String o = "";
    private long s = 0;
    private int t = 0;
    private a u = null;
    private boolean w = true;

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

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

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

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

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

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

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

        @Override
        protected void a() {
            final LoginAuthActivity loginAuthActivity = this.a.get();
            loginAuthActivity.m.a("logintype", 1);
            com.mobile.auth.n.h.a(true, false);
            loginAuthActivity.n.b(loginAuthActivity.m, new com.mobile.auth.g.d() {
                @Override
                public void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
                    if (b.this.b()) {
                        long b2 = aVar.b("loginTime", 0L);
                        String b3 = aVar.b("phonescrip");
                        if (b2 != 0) {
                            aVar.a("loginTime", System.currentTimeMillis() - b2);
                        }
                        if (!"103000".equals(str) || TextUtils.isEmpty(b3)) {
                            loginAuthActivity.w = false;
                            com.cmic.sso.sdk.d.a.a("authClickFailed");
                        } else {
                            com.cmic.sso.sdk.d.a.a("authClickSuccess");
                            loginAuthActivity.w = true;
                        }
                        loginAuthActivity.a(str, str2, aVar, jSONObject);
                        try {
                            Thread.sleep(1000L);
                        } catch (InterruptedException e2) {
                            e2.printStackTrace();
                        }
                        loginAuthActivity.u.sendEmptyMessage(1);
                    }
                }
            });
        }
    }

    public class c implements Runnable {
        private com.cmic.sso.sdk.a f7482b;
        private boolean f7483c;

        c(com.cmic.sso.sdk.a aVar) {
            this.f7482b = aVar;
        }

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

        @Override
        public void run() {
            if (a(true)) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("resultCode", "102507");
                    jSONObject.put("resultString", "请求超时");
                } catch (JSONException e2) {
                    e2.printStackTrace();
                }
                LoginAuthActivity.this.w = false;
                com.cmic.sso.sdk.d.a.a("authClickFailed");
                LoginAuthActivity.this.u.sendEmptyMessage(1);
                long b2 = this.f7482b.b("loginTime", 0L);
                if (b2 != 0) {
                    this.f7482b.a("loginTime", System.currentTimeMillis() - b2);
                }
                LoginAuthActivity.this.a("102507", "请求超时", this.f7482b, jSONObject);
            }
        }
    }

    public void a(String str, String str2, com.cmic.sso.sdk.a aVar, JSONObject jSONObject) {
        com.mobile.auth.g.a a2;
        try {
            this.f7476b.removeCallbacksAndMessages(null);
            if ("103000".equals(str)) {
                if (com.mobile.auth.g.a.a(this) == null || com.mobile.auth.n.e.c(aVar.b("traceId")) == null) {
                    return;
                }
                aVar.a("keepListener", true);
                a2 = com.mobile.auth.g.a.a(this);
            } else if ("200020".equals(str)) {
                if (com.mobile.auth.g.a.a(this) != null) {
                    if (com.mobile.auth.n.e.c(aVar.b("traceId")) != null) {
                        com.mobile.auth.g.a.a(this).a(str, str2, aVar, jSONObject);
                    }
                    a();
                    return;
                }
                return;
            } else {
                aVar.a("keepListener", true);
                a2 = com.mobile.auth.g.a.a(this);
            }
            a2.a(str, str2, aVar, jSONObject);
        } catch (Exception e2) {
            com.mobile.auth.n.c.a(a, "CallbackResult:未知错误");
            e2.printStackTrace();
        }
    }

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

    private void d() {
        String str;
        com.cmic.sso.sdk.a d2 = com.mobile.auth.n.e.d(getIntent().getStringExtra("traceId"));
        this.m = d2;
        if (d2 == null) {
            this.m = new com.cmic.sso.sdk.a(0);
        }
        this.v = com.mobile.auth.n.e.c(this.m.b("traceId", ""));
        getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
        this.f7476b = new Handler(getMainLooper());
        this.u = new a(this);
        this.o = this.m.b("securityphone");
        String str2 = a;
        com.mobile.auth.n.c.b(str2, "mSecurityPhone value is " + this.o);
        String b2 = this.m.b("operatortype", "");
        com.mobile.auth.n.c.b(str2, "operator value is " + b2);
        if (this.A.ap() == 1) {
            this.l = com.cmic.sso.sdk.c.f7465b;
        } else if (this.A.ap() == 2) {
            this.l = com.cmic.sso.sdk.c.f7466c;
        } else {
            this.l = com.cmic.sso.sdk.c.a;
        }
        if (b2.equals("1")) {
            this.y = this.l[0];
            str = "http://wap.cmpassport.com/resources/html/contract.html";
        } else if (b2.equals("3")) {
            this.y = this.l[1];
            str = Constant.CTCC_PROTOCOL_URL;
        } else {
            this.y = this.l[2];
            str = Constant.CUCC_PROTOCOL_URL;
        }
        h hVar = new h(this.f7477c, 16973840, this.y, str);
        this.f7479e = hVar;
        hVar.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.f7479e.b();
                }
                return true;
            }
        });
        this.j = new ArrayList<>();
        this.k = new ArrayList<>();
        if (!TextUtils.isEmpty(this.A.N())) {
            h hVar2 = new h(this.f7477c, 16973840, this.A.M(), this.A.N());
            this.f = hVar2;
            hVar2.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.b();
                    }
                    return true;
                }
            });
            this.j.add(this.f);
            this.k.add(this.A.M());
        }
        if (!TextUtils.isEmpty(this.A.P())) {
            h hVar3 = new h(this.f7477c, 16973840, this.A.O(), this.A.P());
            this.g = hVar3;
            hVar3.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.b();
                    }
                    return true;
                }
            });
            this.j.add(this.g);
            this.k.add(this.A.O());
        }
        if (!TextUtils.isEmpty(this.A.R())) {
            h hVar4 = new h(this.f7477c, 16973840, this.A.Q(), this.A.R());
            this.h = hVar4;
            hVar4.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.h.b();
                    }
                    return true;
                }
            });
            this.j.add(this.h);
            this.k.add(this.A.Q());
        }
        if (!TextUtils.isEmpty(this.A.T())) {
            h hVar5 = new h(this.f7477c, 16973840, this.A.S(), this.A.T());
            this.i = hVar5;
            hVar5.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.i.b();
                    }
                    return true;
                }
            });
            this.j.add(this.i);
            this.k.add(this.A.S());
        }
        j();
        if (this.A.ad()) {
            for (int i = 0; i < this.k.size(); i++) {
                String format = String.format("《%s》", this.k.get(i));
                this.z = this.z.replaceFirst(this.k.get(i), format);
                this.k.set(i, format);
            }
        }
        f.a().a(new f.a() {
            @Override
            public void a() {
                LoginAuthActivity.this.f7476b.removeCallbacksAndMessages(null);
                if (LoginAuthActivity.this.f7479e != null && LoginAuthActivity.this.f7479e.isShowing()) {
                    LoginAuthActivity.this.f7479e.dismiss();
                }
                if (LoginAuthActivity.this.f != null && LoginAuthActivity.this.f.isShowing()) {
                    LoginAuthActivity.this.f.dismiss();
                }
                LoginAuthActivity.this.a(true);
            }
        });
    }

    private void e() {
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.r.getLayoutParams();
        if (this.A.p() > 0 || this.A.q() < 0) {
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.r.measure(makeMeasureSpec, makeMeasureSpec);
            String str = a;
            com.mobile.auth.n.c.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.r.getMeasuredHeight());
            if (this.A.p() <= 0 || (this.B - this.r.getMeasuredHeight()) - i.a(this.f7477c, this.A.p()) <= 0) {
                layoutParams.addRule(12, -1);
            } else {
                com.mobile.auth.n.c.b(str, "numberField_top");
                layoutParams.addRule(10, -1);
                layoutParams.setMargins(0, i.a(this.f7477c, this.A.p()), 0, 0);
            }
        } else if (this.A.q() <= 0 || (this.B - this.r.getMeasuredHeight()) - i.a(this.f7477c, this.A.q()) <= 0) {
            layoutParams.addRule(10, -1);
        } else {
            com.mobile.auth.n.c.b(a, "numberField_bottom");
            layoutParams.addRule(12, -1);
            layoutParams.setMargins(0, 0, 0, i.a(this.f7477c, this.A.q()));
        }
        this.r.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f7478d.getLayoutParams();
        int max = Math.max(this.A.y(), 0);
        int max2 = Math.max(this.A.z(), 0);
        if (this.A.A() > 0 || this.A.B() < 0) {
            if (this.A.A() <= 0 || this.B - i.a(this.f7477c, this.A.x() + this.A.A()) <= 0) {
                layoutParams2.addRule(12, -1);
                layoutParams2.setMargins(i.a(this.f7477c, max), 0, i.a(this.f7477c, max2), 0);
            } else {
                com.mobile.auth.n.c.b(a, "logBtn_top");
                layoutParams2.addRule(10, -1);
                layoutParams2.setMargins(i.a(this.f7477c, max), i.a(this.f7477c, this.A.A()), i.a(this.f7477c, max2), 0);
            }
        } else if (this.A.B() <= 0 || this.B - i.a(this.f7477c, this.A.x() + this.A.B()) <= 0) {
            layoutParams2.addRule(10, -1);
            layoutParams2.setMargins(i.a(this.f7477c, max), 0, i.a(this.f7477c, max2), 0);
        } else {
            com.mobile.auth.n.c.b(a, "logBtn_bottom");
            layoutParams2.addRule(12, -1);
            layoutParams2.setMargins(i.a(this.f7477c, max), 0, i.a(this.f7477c, max2), i.a(this.f7477c, this.A.B()));
        }
        this.f7478d.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.q.getLayoutParams();
        int Z = this.A.Z() >= 0 ? this.A.I() > 30 ? this.A.Z() : this.A.Z() - (30 - this.A.I()) : this.A.I() > 30 ? 0 : -(30 - this.A.I());
        int max3 = Math.max(this.A.aa(), 0);
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.q.measure(makeMeasureSpec2, makeMeasureSpec2);
        if (this.A.ab() > 0 || this.A.ac() < 0) {
            if (this.A.ab() <= 0 || (this.B - this.q.getMeasuredHeight()) - i.a(this.f7477c, this.A.ab()) <= 0) {
                String str2 = a;
                com.mobile.auth.n.c.b(str2, "privacy_bottom=" + Z);
                layoutParams3.addRule(12, -1);
                layoutParams3.setMargins(i.a(this.f7477c, (float) Z), 0, i.a(this.f7477c, (float) max3), 0);
            } else {
                String str3 = a;
                com.mobile.auth.n.c.b(str3, "privacy_top = " + this.q.getMeasuredHeight());
                layoutParams3.addRule(10, -1);
                layoutParams3.setMargins(i.a(this.f7477c, (float) Z), i.a(this.f7477c, (float) this.A.ab()), i.a(this.f7477c, (float) max3), 0);
            }
        } else if (this.A.ac() <= 0 || (this.B - this.q.getMeasuredHeight()) - i.a(this.f7477c, this.A.ac()) <= 0) {
            layoutParams3.addRule(10, -1);
            layoutParams3.setMargins(i.a(this.f7477c, Z), 0, i.a(this.f7477c, max3), 0);
            com.mobile.auth.n.c.b(a, "privacy_top");
        } else {
            String str4 = a;
            com.mobile.auth.n.c.b(str4, "privacy_bottom=" + this.q.getMeasuredHeight());
            layoutParams3.addRule(12, -1);
            layoutParams3.setMargins(i.a(this.f7477c, (float) Z), 0, i.a(this.f7477c, (float) max3), i.a(this.f7477c, (float) this.A.ac()));
        }
        this.q.setLayoutParams(layoutParams3);
    }

    private void f() {
        int i = Build.VERSION.SDK_INT;
        if (i >= 21) {
            getWindow().addFlags(RolePrivilege.privilege_room_updateroomstatus);
            getWindow().addFlags(134217728);
            if (this.A.a() != 0) {
                getWindow().addFlags(Integer.MIN_VALUE);
                getWindow().clearFlags(RolePrivilege.privilege_room_updateroomstatus);
                getWindow().setStatusBarColor(this.A.a());
                getWindow().setNavigationBarColor(this.A.a());
            }
        }
        if (i >= 23) {
            if (this.A.b()) {
                getWindow().getDecorView().setSystemUiVisibility(8192);
            } else {
                getWindow().getDecorView().setSystemUiVisibility(0);
            }
        }
        RelativeLayout relativeLayout = new RelativeLayout(this);
        relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        View c2 = this.A.c();
        if (c2 != null) {
            ViewParent parent = c2.getParent();
            if (parent != null) {
                ((ViewGroup) parent).removeView(c2);
            }
            relativeLayout.addView(c2);
        } else if (this.A.d() != -1) {
            getLayoutInflater().inflate(this.A.d(), relativeLayout);
        }
        setContentView(relativeLayout);
        int requestedOrientation = getRequestedOrientation();
        this.B = i.b(this.f7477c);
        int a2 = i.a(this.f7477c);
        this.C = a2;
        boolean z = true;
        if ((requestedOrientation == 1 && a2 > this.B) || (requestedOrientation == 0 && a2 < this.B)) {
            this.C = this.B;
            this.B = a2;
        }
        String str = a;
        com.mobile.auth.n.c.b(str, "orientation = " + requestedOrientation + "--screenWidth = " + this.C + "--screenHeight = " + this.B);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        if (this.A.aj() != 0) {
            getWindow().getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
            getWindowManager().getDefaultDisplay().getSize(new Point());
            attributes.width = i.a(this.f7477c, this.A.aj());
            int a3 = i.a(this.f7477c, this.A.ak());
            attributes.height = a3;
            this.C = attributes.width;
            this.B = a3;
            attributes.x = i.a(this.f7477c, this.A.al());
            if (this.A.an() == 1) {
                getWindow().setGravity(80);
            } else {
                attributes.y = i.a(this.f7477c, this.A.am());
            }
            getWindow().setAttributes(attributes);
        }
        relativeLayout.setFitsSystemWindows(this.A.aq());
        relativeLayout.setClipToPadding(true);
        try {
            g();
            relativeLayout.addView(this.r);
            relativeLayout.addView(h());
            relativeLayout.addView(i());
            e();
            this.f7478d.setOnClickListener(this);
            this.x.setOnClickListener(this);
            this.p.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                    CheckBox checkBox;
                    LoginAuthActivity loginAuthActivity;
                    String str2;
                    boolean z3 = true;
                    if (z2) {
                        LoginAuthActivity.this.f7478d.setEnabled(true);
                        try {
                            CheckBox checkBox2 = LoginAuthActivity.this.p;
                            LoginAuthActivity loginAuthActivity2 = LoginAuthActivity.this;
                            checkBox2.setBackgroundResource(g.b(loginAuthActivity2, loginAuthActivity2.A.G()));
                            return;
                        } catch (Exception unused) {
                            checkBox = LoginAuthActivity.this.p;
                            loginAuthActivity = LoginAuthActivity.this;
                            str2 = "umcsdk_check_image";
                        }
                    } else {
                        RelativeLayout relativeLayout2 = LoginAuthActivity.this.f7478d;
                        if (LoginAuthActivity.this.A.F() == null && TextUtils.isEmpty(LoginAuthActivity.this.A.C())) {
                            z3 = false;
                        }
                        relativeLayout2.setEnabled(z3);
                        try {
                            CheckBox checkBox3 = LoginAuthActivity.this.p;
                            LoginAuthActivity loginAuthActivity3 = LoginAuthActivity.this;
                            checkBox3.setBackgroundResource(g.b(loginAuthActivity3, loginAuthActivity3.A.H()));
                            return;
                        } catch (Exception unused2) {
                            checkBox = LoginAuthActivity.this.p;
                            loginAuthActivity = LoginAuthActivity.this;
                            str2 = "umcsdk_uncheck_image";
                        }
                    }
                    checkBox.setBackgroundResource(g.b(loginAuthActivity, str2));
                }
            });
            k();
            try {
                if (this.A.K()) {
                    this.p.setChecked(true);
                    this.p.setBackgroundResource(g.b(this, this.A.G()));
                    this.f7478d.setEnabled(true);
                    return;
                }
                this.p.setChecked(false);
                RelativeLayout relativeLayout2 = this.f7478d;
                if (this.A.F() == null && TextUtils.isEmpty(this.A.C())) {
                    z = false;
                }
                relativeLayout2.setEnabled(z);
                this.p.setBackgroundResource(g.b(this, this.A.H()));
            } catch (Exception unused) {
                this.p.setChecked(false);
            }
        } catch (Exception e2) {
            com.cmic.sso.sdk.d.c.f7472b.add(e2);
            e2.printStackTrace();
            com.mobile.auth.n.c.a(a, e2.toString());
            a("200040", "UI资源加载异常", this.m, null);
        }
    }

    private void g() {
        int i;
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.r = relativeLayout;
        relativeLayout.setId(13107);
        this.r.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        TextView textView = new TextView(this);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        textView.setGravity(15);
        int o = this.A.o();
        if (o != 0) {
            if (o > 0) {
                float f = o;
                if ((this.C - textView.getWidth()) - i.a(this.f7477c, f) > 0) {
                    layoutParams.setMargins(i.a(this.f7477c, f), 0, 0, 0);
                } else {
                    com.mobile.auth.n.c.b(a, "RelativeLayout.ALIGN_PARENT_RIGHT");
                    i = 11;
                }
            }
            textView.setTextSize(2, this.A.l());
            textView.setText(this.o);
            if (this.A.m()) {
                textView.setTypeface(Typeface.DEFAULT_BOLD);
            }
            textView.setId(30583);
            this.r.addView(textView, layoutParams);
            textView.setTextColor(this.A.n());
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.r.measure(makeMeasureSpec, makeMeasureSpec);
            com.mobile.auth.n.c.b(a, "mPhoneLayout.getMeasuredHeight()=" + this.r.getMeasuredHeight());
        }
        i = 13;
        layoutParams.addRule(i);
        textView.setTextSize(2, this.A.l());
        textView.setText(this.o);
        if (this.A.m()) {
        }
        textView.setId(30583);
        this.r.addView(textView, layoutParams);
        textView.setTextColor(this.A.n());
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.r.measure(makeMeasureSpec2, makeMeasureSpec2);
        com.mobile.auth.n.c.b(a, "mPhoneLayout.getMeasuredHeight()=" + this.r.getMeasuredHeight());
    }

    private RelativeLayout h() {
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.f7478d = relativeLayout;
        relativeLayout.setId(17476);
        this.f7478d.setLayoutParams(new RelativeLayout.LayoutParams(i.a(this.f7477c, this.A.w()), i.a(this.f7477c, this.A.x())));
        TextView textView = new TextView(this);
        textView.setTextSize(2, this.A.s());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(13);
        textView.setLayoutParams(layoutParams);
        if (this.A.t()) {
            textView.setTypeface(Typeface.DEFAULT_BOLD);
        }
        this.f7478d.addView(textView);
        textView.setText(this.A.r());
        try {
            textView.setTextColor(this.A.u());
        } catch (Exception unused) {
            textView.setTextColor(-1);
        }
        try {
            this.f7478d.setBackgroundResource(g.b(this.f7477c, this.A.v()));
        } catch (Exception e2) {
            e2.printStackTrace();
            this.f7478d.setBackgroundResource(g.b(this.f7477c, "umcsdk_login_btn_bg"));
        }
        return this.f7478d;
    }

    private RelativeLayout i() {
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.q = relativeLayout;
        relativeLayout.setHorizontalGravity(1);
        this.q.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        int I = this.A.I();
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i.a(this.f7477c, Math.max(I, 30)), i.a(this.f7477c, Math.max(this.A.J(), 30)));
        if (this.A.ae() == 1) {
            layoutParams.addRule(15, -1);
        }
        RelativeLayout relativeLayout2 = new RelativeLayout(this);
        this.x = relativeLayout2;
        relativeLayout2.setId(34952);
        this.x.setLayoutParams(layoutParams);
        CheckBox checkBox = new CheckBox(this);
        this.p = checkBox;
        checkBox.setChecked(false);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(i.a(this.f7477c, this.A.I()), i.a(this.f7477c, this.A.J()));
        layoutParams2.setMargins(i.a(this.f7477c, I > 30 ? 0.0f : 30 - I), 0, 0, 0);
        layoutParams2.addRule(11, -1);
        if (this.A.ae() == 1) {
            layoutParams2.addRule(15, -1);
        }
        this.p.setLayoutParams(layoutParams2);
        this.x.addView(this.p);
        this.q.addView(this.x);
        TextView textView = new TextView(this);
        textView.setTextSize(2, this.A.U());
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams3.setMargins(i.a(this.f7477c, 5.0f), 0, 0, i.a(this.f7477c, 5.0f));
        layoutParams3.addRule(1, 34952);
        textView.setLayoutParams(layoutParams3);
        this.q.addView(textView);
        textView.setTextColor(this.A.W());
        textView.setText(i.a(this, this.z, this.y, this.f7479e, this.j, this.k));
        textView.setLineSpacing(8.0f, 1.0f);
        textView.setIncludeFontPadding(false);
        if (this.A.V()) {
            textView.setTypeface(Typeface.DEFAULT_BOLD);
        }
        if (this.A.Y()) {
            textView.setGravity(17);
        }
        textView.setHighlightColor(getResources().getColor(17170445));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        this.p.setButtonDrawable(new ColorDrawable());
        try {
            this.p.setBackgroundResource(g.b(this, this.A.H()));
        } catch (Exception unused) {
            this.p.setBackgroundResource(g.b(this, "umcsdk_uncheck_image"));
        }
        return this.q;
    }

    private String j() {
        this.z = this.A.L();
        if (this.A.ad()) {
            this.y = String.format("《%s》", this.y);
        }
        if (this.z.contains("$$运营商条款$$")) {
            this.z = this.z.replace("$$运营商条款$$", this.y);
        }
        return this.z;
    }

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

    private void l() {
        this.f7478d.setClickable(false);
        this.p.setClickable(false);
    }

    private void m() {
        try {
            if (this.t >= 5) {
                Toast.makeText(this.f7477c, "网络不稳定,请返回重试其他登录方式", 1).show();
                this.f7478d.setClickable(true);
                return;
            }
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            StringBuilder sb = new StringBuilder();
            for (StackTraceElement stackTraceElement : stackTrace) {
                com.mobile.auth.n.c.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.m.a("loginTime", System.currentTimeMillis());
            String b2 = this.m.b("traceId", "");
            if (!TextUtils.isEmpty(b2) && com.mobile.auth.n.e.a(b2)) {
                String c2 = q.c();
                this.m.a("traceId", c2);
                com.mobile.auth.n.e.a(c2, this.v);
            }
            b();
            l();
            c cVar = new c(this.m);
            this.f7476b.postDelayed(cVar, com.mobile.auth.g.a.a(this).c());
            n.a(new b(this, cVar));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void a() {
        this.f7476b.removeCallbacksAndMessages(null);
        h hVar = this.f7479e;
        if (hVar != null && hVar.isShowing()) {
            this.f7479e.dismiss();
        }
        h hVar2 = this.f;
        if (hVar2 != null && hVar2.isShowing()) {
            this.f.dismiss();
        }
        c();
        this.E = null;
        this.q.clearAnimation();
        finish();
        if (this.A.ah() == null || this.A.ai() == null) {
            return;
        }
        overridePendingTransition(g.c(this, this.A.ai()), g.c(this, this.A.ah()));
    }

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

    public void c() {
        try {
            com.mobile.auth.n.c.a(a, "loginClickComplete");
            if (this.A.E() == null || !this.D) {
                Dialog dialog = this.E;
                if (dialog != null && dialog.isShowing()) {
                    this.E.dismiss();
                }
            } else {
                this.D = false;
                this.A.E().b(this.f7477c, null);
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void onClick(View view) {
        try {
            int id = view.getId();
            if (id != 17476) {
                if (id == 26214) {
                    a(false);
                    return;
                } else if (id != 34952) {
                    return;
                } else {
                    if (this.p.isChecked()) {
                        this.p.setChecked(false);
                        return;
                    } else {
                        this.p.setChecked(true);
                        return;
                    }
                }
            }
            if (!this.p.isChecked()) {
                if (this.A.as() != null) {
                    Context context = this.f7477c;
                    this.q.startAnimation(AnimationUtils.loadAnimation(context, g.c(context, this.A.as())));
                }
                if (this.A.F() != null) {
                    this.A.F().a(this.f7477c, null);
                    return;
                } else if (!TextUtils.isEmpty(this.A.C())) {
                    Toast.makeText(this.f7477c, this.A.C(), 1).show();
                    return;
                }
            }
            this.t++;
            m();
        } catch (Exception e2) {
            com.cmic.sso.sdk.d.c.f7472b.add(e2);
            e2.printStackTrace();
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            if (bundle != null) {
                finish();
            }
            this.f7477c = this;
            com.cmic.sso.sdk.view.a a2 = com.mobile.auth.g.a.a(this).a();
            this.A = a2;
            if (a2 != null) {
                if (a2.ao() != -1) {
                    setTheme(this.A.ao());
                }
                if (this.A.af() != null && this.A.ag() != null) {
                    overridePendingTransition(g.c(this, this.A.af()), g.c(this, this.A.ag()));
                }
            }
            com.cmic.sso.sdk.d.a.a("authPageIn");
            this.s = System.currentTimeMillis();
            this.n = com.mobile.auth.g.c.a(this);
            d();
            f();
        } catch (Exception e2) {
            this.m.a().a.add(e2);
            com.mobile.auth.n.c.a(a, e2.toString());
            e2.printStackTrace();
            a("200025", "发生未知错误", this.m, null);
        }
    }

    @Override
    protected void onDestroy() {
        try {
            this.f7476b.removeCallbacksAndMessages(null);
            com.cmic.sso.sdk.d.a.a("timeOnAuthPage", (System.currentTimeMillis() - this.s) + "");
            com.cmic.sso.sdk.d.a.a("authPrivacyState", this.p.isChecked() ? "1" : "0");
            this.E = null;
            f.a().c();
            this.u.removeCallbacksAndMessages(null);
        } catch (Exception e2) {
            com.mobile.auth.n.c.a(a, "LoginAuthActivity clear failed");
            com.cmic.sso.sdk.d.c.f7472b.add(e2);
            e2.printStackTrace();
        }
        super.onDestroy();
    }

    @Override
    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (i == 4 && !keyEvent.isCanceled() && keyEvent.getRepeatCount() == 0) {
            if (this.A.D() != null) {
                this.A.D().a();
            }
            if (this.A.aj() == 0 || this.A.ar()) {
                a(false);
                return true;
            }
            return true;
        }
        return true;
    }

    @Override
    protected void onResume() {
        super.onResume();
        try {
            com.cmic.sso.sdk.a aVar = this.m;
            if (aVar != null) {
                aVar.a("loginMethod", "loginAuth");
            }
            com.mobile.auth.g.a.a(this).a("200087", (JSONObject) null);
        } catch (Exception e2) {
            this.m.a().a.add(e2);
            a("200025", "发生未知错误", this.m, null);
        }
    }
}