米游社.apk(点击下载) / GenLoginAuthActivity.java


package com.cmic.gen.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 com.cmic.gen.sdk.auth.GenAuthnHelper;
import com.cmic.gen.sdk.auth.GenTokenListener;
import com.cmic.gen.sdk.e.e;
import com.cmic.gen.sdk.e.h;
import com.cmic.gen.sdk.e.n;
import com.cmic.gen.sdk.e.q;
import com.cmic.gen.sdk.view.b;
import com.didiglobal.booster.instrument.ShadowToast;
import io.rong.push.common.PushConst;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import m6.d;
import org.json.JSONException;
import org.json.JSONObject;

public class GenLoginAuthActivity extends Activity implements View.OnClickListener {

    /* renamed from: a  reason: collision with root package name */
    public static final String f28914a = GenLoginAuthActivity.class.getSimpleName();
    private GenAuthThemeConfig A;
    private int B;
    private int C;
    private boolean D;
    private Dialog E;

    /* renamed from: b  reason: collision with root package name */
    private Handler f28915b;

    /* renamed from: c  reason: collision with root package name */
    private Context f28916c;

    /* renamed from: d  reason: collision with root package name */
    private RelativeLayout f28917d;

    /* renamed from: e  reason: collision with root package name */
    private d f28918e;

    /* renamed from: f  reason: collision with root package name */
    private d f28919f;

    /* renamed from: g  reason: collision with root package name */
    private d f28920g;

    /* renamed from: h  reason: collision with root package name */
    private d f28921h;

    /* renamed from: i  reason: collision with root package name */
    private d f28922i;

    /* renamed from: j  reason: collision with root package name */
    private ArrayList<d> f28923j;

    /* renamed from: k  reason: collision with root package name */
    private ArrayList<String> f28924k;

    /* renamed from: l  reason: collision with root package name */
    private String[] f28925l;

    /* renamed from: m  reason: collision with root package name */
    private com.cmic.gen.sdk.a f28926m;

    /* renamed from: n  reason: collision with root package name */
    private com.cmic.gen.sdk.auth.a f28927n;

    /* renamed from: o  reason: collision with root package name */
    private String f28928o = "";

    /* renamed from: p  reason: collision with root package name */
    private CheckBox f28929p;

    /* renamed from: q  reason: collision with root package name */
    private RelativeLayout f28930q;

    /* renamed from: r  reason: collision with root package name */
    private RelativeLayout f28931r;

    /* renamed from: s  reason: collision with root package name */
    private long f28932s = 0;

    /* renamed from: t  reason: collision with root package name */
    private int f28933t = 0;

    /* renamed from: u  reason: collision with root package name */
    private a f28934u = null;

    /* renamed from: v  reason: collision with root package name */
    private GenTokenListener f28935v;

    /* renamed from: w  reason: collision with root package name */
    private boolean f28936w = true;

    /* renamed from: x  reason: collision with root package name */
    private RelativeLayout f28937x;

    /* renamed from: y  reason: collision with root package name */
    private String f28938y;

    /* renamed from: z  reason: collision with root package name */
    private String f28939z;

    public static class a extends Handler {

        /* renamed from: a  reason: collision with root package name */
        public WeakReference<GenLoginAuthActivity> f28948a;

        public a(GenLoginAuthActivity genLoginAuthActivity) {
            this.f28948a = new WeakReference<>(genLoginAuthActivity);
        }

        private void a(Message message) {
            GenLoginAuthActivity genLoginAuthActivity = this.f28948a.get();
            if (genLoginAuthActivity != null && message.what == 1) {
                genLoginAuthActivity.c();
                genLoginAuthActivity.k();
            }
        }

        public void handleMessage(Message message) {
            try {
                a(message);
            } catch (Exception e10) {
                com.cmic.gen.sdk.d.c.f28776b.add(e10);
                e10.printStackTrace();
            }
        }
    }

    public static class b extends n.a {

        /* renamed from: a  reason: collision with root package name */
        public WeakReference<GenLoginAuthActivity> f28949a;

        /* renamed from: b  reason: collision with root package name */
        public WeakReference<c> f28950b;

        public b(GenLoginAuthActivity genLoginAuthActivity, c cVar) {
            this.f28949a = new WeakReference<>(genLoginAuthActivity);
            this.f28950b = new WeakReference<>(cVar);
        }

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

