package com.iBookStar.activityComm; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.baidu.idl.face.platform.utils.BitmapUtils; import com.iBookStar.R; import com.iBookStar.a.n; import com.iBookStar.a.o; import com.iBookStar.utils.p; import com.iBookStar.utils.s; import com.iBookStar.utils.w; import com.iBookStar.views.CommonWebView; import com.iBookStar.views.SkinProgressBar; import com.iBookStar.views.TaskProgressBar; import com.iBookStar.views.YmConfig; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; public final class RewardAdWebView extends Activity implements View.OnClickListener, CommonWebView.g2 { private com.iBookStar.a.f A; private String B = ""; private int C; private List<String> D = new ArrayList(); private boolean E = false; private boolean F; private int G = 30; private n H; private long I = 0; private int J = 30; /* renamed from: K reason: collision with root package name */ private boolean f103K = false; private String L; private String M; private String N; private String O; private RelativeLayout P; private ImageView Q; private TextView R; private LinearLayout S; private TextView T; private boolean U; private List<String> V; private int W = 5; private boolean X = false; private boolean Y = false; private boolean Z = false; private RelativeLayout a; protected int a0 = -2142426; private ImageView b; protected int b0 = -1; private TextView c; protected long c0; private TextView d; protected int d0; private CommonWebView e; private Handler e0 = new c(Looper.getMainLooper()); private SkinProgressBar f; private TaskProgressBar g; private String h; private boolean i = false; private boolean j = false; private boolean k = false; private boolean l = false; private Set<String> m = new HashSet(); private boolean n = false; private String o; private int p; private int q; private int r; private int s = 10; private float t = 0.0f; private boolean u = false; private int v = 0; private float w; private float x; private boolean y = false; private boolean z = false; /* access modifiers changed from: package-private */ public class a implements Runnable { a() { } public void run() { RewardAdWebView.this.y = false; if (RewardAdWebView.this.E && !RewardAdWebView.this.isFinishing()) { RewardAdWebView.this.a(true, false, "圆圈进度条走满完成任务", null, 0, 0); } } } /* access modifiers changed from: package-private */ public class b implements Runnable { final /* synthetic */ boolean a; final /* synthetic */ String b; b(boolean z, String str) { this.a = z; this.b = str; } public void run() { RewardAdWebView.this.y = false; if (RewardAdWebView.this.E && !RewardAdWebView.this.isFinishing()) { RewardAdWebView.this.a(true, false, "圆圈进度条走满完成任务", this.a ? null : this.b, 0, 0); } } } class c extends Handler { c(Looper looper) { super(looper); } public void handleMessage(Message message) { int i = message.what; if (i == 0) { RewardAdWebView.this.f(); } else if (i == 1) { RewardAdWebView.this.e(); } else if (i == 2) { RewardAdWebView.this.a((RewardAdWebView) ((String) message.obj), (String) message.arg1); } else if (i == 3) { RewardAdWebView.this.h(); } else if (i == 4) { RewardAdWebView.this.i(); } else if (i == 5) { RewardAdWebView.this.k(); } } } /* access modifiers changed from: package-private */ public class d implements TaskProgressBar.j { d() { } @Override // com.iBookStar.views.TaskProgressBar.j public void a() { if (RewardAdWebView.this.F) { RewardAdWebView.this.c(); } else if (RewardAdWebView.this.U) { RewardAdWebView.this.j(); } } @Override // com.iBookStar.views.TaskProgressBar.j public void b() { if (RewardAdWebView.this.F) { RewardAdWebView.this.c(); } else if (RewardAdWebView.this.U) { RewardAdWebView.this.j(); } } } /* access modifiers changed from: package-private */ public class e extends CommonWebView.f2 { e() { } @Override // com.iBookStar.views.CommonWebView.f2 public void a(CommonWebView commonWebView, String str) { p.a("RewardAdWebView", "ttttttttttttttt, onPageFinished=" + str); RewardAdWebView.this.a((RewardAdWebView) commonWebView, (CommonWebView) str, (String) 2); RewardAdWebView.this.f.setVisibility(8); super.a(commonWebView, str); } @Override // com.iBookStar.views.CommonWebView.f2 public void a(CommonWebView commonWebView, String str, Bitmap bitmap) { p.a("RewardAdWebView", "ttttttttttttttt, onPageStarted=" + str); RewardAdWebView.this.a((RewardAdWebView) commonWebView, (CommonWebView) str, (String) 1); RewardAdWebView.this.f.setVisibility(0); super.a(commonWebView, str, bitmap); } @Override // com.iBookStar.views.CommonWebView.f2 public boolean b(CommonWebView commonWebView, String str) { p.a("RewardAdWebView", "tttttttttttttttt, shouldOverrideUrlLoading=" + str); RewardAdWebView.this.e.report2Web(); if (RewardAdWebView.this.p > 0 && RewardAdWebView.this.i && "buy".equalsIgnoreCase(RewardAdWebView.this.B) && !str.startsWith("http://") && !str.startsWith("https://")) { try { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse(str)); intent.addFlags(268435456); RewardAdWebView.this.startActivity(intent); if (!RewardAdWebView.this.j || RewardAdWebView.this.m.size() < 2) { RewardAdWebView.this.j = true; RewardAdWebView.this.m.add(str); RewardAdWebView.this.e((RewardAdWebView) false); com.iBookStar.a.d.a().c(RewardAdWebView.this.A); } return true; } catch (Exception unused) { } } return super.b(commonWebView, str); } } /* access modifiers changed from: package-private */ public class f extends CommonWebView.d2 { f() { } @Override // com.iBookStar.views.CommonWebView.d2 public void a(CommonWebView commonWebView, int i) { RewardAdWebView.this.f.setProgress(i); super.a(commonWebView, i); } @Override // com.iBookStar.views.CommonWebView.d2 public void a(CommonWebView commonWebView, String str) { } } /* access modifiers changed from: package-private */ public class g implements View.OnTouchListener { g() { } public boolean onTouch(View view, MotionEvent motionEvent) { if (RewardAdWebView.this.y) { return true; } int action = motionEvent.getAction(); if (action == 0) { RewardAdWebView.this.w = motionEvent.getY(); } else if (action == 1) { RewardAdWebView.this.x = motionEvent.getY(); if (RewardAdWebView.this.g.isShow()) { float abs = Math.abs(RewardAdWebView.this.x - RewardAdWebView.this.w); if (!RewardAdWebView.this.f103K && RewardAdWebView.this.j && abs > 50.0f) { RewardAdWebView.this.d((RewardAdWebView) false); } } } return false; } } /* access modifiers changed from: package-private */ public class h extends Thread { class a implements Runnable { a() { } public void run() { if (!RewardAdWebView.this.g.isShow()) { return; } if (RewardAdWebView.this.t >= 360.0f) { RewardAdWebView.this.m(); return; } RewardAdWebView.this.r(); RewardAdWebView.this.s(); } } class b implements Runnable { b() { } public void run() { RewardAdWebView.this.t(); } } h() { } public void run() { Runnable runnable; RewardAdWebView rewardAdWebView; do { if (!RewardAdWebView.this.z) { RewardAdWebView.r(RewardAdWebView.this); if (RewardAdWebView.this.t >= ((float) RewardAdWebView.this.v)) { RewardAdWebView.this.u = false; RewardAdWebView rewardAdWebView2 = RewardAdWebView.this; rewardAdWebView2.t = (float) rewardAdWebView2.v; if (!RewardAdWebView.this.isFinishing()) { rewardAdWebView = RewardAdWebView.this; runnable = new a(); } RewardAdWebView.this.g.setProgress(RewardAdWebView.this.t); } else { rewardAdWebView = RewardAdWebView.this; runnable = new b(); } rewardAdWebView.runOnUiThread(runnable); RewardAdWebView.this.g.setProgress(RewardAdWebView.this.t); } try { Thread.sleep((long) RewardAdWebView.this.q); } catch (Exception unused) { } } while (RewardAdWebView.this.u); } } /* access modifiers changed from: package-private */ public class i implements Runnable { i() { } public void run() { RewardAdWebView.this.y = false; if (RewardAdWebView.this.E && !RewardAdWebView.this.isFinishing()) { RewardAdWebView.this.a(true, true, "点击继续免费阅读本书精彩内容", null, 0, 0); RewardAdWebView.this.g.setCoinText("阅", -15066598); } } } /* access modifiers changed from: package-private */ public class j implements Runnable { j() { } public void run() { RewardAdWebView.this.y = false; RewardAdWebView.this.g.hide(); } } /* access modifiers changed from: package-private */ public class k implements Runnable { k() { } public void run() { RewardAdWebView.this.y = false; if (RewardAdWebView.this.E && !RewardAdWebView.this.isFinishing()) { RewardAdWebView.this.a(true, false, "圆圈进度条走满完成任务", null, 0, 0); } } } private String a(int i2) { if (i2 == 1) { if ("theme".equalsIgnoreCase(this.B)) { return com.iBookStar.c.c.a("thd_1", "参与互动游戏领取福利"); } if ("buy".equalsIgnoreCase(this.B)) { return (!this.f103K || !s.c(this.L)) ? com.iBookStar.c.c.a("tyhq_1", "挑选宝贝后进入详情页领取优惠券") : this.L; } int i3 = this.C; return i3 == 1 ? com.iBookStar.c.c.a("tjs_1", "选择广告点击进入后查看") : i3 == 2 ? com.iBookStar.c.c.a("tapi_1", "选择广告点击进入后查看") : "选择广告点击进入后查看"; } else if ("theme".equalsIgnoreCase(this.B)) { return com.iBookStar.c.c.a("thd_2", "领取成功/请尽快使用您的福利"); } else { if ("buy".equalsIgnoreCase(this.B)) { return (!this.f103K || !s.c(this.M)) ? com.iBookStar.c.c.a("tyhq_2", "领券成功/下单购买立省50%") : this.M; } int i4 = this.C; return i4 == 1 ? com.iBookStar.c.c.a("tjs_2", "继续参与广告进度条走满可得奖励") : i4 == 2 ? com.iBookStar.c.c.a("tapi_2", "继续参与广告进度条走满可得奖励") : "继续参与广告进度条走满可得奖励"; } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(CommonWebView commonWebView, String str, int i2) { if (!isFinishing() && this.H != null && !this.F && !s.a(this.o)) { if (!commonWebView.isTouchByUser()) { this.e0.removeMessages(2); } Handler handler = this.e0; handler.sendMessageDelayed(Message.obtain(handler, 2, i2, i2, str), 1000); commonWebView.resetTouchState(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(String str, int i2) { if (!(isFinishing() || this.H == null || this.F)) { p.a("RewardAdWebView", String.format("ttttttttttttttt--1, loc=%d, url=%s", Integer.valueOf(i2), str)); String c2 = com.iBookStar.utils.k.c(str); if (!this.o.equalsIgnoreCase(c2)) { p.a("RewardAdWebView", String.format("ttttttttttttttt--2, loc=%d, url=%s", Integer.valueOf(i2), str)); this.E = true; if (!this.i) { p.a("RewardAdWebView", String.format("ttttttttttttttt--3, loc=%d, url=%s", Integer.valueOf(i2), str)); this.m.clear(); this.m.add(c2); this.t = 0.0f; this.v = 0; this.i = true; p.a("RewardAdWebView", String.format("ttttttttttttttt--4, loc=%d, url=%s", Integer.valueOf(i2), str)); if (this.G <= 0) { this.b.setVisibility(4); this.c.setVisibility(0); } if (!"buy".equalsIgnoreCase(this.B) || !this.f103K) { a(false, true, null, null, 0, 0); } this.H.b(); } else { if (!this.j) { p.a("RewardAdWebView", String.format("ttttttttttttttt--5, loc=%d, url=%s", Integer.valueOf(i2), str)); if (!"buy".equalsIgnoreCase(this.B)) { this.m.add(c2); if (this.m.size() > 1) { this.j = true; } } else { for (String str2 : this.D) { if (str.contains(str2)) { this.j = true; this.m.add(str); com.iBookStar.a.d.a().c(this.A); } } } } else if (this.m.size() < 2) { if (!"buy".equalsIgnoreCase(this.B)) { this.m.add(c2); } else { for (String str3 : this.D) { if (str.contains(str3)) { this.m.add(str); } } } } com.iBookStar.a.d.a().c(this.A); } e(false); } } } private void a(boolean z2, String str, String str2, long j2, long j3) { a(z2, true, str, str2, j2, j3); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(boolean z2, boolean z3, String str, String str2, long j2, long j3) { q(); if (z3) { this.g.setProgress(0.0f); } if (z2) { this.g.setExpandTips(str, str2, j3); this.g.show(com.iBookStar.utils.k.a(10.0f)); this.g.tryProgressBarExpand(true, j2); return; } this.g.show(com.iBookStar.utils.k.a(10.0f)); this.g.tryProgressBarExpand(false, 0); } private void b(boolean z2) { this.P.setVisibility(8); if (z2) { this.U = false; this.e0.removeMessages(5); } } private void c(boolean z2) { this.f.setMax(100); this.e.setPromptDownload(false); this.e.initWebView(z2); this.e.setCommonWebViewClient(new e()); this.e.setCommonWebChromeClient(new f()); this.e.setOnTouchListener(new g()); this.e.registerEventBus(); this.e.setCommonWebViewListener(this); } private void d() { try { this.e.loadUrl("javascript:if(window.dispatch){window.dispatch('preCountdownFinish')}"); } catch (Throwable unused) { } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void d(boolean z2) { if (!this.F && this.t < 360.0f) { if (z2) { this.v = BitmapUtils.ROTATE360; } else { int i2 = this.v; if (i2 < 360) { this.v = i2 + 120; } } p(); if (!this.u) { this.u = true; new h().start(); } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void e() { n nVar; if (!isFinishing() && !this.E && (nVar = this.H) != null && nVar.a() != null) { if (this.J > this.H.a().C() - this.H.a().D()) { if (!this.z) { TextView textView = this.c; int i2 = this.J - 1; this.J = i2; textView.setText(String.format("%ds", Integer.valueOf(i2))); } this.e0.sendEmptyMessageDelayed(1, 1000); return; } d(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void e(boolean z2) { if (this.g.isShow()) { int i2 = 2; if (this.j && this.m.size() > 1) { if (!this.l) { this.l = true; this.y = true; String a2 = a(2); this.g.tryProgressBarExpand(false, 0); w.a().a(new b(z2, a2), 300); if (z2) { d(true); } else { d(false); } } this.e0.removeMessages(3); b(true); } else if (this.i && this.m.size() > 0 && !this.k) { this.k = true; int i3 = this.p; if (i3 > 1) { a(true, "圆圈进度条走满完成任务", a(1), 0, 2000); } else if (i3 > 0) { this.j = true; if (!"buy".equalsIgnoreCase(this.B) && !"theme".equalsIgnoreCase(this.B)) { this.l = true; } if (!this.l) { i2 = 1; } a(true, "圆圈进度条走满完成任务", a(i2), 0, 2000); } d(false); } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void f() { if (!isFinishing() && !this.E) { if (!this.z) { this.G--; } if (this.G <= 0) { this.b.setVisibility(0); this.c.setVisibility(4); return; } this.e0.sendEmptyMessageDelayed(0, 1000); } } private void g() { if (this.E && !isFinishing() && !this.F) { this.e0.removeMessages(3); this.e0.removeMessages(4); this.e0.removeMessages(5); if (!this.Y && !this.Z) { this.y = true; this.j = true; this.l = true; this.m.add(this.e.getUrl()); this.g.tryProgressBarExpand(false, 0); w.a().a(new a(), 300); d(true); } com.iBookStar.c.b.b("reward_help_count", com.iBookStar.c.b.a("reward_help_count", 0) + 1); this.X = true; this.H.i(); b(true); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void h() { if (this.E && !isFinishing() && !this.F && this.i && !this.j) { this.j = true; this.m.add(this.e.getUrl()); e(true); this.Y = true; } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void i() { if (this.E && !isFinishing() && !this.F && !this.u) { this.l = true; this.y = true; this.g.tryProgressBarExpand(false, 0); w.a().a(new k(), 300); d(true); this.Z = true; b(true); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void j() { if (this.E && !isFinishing() && !this.F && !this.X && this.P.getVisibility() != 0) { int round = Math.round(((float) this.J) * (1.0f - (this.t / 360.0f))); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("完成本次任务仅剩"); int length = spannableStringBuilder.length(); spannableStringBuilder.append((CharSequence) String.valueOf(round)); int length2 = spannableStringBuilder.length(); spannableStringBuilder.append((CharSequence) "秒"); spannableStringBuilder.setSpan(new ForegroundColorSpan(-2207963), length, length2, 33); this.R.setText(spannableStringBuilder); if (this.S.getChildCount() <= 0) { int i2 = 0; while (i2 < this.V.size()) { LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(0); TextView textView = new TextView(this); int i3 = i2 + 1; textView.setText(String.format("%d、", Integer.valueOf(i3))); textView.setTextSize(1, 14.0f); textView.setTextColor(-13421773); linearLayout.addView(textView); TextView textView2 = new TextView(this); textView2.setText(this.V.get(i2)); textView2.setTextSize(1, 14.0f); textView2.setTextColor(-13421773); linearLayout.addView(textView2); this.S.addView(linearLayout, new LinearLayout.LayoutParams(-2, -2)); i2 = i3; } } int a2 = this.W - com.iBookStar.c.b.a("reward_help_count", 0); if (a2 < 0) { a2 = 0; } this.T.setText(String.format("快速通关(还剩%d次)", Integer.valueOf(a2))); if (a2 <= 0) { this.T.setEnabled(false); } else { this.T.setEnabled(true); } this.P.setAlpha(0.0f); this.P.setScaleX(0.0f); this.P.setScaleY(0.0f); this.P.setVisibility(0); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(500L); animatorSet.playTogether(ObjectAnimator.ofFloat(this.P, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(this.P, "scaleX", 0.0f, 1.0f), ObjectAnimator.ofFloat(this.P, "scaleY", 0.0f, 1.0f)); animatorSet.start(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void k() { if (this.E && !isFinishing() && !this.F && !this.X) { this.g.setCoinTextWithAnim("通关\n帮助", -1877976); this.U = true; } } private void l() { try { this.e.loadUrl("javascript:if(window.dispatch){window.dispatch('clickSkipAdButton')}"); } catch (Throwable unused) { } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void m() { if (!isFinishing() && this.H != null) { this.y = true; this.g.tryProgressBarExpand(false, 0); w.a().a(new i(), 300); this.l = true; this.F = true; this.d.setText("任务已完成"); this.b.setVisibility(0); this.c.setVisibility(4); com.iBookStar.utils.k.a((Activity) this, -12401799); this.a.setBackgroundColor(-12401799); b(true); this.H.h(); this.H.d(); if (!this.X) { int a2 = com.iBookStar.c.b.a("reward_complete_count", 0) + 1; if (a2 >= 3) { int a3 = com.iBookStar.c.b.a("reward_help_count", 0) - 1; if (a3 < 0) { a3 = 0; } com.iBookStar.c.b.b("reward_help_count", a3); com.iBookStar.c.b.b("reward_complete_count", 0); return; } com.iBookStar.c.b.b("reward_complete_count", a2); } } } private void n() { if (!this.g.isShow() || !this.g.isProgressBarExpand()) { this.g.hide(); return; } this.y = true; this.g.tryProgressBarExpand(false, 0); w.a().a(new j(), 300); } private void o() { if (this.g.isShow()) { n(); } this.B = ""; this.D.clear(); this.u = false; this.t = 0.0f; this.v = 0; this.f103K = false; this.i = false; this.j = false; this.k = false; this.l = false; this.m.clear(); this.A = null; int C2 = this.H.a().C(); this.J = C2; this.c.setText(String.format("%ds", Integer.valueOf(C2))); this.e0.removeMessages(2); this.e0.removeMessages(3); this.e0.removeMessages(4); b(true); } private void p() { String a2; if (this.e0.hasMessages(4)) { if (!this.f103K || !s.c(this.O)) { a2 = a(this.l ? 2 : 1); } else { a2 = this.O; } a(true, false, "圆圈进度条走满完成任务", a2, 0, 0); this.e0.removeMessages(4); b(true); } } private void q() { this.g.setCoinMode(2); this.g.setProgressBarBackground(1); this.g.setCoinText("奖", -15066598); } static /* synthetic */ float r(RewardAdWebView rewardAdWebView) { float f2 = rewardAdWebView.t; rewardAdWebView.t = 1.0f + f2; return f2; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void r() { if (!this.j && !this.e0.hasMessages(3)) { this.e0.sendEmptyMessageDelayed(3, ((long) this.s) * 1000); this.e0.sendEmptyMessageDelayed(5, 5000); this.g.setExpandDescAnim(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void s() { String str; TaskProgressBar taskProgressBar; if (this.j && !this.u && !this.e0.hasMessages(4)) { this.e0.sendEmptyMessageDelayed(4, ((long) this.s) * 1000); this.e0.sendEmptyMessageDelayed(5, 5000); if (!this.f103K || !s.c(this.N)) { taskProgressBar = this.g; str = "滑动页面正常浏览进度才会走"; } else { taskProgressBar = this.g; str = this.N; } taskProgressBar.setExpandDesc(str); this.g.setExpandDescAnim(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void t() { int round = Math.round(((float) this.J) * (1.0f - (this.t / 360.0f))); if (round < 1) { round = 1; } this.c.setText(String.format("%ds", Integer.valueOf(round))); if (this.P.getVisibility() == 0) { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("完成本次任务仅剩"); int length = spannableStringBuilder.length(); spannableStringBuilder.append((CharSequence) String.valueOf(round)); int length2 = spannableStringBuilder.length(); spannableStringBuilder.append((CharSequence) "秒"); spannableStringBuilder.setSpan(new ForegroundColorSpan(-2207963), length, length2, 33); this.R.setText(spannableStringBuilder); } } public void a() { com.iBookStar.utils.k.a((Activity) this, this.a0); this.a.setBackgroundColor(this.a0); this.b.setImageDrawable(com.iBookStar.utils.k.a(getResources().getDrawable(com.iBookStar.utils.k.a(R.drawable.ym_toolbar_close, "ym_toolbar_close", "drawable")), this.b0)); this.c.setTextColor(this.b0); this.d.setTextColor(this.b0); int color = getResources().getColor(com.iBookStar.utils.k.a(R.color.ym_client_bg, "ym_client_bg", "color")); ((View) this.e.getParent()).setBackgroundColor(color); this.f.setProgressDrawableEx(getResources().getDrawable(com.iBookStar.utils.k.a(R.drawable.ym_progress_bar_states, "ym_progress_bar_states", "drawable")), YmConfig.getWebViewProgressColor(), new ColorDrawable(color)); } public void a(boolean z2) { if (!this.y) { if (z2) { finish(); } else if (this.P.getVisibility() != 0 && this.e.canGoBack()) { try { if (!this.F) { CommonWebView.c2 copyBackForwardList = this.e.copyBackForwardList(); if (copyBackForwardList != null && copyBackForwardList.a() > 0) { String c2 = com.iBookStar.utils.k.c(copyBackForwardList.a(copyBackForwardList.a() - 1).b()); if (s.c(c2) && c2.equalsIgnoreCase(this.o)) { j(); return; } } this.e.setTouchByUser(); this.e.goBackOrForward(-1); return; } this.e.setTouchByUser(); this.e.goBack(); } catch (Throwable th) { th.printStackTrace(); } } } } @Override // com.iBookStar.views.CommonWebView.g2 public void aSetUserBindRelation(String str) { } /* access modifiers changed from: protected */ public void b() { this.e = (CommonWebView) findViewById(com.iBookStar.utils.k.a(R.id.ym_content_wv, "ym_content_wv", "id")); this.f = (SkinProgressBar) findViewById(com.iBookStar.utils.k.a(R.id.ym_webview_progress, "ym_webview_progress", "id")); TaskProgressBar taskProgressBar = (TaskProgressBar) findViewById(com.iBookStar.utils.k.a(R.id.ym_progressBar_ll, "ym_progressBar_ll", "id")); this.g = taskProgressBar; taskProgressBar.setListener(new d()); this.a = (RelativeLayout) findViewById(com.iBookStar.utils.k.a(R.id.ym_title_text_container, "ym_title_text_container", "id")); TextView textView = (TextView) findViewById(com.iBookStar.utils.k.a(R.id.ym_title_tv, "ym_title_tv", "id")); this.d = textView; textView.setOnClickListener(this); this.d.setText("完成小说试读任务领取奖励"); ImageView imageView = (ImageView) findViewById(com.iBookStar.utils.k.a(R.id.ym_colse_iv, "ym_colse_iv", "id")); this.b = imageView; imageView.setOnClickListener(this); this.b.setVisibility(4); this.c = (TextView) findViewById(com.iBookStar.utils.k.a(R.id.ym_countdown_tv, "ym_countdown_tv", "id")); this.P = (RelativeLayout) findViewById(com.iBookStar.utils.k.a(R.id.ym_help_mask_rl, "ym_help_mask_rl", "id")); ImageView imageView2 = (ImageView) findViewById(com.iBookStar.utils.k.a(R.id.ym_help_close_iv, "ym_help_close_iv", "id")); this.Q = imageView2; imageView2.setOnClickListener(this); this.R = (TextView) findViewById(com.iBookStar.utils.k.a(R.id.ym_help_title_tv, "ym_help_title_tv", "id")); this.S = (LinearLayout) findViewById(com.iBookStar.utils.k.a(R.id.ym_help_desc_ll, "ym_help_desc_ll", "id")); TextView textView2 = (TextView) findViewById(com.iBookStar.utils.k.a(R.id.ym_help_ok_tv, "ym_help_ok_tv", "id")); this.T = textView2; textView2.setOnClickListener(this); a(); n a2 = o.a(getIntent().getStringExtra("id")); this.H = a2; if (a2 == null || a2.a() == null) { finish(); return; } boolean booleanExtra = getIntent().getBooleanExtra("useX5", false); String stringExtra = getIntent().getStringExtra("url"); this.h = stringExtra; if (!booleanExtra) { booleanExtra = stringExtra.contains("useX5=1"); } c(booleanExtra); this.p = 1; this.r = 35; this.q = Math.round(((((float) 35) * 1000.0f) / 360.0f) + 0.5f); this.e.loadUrl(this.h); int C2 = this.H.a().C(); this.J = C2; this.c.setText(String.format("%ds", Integer.valueOf(C2))); this.G = this.H.a().E(); this.e0.removeMessages(0); this.e0.sendEmptyMessageDelayed(0, 1000); ArrayList arrayList = new ArrayList(); this.V = arrayList; arrayList.add("按提示正常浏览页面即可顺利通关"); this.V.add("点击查看信息后如遇进度卡顿,请等待10秒超时后可顺利通关"); this.V.add("正常通关3次可增加【快速通关】1次"); } public void c() { if (!this.y) { try { CommonWebView.c2 copyBackForwardList = this.e.copyBackForwardList(); if (copyBackForwardList != null) { int i2 = 0; for (int a2 = copyBackForwardList.a(); a2 >= 0; a2--) { String c2 = com.iBookStar.utils.k.c(copyBackForwardList.a(a2).b()); if (!s.c(c2) || !c2.equalsIgnoreCase(this.o)) { i2--; } else if (i2 < 0) { this.e.goBackOrForward(i2); return; } else { return; } } } this.e.goBack(); } catch (Throwable th) { th.printStackTrace(); } } } @Override // com.iBookStar.views.CommonWebView.g2 public void clickToPushSetting() { } @Override // com.iBookStar.views.CommonWebView.g2 public void createPopupWindow(String str, String str2) { } @Override // com.iBookStar.views.CommonWebView.g2 public void dealPics(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void destroyPopupWindow(String str) { } /* JADX WARNING: Can't wrap try/catch for region: R(7:6|7|8|(1:10)(2:11|(2:16|17)(1:15))|18|19|21) */ /* JADX WARNING: Code restructure failed: missing block: B:22:?, code lost: return; */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:18:0x0069 */ @Override // com.iBookStar.views.CommonWebView.g2 public void fetchAd(String str) { n nVar; if (!isFinishing() && (nVar = this.H) != null && nVar.a() != null) { if (this.H.a().I() != null) { if (com.iBookStar.utils.k.a(com.iBookStar.c.b.a("rewardad_show_time", 0L)) || Math.random() >= this.H.a().w()) { com.iBookStar.c.b.b("rewardad_show_time", System.currentTimeMillis()); this.e.loadUrl(String.format("javascript:if(%s){%s(%s)}", str, str, this.H.a().r())); return; } } com.iBookStar.c.b.b("rewardad_show_time", System.currentTimeMillis()); JSONObject jSONObject = new JSONObject(); jSONObject.put("resultCode", "-1"); this.e.loadUrl(String.format("javascript:if(%s){%s(%s)}", str, str, jSONObject.toString())); } } @Override // com.iBookStar.views.CommonWebView.g2 public String getCoinTaskProgress() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public String getCurrentCoinTask() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public long getCurrentTaskId() { return 0; } @Override // com.iBookStar.views.CommonWebView.g2 public void getMonitorTime(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public String getTaskParams() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public float getTopSafeAreaInset() { return 0.0f; } @Override // com.iBookStar.views.CommonWebView.g2 public String getUserBindRelation() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public String getUserSpecialId() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public String getUtdid() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public int getWebViewEnvironment() { return this.F ? 7 : 6; } @Override // com.iBookStar.views.CommonWebView.g2 public String getYPProductData() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public void gotoTab(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void hidePopupWindow(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void hrefNumOnPage(int i2) { } @Override // com.iBookStar.views.CommonWebView.g2 public String isEnterReaderFromTask() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public String isTaskFail() { return null; } @Override // com.iBookStar.views.CommonWebView.g2 public void needPost() { if (!this.n) { String url = this.e.getUrl(); if (s.a(url)) { url = this.h; } this.o = com.iBookStar.utils.k.c(url); this.n = true; } } public void onActivityResult(int i2, int i3, Intent intent) { super.onActivityResult(i2, i3, intent); } @Override // com.iBookStar.views.CommonWebView.g2 public void onBackAdReceived(String str) { } public void onClick(View view) { String str; if (view == this.b) { if (!this.y) { long currentTimeMillis = System.currentTimeMillis(); if (currentTimeMillis - this.I > 3000) { this.I = currentTimeMillis; if (this.F) { this.H.c(); finish(); return; } l(); } } } else if (view == this.d) { long currentTimeMillis2 = System.currentTimeMillis(); if (currentTimeMillis2 - this.c0 > 3000) { this.c0 = currentTimeMillis2; this.d0 = 0; return; } int i2 = this.d0; this.d0 = i2 + 1; if (i2 > 7) { if (com.iBookStar.c.c.j()) { com.iBookStar.c.c.a(false); str = "关闭DEBUG模式"; } else { com.iBookStar.c.c.a(true); str = "打开DEBUG模式"; } Toast.makeText(this, str, 0).show(); this.c0 = 0; } } else if (view == this.Q) { b(false); } else if (view == this.T) { g(); } } @Override // com.iBookStar.views.CommonWebView.g2 public void onClickTasksCenter() { } @Override // com.iBookStar.views.CommonWebView.g2 public void onClose() { a(true); } @Override // com.iBookStar.views.CommonWebView.g2 public void onContentLoaded(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void onContinueAd() { } public void onCreate(Bundle bundle) { super.onCreate(bundle); if (bundle != null) { finish(); } else if (getIntent().getExtras() == null) { finish(); } else { a.c().a(getApplication()); setContentView(com.iBookStar.utils.k.a(R.layout.ym_reward_webview_layout, "ym_reward_webview_layout", TtmlNode.TAG_LAYOUT)); b(); } } /* access modifiers changed from: protected */ public void onDestroy() { super.onDestroy(); this.e0.removeCallbacksAndMessages(null); CommonWebView commonWebView = this.e; if (commonWebView != null) { commonWebView.unregisterEventBus(); } n nVar = this.H; if (nVar != null) { nVar.j(); this.H.destroy(); this.H = null; } } @Override // com.iBookStar.views.CommonWebView.g2 public void onFloatAdShow() { if (!this.F) { this.e0.removeMessages(1); this.e0.sendEmptyMessageDelayed(1, 1000); } } public boolean onKeyDown(int i2, KeyEvent keyEvent) { if (i2 != 4) { return super.onKeyDown(i2, keyEvent); } a(false); return true; } @Override // com.iBookStar.views.CommonWebView.g2 public void onMonitorPhase(String str) { if (!isFinishing() && this.H != null && !this.F && this.f103K) { if ("secondJump".equalsIgnoreCase(str)) { if (!this.j || this.m.size() < 2) { this.j = true; this.m.add(this.e.getUrl()); e(false); com.iBookStar.a.d.a().c(this.A); } } else if ("interactTouch".equalsIgnoreCase(str)) { d(true); if (!this.e0.hasMessages(4) && s.c(this.O)) { this.g.setExpandDesc(this.O); } } } } @Override // com.iBookStar.views.CommonWebView.g2 public void onMonitorTips(String str) { if (!isFinishing() && this.H != null && !this.F && this.f103K) { try { JSONObject jSONObject = new JSONObject(str); this.L = jSONObject.optString("firstJump"); this.M = jSONObject.optString("secondJump"); this.N = jSONObject.optString("interactionDesc"); this.O = jSONObject.optString("thirdJump"); if (!this.g.isShow()) { if (!this.i) { this.E = true; this.m.clear(); this.m.add("xxx.com.cn"); this.t = 0.0f; this.v = 0; this.i = true; if (this.G <= 0) { this.b.setVisibility(4); this.c.setVisibility(0); } this.H.b(); } a(false, true, null, null, 0, 0); e(false); } } catch (Throwable unused) { } } } /* access modifiers changed from: protected */ public void onPause() { super.onPause(); this.z = true; } @Override // com.iBookStar.views.CommonWebView.g2 public void onPayCancel() { } @Override // com.iBookStar.views.CommonWebView.g2 public void onPayFinish() { } @Override // com.iBookStar.views.CommonWebView.g2 public void onPayStart() { } @Override // com.iBookStar.views.CommonWebView.g2 public void onRefresh() { } /* access modifiers changed from: protected */ public void onResume() { super.onResume(); this.z = false; this.H.f(); } @Override // com.iBookStar.views.CommonWebView.g2 public void onSkipAd() { this.H.g(); this.H.c(); finish(); } @Override // com.iBookStar.views.CommonWebView.g2 public void openCouponPage(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void openItemDetailWithParams(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void openNextCoinTask() { } @Override // com.iBookStar.views.CommonWebView.g2 public void openURLWithNewWindow(String str) { try { Intent intent = new Intent(com.iBookStar.b.a.k(), SurveyWebView.class); intent.putExtra("url", str); intent.putExtra("back", true); startActivity(intent); } catch (Throwable th) { th.printStackTrace(); } } @Override // com.iBookStar.views.CommonWebView.g2 public void postPopupWindowHeight(String str, int i2) { } @Override // com.iBookStar.views.CommonWebView.g2 public void postRightBtn(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void postTaskCenterCloseMsg(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void postTaskCondition(String str) { try { if (!this.E && s.c(str)) { JSONObject jSONObject = new JSONObject(str).getJSONObject("condition"); this.s = jSONObject.optInt("timeout", 10); this.W = jSONObject.optInt("maxHelpCount", 5); JSONArray optJSONArray = jSONObject.optJSONArray("help"); if (optJSONArray != null && optJSONArray.length() > 0) { this.V.clear(); for (int i2 = 0; i2 < optJSONArray.length(); i2++) { this.V.add(optJSONArray.getString(i2)); } } } } catch (Exception unused) { } } @Override // com.iBookStar.views.CommonWebView.g2 public void sendMessage(String str, String str2) { } @Override // com.iBookStar.views.CommonWebView.g2 public void setAdItem(com.iBookStar.a.f fVar) { this.A = fVar; this.B = fVar.b(); this.C = fVar.z(); if (!com.iBookStar.c.b.a("use_monitor_control", false) && fVar.N() > 0) { int N2 = (int) fVar.N(); this.r = N2; this.q = Math.round(((((float) N2) * 1000.0f) / 360.0f) + 0.5f); if (Math.random() < fVar.O()) { this.p = 2; } else { this.p = 1; } } if ("buy".equalsIgnoreCase(this.B)) { this.D.clear(); if (!s.c(fVar.v())) { this.D.add("detail.m.tmall"); this.D.add("awp/core/detail"); } else if (fVar.v().equalsIgnoreCase("dzad")) { this.f103K = true; } else { String[] split = fVar.v().split("\\|"); for (String str : split) { if (s.c(str)) { this.D.add(str); } } } } } @Override // com.iBookStar.views.CommonWebView.g2 public void setStatusBarMode(int i2) { } @Override // com.iBookStar.views.CommonWebView.g2 public void shareGoodsDetails(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void showPopupWindow(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void timeMonitorComplete() { } @Override // com.iBookStar.views.CommonWebView.g2 public void userToLoginAndAuthorized(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void webPageChanged(String str) { n nVar; if (!isFinishing() && (nVar = this.H) != null && nVar.a() != null) { o(); this.E = false; if (!this.F) { this.G = this.H.a().E(); this.e0.removeMessages(0); this.e0.sendEmptyMessageDelayed(0, 1000); } } } @Override // com.iBookStar.views.CommonWebView.g2 public void webviewTitleChangeToString(String str) { } @Override // com.iBookStar.views.CommonWebView.g2 public void withdraw() { } }