家家有田 v1.2.8版本的 MD5 值为:62f44aac901441b9b72af508fbe86bf2

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


package com.netease.nis.captcha;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.WebView;
import com.netease.nis.captcha.Captcha;
import com.netease.nis.captcha.CaptchaConfiguration;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public class a extends Dialog {
    private final String A;
    private final String B;
    private final String C;
    private final boolean D;
    private final boolean E;
    private final String F;
    private final String G;
    private final String H;
    private final String I;
    private final String J;
    private final String K;
    private final String L;
    private final String M;
    private final String N;
    private final String O;
    private final String P;
    private final String Q;
    private final String R;
    private final String S;
    private final String T;
    private final String U;
    private final String V;
    private final String W;
    private final String X;
    private final String Y;
    private final int Z;
    private final Context a;
    private final String a0;
    private final String b;
    private final String b0;
    private final CaptchaConfiguration.ModeType c;
    private final String c0;
    private final CaptchaConfiguration.LangType d;
    private final int d0;
    private final String e;
    private final String e0;
    private final float f;
    private final int f0;
    private final String g;
    private final int g0;
    private final int h;
    private final int h0;
    private final int i;
    private final int i0;
    private final int j;
    private final int j0;
    private final boolean k;
    private final float k0;
    private final boolean l;
    private final int l0;
    private final long m;
    private final int m0;
    private final int n;
    private final int n0;
    private final CaptchaListener o;
    private CaptchaWebView p;
    private View q;
    private String r;
    private String s;
    private final boolean t;
    private String u;
    private String v;
    private String w;
    private final boolean x;
    boolean y;
    boolean z;

    public class View$OnClickListenerC0089a implements View.OnClickListener {
        final Dialog a;

        View$OnClickListenerC0089a(Dialog dialog) {
            this.a = dialog;
        }

        @Override
        public void onClick(View view) {
            if (a.this.x) {
                this.a.hide();
                a aVar = a.this;
                aVar.y = true;
                aVar.o.onClose(Captcha.CloseType.USER_CLOSE);
                return;
            }
            this.a.dismiss();
        }
    }

    public a(CaptchaConfiguration captchaConfiguration) {
        super(captchaConfiguration.a, R.style.yd_CaptchaDialogStyle);
        this.y = false;
        this.a = captchaConfiguration.a;
        this.b = captchaConfiguration.b;
        this.c = captchaConfiguration.c;
        this.d = captchaConfiguration.d;
        this.e = captchaConfiguration.e == CaptchaConfiguration.Theme.DARK ? "dark" : "light";
        this.f = captchaConfiguration.f;
        this.g = captchaConfiguration.g;
        this.h = captchaConfiguration.h;
        this.i = captchaConfiguration.i;
        int i = captchaConfiguration.j;
        this.j = i == 0 ? b() : i;
        this.k = captchaConfiguration.n;
        this.l = captchaConfiguration.o;
        this.m = captchaConfiguration.l;
        this.n = captchaConfiguration.p;
        this.o = captchaConfiguration.k;
        this.r = captchaConfiguration.q;
        this.s = captchaConfiguration.r;
        this.t = captchaConfiguration.t;
        this.u = captchaConfiguration.u;
        this.v = captchaConfiguration.v;
        this.w = captchaConfiguration.w;
        this.x = captchaConfiguration.c == CaptchaConfiguration.ModeType.MODE_INTELLIGENT_NO_SENSE;
        this.z = captchaConfiguration.m;
        this.A = captchaConfiguration.s;
        this.B = captchaConfiguration.A;
        this.C = captchaConfiguration.B;
        this.D = captchaConfiguration.C;
        this.E = captchaConfiguration.E;
        this.F = captchaConfiguration.F;
        this.G = captchaConfiguration.G;
        this.H = captchaConfiguration.H;
        this.I = captchaConfiguration.I;
        this.J = captchaConfiguration.J;
        this.K = captchaConfiguration.K;
        this.L = captchaConfiguration.L;
        this.M = captchaConfiguration.M;
        this.N = captchaConfiguration.N;
        this.O = captchaConfiguration.O;
        this.P = captchaConfiguration.P;
        this.Q = captchaConfiguration.Q;
        this.R = captchaConfiguration.R;
        this.S = captchaConfiguration.S;
        this.T = captchaConfiguration.T;
        this.U = captchaConfiguration.U;
        this.V = captchaConfiguration.V;
        this.W = captchaConfiguration.W;
        this.X = captchaConfiguration.X;
        this.Y = captchaConfiguration.Y;
        this.Z = captchaConfiguration.Z;
        this.a0 = captchaConfiguration.a0;
        this.b0 = captchaConfiguration.b0;
        this.c0 = captchaConfiguration.c0;
        this.d0 = captchaConfiguration.d0;
        this.e0 = captchaConfiguration.e0;
        this.f0 = captchaConfiguration.f0;
        this.g0 = captchaConfiguration.g0;
        this.h0 = captchaConfiguration.h0;
        this.i0 = captchaConfiguration.i0;
        this.j0 = captchaConfiguration.j0;
        this.k0 = captchaConfiguration.k0;
        this.l0 = captchaConfiguration.l0;
        this.m0 = captchaConfiguration.m0;
        this.n0 = captchaConfiguration.n0;
        i();
    }

    private void f() {
        c.a("%s", "设置ContentView");
        View view = this.q;
        if (view != null) {
            setContentView(view);
        } else if (this.D) {
            setContentView(R.layout.yd_dialog_captcha_bottom);
        } else {
            setContentView(R.layout.yd_dialog_captcha);
        }
        if (this.p == null) {
            CaptchaWebView captchaWebView = (CaptchaWebView) findViewById(R.id.web_view);
            this.p = captchaWebView;
            captchaWebView.setRadius(c.a(getContext(), this.l0));
            this.p.setCaptchaListener(this.o);
        }
        findViewById(R.id.img_btn_close).setOnClickListener(new View$OnClickListenerC0089a(this));
        View view2 = this.q;
        if (view2 != null) {
            view2.setVisibility(4);
        }
        if (this.z) {
            findViewById(R.id.img_btn_close).setVisibility(8);
            findViewById(R.id.rl_close).setVisibility(8);
        }
        if (this.c == CaptchaConfiguration.ModeType.MODE_INTELLIGENT_NO_SENSE) {
            getWindow().setDimAmount(0.0f);
        } else {
            getWindow().setDimAmount(this.f);
        }
        setCanceledOnTouchOutside(this.k);
    }

    private void i() {
        c.a("set dialog position x:%d y:%d width:%d", Integer.valueOf(this.h), Integer.valueOf(this.i), Integer.valueOf(this.j));
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        int i = this.h;
        if (i != -1) {
            attributes.gravity = 3 | attributes.gravity;
            attributes.x = i;
        }
        int i2 = this.i;
        if (i2 != -1) {
            attributes.gravity |= 48;
            attributes.y = i2;
        }
        int i3 = this.j;
        if (i3 != 0) {
            attributes.width = i3;
        }
        attributes.gravity = 17;
        getWindow().setAttributes(attributes);
    }

    public WebView c() {
        return this.p;
    }

    public View d() {
        return this.q;
    }

    @Override
    public void dismiss() {
        try {
            Context context = this.a;
            if (context != null && (context instanceof Activity)) {
                if (Build.VERSION.SDK_INT >= 17) {
                    if (((Activity) context).isFinishing() || ((Activity) this.a).isDestroyed()) {
                        return;
                    }
                    if (this.p != null && this.q.isActivated()) {
                        this.p.loadUrl("about:blank");
                    }
                    super.dismiss();
                    return;
                } else if (((Activity) context).isFinishing()) {
                    return;
                } else {
                    if (this.p != null && this.q.isActivated()) {
                        this.p.loadUrl("about:blank");
                    }
                    super.dismiss();
                    return;
                }
            }
            CaptchaWebView captchaWebView = this.p;
            if (captchaWebView != null) {
                captchaWebView.loadUrl("about:blank");
            }
            super.dismiss();
        } catch (Exception e) {
            c.b(Captcha.TAG, "Captcha  Dialog dismiss Error: %s", e.toString());
        }
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (this.z && keyEvent.getKeyCode() == 4) {
            return true;
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    public void e() {
        ViewGroup.LayoutParams layoutParams = this.p.getLayoutParams();
        int i = this.j;
        if (i != 0) {
            layoutParams.width = i;
        }
        layoutParams.height = -2;
        this.p.setLayoutParams(layoutParams);
        String a = a();
        c.a("%s", "request url is:" + a);
        this.p.addJavascriptInterface(new f(this.a), "JSInterface");
        this.p.loadUrl(a);
    }

    public void g() {
        if (this.D) {
            if (this.q == null) {
                this.q = LayoutInflater.from(this.a).inflate(R.layout.yd_dialog_captcha_bottom, (ViewGroup) null);
            }
        } else if (this.q == null) {
            this.q = LayoutInflater.from(this.a).inflate(R.layout.yd_dialog_captcha, (ViewGroup) null);
        }
        if (this.p == null) {
            CaptchaWebView captchaWebView = (CaptchaWebView) this.q.findViewById(R.id.web_view);
            this.p = captchaWebView;
            captchaWebView.setRadius(c.a(getContext(), this.l0));
            this.p.setCaptchaListener(this.o);
        }
    }

    public void h() {
        this.y = true;
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        if (this.x) {
            hide();
            this.y = true;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        if (this.E) {
            c.a(this);
        }
        f();
    }

    @Override
    public void show() {
        try {
            Context context = this.a;
            if (context == null || !(context instanceof Activity) || ((Activity) context).isFinishing()) {
                return;
            }
            super.show();
        } catch (Exception e) {
            c.b("Captcha  Dialog show Error:%s", e.toString());
        }
    }

    private String a() {
        String a;
        float f = getContext().getResources().getDisplayMetrics().density;
        StringBuilder sb = new StringBuilder();
        sb.append("https://cstaticdun.126.net/api/v2/mobile.v2.13.5.html");
        sb.append("?captchaId=");
        sb.append(this.b);
        if (this.c == CaptchaConfiguration.ModeType.MODE_INTELLIGENT_NO_SENSE) {
            sb.append("&mode=bind");
        }
        sb.append("&os=android");
        sb.append("&osVer=");
        sb.append(Build.VERSION.RELEASE);
        sb.append("&sdkVer=3.4.3");
        float f2 = this.j / f;
        try {
            sb.append("&popupStyles.width=");
            sb.append(URLEncoder.encode(String.valueOf(f2), "utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            sb.append("&popupStyles.width=");
            sb.append(f2);
        }
        if (TextUtils.isEmpty(c.a(this.d))) {
            a = c.a();
        } else {
            a = c.a(this.d);
        }
        if (!TextUtils.isEmpty(a)) {
            sb.append("&lang=");
            sb.append(a);
        }
        if (!TextUtils.isEmpty(this.g)) {
            sb.append("&customStyles.icon.slider=");
            sb.append(this.g);
        }
        sb.append("&defaultFallback=");
        sb.append(this.l);
        sb.append("&errorFallbackCount=");
        sb.append(this.n);
        sb.append("&mobileTimeout=");
        sb.append(this.m);
        if (this.t) {
            sb.append("&ipv6=true");
            this.v = "ac-v6.dun.163yun.com";
            this.u = "ac-v6.dun.163yun.com";
            this.w = "acstatic-dun-v6.126.net";
            if (TextUtils.isEmpty(this.r)) {
                this.r = "c-v6.dun.163.com";
            }
            if (TextUtils.isEmpty(this.s)) {
                this.s = "cstaticdun-v6.126.net";
            }
        }
        if (!TextUtils.isEmpty(this.r)) {
            sb.append("&apiServer=");
            sb.append(this.r);
        }
        if (!TextUtils.isEmpty(this.s)) {
            sb.append("&staticServer=");
            sb.append(this.s);
        }
        if (!TextUtils.isEmpty(this.A)) {
            sb.append("&protocol=");
            sb.append(this.A);
        }
        if (!TextUtils.isEmpty(this.u)) {
            sb.append("&wmServerConfig.configServer=");
            sb.append(this.u);
        }
        if (!TextUtils.isEmpty(this.v)) {
            sb.append("&wmServerConfig.apiServer=");
            sb.append(this.v);
        }
        if (!TextUtils.isEmpty(this.w)) {
            sb.append("&wmServerConfig.staticServer=");
            sb.append(this.w);
        }
        if (!TextUtils.isEmpty(this.B)) {
            sb.append("&extraData=");
            sb.append(this.B);
        }
        if (!TextUtils.isEmpty(this.e)) {
            sb.append("&theme=");
            sb.append(this.e);
        }
        if (TextUtils.isEmpty(this.C)) {
            float b = c.b(getContext());
            if (b != 0.85f) {
                if (b == 1.0f) {
                    sb.append("&size=small");
                } else if (b == 1.15f) {
                    sb.append("&size=medium");
                } else {
                    sb.append("&size=large");
                }
            }
        } else {
            sb.append("&size=");
            sb.append(this.C);
        }
        if (!TextUtils.isEmpty(this.F)) {
            sb.append("&customStyles.imagePanel.align=");
            sb.append(this.F);
        }
        if (!TextUtils.isEmpty(this.G)) {
            sb.append("&customStyles.imagePanel.borderRadius=");
            sb.append(this.G);
        }
        if (!TextUtils.isEmpty(this.H)) {
            sb.append("&customStyles.controlBar.height=");
            sb.append(this.H);
        }
        if (!TextUtils.isEmpty(this.I)) {
            sb.append("&customStyles.controlBar.borderRadius=");
            sb.append(this.I);
        }
        if (!TextUtils.isEmpty(this.J)) {
            sb.append("&customStyles.controlBar.borderColor=");
            sb.append(this.J);
        }
        if (!TextUtils.isEmpty(this.K)) {
            sb.append("&customStyles.controlBar.background=");
            sb.append(this.K);
        }
        if (!TextUtils.isEmpty(this.L)) {
            sb.append("&customStyles.controlBar.borderColorMoving=");
            sb.append(this.L);
        }
        if (!TextUtils.isEmpty(this.M)) {
            sb.append("&customStyles.controlBar.backgroundMoving=");
            sb.append(this.M);
        }
        if (!TextUtils.isEmpty(this.N)) {
            sb.append("&customStyles.controlBar.borderColorSuccess=");
            sb.append(this.N);
        }
        if (!TextUtils.isEmpty(this.O)) {
            sb.append("&customStyles.controlBar.backgroundSuccess=");
            sb.append(this.O);
        }
        if (!TextUtils.isEmpty(this.P)) {
            sb.append("&customStyles.controlBar.borderColorError=");
            sb.append(this.P);
        }
        if (!TextUtils.isEmpty(this.Q)) {
            sb.append("&customStyles.controlBar.backgroundError=");
            sb.append(this.Q);
        }
        if (!TextUtils.isEmpty(this.R)) {
            sb.append("&customStyles.controlBar.slideBackground=");
            sb.append(this.R);
        }
        if (!TextUtils.isEmpty(this.S)) {
            sb.append("&customStyles.controlBar.textSize=");
            sb.append(this.S);
        }
        if (!TextUtils.isEmpty(this.T)) {
            sb.append("&customStyles.controlBar.textColor=");
            sb.append(this.T);
        }
        if (!TextUtils.isEmpty(this.U)) {
            sb.append("&customStyles.gap=");
            sb.append(this.U);
        }
        if (!TextUtils.isEmpty(this.V)) {
            sb.append("&customStyles.executeBorderRadius=");
            sb.append(this.V);
        }
        if (!TextUtils.isEmpty(this.W)) {
            sb.append("&customStyles.executeBackground=");
            sb.append(this.W);
        }
        if (!TextUtils.isEmpty(this.X)) {
            sb.append("&customStyles.executeTop=");
            sb.append(this.X);
        }
        if (!TextUtils.isEmpty(this.Y)) {
            sb.append("&customStyles.executeRight=");
            sb.append(this.Y);
        }
        if (this.Z != 0) {
            sb.append("&popupStyles.capBarHeight=");
            sb.append(this.Z);
        }
        if (!TextUtils.isEmpty(this.a0)) {
            sb.append("&popupStyles.capBarTextAlign=");
            sb.append(this.a0);
        }
        if (!TextUtils.isEmpty(this.b0)) {
            sb.append("&popupStyles.capBarBorderColor=");
            sb.append(this.b0);
        }
        if (!TextUtils.isEmpty(this.c0)) {
            sb.append("&popupStyles.capBarTextColor=");
            sb.append(this.c0);
        }
        if (this.d0 != 0) {
            sb.append("&popupStyles.capBarTextSize=");
            sb.append(this.d0);
        }
        if (!TextUtils.isEmpty(this.e0)) {
            sb.append("&popupStyles.capBarTextWeight=");
            sb.append(this.e0);
        }
        if (this.f0 != 15) {
            sb.append("&popupStyles.capPadding=");
            sb.append(this.f0);
        }
        if (this.g0 != 15) {
            sb.append("&popupStyles.capPaddingTop=");
            sb.append(this.g0);
        }
        if (this.h0 != 15) {
            sb.append("&popupStyles.capPaddingRight=");
            sb.append(this.h0);
        }
        if (this.i0 != 15) {
            sb.append("&popupStyles.capPaddingBottom=");
            sb.append(this.i0);
        }
        if (this.j0 != 15) {
            sb.append("&popupStyles.capPaddingLeft=");
            sb.append(this.j0);
        }
        if (this.k0 != 0.0f) {
            sb.append("&popupStyles.opacity=");
            sb.append(this.k0);
        }
        if (this.l0 != 0) {
            sb.append("&popupStyles.radius=");
            sb.append(this.l0);
        }
        if (this.m0 != 0) {
            sb.append("&popupStyles.paddingTop=");
            sb.append(this.m0);
        }
        if (this.n0 != 0) {
            sb.append("&popupStyles.paddingBottom=");
            sb.append(this.n0);
        }
        return sb.toString();
    }

    private int b() {
        DisplayMetrics displayMetrics = this.a.getResources().getDisplayMetrics();
        int i = displayMetrics.widthPixels;
        int i2 = displayMetrics.heightPixels;
        float f = displayMetrics.density;
        if (i2 < i) {
            i = (i2 * 3) / 4;
        }
        int i3 = (i * 4) / 5;
        return ((int) (((float) i3) / f)) < 270 ? (int) (270 * f) : i3;
    }
}