家家有田 v1.2.8版本的 MD5 值为:62f44aac901441b9b72af508fbe86bf2
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.netease.nis.captcha;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.webkit.JavascriptInterface;
import com.netease.nis.captcha.Captcha;
import com.netease.nis.captcha.CaptchaConfiguration;
import org.json.JSONException;
import org.json.JSONObject;
public class f {
private static final Handler i = new Handler(Looper.getMainLooper());
private final Captcha a;
private final Context b;
private final com.netease.nis.captcha.a c;
private final CaptchaConfiguration d;
private final CaptchaListener e;
private final CaptchaWebView f;
private final com.netease.nis.captcha.b g;
private boolean h = false;
public class a implements Runnable {
a() {
}
@Override
public void run() {
if (f.this.a.c() != null) {
f.this.a.c().dismiss();
}
}
}
class b implements Runnable {
b() {
}
@Override
public void run() {
if (f.this.f != null) {
f.this.f.loadUrl("javascript:popupCaptcha()");
}
}
}
class c implements Runnable {
c() {
}
@Override
public void run() {
try {
f.this.e.onReady();
} catch (Exception e) {
e.printStackTrace();
}
}
}
class d implements Runnable {
d() {
}
@Override
public void run() {
if (f.this.c != null) {
f.this.c.dismiss();
}
if (f.this.e != null) {
if (!f.this.c() || f.this.h) {
f.this.e.onClose(Captcha.CloseType.VERIFY_SUCCESS_CLOSE);
f.this.h = false;
}
}
}
}
class e implements Runnable {
final String a;
final String b;
final String c;
e(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
@Override
public void run() {
try {
f.this.e.onValidate(this.a, this.b, this.c);
} catch (Exception e) {
e.printStackTrace();
}
}
}
class RunnableC0093f implements Runnable {
RunnableC0093f() {
}
@Override
public void run() {
if (f.this.g == null || !f.this.g.isShowing()) {
return;
}
f.this.g.dismiss();
}
}
class g implements Runnable {
final String a;
g(String str) {
this.a = str;
}
@Override
public void run() {
com.netease.nis.captcha.c.a("%s", "onError is callback" + this.a);
if (f.this.a.d()) {
return;
}
if (f.this.c != null) {
f.this.c.dismiss();
}
if (f.this.g != null && f.this.d.D) {
if (!f.this.g.isShowing()) {
f.this.g.show();
}
f.this.g.c(R.string.yd_tip_load_failed);
}
try {
JSONObject jSONObject = new JSONObject(this.a);
int i = jSONObject.getInt("code");
String string = jSONObject.getString("message");
if (f.this.e != null) {
f.this.e.onError(i, string);
}
} catch (JSONException e) {
com.netease.nis.captcha.c.b("%s", "onError is callback" + this.a);
if (f.this.e != null) {
f.this.e.onError(2000, e.toString());
}
}
}
}
public class h implements Runnable {
h() {
}
@Override
public void run() {
if (f.this.c == null || f.this.c.isShowing()) {
return;
}
f.this.c.show();
}
}
public class i implements Runnable {
i() {
}
@Override
public void run() {
f.this.f.loadUrl("javascript:captchaVerify()");
}
}
public class j implements Runnable {
j() {
}
@Override
public void run() {
if (f.this.c != null) {
if (f.this.d.c == CaptchaConfiguration.ModeType.MODE_INTELLIGENT_NO_SENSE && !((Activity) f.this.b).isFinishing()) {
f.this.c.getWindow().setDimAmount(f.this.d.f);
}
if (f.this.c.d().getVisibility() == 4) {
com.netease.nis.captcha.c.a("%s", "显示验证码视图");
f.this.c.d().setVisibility(0);
}
}
}
}
public f(Context context) {
this.b = context;
Captcha captcha = Captcha.getInstance();
this.a = captcha;
com.netease.nis.captcha.a b2 = captcha.b();
this.c = b2;
CaptchaConfiguration a2 = captcha.a();
this.d = a2;
this.e = a2.k;
this.f = (CaptchaWebView) b2.c();
this.g = captcha.c();
}
@JavascriptInterface
public void onError(String str) {
i.post(new g(str));
}
@JavascriptInterface
public void onLoad() {
com.netease.nis.captcha.c.a("%s", "onLoad is callback");
if (this.a.d() || this.d.c != CaptchaConfiguration.ModeType.MODE_CAPTCHA) {
return;
}
i.post(new b());
}
@JavascriptInterface
public void onReady(int i2, int i3) {
long currentTimeMillis = System.currentTimeMillis() - this.a.g;
com.netease.nis.captcha.c.a("%s %d", "加载总耗时为:", Long.valueOf(currentTimeMillis));
com.netease.nis.captcha.c.a("%s", "onReady is callback");
com.netease.nis.captcha.g.b().a(this.d.b, System.currentTimeMillis(), currentTimeMillis);
com.netease.nis.captcha.g.b().b(this.b);
b();
if (this.a.d()) {
return;
}
d();
if (this.e != null) {
i.post(new c());
}
if (c()) {
a();
} else {
e();
}
}
@JavascriptInterface
public void onValidate(String str, String str2, String str3, String str4) {
com.netease.nis.captcha.c.a("result=%s validate =%s message =%s next=%s", str, str2, str3, str4);
if (this.a.d()) {
return;
}
if (!TextUtils.isEmpty(str4) && str4.equals("true")) {
e();
this.h = true;
} else if (!TextUtils.isEmpty(str2)) {
this.a.h();
i.postDelayed(new d(), c() ? 0L : 500L);
}
if (this.e != null && !str4.equals("true")) {
i.post(new e(str, str2, str3));
}
i.post(new RunnableC0093f());
}
private void b() {
if (this.a.c() != null) {
i.post(new a());
}
}
public boolean c() {
return this.d.c == CaptchaConfiguration.ModeType.MODE_INTELLIGENT_NO_SENSE;
}
private void d() {
i.post(new h());
}
private void e() {
i.post(new j());
}
private void a() {
if (this.f != null) {
com.netease.nis.captcha.c.a("%s", "智能无感知调用captchaVerify");
i.post(new i());
}
}
}