        @Override // com.cmic.gen.sdk.e.n.a
        public void a() {
            final GenLoginAuthActivity genLoginAuthActivity = this.f28949a.get();
            genLoginAuthActivity.f28926m.a("logintype", 1);
            h.a(true, false);
            genLoginAuthActivity.f28927n.b(genLoginAuthActivity.f28926m, new com.cmic.gen.sdk.auth.b() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.b.AnonymousClass1 */

                @Override // com.cmic.gen.sdk.auth.b
                public void a(String str, String str2, com.cmic.gen.sdk.a aVar, JSONObject jSONObject) {
                    if (b.this.b()) {
                        long b10 = aVar.b("loginTime", 0L);
                        String b11 = aVar.b("phonescrip");
                        if (b10 != 0) {
                            aVar.a("loginTime", System.currentTimeMillis() - b10);
                        }
                        if (!"103000".equals(str) || TextUtils.isEmpty(b11)) {
                            genLoginAuthActivity.f28936w = false;
                            com.cmic.gen.sdk.d.a.a("authClickFailed");
                        } else {
                            com.cmic.gen.sdk.d.a.a("authClickSuccess");
                            genLoginAuthActivity.f28936w = true;
                        }
                        genLoginAuthActivity.a(str, str2, aVar, jSONObject);
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e10) {
                            e10.printStackTrace();
                        }
                        genLoginAuthActivity.f28934u.sendEmptyMessage(1);
                    }
                }
            });
        }
    }

    public class c implements Runnable {

        /* renamed from: b  reason: collision with root package name */
        private com.cmic.gen.sdk.a f28954b;

        /* renamed from: c  reason: collision with root package name */
        private boolean f28955c;

        public c(com.cmic.gen.sdk.a aVar) {
            this.f28954b = aVar;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private synchronized boolean a(boolean z10) {
            boolean z11;
            z11 = this.f28955c;
            this.f28955c = z10;
            return !z11;
        }

        public void run() {
            if (a(true)) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put(PushConst.RESULT_CODE, "102507");
                    jSONObject.put("resultString", "请求超时");
                } catch (JSONException e10) {
                    e10.printStackTrace();
                }
                GenLoginAuthActivity.this.f28936w = false;
                com.cmic.gen.sdk.d.a.a("authClickFailed");
                GenLoginAuthActivity.this.f28934u.sendEmptyMessage(1);
                long b10 = this.f28954b.b("loginTime", 0L);
                if (b10 != 0) {
                    this.f28954b.a("loginTime", System.currentTimeMillis() - b10);
                }
                GenLoginAuthActivity.this.a("102507", "请求超时", this.f28954b, jSONObject);
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(String str, String str2, com.cmic.gen.sdk.a aVar, JSONObject jSONObject) {
        GenAuthnHelper instance;
        try {
            this.f28915b.removeCallbacksAndMessages(null);
            if ("103000".equals(str)) {
                if (GenAuthnHelper.getInstance((Context) this) != null && e.c(aVar.b("traceId")) != null) {
                    aVar.a("keepListener", true);
                    instance = GenAuthnHelper.getInstance((Context) this);
                } else {
                    return;
                }
            } else if (!"200020".equals(str)) {
                aVar.a("keepListener", true);
                instance = GenAuthnHelper.getInstance((Context) this);
            } else if (GenAuthnHelper.getInstance((Context) this) != null) {
                if (e.c(aVar.b("traceId")) != null) {
                    GenAuthnHelper.getInstance((Context) this).callBackResult(str, str2, aVar, jSONObject);
                }
                a();
                return;
            } else {
                return;
            }
            instance.callBackResult(str, str2, aVar, jSONObject);
        } catch (Exception e10) {
            com.cmic.gen.sdk.e.c.a(f28914a, "CallbackResult:未知错误");
            e10.printStackTrace();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(boolean z10) {
        try {
            com.cmic.gen.sdk.d.a.a("authPageOut");
            a("200020", "登录页面关闭", this.f28926m, null);
        } catch (Exception e10) {
            com.cmic.gen.sdk.d.c.f28776b.add(e10);
            e10.printStackTrace();
        }
    }

    private void d() {
        String str;
        com.cmic.gen.sdk.a d10 = e.d(getIntent().getStringExtra("traceId"));
        this.f28926m = d10;
        if (d10 == null) {
            this.f28926m = new com.cmic.gen.sdk.a(0);
        }
        this.f28935v = e.c(this.f28926m.b("traceId", ""));
        getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
        this.f28915b = new Handler(getMainLooper());
        this.f28934u = new a(this);
        this.f28928o = this.f28926m.b(d.f89663t);
        String str2 = f28914a;
        com.cmic.gen.sdk.e.c.b(str2, "mSecurityPhone value is " + this.f28928o);
        String b10 = this.f28926m.b("operatortype", "");
        com.cmic.gen.sdk.e.c.b(str2, "operator value is " + b10);
        if (this.A.getAppLanguageType() == 1) {
            this.f28925l = com.cmic.gen.sdk.c.f28648b;
        } else if (this.A.getAppLanguageType() == 2) {
            this.f28925l = com.cmic.gen.sdk.c.f28649c;
        } else {
            this.f28925l = com.cmic.gen.sdk.c.f28647a;
        }
        if (b10.equals("1")) {
            this.f28938y = this.f28925l[0];
            str = d.f89631d;
        } else if (b10.equals("3")) {
            this.f28938y = this.f28925l[1];
            str = d.f89627b;
        } else {
            this.f28938y = this.f28925l[2];
            str = "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true";
        }
        d dVar = new d(this.f28916c, 16973840, this.f28938y, str);
        this.f28918e = dVar;
        dVar.setOnKeyListener(new DialogInterface.OnKeyListener() {
            /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass1 */

            public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                if (i10 == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                    GenLoginAuthActivity.this.f28918e.b();
                }
                return true;
            }
        });
        this.f28923j = new ArrayList<>();
        this.f28924k = new ArrayList<>();
        if (!TextUtils.isEmpty(this.A.getClauseUrl())) {
            d dVar2 = new d(this.f28916c, 16973840, this.A.getClauseName(), this.A.getClauseUrl());
            this.f28919f = dVar2;
            dVar2.setOnKeyListener(new DialogInterface.OnKeyListener() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass2 */

                public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                    if (i10 == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        GenLoginAuthActivity.this.f28919f.b();
                    }
                    return true;
                }
            });
            this.f28923j.add(this.f28919f);
            this.f28924k.add(this.A.getClauseName());
        }
        if (!TextUtils.isEmpty(this.A.getClauseUrl2())) {
            d dVar3 = new d(this.f28916c, 16973840, this.A.getClauseName2(), this.A.getClauseUrl2());
            this.f28920g = dVar3;
            dVar3.setOnKeyListener(new DialogInterface.OnKeyListener() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass3 */

                public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                    if (i10 == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        GenLoginAuthActivity.this.f28920g.b();
                    }
                    return true;
                }
            });
            this.f28923j.add(this.f28920g);
            this.f28924k.add(this.A.getClauseName2());
        }
        if (!TextUtils.isEmpty(this.A.getClauseUrl3())) {
            d dVar4 = new d(this.f28916c, 16973840, this.A.getClauseName3(), this.A.getClauseUrl3());
            this.f28921h = dVar4;
            dVar4.setOnKeyListener(new DialogInterface.OnKeyListener() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass4 */

                public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                    if (i10 == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        GenLoginAuthActivity.this.f28921h.b();
                    }
                    return true;
                }
            });
            this.f28923j.add(this.f28921h);
            this.f28924k.add(this.A.getClauseName3());
        }
        if (!TextUtils.isEmpty(this.A.getClauseUrl4())) {
            d dVar5 = new d(this.f28916c, 16973840, this.A.getClauseName4(), this.A.getClauseUrl4());
            this.f28922i = dVar5;
            dVar5.setOnKeyListener(new DialogInterface.OnKeyListener() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass5 */

                public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                    if (i10 == 4 && keyEvent.getAction() == 1 && keyEvent.getRepeatCount() == 0) {
                        GenLoginAuthActivity.this.f28922i.b();
                    }
                    return true;
                }
            });
            this.f28923j.add(this.f28922i);
            this.f28924k.add(this.A.getClauseName4());
        }
        j();
        if (this.A.isPrivacyBookSymbol()) {
            for (int i10 = 0; i10 < this.f28924k.size(); i10++) {
                String format = String.format("《%s》", this.f28924k.get(i10));
                this.f28939z = this.f28939z.replaceFirst(this.f28924k.get(i10), format);
                this.f28924k.set(i10, format);
            }
        }
        b.a().a(new b.a() {
            /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass6 */

            @Override // com.cmic.gen.sdk.view.b.a
            public void a() {
                GenLoginAuthActivity.this.f28915b.removeCallbacksAndMessages(null);
                if (GenLoginAuthActivity.this.f28918e != null && GenLoginAuthActivity.this.f28918e.isShowing()) {
                    GenLoginAuthActivity.this.f28918e.dismiss();
                }
                if (GenLoginAuthActivity.this.f28919f != null && GenLoginAuthActivity.this.f28919f.isShowing()) {
                    GenLoginAuthActivity.this.f28919f.dismiss();
                }
                GenLoginAuthActivity.this.a((GenLoginAuthActivity) true);
            }
        });
    }

    /* JADX WARNING: Removed duplicated region for block: B:35:0x01b6  */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x01d4  */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x0203  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0290  */
    private void e() {
        RelativeLayout.LayoutParams layoutParams;
        int privacyMarginLeft;
        int max;
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f28931r.getLayoutParams();
        if (this.A.getNumFieldOffsetY() > 0 || this.A.getNumFieldOffsetY_B() < 0) {
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.f28931r.measure(makeMeasureSpec, makeMeasureSpec);
            String str = f28914a;
            com.cmic.gen.sdk.e.c.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.f28931r.getMeasuredHeight());
            if (this.A.getNumFieldOffsetY() <= 0 || (this.B - this.f28931r.getMeasuredHeight()) - e.a(this.f28916c, (float) this.A.getNumFieldOffsetY()) <= 0) {
                layoutParams2.addRule(12, -1);
            } else {
                com.cmic.gen.sdk.e.c.b(str, "numberField_top");
                layoutParams2.addRule(10, -1);
                layoutParams2.setMargins(0, e.a(this.f28916c, (float) this.A.getNumFieldOffsetY()), 0, 0);
            }
        } else if (this.A.getNumFieldOffsetY_B() <= 0 || (this.B - this.f28931r.getMeasuredHeight()) - e.a(this.f28916c, (float) this.A.getNumFieldOffsetY_B()) <= 0) {
            layoutParams2.addRule(10, -1);
        } else {
            com.cmic.gen.sdk.e.c.b(f28914a, "numberField_bottom");
            layoutParams2.addRule(12, -1);
            layoutParams2.setMargins(0, 0, 0, e.a(this.f28916c, (float) this.A.getNumFieldOffsetY_B()));
        }
        this.f28931r.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.f28917d.getLayoutParams();
        int max2 = Math.max(this.A.getLogBtnMarginLeft(), 0);
        int max3 = Math.max(this.A.getLogBtnMarginRight(), 0);
        if (this.A.getLogBtnOffsetY() > 0 || this.A.getLogBtnOffsetY_B() < 0) {
            if (this.A.getLogBtnOffsetY() <= 0 || this.B - e.a(this.f28916c, (float) (this.A.getLogBtnHeight() + this.A.getLogBtnOffsetY())) <= 0) {
                layoutParams3.addRule(12, -1);
            } else {
                com.cmic.gen.sdk.e.c.b(f28914a, "logBtn_top");
                layoutParams3.addRule(10, -1);
                layoutParams3.setMargins(e.a(this.f28916c, (float) max2), e.a(this.f28916c, (float) this.A.getLogBtnOffsetY()), e.a(this.f28916c, (float) max3), 0);
                this.f28917d.setLayoutParams(layoutParams3);
                layoutParams = (RelativeLayout.LayoutParams) this.f28930q.getLayoutParams();
                privacyMarginLeft = this.A.getPrivacyMarginLeft() >= 0 ? this.A.getCheckedImgWidth() > 30 ? this.A.getPrivacyMarginLeft() : this.A.getPrivacyMarginLeft() - (30 - this.A.getCheckedImgWidth()) : this.A.getCheckedImgWidth() > 30 ? 0 : -(30 - this.A.getCheckedImgWidth());
                max = Math.max(this.A.getPrivacyMarginRight(), 0);
                int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
                this.f28930q.measure(makeMeasureSpec2, makeMeasureSpec2);
                if (this.A.getPrivacyOffsetY() <= 0 || this.A.getPrivacyOffsetY_B() < 0) {
                    if (this.A.getPrivacyOffsetY() > 0 || (this.B - this.f28930q.getMeasuredHeight()) - e.a(this.f28916c, (float) this.A.getPrivacyOffsetY()) <= 0) {
                        String str2 = f28914a;
                        com.cmic.gen.sdk.e.c.b(str2, "privacy_bottom=" + privacyMarginLeft);
                        layoutParams.addRule(12, -1);
                        layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), 0, e.a(this.f28916c, (float) max), 0);
                    } else {
                        String str3 = f28914a;
                        com.cmic.gen.sdk.e.c.b(str3, "privacy_top = " + this.f28930q.getMeasuredHeight());
                        layoutParams.addRule(10, -1);
                        layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), e.a(this.f28916c, (float) this.A.getPrivacyOffsetY()), e.a(this.f28916c, (float) max), 0);
                    }
                } else if (this.A.getPrivacyOffsetY_B() <= 0 || (this.B - this.f28930q.getMeasuredHeight()) - e.a(this.f28916c, (float) this.A.getPrivacyOffsetY_B()) <= 0) {
                    layoutParams.addRule(10, -1);
                    layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), 0, e.a(this.f28916c, (float) max), 0);
                    com.cmic.gen.sdk.e.c.b(f28914a, "privacy_top");
                } else {
                    String str4 = f28914a;
                    com.cmic.gen.sdk.e.c.b(str4, "privacy_bottom=" + this.f28930q.getMeasuredHeight());
                    layoutParams.addRule(12, -1);
                    layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), 0, e.a(this.f28916c, (float) max), e.a(this.f28916c, (float) this.A.getPrivacyOffsetY_B()));
                }
                this.f28930q.setLayoutParams(layoutParams);
            }
        } else if (this.A.getLogBtnOffsetY_B() <= 0 || this.B - e.a(this.f28916c, (float) (this.A.getLogBtnHeight() + this.A.getLogBtnOffsetY_B())) <= 0) {
            layoutParams3.addRule(10, -1);
        } else {
            com.cmic.gen.sdk.e.c.b(f28914a, "logBtn_bottom");
            layoutParams3.addRule(12, -1);
            layoutParams3.setMargins(e.a(this.f28916c, (float) max2), 0, e.a(this.f28916c, (float) max3), e.a(this.f28916c, (float) this.A.getLogBtnOffsetY_B()));
            this.f28917d.setLayoutParams(layoutParams3);
            layoutParams = (RelativeLayout.LayoutParams) this.f28930q.getLayoutParams();
            if (this.A.getPrivacyMarginLeft() >= 0) {
            }
            max = Math.max(this.A.getPrivacyMarginRight(), 0);
            int makeMeasureSpec22 = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.f28930q.measure(makeMeasureSpec22, makeMeasureSpec22);
            if (this.A.getPrivacyOffsetY() <= 0) {
            }
            if (this.A.getPrivacyOffsetY() > 0) {
            }
            String str22 = f28914a;
            com.cmic.gen.sdk.e.c.b(str22, "privacy_bottom=" + privacyMarginLeft);
            layoutParams.addRule(12, -1);
            layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), 0, e.a(this.f28916c, (float) max), 0);
            this.f28930q.setLayoutParams(layoutParams);
        }
        layoutParams3.setMargins(e.a(this.f28916c, (float) max2), 0, e.a(this.f28916c, (float) max3), 0);
        this.f28917d.setLayoutParams(layoutParams3);
        layoutParams = (RelativeLayout.LayoutParams) this.f28930q.getLayoutParams();
        if (this.A.getPrivacyMarginLeft() >= 0) {
        }
        max = Math.max(this.A.getPrivacyMarginRight(), 0);
        int makeMeasureSpec222 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.f28930q.measure(makeMeasureSpec222, makeMeasureSpec222);
        if (this.A.getPrivacyOffsetY() <= 0) {
        }
        if (this.A.getPrivacyOffsetY() > 0) {
        }
        String str222 = f28914a;
        com.cmic.gen.sdk.e.c.b(str222, "privacy_bottom=" + privacyMarginLeft);
        layoutParams.addRule(12, -1);
        layoutParams.setMargins(e.a(this.f28916c, (float) privacyMarginLeft), 0, e.a(this.f28916c, (float) max), 0);
        this.f28930q.setLayoutParams(layoutParams);
    }

    private void f() {
        int i10 = Build.VERSION.SDK_INT;
        if (i10 >= 21) {
            getWindow().addFlags(67108864);
            getWindow().addFlags(134217728);
            if (this.A.getStatusBarColor() != 0) {
                getWindow().addFlags(Integer.MIN_VALUE);
                getWindow().clearFlags(67108864);
                getWindow().setStatusBarColor(this.A.getStatusBarColor());
                getWindow().setNavigationBarColor(this.A.getStatusBarColor());
            }
        }
        if (i10 >= 23) {
            if (this.A.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.A.getContentView();
        if (contentView != null) {
            ViewParent parent = contentView.getParent();
            if (parent != null) {
                ((ViewGroup) parent).removeView(contentView);
            }
            relativeLayout.addView(contentView);
        } else if (this.A.getLayoutResID() != -1) {
            getLayoutInflater().inflate(this.A.getLayoutResID(), relativeLayout);
        }
        setContentView(relativeLayout);
        int requestedOrientation = getRequestedOrientation();
        this.B = e.b(this.f28916c);
        int a10 = e.a(this.f28916c);
        this.C = a10;
        boolean z10 = true;
        if ((requestedOrientation == 1 && a10 > this.B) || (requestedOrientation == 0 && a10 < this.B)) {
            this.C = this.B;
            this.B = a10;
        }
        com.cmic.gen.sdk.e.c.b(f28914a, "orientation = " + requestedOrientation + "--screenWidth = " + this.C + "--screenHeight = " + this.B);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        if (this.A.getWindowWidth() != 0) {
            getWindow().getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
            getWindowManager().getDefaultDisplay().getSize(new Point());
            attributes.width = e.a(this.f28916c, (float) this.A.getWindowWidth());
            int a11 = e.a(this.f28916c, (float) this.A.getWindowHeight());
            attributes.height = a11;
            this.C = attributes.width;
            this.B = a11;
            attributes.x = e.a(this.f28916c, (float) this.A.getWindowX());
            if (this.A.getWindowBottom() == 1) {
                getWindow().setGravity(80);
            } else {
                attributes.y = e.a(this.f28916c, (float) this.A.getWindowY());
            }
            getWindow().setAttributes(attributes);
        }
        relativeLayout.setFitsSystemWindows(this.A.isFitsSystemWindows());
        relativeLayout.setClipToPadding(true);
        try {
            g();
            relativeLayout.addView(this.f28931r);
            relativeLayout.addView(h());
            relativeLayout.addView(i());
            e();
            this.f28917d.setOnClickListener(this);
            this.f28937x.setOnClickListener(this);
            this.f28929p.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass7 */

                public void onCheckedChanged(CompoundButton compoundButton, boolean z10) {
                    CheckBox checkBox;
                    GenLoginAuthActivity genLoginAuthActivity;
                    String str;
                    GenLoginAuthActivity.this.A.getGenCheckedChangeListener().onCheckedChanged(z10);
                    boolean z11 = true;
                    if (z10) {
                        GenLoginAuthActivity.this.f28917d.setEnabled(true);
                        try {
                            CheckBox checkBox2 = GenLoginAuthActivity.this.f28929p;
                            GenLoginAuthActivity genLoginAuthActivity2 = GenLoginAuthActivity.this;
                            checkBox2.setBackgroundResource(c.b(genLoginAuthActivity2, genLoginAuthActivity2.A.getCheckedImgPath()));
                            return;
                        } catch (Exception unused) {
                            checkBox = GenLoginAuthActivity.this.f28929p;
                            genLoginAuthActivity = GenLoginAuthActivity.this;
                            str = "umcsdk_check_image";
                        }
                    } else {
                        RelativeLayout relativeLayout = GenLoginAuthActivity.this.f28917d;
                        if (GenLoginAuthActivity.this.A.getGenCheckBoxListener() == null && TextUtils.isEmpty(GenLoginAuthActivity.this.A.getCheckTipText())) {
                            z11 = false;
                        }
                        relativeLayout.setEnabled(z11);
                        try {
                            CheckBox checkBox3 = GenLoginAuthActivity.this.f28929p;
                            GenLoginAuthActivity genLoginAuthActivity3 = GenLoginAuthActivity.this;
                            checkBox3.setBackgroundResource(c.b(genLoginAuthActivity3, genLoginAuthActivity3.A.getUncheckedImgPath()));
                            return;
                        } catch (Exception unused2) {
                            checkBox = GenLoginAuthActivity.this.f28929p;
                            genLoginAuthActivity = GenLoginAuthActivity.this;
                            str = "umcsdk_uncheck_image";
                        }
                    }
                    checkBox.setBackgroundResource(c.b(genLoginAuthActivity, str));
                }
            });
            k();
            try {
                if (this.A.isPrivacyState()) {
                    this.f28929p.setChecked(true);
                    this.f28929p.setBackgroundResource(c.b(this, this.A.getCheckedImgPath()));
                    this.f28917d.setEnabled(true);
                    return;
                }
                this.f28929p.setChecked(false);
                RelativeLayout relativeLayout2 = this.f28917d;
                if (this.A.getGenCheckBoxListener() == null) {
                    if (TextUtils.isEmpty(this.A.getCheckTipText())) {
                        z10 = false;
                    }
                }
                relativeLayout2.setEnabled(z10);
                this.f28929p.setBackgroundResource(c.b(this, this.A.getUncheckedImgPath()));
            } catch (Exception unused) {
                this.f28929p.setChecked(false);
            }
        } catch (Exception e10) {
            com.cmic.gen.sdk.d.c.f28776b.add(e10);
            e10.printStackTrace();
            com.cmic.gen.sdk.e.c.a(f28914a, e10.toString());
            a("200040", "UI资源加载异常", this.f28926m, null);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:16:0x007b  */
    private void g() {
        int i10;
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.f28931r = relativeLayout;
        relativeLayout.setId(13107);
        this.f28931r.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.A.getNumberOffsetX();
        if (numberOffsetX == 0) {
            i10 = 13;
        } else {
            if (numberOffsetX > 0) {
                float f10 = (float) numberOffsetX;
                if ((this.C - textView.getWidth()) - e.a(this.f28916c, f10) > 0) {
                    layoutParams.setMargins(e.a(this.f28916c, f10), 0, 0, 0);
                } else {
                    com.cmic.gen.sdk.e.c.b(f28914a, "RelativeLayout.ALIGN_PARENT_RIGHT");
                    i10 = 11;
                }
            }
            textView.setTextSize(2, (float) this.A.getNumberSize());
            textView.setText(this.f28928o);
            if (this.A.isNumberBold()) {
                textView.setTypeface(Typeface.DEFAULT_BOLD);
            }
            textView.setId(30583);
            this.f28931r.addView(textView, layoutParams);
            textView.setTextColor(this.A.getNumberColor());
            int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
            this.f28931r.measure(makeMeasureSpec, makeMeasureSpec);
            String str = f28914a;
            com.cmic.gen.sdk.e.c.b(str, "mPhoneLayout.getMeasuredHeight()=" + this.f28931r.getMeasuredHeight());
        }
        layoutParams.addRule(i10);
        try {
            textView.setTextSize(2, (float) this.A.getNumberSize());
        } catch (Exception unused) {
            textView.setTextSize(2, 18.0f);
        }
        textView.setText(this.f28928o);
        if (this.A.isNumberBold()) {
        }
        textView.setId(30583);
        this.f28931r.addView(textView, layoutParams);
        try {
            textView.setTextColor(this.A.getNumberColor());
        } catch (Exception unused2) {
            textView.setTextColor(-13421773);
        }
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        this.f28931r.measure(makeMeasureSpec2, makeMeasureSpec2);
        String str2 = f28914a;
        com.cmic.gen.sdk.e.c.b(str2, "mPhoneLayout.getMeasuredHeight()=" + this.f28931r.getMeasuredHeight());
    }

    private RelativeLayout h() {
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.f28917d = relativeLayout;
        relativeLayout.setId(17476);
        this.f28917d.setLayoutParams(new RelativeLayout.LayoutParams(e.a(this.f28916c, (float) this.A.getLogBtnWidth()), e.a(this.f28916c, (float) this.A.getLogBtnHeight())));
        TextView textView = new TextView(this);
        textView.setTextSize(2, (float) this.A.getLogBtnTextSize());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(13);
        textView.setLayoutParams(layoutParams);
        if (this.A.isLogBtnTextBold()) {
            textView.setTypeface(Typeface.DEFAULT_BOLD);
        }
        this.f28917d.addView(textView);
        textView.setText(this.A.getLogBtnText());
        try {
            textView.setTextColor(this.A.getLogBtnTextColor());
        } catch (Exception unused) {
            textView.setTextColor(-1);
        }
        try {
            this.f28917d.setBackgroundResource(c.b(this.f28916c, this.A.getLogBtnBackgroundPath()));
        } catch (Exception e10) {
            e10.printStackTrace();
            this.f28917d.setBackgroundResource(c.b(this.f28916c, "umcsdk_login_btn_bg"));
        }
        return this.f28917d;
    }

    private RelativeLayout i() {
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.f28930q = relativeLayout;
        relativeLayout.setHorizontalGravity(1);
        this.f28930q.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
        int checkedImgWidth = this.A.getCheckedImgWidth();
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(e.a(this.f28916c, (float) Math.max(checkedImgWidth, 30)), e.a(this.f28916c, (float) Math.max(this.A.getCheckedImgHeight(), 30)));
        if (this.A.getCheckBoxLocation() == 1) {
            layoutParams.addRule(15, -1);
        }
        RelativeLayout relativeLayout2 = new RelativeLayout(this);
        this.f28937x = relativeLayout2;
        relativeLayout2.setId(34952);
        this.f28937x.setLayoutParams(layoutParams);
        CheckBox checkBox = new CheckBox(this);
        this.f28929p = checkBox;
        checkBox.setChecked(false);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(e.a(this.f28916c, (float) this.A.getCheckedImgWidth()), e.a(this.f28916c, (float) this.A.getCheckedImgHeight()));
        layoutParams2.setMargins(e.a(this.f28916c, checkedImgWidth > 30 ? 0.0f : (float) (30 - checkedImgWidth)), 0, 0, 0);
        layoutParams2.addRule(11, -1);
        if (this.A.getCheckBoxLocation() == 1) {
            layoutParams2.addRule(15, -1);
        }
        this.f28929p.setLayoutParams(layoutParams2);
        this.f28937x.addView(this.f28929p);
        this.f28930q.addView(this.f28937x);
        TextView textView = new TextView(this);
        textView.setTextSize(2, (float) this.A.getPrivacyTextSize());
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams3.setMargins(e.a(this.f28916c, 5.0f), 0, 0, e.a(this.f28916c, 5.0f));
        layoutParams3.addRule(1, 34952);
        textView.setLayoutParams(layoutParams3);
        this.f28930q.addView(textView);
        textView.setTextColor(this.A.getClauseBaseColor());
        textView.setText(e.a(this, this.f28939z, this.f28938y, this.f28918e, this.f28923j, this.f28924k));
        textView.setLineSpacing(8.0f, 1.0f);
        textView.setIncludeFontPadding(false);
        if (this.A.isPrivacyTextBold()) {
            textView.setTypeface(Typeface.DEFAULT_BOLD);
        }
        if (this.A.isPrivacyTextGravityCenter()) {
            textView.setGravity(17);
        }
        textView.setHighlightColor(getResources().getColor(17170445));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        this.f28929p.setButtonDrawable(new ColorDrawable());
        try {
            this.f28929p.setBackgroundResource(c.b(this, this.A.getUncheckedImgPath()));
        } catch (Exception unused) {
            this.f28929p.setBackgroundResource(c.b(this, "umcsdk_uncheck_image"));
        }
        return this.f28930q;
    }

    private String j() {
        this.f28939z = this.A.getPrivacy();
        if (this.A.isPrivacyBookSymbol()) {
            this.f28938y = String.format("《%s》", this.f28938y);
        }
        if (this.f28939z.contains(GenAuthThemeConfig.PLACEHOLDER)) {
            this.f28939z = this.f28939z.replace(GenAuthThemeConfig.PLACEHOLDER, this.f28938y);
        }
        return this.f28939z;
    }

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

    private void l() {
        this.f28917d.setClickable(false);
        this.f28929p.setClickable(false);
    }

    private void m() {
        try {
            if (this.f28933t >= 5) {
                ShadowToast.show(Toast.makeText(this.f28916c, "网络不稳定,请返回重试其他登录方式", 1));
                this.f28917d.setClickable(true);
                return;
            }
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            StringBuilder sb2 = new StringBuilder();
            for (StackTraceElement stackTraceElement : stackTrace) {
                com.cmic.gen.sdk.e.c.a("stack", stackTraceElement.getClassName());
                String className = stackTraceElement.getClassName();
                if (!TextUtils.isEmpty(className) && className.contains("com.cmic.gen.sdk.activity") && !sb2.toString().contains(className)) {
                    sb2.append(className);
                    sb2.append(t4.h.f134437b);
                }
            }
            this.f28926m.a("loginTime", System.currentTimeMillis());
            String b10 = this.f28926m.b("traceId", "");
            if (!TextUtils.isEmpty(b10) && e.a(b10)) {
                String c10 = q.c();
                this.f28926m.a("traceId", c10);
                e.a(c10, this.f28935v);
            }
            b();
            l();
            c cVar = new c(this.f28926m);
            this.f28915b.postDelayed(cVar, GenAuthnHelper.getInstance((Context) this).getOverTime());
            n.a(new b(this, cVar));
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public void a() {
        this.f28915b.removeCallbacksAndMessages(null);
        d dVar = this.f28918e;
        if (dVar != null && dVar.isShowing()) {
            this.f28918e.dismiss();
        }
        d dVar2 = this.f28919f;
        if (dVar2 != null && dVar2.isShowing()) {
            this.f28919f.dismiss();
        }
        c();
        this.E = null;
        this.f28930q.clearAnimation();
        finish();
        if (this.A.getAuthPageActOut() != null && this.A.getActivityIn() != null) {
            overridePendingTransition(c.c(this, this.A.getActivityIn()), c.c(this, this.A.getAuthPageActOut()));
        }
    }

    public void b() {
        com.cmic.gen.sdk.e.c.a(f28914a, "loginClickStart");
        try {
            this.D = true;
            if (this.A.getGenLoginClickListener() != null) {
                this.A.getGenLoginClickListener().onLoginClickStart(this.f28916c, 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() {
                    /* class com.cmic.gen.sdk.view.GenLoginAuthActivity.AnonymousClass8 */

                    public boolean onKey(DialogInterface dialogInterface, int i10, KeyEvent keyEvent) {
                        return i10 == 4;
                    }
                });
                RelativeLayout relativeLayout = new RelativeLayout(this.E.getContext());
                relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
                ImageView imageView = new ImageView(this.E.getContext());
                imageView.setImageResource(c.b(this.f28916c, "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 e10) {
            e10.printStackTrace();
        }
        com.cmic.gen.sdk.e.c.a(f28914a, "loginClickStart");
    }

    public void c() {
        try {
            com.cmic.gen.sdk.e.c.a(f28914a, "loginClickComplete");
            if (this.A.getGenLoginClickListener() == null || !this.D) {
                Dialog dialog = this.E;
                if (dialog != null && dialog.isShowing()) {
                    this.E.dismiss();
                    return;
                }
                return;
            }
            this.D = false;
            this.A.getGenLoginClickListener().onLoginClickComplete(this.f28916c, null);
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public void onClick(View view) {
        try {
            int id2 = view.getId();
            if (id2 == 17476) {
                if (!this.f28929p.isChecked()) {
                    if (this.A.getPrivacyAnimation() != null) {
                        Context context = this.f28916c;
                        this.f28930q.startAnimation(AnimationUtils.loadAnimation(context, c.c(context, this.A.getPrivacyAnimation())));
                    }
                    if (this.A.getGenCheckBoxListener() != null) {
                        this.A.getGenCheckBoxListener().onLoginClick(this.f28916c, null);
                        return;
                    } else if (!TextUtils.isEmpty(this.A.getCheckTipText())) {
                        ShadowToast.show(Toast.makeText(this.f28916c, this.A.getCheckTipText(), 1));
                        return;
                    }
                }
                this.f28933t++;
                m();
            } else if (id2 == 26214) {
                a(false);
            } else if (id2 == 34952) {
                if (this.f28929p.isChecked()) {
                    this.f28929p.setChecked(false);
                } else {
                    this.f28929p.setChecked(true);
                }
            }
        } catch (Exception e10) {
            com.cmic.gen.sdk.d.c.f28776b.add(e10);
            e10.printStackTrace();
        }
    }

    public void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            if (bundle != null) {
                finish();
            }
            this.f28916c = this;
            GenAuthThemeConfig authThemeConfig = GenAuthnHelper.getInstance((Context) this).getAuthThemeConfig();
            this.A = authThemeConfig;
            if (authThemeConfig != null) {
                if (authThemeConfig.getThemeId() != -1) {
                    setTheme(this.A.getThemeId());
                }
                if (!(this.A.getAuthPageActIn() == null || this.A.getActivityOut() == null)) {
                    overridePendingTransition(c.c(this, this.A.getAuthPageActIn()), c.c(this, this.A.getActivityOut()));
                }
            }
            com.cmic.gen.sdk.d.a.a("authPageIn");
            this.f28932s = System.currentTimeMillis();
            this.f28927n = com.cmic.gen.sdk.auth.a.a(this);
            d();
            f();
        } catch (Exception e10) {
            if (this.f28926m == null) {
                this.f28926m = new com.cmic.gen.sdk.a(0);
            }
            this.f28926m.a().f28750a.add(e10);
            com.cmic.gen.sdk.e.c.a(f28914a, e10.toString());
            e10.printStackTrace();
            a("200025", "发生未知错误", this.f28926m, null);
        }
    }

    public void onDestroy() {
        try {
            this.f28915b.removeCallbacksAndMessages(null);
            com.cmic.gen.sdk.d.a.a("timeOnAuthPage", (System.currentTimeMillis() - this.f28932s) + "");
            com.cmic.gen.sdk.d.a.a("authPrivacyState", this.f28929p.isChecked() ? "1" : "0");
            com.cmic.gen.sdk.d.a.a(this.f28916c.getApplicationContext(), this.f28926m);
            com.cmic.gen.sdk.d.a.a();
            this.E = null;
            b.a().c();
            this.f28934u.removeCallbacksAndMessages(null);
        } catch (Exception e10) {
            com.cmic.gen.sdk.e.c.a(f28914a, "GenLoginAuthActivity clear failed");
            com.cmic.gen.sdk.d.c.f28776b.add(e10);
            e10.printStackTrace();
        }
        super.onDestroy();
    }

    public boolean onKeyUp(int i10, KeyEvent keyEvent) {
        if (i10 != 4 || keyEvent.isCanceled() || keyEvent.getRepeatCount() != 0) {
            return true;
        }
        if (this.A.getGenBackPressedListener() != null) {
            this.A.getGenBackPressedListener().onBackPressed();
        }
        if (this.A.getWindowWidth() != 0 && !this.A.isBackButton()) {
            return true;
        }
        a(false);
        return true;
    }

    public void onResume() {
        super.onResume();
        try {
            com.cmic.gen.sdk.a aVar = this.f28926m;
            if (aVar != null) {
                aVar.a("loginMethod", "loginAuth");
            }
            GenAuthnHelper.getInstance((Context) this).loginPageInCallBack("200087", null);
        } catch (Exception e10) {
            this.f28926m.a().f28750a.add(e10);
            a("200025", "发生未知错误", this.f28926m, null);
        }
    }
}