翰林优商.apk(点击下载) / WebViewFragment.java


package com.iBookStar.activityComm;

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.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.baidu.idl.face.platform.utils.BitmapUtils;
import com.bytedance.sdk.openadsdk.BuildConfig;
import com.iBookStar.R;
import com.iBookStar.utils.l;
import com.iBookStar.utils.w;
import com.iBookStar.views.CommonWebView;
import com.iBookStar.views.NativeAdUtil;
import com.iBookStar.views.PopupWebView;
import com.iBookStar.views.SdkAdMonitorView;
import com.iBookStar.views.SkinProgressBar;
import com.iBookStar.views.TaskProgressBar;
import com.iBookStar.views.YmConfig;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.sigmob.sdk.base.mta.PointCategory;
import com.umeng.analytics.pro.am;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import org.json.JSONArray;
import org.json.JSONObject;

public class WebViewFragment extends Fragment implements CommonWebView.g2, CommonWebView.b2 {
    private static Stack<WebViewFragment> A0 = new Stack<>();
    public static boolean B0 = false;
    private static boolean C0 = false;
    private float A;
    private float B;
    private boolean C = false;
    private com.iBookStar.a.f D;
    private String E = "";
    private int F;
    private List<String> G = new ArrayList();
    private boolean H = false;
    private boolean I = false;
    private String J = "store";

    /* renamed from: K  reason: collision with root package name */
    private boolean f104K = false;
    private boolean L = false;
    private int M = 0;
    private String N;
    private boolean O = false;
    private Map<String, PopupWebView> P = new HashMap();
    private long Q;
    private boolean R;
    private boolean S = false;
    private boolean T = false;
    private String U;
    private boolean V;
    private boolean W = false;
    private String X;
    private String Y;
    private String Z;
    protected Activity a;
    private String a0;
    protected RelativeLayout b;
    private int b0;
    protected CommonWebView c;
    private int c0;
    protected SkinProgressBar d;
    private int d0 = 15;
    protected TaskProgressBar e;
    private int e0 = 10;
    protected int f = 100;
    private int f0 = Math.round(((((float) 15) * 1000.0f) / 360.0f) + 0.5f);
    protected String g;
    private String g0;
    protected String h;
    private JSONArray h0;
    protected boolean i = true;
    private String i0 = "WEAK";
    protected String j;
    private int j0 = 1;
    protected boolean k = false;
    private int k0 = 1;
    protected v l;
    private float l0 = 0.0f;
    protected boolean m = false;
    private boolean m0 = false;
    protected boolean n = false;
    private int n0 = 0;
    protected boolean o = false;
    private int o0 = 0;
    protected boolean p = false;
    private long p0 = 0;
    protected boolean q = false;
    private String q0 = "";
    private Intent r = new Intent();
    private String r0 = "";
    private int s = -1;
    private long s0 = 0;
    private boolean t = false;
    private boolean t0 = false;
    private com.iBookStar.a.g u;
    private boolean u0 = false;
    private boolean v = false;
    private boolean v0 = false;
    private boolean w = false;
    private boolean w0 = false;
    private String x;
    private Set<String> x0 = new HashSet();
    private boolean y = false;
    private boolean y0 = false;
    private boolean z = false;
    private boolean z0 = false;

    /* access modifiers changed from: package-private */
    public class a implements l.m {
        a() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            WebViewFragment.this.B();
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class b implements l.m {
        b() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            WebViewFragment.this.B();
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class c implements l.m {
        c() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            WebViewFragment.this.B();
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class d implements TaskProgressBar.j {
        d() {
        }

        @Override // com.iBookStar.views.TaskProgressBar.j
        public void a() {
            if (!WebViewFragment.this.e.isProgressBarExpand()) {
                WebViewFragment.this.a(true, false, null, WebViewFragment.this.a((WebViewFragment) 2), 0, 0);
            }
        }

        @Override // com.iBookStar.views.TaskProgressBar.j
        public void b() {
        }
    }

    /* 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) {
            com.iBookStar.utils.p.a("WebViewFragment", "ttttttttttttttttt, onPageFinished=" + str);
            WebViewFragment.this.a((WebViewFragment) commonWebView, (CommonWebView) str, (String) 2);
            WebViewFragment.this.d.setVisibility(8);
            super.a(commonWebView, str);
        }

        @Override // com.iBookStar.views.CommonWebView.f2
        public void a(CommonWebView commonWebView, String str, Bitmap bitmap) {
            com.iBookStar.utils.p.a("WebViewFragment", "ttttttttttttttttt, onPageStarted=" + str);
            WebViewFragment.this.a((WebViewFragment) commonWebView, (CommonWebView) str, (String) 1);
            WebViewFragment.this.d.setVisibility(0);
            super.a(commonWebView, str, bitmap);
        }

        @Override // com.iBookStar.views.CommonWebView.f2
        public boolean b(CommonWebView commonWebView, String str) {
            com.iBookStar.utils.p.a("WebViewFragment", "tttttttttttttttttt, shouldOverrideUrlLoading=" + str);
            if (WebViewFragment.this.a(commonWebView, str)) {
                return true;
            }
            if (WebViewFragment.this.w) {
                WebViewFragment.this.c.report2Web();
                if (am.aw.equalsIgnoreCase(WebViewFragment.this.J) && "buy".equalsIgnoreCase(WebViewFragment.this.E) && !str.startsWith("http://") && !str.startsWith("https://")) {
                    try {
                        Intent intent = new Intent("android.intent.action.VIEW");
                        intent.setData(Uri.parse(str));
                        intent.addFlags(268435456);
                        WebViewFragment.this.a.startActivity(intent);
                        if (!WebViewFragment.this.u0 || WebViewFragment.this.x0.size() < 2) {
                            WebViewFragment.this.u0 = true;
                            WebViewFragment.this.x0.add(str);
                            WebViewFragment.this.d((WebViewFragment) false);
                            com.iBookStar.a.d.a().c(WebViewFragment.this.D);
                        }
                        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) {
            WebViewFragment.this.d.setProgress(i);
            super.a(commonWebView, i);
        }

        @Override // com.iBookStar.views.CommonWebView.d2
        public void a(CommonWebView commonWebView, String str) {
            v vVar;
            if (WebViewFragment.this.i && com.iBookStar.utils.s.c(str)) {
                WebViewFragment webViewFragment = WebViewFragment.this;
                webViewFragment.g = str;
                if (com.iBookStar.utils.s.a(webViewFragment.x) && (vVar = WebViewFragment.this.l) != null) {
                    vVar.c(str);
                }
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class g implements View.OnTouchListener {
        g() {
        }

        public boolean onTouch(View view, MotionEvent motionEvent) {
            int action = motionEvent.getAction();
            if (action == 0) {
                WebViewFragment.this.A = motionEvent.getY();
            } else if (action == 1) {
                WebViewFragment.this.B = motionEvent.getY();
                if (WebViewFragment.this.e.isShow() && !WebViewFragment.this.y0) {
                    float abs = Math.abs(WebViewFragment.this.B - WebViewFragment.this.A);
                    if (!WebViewFragment.this.W && WebViewFragment.this.u0 && abs > 50.0f) {
                        WebViewFragment.this.c((WebViewFragment) false);
                    }
                }
            }
            return false;
        }
    }

    /* access modifiers changed from: package-private */
    public class h implements Runnable {
        final /* synthetic */ int a;
        final /* synthetic */ String b;
        final /* synthetic */ CommonWebView c;

        h(int i, String str, CommonWebView commonWebView) {
            this.a = i;
            this.b = str;
            this.c = commonWebView;
        }

        /* JADX WARNING: Code restructure failed: missing block: B:22:0x0132, code lost:
            if (r1 != null) goto L_0x018c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:28:0x015a, code lost:
            if (r1 != null) goto L_0x017c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:32:0x017a, code lost:
            if (r1 != null) goto L_0x017c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:35:0x018a, code lost:
            if (r1 != null) goto L_0x018c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:36:0x018c, code lost:
            r1.a();
         */
        public void run() {
            v vVar;
            v vVar2;
            if (!WebViewFragment.this.a.isFinishing()) {
                if ((WebViewFragment.this.w || WebViewFragment.this.t) && com.iBookStar.utils.s.c(WebViewFragment.this.x)) {
                    int i = 2;
                    com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--1, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                    String c2 = com.iBookStar.utils.k.c(this.b);
                    if (!WebViewFragment.this.x.equalsIgnoreCase(c2)) {
                        com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--2, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                        WebViewFragment.this.S = false;
                        WebViewFragment.this.Q = 0;
                        WebViewFragment.this.R = false;
                        WebViewFragment.this.J = am.aw;
                        boolean z = !WebViewFragment.this.t0;
                        if (this.c.isTouchByUser()) {
                            com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--3, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                            if (!WebViewFragment.this.t0) {
                                com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--4, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                                WebViewFragment.this.s0 = System.currentTimeMillis();
                                WebViewFragment.this.x0.clear();
                                WebViewFragment.this.x0.add(c2);
                                WebViewFragment.this.l0 = 0.0f;
                                WebViewFragment.this.n0 = 0;
                                WebViewFragment.this.t0 = true;
                                if (WebViewFragment.this.j0 == 0) {
                                    com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--5, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                                    if (!WebViewFragment.this.y && com.iBookStar.c.b.a(com.iBookStar.c.c.a("taskOnDlgWithContinueRead"), false)) {
                                        WebViewFragment.this.K();
                                        vVar = WebViewFragment.this.l;
                                    } else if (!"buy".equalsIgnoreCase(WebViewFragment.this.E) || !WebViewFragment.this.W) {
                                        WebViewFragment.this.a(false, true, null, null, 0, 0);
                                        vVar2 = WebViewFragment.this.l;
                                    }
                                } else if (com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_count"), 0) > 0) {
                                    WebViewFragment.this.a(false, true, null, null, 0, 0);
                                    vVar2 = WebViewFragment.this.l;
                                } else {
                                    WebViewFragment.this.K();
                                    vVar = WebViewFragment.this.l;
                                }
                                vVar2.b();
                            } else {
                                if (!WebViewFragment.this.u0) {
                                    com.iBookStar.utils.p.a("WebViewFragment", String.format("ttttttttttttttt--6, loc=%d, url=%s", Integer.valueOf(this.a), this.b));
                                    if (!"buy".equalsIgnoreCase(WebViewFragment.this.E)) {
                                        WebViewFragment.this.x0.add(c2);
                                        if (WebViewFragment.this.x0.size() > 1) {
                                            WebViewFragment.this.u0 = true;
                                        }
                                    } else {
                                        for (String str : WebViewFragment.this.G) {
                                            if (this.b.contains(str)) {
                                                WebViewFragment.this.u0 = true;
                                                WebViewFragment.this.x0.add(this.b);
                                                com.iBookStar.a.d.a().c(WebViewFragment.this.D);
                                            }
                                        }
                                    }
                                } else if (WebViewFragment.this.x0.size() < 2) {
                                    if (!"buy".equalsIgnoreCase(WebViewFragment.this.E)) {
                                        WebViewFragment.this.x0.add(c2);
                                    } else {
                                        for (String str2 : WebViewFragment.this.G) {
                                            if (this.b.contains(str2)) {
                                                WebViewFragment.this.x0.add(this.b);
                                            }
                                        }
                                    }
                                }
                                com.iBookStar.a.d.a().c(WebViewFragment.this.D);
                            }
                        }
                        WebViewFragment.this.d((WebViewFragment) false);
                        WebViewFragment webViewFragment = WebViewFragment.this;
                        if (webViewFragment.l != null) {
                            if (!webViewFragment.t) {
                                if (z) {
                                    WebViewFragment webViewFragment2 = WebViewFragment.this;
                                    webViewFragment2.l.a(1, webViewFragment2.D != null ? WebViewFragment.this.D.o() : 0);
                                }
                                if (WebViewFragment.this.o0 == 1) {
                                    WebViewFragment.this.l.a(2);
                                } else {
                                    WebViewFragment webViewFragment3 = WebViewFragment.this;
                                    v vVar3 = webViewFragment3.l;
                                    if (webViewFragment3.M < 2) {
                                        i = 0;
                                    }
                                    vVar3.a(i);
                                }
                            }
                            WebViewFragment webViewFragment4 = WebViewFragment.this;
                            if (webViewFragment4.i) {
                                webViewFragment4.l.c(this.c.getTitle());
                            }
                        }
                    }
                }
                this.c.resetTouchState();
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class i implements Runnable {
        i() {
        }

        public void run() {
            WebViewFragment.this.V = false;
            if (am.aw.equalsIgnoreCase(WebViewFragment.this.J) && !WebViewFragment.this.a.isFinishing() && WebViewFragment.this.t0 && !WebViewFragment.this.u0) {
                WebViewFragment.this.u0 = true;
                WebViewFragment.this.x0.add(WebViewFragment.this.c.getUrl());
                WebViewFragment.this.d((WebViewFragment) true);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class j implements Runnable {

        class a implements Runnable {
            a() {
            }

            public void run() {
                if (am.aw.equalsIgnoreCase(WebViewFragment.this.J) && !WebViewFragment.this.a.isFinishing()) {
                    WebViewFragment.this.a(true, false, "圆圈进度条走满即可通关", null, 0, 0);
                }
            }
        }

        j() {
        }

        public void run() {
            boolean z = WebViewFragment.this.O;
            WebViewFragment.this.O = false;
            if (am.aw.equalsIgnoreCase(WebViewFragment.this.J) && !WebViewFragment.this.a.isFinishing() && !WebViewFragment.this.m0 && z) {
                WebViewFragment.this.w0 = true;
                WebViewFragment.this.e.tryProgressBarExpand(false, 0);
                WebViewFragment.this.b.postDelayed(new a(), 300);
                WebViewFragment.this.c((WebViewFragment) true);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class k implements Runnable {
        k() {
        }

        public void run() {
            WebViewFragment.this.z0 = false;
            WebViewFragment.this.e.hide();
        }
    }

    /* access modifiers changed from: package-private */
    public class l implements Runnable {
        final /* synthetic */ boolean a;
        final /* synthetic */ String b;

        l(boolean z, String str) {
            this.a = z;
            this.b = str;
        }

        public void run() {
            if (am.aw.equalsIgnoreCase(WebViewFragment.this.J)) {
                WebViewFragment.this.a(true, false, "圆圈进度条走满即可通关", this.a ? null : this.b, 0, 0);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class m implements l.m {
        m() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            WebViewFragment.this.H = false;
            if (i2 == 0) {
                WebViewFragment.this.h = String.format("%s%s", com.iBookStar.c.b.a("reward_unit", "金币"), String.valueOf(obj));
                WebViewFragment webViewFragment = WebViewFragment.this;
                if (webViewFragment.l != null && (webViewFragment.t || "reader".equalsIgnoreCase(WebViewFragment.this.J))) {
                    WebViewFragment webViewFragment2 = WebViewFragment.this;
                    webViewFragment2.l.b(webViewFragment2.h);
                }
            }
            return true;
        }
    }

    class n implements Runnable {
        final /* synthetic */ com.iBookStar.utils.j a;

        n(com.iBookStar.utils.j jVar) {
            this.a = jVar;
        }

        public void run() {
            WebViewFragment.this.a((WebViewFragment) this.a.a());
        }
    }

    /* access modifiers changed from: package-private */
    public class o implements SdkAdMonitorView.e {
        o() {
        }

        @Override // com.iBookStar.views.SdkAdMonitorView.e
        public void a() {
            WebViewFragment.this.R = true;
            if (!WebViewFragment.this.C) {
                WebViewFragment.this.o0 = 1;
                WebViewFragment.this.y0 = true;
                WebViewFragment webViewFragment = WebViewFragment.this;
                int i = webViewFragment.s;
                int i2 = WebViewFragment.this.b0;
                int i3 = WebViewFragment.this.c0;
                long currentTimeMillis = System.currentTimeMillis();
                webViewFragment.a((WebViewFragment) i, i2, i3, (int) currentTimeMillis, (long) "闯关默认书名", "1", WebViewFragment.this.d0 + "", "1", WebViewFragment.this.g0);
                WebViewFragment.this.g0 = "";
                WebViewFragment.this.E();
                WebViewFragment.this.R = false;
                WebViewFragment.this.Q = 0;
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class p implements l.m {
        p() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            if (i2 == 0) {
                try {
                    WebViewFragment.this.u.f(WebViewFragment.this.u.k() - 1);
                    String str = (String) obj;
                    if (WebViewFragment.this.l != null) {
                        WebViewFragment.this.l.d(str);
                    }
                    WebViewFragment.this.v();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class q implements l.m {
        final /* synthetic */ String a;
        final /* synthetic */ String b;
        final /* synthetic */ String c;

        q(String str, String str2, String str3) {
            this.a = str;
            this.b = str2;
            this.c = str3;
        }

        /* JADX WARNING: Removed duplicated region for block: B:58:0x0146  */
        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            int i3;
            String str;
            String a2;
            try {
                WebViewFragment.this.y0 = false;
                if (i2 == 0) {
                    if (objArr == null || objArr[1] == null) {
                        i3 = 1;
                    } else {
                        i3 = Integer.parseInt(objArr[1].toString());
                        if (i3 == 1) {
                            if (WebViewFragment.this.o0 == 1) {
                                WebViewFragment.this.w();
                                WebViewFragment.this.o0 = 0;
                            } else {
                                WebViewFragment.this.K();
                            }
                            if (WebViewFragment.this.l != null) {
                                WebViewFragment.this.l.a();
                            }
                            WebViewFragment.this.j0 = 1;
                            com.iBookStar.c.b.a(com.iBookStar.c.c.b("ad_task_fail"));
                            com.iBookStar.c.b.a(com.iBookStar.c.c.a("task_status_time"));
                            a2 = com.iBookStar.c.c.a("query_task_status_time");
                        } else if (i3 == 0) {
                            if (WebViewFragment.this.o0 == 1) {
                                WebViewFragment.this.o0 = 0;
                                if ("1".equalsIgnoreCase(this.a)) {
                                    com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                                    com.iBookStar.utils.l.a(WebViewFragment.this.s, this.b, this.c, 1);
                                }
                            }
                            a2 = com.iBookStar.c.c.a("task_status_time");
                        }
                        com.iBookStar.c.b.b(a2, System.currentTimeMillis());
                    }
                    if (!(objArr == null || objArr[3] == null)) {
                        WebViewFragment.this.k0 = Integer.parseInt(objArr[3].toString());
                        com.iBookStar.c.b.b(com.iBookStar.c.c.a("continue_read"), WebViewFragment.this.k0);
                        WebViewFragment.this.J();
                    }
                    if (i3 == 0 && !com.iBookStar.c.b.a(com.iBookStar.c.c.a("taskOnDlgWithContinueRead"), false)) {
                        WebViewFragment.this.I();
                        if (WebViewFragment.this.l != null) {
                            WebViewFragment.this.l.b();
                        }
                    }
                    if (!(objArr == null || objArr[4] == null)) {
                        WebViewFragment.this.h0 = (JSONArray) objArr[4];
                    }
                    if (!com.iBookStar.c.b.a(com.iBookStar.c.c.a("project_valid"), true)) {
                        if (!(objArr == null || objArr[5] == null)) {
                            str = (String) objArr[5];
                            if (!(WebViewFragment.this.l == null || WebViewFragment.this.o0 == 1)) {
                                WebViewFragment.this.l.d(str);
                            }
                            if (com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_count"), 0) > 0) {
                                String a3 = com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_tips"), (String) null);
                                if (!TextUtils.isEmpty(a3)) {
                                    Toast.makeText(WebViewFragment.this.a, a3, 1).show();
                                }
                            }
                        }
                    } else if (obj != null) {
                        str = String.valueOf(obj);
                        WebViewFragment.this.v();
                        WebViewFragment.this.l.d(str);
                        if (com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_count"), 0) > 0) {
                        }
                    }
                    str = null;
                    WebViewFragment.this.l.d(str);
                    if (com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_count"), 0) > 0) {
                    }
                } else {
                    if (i2 == -7) {
                        com.iBookStar.utils.l.c(null);
                    }
                    if (WebViewFragment.this.o0 == 1) {
                        WebViewFragment.this.o0 = 0;
                        if ("1".equalsIgnoreCase(this.a)) {
                            com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                            com.iBookStar.utils.l.a(WebViewFragment.this.s, this.b, this.c, 1);
                        }
                    }
                }
                if (!(objArr == null || objArr[6] == null)) {
                    WebViewFragment.this.c((WebViewFragment) ((String) objArr[6]));
                }
            } catch (Exception unused) {
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class r implements l.m {
        r() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            String str = null;
            if (i2 == 0) {
                try {
                    if (!com.iBookStar.c.b.a(com.iBookStar.c.c.a("project_valid"), true)) {
                        if (!(objArr == null || objArr[0] == null)) {
                            str = (String) objArr[0];
                        }
                    } else if (obj != null) {
                        str = String.valueOf(obj);
                        WebViewFragment.this.v();
                    }
                    if (WebViewFragment.this.l != null) {
                        WebViewFragment.this.l.d(str);
                    }
                } catch (Exception unused) {
                }
            } else if (i2 == -7) {
                com.iBookStar.utils.l.c(null);
            }
            return true;
        }
    }

    /* access modifiers changed from: package-private */
    public class s implements l.m {
        s() {
        }

        @Override // com.iBookStar.utils.l.m
        public boolean a(int i, int i2, Object obj, Object... objArr) {
            if (i2 != 0) {
                return true;
            }
            int intValue = ((Integer) obj).intValue();
            int intValue2 = ((Integer) objArr[0]).intValue();
            if (intValue != 0) {
                return true;
            }
            WebViewFragment.this.k0 = intValue2;
            WebViewFragment.this.J();
            WebViewFragment.this.I();
            v vVar = WebViewFragment.this.l;
            if (vVar == null) {
                return true;
            }
            vVar.b();
            return true;
        }
    }

    class t implements Runnable {
        t() {
        }

        public void run() {
            WebViewFragment webViewFragment;
            v vVar;
            if (!"reader".equalsIgnoreCase(WebViewFragment.this.J) && (vVar = (webViewFragment = WebViewFragment.this).l) != null) {
                vVar.c(webViewFragment.g);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class u extends Thread {

        class a implements Runnable {

            /* renamed from: com.iBookStar.activityComm.WebViewFragment$u$a$a  reason: collision with other inner class name */
            class RunnableC0062a implements Runnable {

                /* renamed from: com.iBookStar.activityComm.WebViewFragment$u$a$a$a  reason: collision with other inner class name */
                class RunnableC0063a implements Runnable {
                    RunnableC0063a() {
                    }

                    public void run() {
                        WebViewFragment.this.e.setExpandDescAnim();
                    }
                }

                /* renamed from: com.iBookStar.activityComm.WebViewFragment$u$a$a$b */
                class b implements Runnable {
                    b() {
                    }

                    public void run() {
                        WebViewFragment.this.z0 = false;
                        WebViewFragment.this.K();
                        v vVar = WebViewFragment.this.l;
                        if (vVar != null) {
                            vVar.a();
                            WebViewFragment.this.l.a(2);
                        }
                        if (WebViewFragment.this.L) {
                            WebViewFragment.this.G();
                        }
                    }
                }

                RunnableC0062a() {
                }

                public void run() {
                    WebViewFragment.this.a(true, true, null, "完成啦!返回继续免费阅读", 0, 0);
                    WebViewFragment.this.b.postDelayed(new RunnableC0063a(), 300);
                    WebViewFragment.this.b.postDelayed(new b(), 3000);
                }
            }

            a() {
            }

            public void run() {
                if (!WebViewFragment.this.e.isShow()) {
                    return;
                }
                if (WebViewFragment.this.l0 < 360.0f) {
                    WebViewFragment.this.Q();
                    WebViewFragment.this.R();
                } else if (am.aw.equalsIgnoreCase(WebViewFragment.this.J)) {
                    if (WebViewFragment.this.t) {
                        WebViewFragment.this.K();
                        v vVar = WebViewFragment.this.l;
                        if (vVar != null) {
                            vVar.a();
                        }
                        WebViewFragment.this.L();
                        return;
                    }
                    int a2 = com.iBookStar.c.b.a(com.iBookStar.c.c.a("extra_reward_count"), 0);
                    if (WebViewFragment.this.j0 != 1 || a2 <= 0) {
                        WebViewFragment.this.o0 = 1;
                        WebViewFragment.this.z0 = true;
                        WebViewFragment.this.e.tryProgressBarExpand(false, 0);
                        WebViewFragment.this.b.postDelayed(new RunnableC0062a(), 300);
                        return;
                    }
                    com.iBookStar.c.b.b(com.iBookStar.c.c.a("extra_reward_count"), a2 - 1);
                    WebViewFragment.this.K();
                    v vVar2 = WebViewFragment.this.l;
                    if (vVar2 != null) {
                        vVar2.a();
                    }
                    WebViewFragment webViewFragment = WebViewFragment.this;
                    webViewFragment.a(webViewFragment.s, WebViewFragment.this.b0, WebViewFragment.this.c0, System.currentTimeMillis(), "额外奖励", WebViewFragment.this.x0.size() + "", WebViewFragment.this.d0 + "", "1");
                    WebViewFragment.this.z = true;
                }
            }
        }

        u() {
        }

        public void run() {
            do {
                if (!WebViewFragment.this.C) {
                    WebViewFragment.m(WebViewFragment.this);
                    if (WebViewFragment.this.l0 >= ((float) WebViewFragment.this.n0)) {
                        WebViewFragment.this.m0 = false;
                        WebViewFragment webViewFragment = WebViewFragment.this;
                        webViewFragment.l0 = (float) webViewFragment.n0;
                        Activity activity = WebViewFragment.this.a;
                        if (activity != null && !activity.isFinishing()) {
                            WebViewFragment.this.a.runOnUiThread(new a());
                        }
                    }
                    WebViewFragment webViewFragment2 = WebViewFragment.this;
                    webViewFragment2.e.setProgress(webViewFragment2.l0);
                }
                try {
                    Thread.sleep((long) WebViewFragment.this.f0);
                } catch (Exception unused) {
                }
            } while (WebViewFragment.this.m0);
        }
    }

    public interface v {
        void a();

        void a(int i);

        void a(int i, int i2);

        void a(String str);

        void b();

        void b(String str);

        void c(String str);

        boolean c();

        void d(String str);

        float getTopSafeAreaInset();
    }

    private boolean A() {
        try {
            if (this.L && !this.c.canGoBack()) {
                return true;
            }
            CommonWebView.c2 copyBackForwardList = this.c.copyBackForwardList();
            if (copyBackForwardList.a() == 0) {
                return true;
            }
            String c2 = com.iBookStar.utils.k.c(copyBackForwardList.a(copyBackForwardList.a() - 1).b());
            return com.iBookStar.utils.s.c(c2) && c2.equalsIgnoreCase(this.x);
        } catch (Throwable th) {
            th.printStackTrace();
            return false;
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:38:0x00f1, code lost:
        if (com.iBookStar.c.b.j().d() == false) goto L_0x0106;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x0104, code lost:
        if (com.iBookStar.c.b.j().d() == false) goto L_0x0106;
     */
    private void B() {
        if (!com.iBookStar.c.c.h()) {
            if (this.j.contains("_needloginbeforemonthpay=1")) {
            }
            this.c.loadUrl(this.j);
            return;
        } else if (0 == com.iBookStar.c.b.a(com.iBookStar.c.c.b("config_setup"), 0L)) {
            com.iBookStar.utils.l.c(new a());
            return;
        } else {
            com.iBookStar.utils.l.c(null);
            if (com.iBookStar.c.b.a("coin_task_filter", true) || C0) {
                com.iBookStar.a.g a2 = com.iBookStar.c.b.a(1);
                this.u = a2;
                boolean z2 = a2 != null && a2.k() > 0;
                this.t = z2;
                if (!z2 || com.iBookStar.c.b.j().c() > 0 || this.v) {
                    if (this.t && com.iBookStar.c.b.j().c() > 0) {
                        this.x = "xxx.com";
                        v();
                        int b2 = (int) (((double) this.u.b()) * (Math.random() + 0.5d));
                        this.d0 = b2;
                        int i2 = (b2 / 5) * 5;
                        this.d0 = i2;
                        int round = Math.round(((((float) i2) * 1000.0f) / 360.0f) + 0.5f);
                        this.f0 = round;
                        if (round <= 10) {
                            this.f0 = 30;
                        }
                        this.i0 = Math.random() < ((double) com.iBookStar.c.b.a(com.iBookStar.c.c.a("second_jump_rate"), 0.7f)) ? "FORCE" : "WEAK";
                        this.j0 = 0;
                        this.c.setTouchByUser();
                        P();
                    }
                    if (this.j.contains("_needloginbeforemonthpay=1")) {
                    }
                    this.c.loadUrl(this.j);
                    return;
                }
                com.iBookStar.utils.l.a(new c());
                this.v = true;
                return;
            }
            com.iBookStar.utils.l.d(new b());
            C0 = true;
            return;
        }
        this.c.login(null, null);
    }

    private void C() {
        try {
            JSONObject jSONObject = new JSONObject(getArguments().getString("taskParams"));
            this.w = jSONObject.optBoolean("isNeedPost");
            this.x = jSONObject.optString("iDefaultHost", null);
            this.j0 = jSONObject.optInt("iTaskStatus", 1);
            this.i0 = jSONObject.optString("iDetectMode", "WEAK");
            this.d0 = jSONObject.optInt("iDuration", 15);
            this.f0 = jSONObject.optInt("iSpeed", 30);
            this.E = jSONObject.optString("iTaskType", PointCategory.SHOW);
            this.F = jSONObject.optInt("iIsJs", 0);
            JSONArray optJSONArray = jSONObject.optJSONArray("iTaskBuyParams");
            if (optJSONArray != null && optJSONArray.length() > 0) {
                for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
                    this.G.add(optJSONArray.getString(i2));
                }
            }
            this.N = jSONObject.optString("iBackAdId", null);
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    private void D() {
        if (!am.aw.equalsIgnoreCase(this.J) && !com.iBookStar.utils.k.a(com.iBookStar.c.b.a(com.iBookStar.c.c.a("query_task_status_time"), 0L))) {
            com.iBookStar.utils.l.h(new s());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void E() {
        if (!this.a.isFinishing() && this.D != null && !F() && !this.c.reloadFloatNativeAd(this.D)) {
            this.c.reloadNativeAd(this.D);
        }
    }

    private boolean F() {
        if (this.D == null) {
            return false;
        }
        for (PopupWebView popupWebView : this.P.values()) {
            if (this.D.equals(popupWebView.getAdItem())) {
                popupWebView.reloadAd();
                return true;
            }
        }
        return false;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void G() {
        this.r.putExtra("iCurrentWebPage", this.J);
        this.r.putExtra("adClickCounts", this.q0);
        this.r.putExtra("adDurations", this.r0);
        this.r.putExtra("iLastTime", this.s0);
        this.r.putExtra("iEasyModeState", this.o0);
    }

    private void H() {
        v vVar;
        if (this.M >= 2 && am.aw.equalsIgnoreCase(this.J) && (vVar = this.l) != null) {
            vVar.a(2);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void I() {
        this.c.loadUrl("javascript:if(window.startTask){window.startTask()}");
        this.j0 = 0;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void J() {
        String str;
        CommonWebView commonWebView;
        if (this.k0 == 0) {
            commonWebView = this.c;
            str = "javascript:if(window.toggleNextButton){window.toggleNextButton(false)}";
        } else {
            commonWebView = this.c;
            str = "javascript:if(window.toggleNextButton){window.toggleNextButton(true)}";
        }
        commonWebView.loadUrl(str);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void K() {
        if (!this.e.isShow() || !this.e.isProgressBarExpand()) {
            this.e.hide();
            return;
        }
        this.z0 = true;
        this.e.tryProgressBarExpand(false, 0);
        this.b.postDelayed(new k(), 300);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void L() {
        try {
            com.iBookStar.utils.l.a(new p(), this.u.l(), 1);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void M() {
        try {
            this.c.loadUrl("javascript:if(window.onTaskDetectFail) {window.onTaskDetectFail()}");
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    private void N() {
        String str;
        StringBuilder sb;
        if (am.aw.equalsIgnoreCase(this.J)) {
            this.E = "";
            if (TextUtils.isEmpty(this.q0)) {
                str = String.valueOf(this.x0.size());
            } else {
                str = this.q0 + "," + this.x0.size();
            }
            this.q0 = str;
            long currentTimeMillis = (System.currentTimeMillis() - this.s0) / 1000;
            if (TextUtils.isEmpty(this.r0)) {
                sb = new StringBuilder();
                sb.append(currentTimeMillis);
                sb.append("");
            } else {
                sb = new StringBuilder();
                sb.append(this.r0);
                sb.append(",");
                sb.append(currentTimeMillis);
            }
            this.r0 = sb.toString();
            K();
            if (this.j0 == 0) {
                if (this.o0 == 1) {
                    v vVar = this.l;
                    if (vVar != null) {
                        vVar.a();
                    }
                    a(this.s, this.b0, this.c0, System.currentTimeMillis(), "闯关默认书名", this.x0.size() + "", this.d0 + "", "1", this.g0);
                    this.z = true;
                    this.y0 = true;
                } else {
                    this.o0 = 0;
                    com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                    com.iBookStar.utils.l.a(this.s, this.x0.size() + "", this.d0 + "", 0);
                    M();
                }
            }
            this.p0 = 0;
            this.m0 = false;
            this.l0 = 0.0f;
            this.n0 = 0;
            this.t0 = false;
            this.u0 = false;
            this.v0 = false;
            this.w0 = false;
            this.x0.clear();
            this.M = 0;
            this.Q = 0;
            this.S = false;
            this.T = false;
            this.D = null;
            this.O = false;
            this.V = false;
            this.W = false;
            if (this.z) {
                this.q0 = "";
                this.r0 = "";
                this.g0 = "";
                this.z = false;
            }
        }
    }

    private void O() {
        if (this.O) {
            if (!this.W || !com.iBookStar.utils.s.c(this.a0)) {
                this.e.setExpandDesc(a(this.w0 ? 2 : 1));
            } else {
                this.e.setExpandDesc(this.a0);
            }
            this.O = false;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0051  */
    /* JADX WARNING: Removed duplicated region for block: B:17:? A[RETURN, SYNTHETIC] */
    private void P() {
        TaskProgressBar taskProgressBar;
        int i2 = this.o0;
        String str = null;
        if (i2 == 0) {
            this.e.setCoinMode(0);
            this.e.setProgressBarBackground(1);
        } else if (i2 == 1) {
            this.e.setCoinMode(4);
            this.e.setProgressBarBackground(2);
        } else {
            if (i2 == 2) {
                this.e.setCoinMode(2);
                this.e.setProgressBarBackground(1);
                long j2 = this.p0;
                if (j2 > 0) {
                    this.e.setCoinText(String.valueOf(j2));
                } else {
                    taskProgressBar = this.e;
                    str = String.valueOf(this.d0);
                    taskProgressBar.setCoinText(str);
                }
            }
            if (!this.t) {
                this.e.setCoinText(String.valueOf(this.u.d()));
                return;
            }
            return;
        }
        taskProgressBar = this.e;
        taskProgressBar.setCoinText(str);
        if (!this.t) {
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void Q() {
        if (!this.u0 && !this.V) {
            this.V = true;
            this.e.setExpandDescAnim();
            this.b.postDelayed(new i(), (long) (this.e0 * 1000));
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void R() {
        String str;
        TaskProgressBar taskProgressBar;
        if (this.u0 && !this.m0 && !this.O) {
            this.O = true;
            if (!this.W || !com.iBookStar.utils.s.c(this.Z)) {
                taskProgressBar = this.e;
                str = "滑动页面正常浏览进度才会走";
            } else {
                taskProgressBar = this.e;
                str = this.Z;
            }
            taskProgressBar.setExpandDesc(str);
            this.e.setExpandDescAnim();
            this.b.postDelayed(new j(), (long) (this.e0 * 1000));
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String a(int i2) {
        if (i2 == 1) {
            if ("theme".equalsIgnoreCase(this.E)) {
                return com.iBookStar.c.c.a("hd_1", "参与互动游戏领取福利");
            }
            if ("buy".equalsIgnoreCase(this.E)) {
                return (!this.W || !com.iBookStar.utils.s.c(this.X)) ? com.iBookStar.c.c.a("yhq_1", "挑选宝贝后进入详情页领取优惠券") : this.X;
            }
            int i3 = this.F;
            return i3 == 1 ? com.iBookStar.c.c.a("js_1", "选择广告点击进入后查看") : i3 == 2 ? com.iBookStar.c.c.a("api_1", "选择广告点击进入后查看") : "选择广告点击进入后查看";
        } else if ("theme".equalsIgnoreCase(this.E)) {
            return com.iBookStar.c.c.a("hd_2", "领取成功/请尽快使用您的福利");
        } else {
            if ("buy".equalsIgnoreCase(this.E)) {
                return (!this.W || !com.iBookStar.utils.s.c(this.Y)) ? com.iBookStar.c.c.a("yhq_2", "领券成功/下单购买立省50%") : this.Y;
            }
            int i4 = this.F;
            return i4 == 1 ? com.iBookStar.c.c.a("js_2", "继续参与广告进度条走满即可通关") : i4 == 2 ? com.iBookStar.c.c.a("api_2", "继续参与广告进度条走满即可通关") : "继续参与广告进度条走满即可通关";
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(int i2, int i3, int i4, long j2, String str, String str2, String str3, String str4) {
        Exception e2;
        try {
            try {
                com.iBookStar.utils.l.a(new r(), String.valueOf(i3), i4, i2, str2, str3, str, 0, 1, str4);
            } catch (Exception e3) {
                e2 = e3;
            }
        } catch (Exception e4) {
            e2 = e4;
            e2.printStackTrace();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(int i2, int i3, int i4, long j2, String str, String str2, String str3, String str4, String str5) {
        Exception e2;
        try {
            try {
                com.iBookStar.utils.l.a(new q(str4, str2, str3), String.valueOf(i3), i4, i2, str2, str3, str, 0, 1, str4, str5);
            } catch (Exception e3) {
                e2 = e3;
            }
        } catch (Exception e4) {
            e2 = e4;
            e2.printStackTrace();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(Activity activity) {
        if (!activity.isFinishing()) {
            String className = activity.getComponentName().getClassName();
            if (className.startsWith("com.baidu.mobads") || className.startsWith("com.sogou.feedads") || className.startsWith("com.qq.e") || className.startsWith(BuildConfig.LIBRARY_PACKAGE_NAME)) {
                ((SdkAdMonitorView) LayoutInflater.from(activity).inflate(com.iBookStar.utils.k.a(R.layout.ym_sdkad_tip, "ym_sdkad_tip", TtmlNode.TAG_LAYOUT), (ViewGroup) null)).show(activity, false, this.e0, this.d0, new o());
                this.S = false;
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(CommonWebView commonWebView, String str, int i2) {
        this.b.postDelayed(new h(i2, str, commonWebView), 1000);
    }

    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) {
        P();
        if (z3) {
            this.e.setProgress(0.0f);
        }
        this.e.show();
        if (z2) {
            this.e.setExpandTips(str, str2, j3);
            this.e.tryProgressBarExpand(true, j2);
            return;
        }
        this.e.tryProgressBarExpand(false, 0);
    }

    private PopupWebView b(String str) {
        if (this.a.isFinishing() || com.iBookStar.utils.s.a(str)) {
            return null;
        }
        return this.P.get(str);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void c(String str) {
        try {
            CommonWebView commonWebView = this.c;
            commonWebView.loadUrl("javascript:if(window.onReportEndSuccess){window.onReportEndSuccess(" + str + ")}");
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void c(boolean z2) {
        if (this.l0 < 360.0f) {
            if (z2) {
                this.n0 = BitmapUtils.ROTATE360;
            } else {
                int i2 = this.n0;
                if (i2 < 360) {
                    this.n0 = i2 + 120;
                }
            }
            O();
            if (!this.m0) {
                this.m0 = true;
                new u().start();
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void d(boolean z2) {
        if (this.e.isShow()) {
            int i2 = 2;
            if (!this.u0 || this.x0.size() <= 1) {
                if (this.t0 && this.x0.size() > 0 && !this.v0) {
                    this.v0 = true;
                    if (!this.t && !this.i0.equalsIgnoreCase("FORCE")) {
                        this.u0 = true;
                        if (!"buy".equalsIgnoreCase(this.E) && !"theme".equalsIgnoreCase(this.E)) {
                            this.w0 = true;
                        }
                        if (!this.w0) {
                            i2 = 1;
                        }
                        a(true, "圆圈进度条走满即可通关", a(i2), 0, 2000);
                        this.p0 = System.currentTimeMillis();
                    } else {
                        a(true, "圆圈进度条走满即可通关", a(1), 0, 2000);
                    }
                } else {
                    return;
                }
            } else if (!this.w0) {
                String a2 = a(2);
                this.e.tryProgressBarExpand(false, 0);
                this.b.postDelayed(new l(z2, a2), 300);
                this.p0 = System.currentTimeMillis();
                this.w0 = true;
                if (z2) {
                    c(true);
                    return;
                }
            } else {
                return;
            }
            c(false);
        }
    }

    static /* synthetic */ float m(WebViewFragment webViewFragment) {
        float f2 = webViewFragment.l0;
        webViewFragment.l0 = 1.0f + f2;
        return f2;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void w() {
        if (this.D != null) {
            for (PopupWebView popupWebView : this.P.values()) {
                if (this.D.equals(popupWebView.getAdItem())) {
                    popupWebView.destroyPopupWindow(null);
                    return;
                }
            }
        }
    }

    private boolean x() {
        if (this.T || this.j0 == 0 || !am.aw.equalsIgnoreCase(this.J) || !A() || !com.iBookStar.utils.s.c(this.N) || this.u0) {
            return false;
        }
        this.E = "";
        this.m0 = false;
        this.l0 = 0.0f;
        this.n0 = 0;
        this.t0 = false;
        this.u0 = false;
        this.v0 = false;
        this.w0 = false;
        this.x0.clear();
        this.O = false;
        this.V = false;
        if (this.z) {
            this.q0 = "";
            this.r0 = "";
            this.g0 = "";
            this.z = false;
        }
        this.c.setTouchByUser();
        NativeAdUtil.getInstance().click(this.c, this.N, 0, 0, 0, 0, false, true);
        this.r.putExtra("iBackAdId", this.N);
        this.N = null;
        this.T = true;
        return true;
    }

    private boolean y() {
        if (this.T || this.j0 == 0 || !am.aw.equalsIgnoreCase(this.J) || !A() || !z()) {
            return false;
        }
        this.E = "";
        this.m0 = false;
        this.l0 = 0.0f;
        this.n0 = 0;
        this.t0 = false;
        this.u0 = false;
        this.v0 = false;
        this.w0 = false;
        this.x0.clear();
        this.O = false;
        this.V = false;
        if (this.z) {
            this.q0 = "";
            this.r0 = "";
            this.g0 = "";
            this.z = false;
        }
        this.c.setTouchByUser();
        this.c.loadUrl(String.format("javascript:location.replace('%s')", com.iBookStar.c.b.a("promotion_page_url", "")));
        this.T = true;
        return true;
    }

    private boolean z() {
        return false;
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public String a(int i2, int i3) {
        if (TextUtils.isEmpty(this.q0)) {
            return "";
        }
        return "{\n  \"adClickCounts\": \"" + this.q0 + "\",\n  \"bookId\": " + i2 + ",\n  \"chapterId\": " + i3 + ",\n  \"adDurations\": \"" + this.r0 + "\"\n}";
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void a() {
        this.y = false;
        this.e.tryProgressBarExpand(false, 0);
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void a(int i2, int i3, long j2) {
        this.e.setProgress(0.0f);
        if (com.iBookStar.c.b.j().c() > 0) {
            com.iBookStar.utils.l.a(String.valueOf(i2), i3);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void a(int i2, int i3, long j2, String str) {
        Activity activity = this.a;
        if (activity != null && !activity.isFinishing() && com.iBookStar.c.b.j().c() > 0) {
            int i4 = this.s;
            if (i4 > 0) {
                a(i4, i2, i3, j2, str, this.q0, this.r0, (String) null, (String) null);
            }
            this.q0 = "";
            this.r0 = "";
        }
    }

    public void a(v vVar) {
        this.l = vVar;
    }

    public void a(WebViewFragment webViewFragment) {
        if (webViewFragment != null) {
            A0.remove(webViewFragment);
            webViewFragment.a.finish();
        }
    }

    public void a(TaskProgressBar taskProgressBar) {
        this.e = taskProgressBar;
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void a(String str) {
        this.g0 = str;
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void a(String str, float f2) {
    }

    /* access modifiers changed from: protected */
    public void a(boolean z2) {
        this.e.setListener(new d());
        P();
        SkinProgressBar skinProgressBar = (SkinProgressBar) this.b.findViewById(com.iBookStar.utils.k.a(R.id.ym_webview_progress, "ym_webview_progress", "id"));
        this.d = skinProgressBar;
        skinProgressBar.setMax(this.f);
        CommonWebView commonWebView = (CommonWebView) this.b.findViewById(com.iBookStar.utils.k.a(R.id.ym_content_wv, "ym_content_wv", "id"));
        this.c = commonWebView;
        commonWebView.initWebView(z2);
        this.c.setOnAwardListener(this);
        this.c.setPromptDownload(false);
        this.c.setCommonWebViewClient(new e());
        if (com.iBookStar.utils.s.a(this.g)) {
            this.i = true;
        } else {
            this.i = false;
            v vVar = this.l;
            if (vVar != null) {
                vVar.c(this.g);
            }
        }
        this.c.setCommonWebChromeClient(new f());
        this.c.setCommonWebViewListener(this);
        this.c.setOnTouchListener(new g());
    }

    public boolean a(int i2, KeyEvent keyEvent) {
        if (i2 != 4) {
            return false;
        }
        b(false);
        return true;
    }

    public boolean a(CommonWebView commonWebView, String str) {
        if (com.iBookStar.utils.s.a(str) || (!str.startsWith("http://") && !str.startsWith("https://"))) {
            return false;
        }
        if (str.contains("dbnewopen") || str.contains("dbnewopenbackrefresh")) {
            Intent intent = new Intent();
            intent.setClass(this.a, SurveyWebView.class);
            intent.putExtra("url", str);
            startActivityForResult(intent, 101);
            return true;
        } else if (str.contains("dbbackrefresh")) {
            Intent intent2 = new Intent();
            if (str.contains("dbbackrefreshex")) {
                intent2.putExtra("url", str.replace("dbbackrefreshex", "none"));
            }
            this.a.setResult(100, intent2);
            a(this);
            return true;
        } else if (str.contains("dbbackrootrefresh")) {
            if (A0.size() < 2) {
                a(this);
            } else {
                A0.get(1).a.setResult(100);
                q();
            }
            return true;
        } else if (str.contains("dbbackroot")) {
            if (A0.size() == 1) {
                a(this);
            } else {
                q();
            }
            return true;
        } else if (str.contains("dbback")) {
            a(this);
            return true;
        } else if (!this.k || str.equalsIgnoreCase(this.j)) {
            return false;
        } else {
            Bundle bundle = new Bundle();
            bundle.putString(CampaignEx.JSON_KEY_TITLE, com.iBookStar.utils.s.c(this.g) ? this.g : "");
            bundle.putString("url", str);
            Intent intent3 = new Intent(this.a, SurveyWebView.class);
            intent3.putExtras(bundle);
            startActivityForResult(intent3, 100);
            return true;
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void aSetUserBindRelation(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void b() {
        if (this.j0 == 0) {
            this.o0 = 1;
            this.y0 = true;
            int i2 = this.s;
            int i3 = this.b0;
            int i4 = this.c0;
            long currentTimeMillis = System.currentTimeMillis();
            a(i2, i3, i4, currentTimeMillis, "闯关默认书名", "1", this.d0 + "", "1", this.g0);
            this.g0 = "";
        }
    }

    public void b(boolean z2) {
        if (!this.z0 && !this.y0 && !this.p) {
            if (!z2 && (y() || x())) {
                this.M++;
                H();
            } else if (z2 || !p()) {
                int i2 = -1;
                if (this.n) {
                    i2 = 101;
                } else if (this.o) {
                    i2 = 102;
                }
                this.a.setResult(i2, this.r);
                a(this);
            } else {
                this.c.setTouchByUser();
                this.c.goBack();
                if (am.aw.equalsIgnoreCase(this.J)) {
                    this.M++;
                    H();
                }
            }
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public int c() {
        return !com.iBookStar.c.b.a(com.iBookStar.c.c.a("taskOnDlgWithContinueRead"), false) ? 2 : 0;
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void clickToPushSetting() {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void createPopupWindow(String str, String str2) {
        PopupWebView b2 = b(str);
        if (b2 == null) {
            b2 = new PopupWebView(this.a);
            this.P.put(str, b2);
        }
        b2.preparePopupWindow(this.c);
        b2.createPopupWindow(str, str2);
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void d() {
        this.y = true;
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void dealPics(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void destroyPopupWindow(String str) {
        PopupWebView b2 = b(str);
        if (b2 != null) {
            b2.destroyPopupWindow(str);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void e() {
        if (this.a.isFinishing() || (!this.w && !this.t)) {
            B0 = true;
        } else {
            v();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void f() {
        v vVar;
        if (!am.aw.equalsIgnoreCase(this.J) && this.j0 == 0 && this.o0 == 0 && !this.y0 && (vVar = this.l) != null) {
            vVar.b();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void fetchAd(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void g() {
    }

    @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 this.t ? this.u.l() : this.j0 == 0 ? -1 : 0;
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void getMonitorTime(String str) {
        try {
            CommonWebView commonWebView = this.c;
            commonWebView.loadUrl(String.format("javascript:if(%s){%s(%d)}", str, str, Integer.valueOf(this.d0)));
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public String getTaskParams() {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("isNeedPost", this.w);
            jSONObject.put("iDefaultHost", this.x);
            jSONObject.put("iTaskStatus", this.j0);
            jSONObject.put("iDetectMode", this.i0);
            jSONObject.put("iDuration", this.d0);
            jSONObject.put("iSpeed", this.f0);
            jSONObject.put("iTaskType", this.E);
            jSONObject.put("iIsJs", this.F);
            jSONObject.put("iTaskBuyParams", this.G);
            jSONObject.put("iBackAdId", this.N);
            return jSONObject.toString();
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public float getTopSafeAreaInset() {
        v vVar = this.l;
        if (vVar != null) {
            return vVar.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 3;
    }

    @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.b2
    public void h() {
    }

    @com.iBookStar.utils.t
    public void handleAdClick(com.iBookStar.utils.e eVar) {
        com.iBookStar.a.f fVar;
        if (this.j0 == 0) {
            this.S = true;
            this.R = false;
            this.Q = System.currentTimeMillis();
            if (eVar.a() && (fVar = this.D) != null) {
                this.c.loadUrl(String.format("javascript:if(window.onNativeAdClick){window.onNativeAdClick('%s')}", fVar.y()));
            }
        }
    }

    @com.iBookStar.utils.t
    public void handleSdkAdLpOpen(com.iBookStar.utils.j jVar) {
        com.iBookStar.a.f fVar;
        if (this.j0 == 0 && (fVar = this.D) != null && !"motivated".equalsIgnoreCase(fVar.h()) && System.currentTimeMillis() - this.Q < 2000) {
            this.b.postDelayed(new n(jVar), 500);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void hidePopupWindow(String str) {
        PopupWebView b2 = b(str);
        if (b2 != null) {
            b2.hidePopupWindow(str);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void hrefNumOnPage(int i2) {
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public int i() {
        return this.j0;
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public String isEnterReaderFromTask() {
        return this.I ? "1" : "0";
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public String isTaskFail() {
        try {
            if (com.iBookStar.c.b.a("ad_task_fail_handle", 1) != 1) {
                return "0";
            }
            if (am.aw.equalsIgnoreCase(this.J)) {
                return (this.j0 != 0 || this.o0 == 1) ? "0" : "1";
            }
            if (System.currentTimeMillis() - com.iBookStar.c.b.a(com.iBookStar.c.c.b("ad_task_fail"), 0L) < 300000) {
                return "1";
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void j() {
        v vVar = this.l;
        if (vVar != null) {
            vVar.a();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public void k() {
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public int l() {
        return this.s;
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public int m() {
        return this.k0;
    }

    @Override // com.iBookStar.views.CommonWebView.b2
    public String n() {
        JSONArray jSONArray = this.h0;
        return jSONArray != null ? jSONArray.toString() : "";
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void needPost() {
        if (!"profile".equalsIgnoreCase(this.J) && !this.w) {
            String url = this.c.getUrl();
            if (com.iBookStar.utils.s.a(url)) {
                url = this.j;
            }
            String c2 = com.iBookStar.utils.k.c(url);
            this.x = c2;
            if (this.s > 0 && com.iBookStar.utils.s.c(c2)) {
                this.w = true;
                v();
            }
        }
    }

    public void o() {
        int color = getResources().getColor(com.iBookStar.utils.k.a(R.color.ym_client_bg, "ym_client_bg", "color"));
        this.b.setBackgroundColor(color);
        this.d.setProgressDrawableEx(getResources().getDrawable(com.iBookStar.utils.k.a(R.drawable.ym_progress_bar_states, "ym_progress_bar_states", "drawable")), YmConfig.getWebViewProgressColor(), new ColorDrawable(color));
    }

    @Override // androidx.fragment.app.Fragment
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        this.c.registerEventBus();
        w.a().b(this);
    }

    @Override // androidx.fragment.app.Fragment
    public void onActivityResult(int i2, int i3, Intent intent) {
        int i4;
        StringBuilder sb;
        super.onActivityResult(i2, i3, intent);
        this.c.onActivityResult(i2, i3, intent);
        if (i2 == 100) {
            if (i3 == -1) {
                s();
            }
        } else if (i2 == 101) {
            if (i3 == 100) {
                if (!(intent == null || intent.getStringExtra("url") == null)) {
                    String stringExtra = intent.getStringExtra("url");
                    this.j = stringExtra;
                    this.c.loadUrl(stringExtra);
                    return;
                }
            } else if (i3 != 101) {
                if (i3 == 102) {
                    t();
                    return;
                }
                return;
            }
            this.c.reload();
        } else {
            if (i2 == 20000) {
                this.S = false;
                this.Q = 0;
                this.R = false;
                if (i3 == -1) {
                    if (!intent.getBooleanExtra("complete", false)) {
                        String format = String.format("javascript:if(window.onRewardVideoFail){window.onRewardVideoFail('%s', [\"%s\"])}", intent.getStringExtra("adId"), intent.getStringExtra(com.sigmob.sdk.base.h.k));
                        System.out.println(format);
                        this.c.loadUrl(format);
                        if (this.j0 == 0) {
                            this.o0 = 0;
                            com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                            i4 = this.s;
                            sb = new StringBuilder();
                        } else {
                            return;
                        }
                    } else if (this.j0 == 0) {
                        this.o0 = 1;
                        this.y0 = true;
                        int i5 = this.s;
                        int i6 = this.b0;
                        int i7 = this.c0;
                        long currentTimeMillis = System.currentTimeMillis();
                        a(i5, i6, i7, currentTimeMillis, "闯关默认书名", "1", this.d0 + "", "1", this.g0);
                        this.g0 = "";
                        return;
                    } else {
                        return;
                    }
                } else if (this.j0 == 0) {
                    this.o0 = 0;
                    com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                    i4 = this.s;
                    sb = new StringBuilder();
                } else {
                    return;
                }
            } else if (i2 == 20001) {
                this.S = false;
                this.Q = 0;
                this.R = false;
                E();
                if (intent != null) {
                    String stringExtra2 = intent.getStringExtra("iBackAdId");
                    if (com.iBookStar.utils.s.c(stringExtra2) && stringExtra2.equalsIgnoreCase(this.N)) {
                        this.N = null;
                    }
                    String str = this.J;
                    if (this.w) {
                        this.J = intent.getStringExtra("iCurrentWebPage");
                        this.q0 = intent.getStringExtra("adClickCounts");
                        this.r0 = intent.getStringExtra("adDurations");
                        this.s0 = intent.getLongExtra("iLastTime", 0);
                        this.o0 = intent.getIntExtra("iEasyModeState", 0);
                        N();
                    }
                    this.J = str;
                    return;
                } else if (this.j0 == 0) {
                    this.o0 = 0;
                    com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                    i4 = this.s;
                    sb = new StringBuilder();
                } else {
                    return;
                }
            } else {
                return;
            }
            sb.append("");
            sb.append(this.d0);
            com.iBookStar.utils.l.a(i4, "1", sb.toString(), 0);
            M();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onBackAdReceived(String str) {
        this.N = str;
        NativeAdUtil.getInstance().show(str);
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onClickTasksCenter() {
        com.iBookStar.c.b.a("current_url");
        boolean z2 = false;
        if (com.iBookStar.c.b.a(com.iBookStar.c.c.b("task_state_for_reward_open"), 0) != 1) {
            z2 = true;
        }
        com.iBookStar.utils.v.a(z2, true);
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onClose() {
        b(true);
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onContentLoaded(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onContinueAd() {
    }

    @Override // androidx.fragment.app.Fragment
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.a = getActivity();
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x00c4  */
    @Override // androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        boolean z2;
        A0.push(this);
        boolean z3 = getArguments().getBoolean("useX5", false);
        this.g = getArguments().getString(CampaignEx.JSON_KEY_TITLE);
        this.j = getArguments().getString("url");
        this.k = getArguments().getBoolean("opennew", false);
        this.E = getArguments().getString("taskType", PointCategory.SHOW);
        this.I = getArguments().getBoolean("fromTask", false);
        this.L = getArguments().getBoolean("h5AdLandingPage", false);
        if (!z3) {
            z3 = this.j.contains("useX5=1");
        }
        String str = "dbnewopenbackrefresh";
        if (this.j.contains(str)) {
            this.n = true;
        } else {
            str = "dbnewopen";
            if (!this.j.contains(str)) {
                if (this.j.contains("autoClose=1")) {
                    this.f104K = true;
                }
                this.b = (RelativeLayout) layoutInflater.inflate(com.iBookStar.utils.k.a(R.layout.ym_webview_fragment, "ym_webview_fragment", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                a(z3);
                o();
                boolean z4 = getArguments().getBoolean("adPage");
                z2 = this.L;
                if (!z2 || !z4) {
                    if (z2) {
                        C();
                        this.c.setTouchByUser();
                    }
                    if (this.j.contains("_needloginbeforemonthpay=1") || com.iBookStar.c.b.j().d()) {
                        this.c.loadUrl(this.j);
                    } else {
                        this.c.login(null, null);
                    }
                    this.s = com.iBookStar.c.b.a(com.iBookStar.c.c.b("hascoin"), -1);
                    com.iBookStar.utils.v.k();
                } else {
                    B();
                }
                return this.b;
            }
        }
        this.m = true;
        this.j = this.j.replace(str, "none");
        this.b = (RelativeLayout) layoutInflater.inflate(com.iBookStar.utils.k.a(R.layout.ym_webview_fragment, "ym_webview_fragment", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
        a(z3);
        o();
        boolean z42 = getArguments().getBoolean("adPage");
        z2 = this.L;
        if (!z2) {
        }
        if (z2) {
        }
        if (this.j.contains("_needloginbeforemonthpay=1")) {
        }
        this.c.loadUrl(this.j);
        this.s = com.iBookStar.c.b.a(com.iBookStar.c.c.b("hascoin"), -1);
        com.iBookStar.utils.v.k();
        return this.b;
    }

    @Override // androidx.fragment.app.Fragment
    public void onDestroy() {
        super.onDestroy();
        Iterator<WebViewFragment> it = A0.iterator();
        while (it.hasNext()) {
            if (it.next() == this) {
                it.remove();
            }
        }
        for (Map.Entry<String, PopupWebView> entry : this.P.entrySet()) {
            entry.getValue().destroyPopupWindow(entry.getKey());
        }
        this.P.clear();
        com.iBookStar.utils.v.j();
    }

    @Override // androidx.fragment.app.Fragment
    public void onDestroyView() {
        super.onDestroyView();
        this.c.unregisterEventBus();
        w.a().c(this);
        this.c.finish();
        try {
            ViewParent parent = this.c.getParent();
            if (parent != null) {
                ((ViewGroup) parent).removeView(this.c);
            }
            this.c.stopLoading();
            this.c.setJavaScriptEnabled(false);
            this.c.clearHistory();
            this.c.clearView();
            this.c.removeAllViews();
            this.c.destroy();
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onFloatAdShow() {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onMonitorPhase(String str) {
        if (!this.a.isFinishing() && this.j0 == 0 && this.W) {
            if ("secondJump".equalsIgnoreCase(str)) {
                if (!this.u0 || this.x0.size() < 2) {
                    this.u0 = true;
                    this.x0.add(this.c.getUrl());
                    d(false);
                    com.iBookStar.a.d.a().c(this.D);
                }
            } else if ("interactTouch".equalsIgnoreCase(str)) {
                c(true);
                if (!this.O && com.iBookStar.utils.s.c(this.a0)) {
                    this.e.setExpandDesc(this.a0);
                }
            }
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onMonitorTips(String str) {
        if (!this.a.isFinishing() && this.j0 == 0 && this.W) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                this.X = jSONObject.optString("firstJump");
                this.Y = jSONObject.optString("secondJump");
                this.Z = jSONObject.optString("interactionDesc");
                this.a0 = jSONObject.optString("thirdJump");
                if (!this.e.isShow()) {
                    if (!this.t0) {
                        this.S = false;
                        this.Q = 0;
                        this.R = false;
                        this.J = am.aw;
                        this.s0 = System.currentTimeMillis();
                        this.x0.clear();
                        this.x0.add("xxx.com.cn");
                        this.l0 = 0.0f;
                        this.n0 = 0;
                        this.t0 = true;
                        v vVar = this.l;
                        if (vVar != null) {
                            com.iBookStar.a.f fVar = this.D;
                            vVar.a(1, fVar != null ? fVar.o() : 0);
                        }
                    }
                    a(false, true, null, null, 0, 0);
                    v vVar2 = this.l;
                    if (vVar2 != null) {
                        vVar2.b();
                    }
                    d(false);
                }
            } catch (Throwable unused) {
            }
        }
    }

    @Override // androidx.fragment.app.Fragment
    public void onPause() {
        super.onPause();
        this.C = true;
        this.c.changeVisibility(8);
        try {
            this.c.loadUrl("javascript:if(window.switchCountDown){window.switchCountDown(false)}");
        } catch (Throwable unused) {
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onPayCancel() {
        this.p = false;
        if (!this.q) {
            this.a.setResult(0, this.r);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onPayFinish() {
        this.p = false;
        if (!this.q) {
            this.a.setResult(-1, this.r);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onPayStart() {
        this.p = true;
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onRefresh() {
        this.o = true;
    }

    @Override // androidx.fragment.app.Fragment
    public void onResume() {
        long j2;
        super.onResume();
        this.C = false;
        this.c.changeVisibility(0);
        try {
            this.c.loadUrl("javascript:if(window.switchCountDown){window.switchCountDown(true)}");
        } catch (Throwable unused) {
        }
        try {
            if ("reader".equalsIgnoreCase(this.J) && this.j0 == 0 && this.Q > 0) {
                if (this.R) {
                    this.o0 = 1;
                    this.y0 = true;
                    a(this.s, this.b0, this.c0, System.currentTimeMillis(), "闯关默认书名", "1", this.d0 + "", "1", this.g0);
                    this.g0 = "";
                    E();
                    this.R = false;
                    this.Q = 0;
                } else {
                    int a2 = com.iBookStar.c.b.a(com.iBookStar.c.c.b("task_state_for_reward_open"), 0);
                    if (a2 == 2) {
                        this.o0 = 1;
                        this.y0 = true;
                        a(this.s, this.b0, this.c0, System.currentTimeMillis(), "闯关默认书名", "1", this.d0 + "", "1", this.g0);
                        this.g0 = "";
                        E();
                        this.R = false;
                        j2 = 0;
                    } else {
                        j2 = 0;
                        if (a2 == 1) {
                            this.o0 = 0;
                            com.iBookStar.c.b.b(com.iBookStar.c.c.b("ad_task_fail"), System.currentTimeMillis());
                            com.iBookStar.utils.l.a(this.s, "1", "" + this.d0, 0);
                            M();
                            E();
                            this.R = false;
                        }
                    }
                    this.Q = j2;
                }
                this.S = false;
            }
            com.iBookStar.c.b.a(com.iBookStar.c.c.b("task_state_for_reward_open"));
        } catch (Throwable unused2) {
        }
        if ((this.w || this.t) && B0) {
            v();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void onSkipAd() {
    }

    @Override // androidx.fragment.app.Fragment
    public void onStop() {
        super.onStop();
        if (this.f104K) {
            a(this);
        }
    }

    @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();
        }
    }

    public boolean p() {
        return !this.m && this.c.canGoBack();
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void postPopupWindowHeight(String str, int i2) {
        PopupWebView b2 = b(str);
        if (b2 != null) {
            b2.postPopupWindowHeight(str, i2);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void postRightBtn(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("text");
            if (com.iBookStar.utils.s.c(optString)) {
                this.U = jSONObject.optString("callback");
                v vVar = this.l;
                if (vVar != null) {
                    vVar.a(optString);
                    this.l.a("reader".equalsIgnoreCase(this.J) ? 1 : 0);
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void postTaskCenterCloseMsg(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void postTaskCondition(String str) {
        try {
            if (!am.aw.equalsIgnoreCase(this.J) && com.iBookStar.utils.s.c(str)) {
                JSONObject jSONObject = new JSONObject(str);
                this.b0 = jSONObject.optInt("bookId");
                this.c0 = jSONObject.optInt("chapterId");
                JSONObject jSONObject2 = jSONObject.getJSONObject("condition");
                this.e0 = jSONObject2.optInt("timeout", 10);
                int optInt = jSONObject2.optInt("duration", 15);
                this.d0 = optInt;
                this.f0 = Math.round(((((float) optInt) * 1000.0f) / 360.0f) + 0.5f);
                this.i0 = jSONObject2.optString("detectMode", "WEAK");
            }
        } catch (Exception unused) {
        }
    }

    public void q() {
        int size = A0.size();
        for (int i2 = 0; i2 < size - 1; i2++) {
            A0.pop().a.finish();
        }
    }

    public void r() {
        if (!this.z0 && !this.y0) {
            if (this.L) {
                b(true);
                return;
            }
            try {
                CommonWebView.c2 copyBackForwardList = this.c.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 (!com.iBookStar.utils.s.c(c2) || !c2.equalsIgnoreCase(this.x)) {
                            i2--;
                        } else if (i2 < 0) {
                            this.c.goBackOrForward(i2);
                            return;
                        } else {
                            return;
                        }
                    }
                }
                this.c.goBack();
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    public void s() {
        if (com.iBookStar.utils.s.a(this.c.getOriginalUrl())) {
            this.c.loadUrl(this.j);
        } else {
            this.c.reload();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void sendMessage(String str, String str2) {
        PopupWebView b2 = b(str);
        if (b2 != null) {
            b2.onReceiveMessage(str2);
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void setAdItem(com.iBookStar.a.f fVar) {
        this.D = fVar;
        this.E = fVar.b();
        this.F = fVar.z();
        if (!com.iBookStar.c.b.a("use_monitor_control", false) && fVar.N() > 0) {
            int N2 = (int) fVar.N();
            this.d0 = N2;
            this.f0 = Math.round(((((float) N2) * 1000.0f) / 360.0f) + 0.5f);
            this.i0 = Math.random() < fVar.O() ? "FORCE" : "WEAK";
        }
        if ("buy".equalsIgnoreCase(this.E)) {
            this.G.clear();
            if (!com.iBookStar.utils.s.c(fVar.v())) {
                this.G.add("detail.m.tmall");
                this.G.add("awp/core/detail");
            } else if (fVar.v().equalsIgnoreCase("dzad")) {
                this.W = true;
            } else {
                String[] split = fVar.v().split("\\|");
                for (String str : split) {
                    if (com.iBookStar.utils.s.c(str)) {
                        this.G.add(str);
                    }
                }
            }
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void setStatusBarMode(int i2) {
        v vVar;
        if (this.a != null && (vVar = this.l) != null) {
            try {
                if (!vVar.c()) {
                    return;
                }
                if (i2 == 0) {
                    com.iBookStar.utils.r.a(this.a);
                } else {
                    com.iBookStar.utils.r.b(this.a);
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void shareGoodsDetails(String str) {
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void showPopupWindow(String str) {
        PopupWebView b2 = b(str);
        if (b2 != null) {
            b2.showPopupWindow(str);
        }
    }

    public void t() {
        this.c.refreshContent();
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void timeMonitorComplete() {
        if (this.j0 == 0 && this.S) {
            this.R = true;
            if (!this.C) {
                this.o0 = 1;
                this.y0 = true;
                int i2 = this.s;
                int i3 = this.b0;
                int i4 = this.c0;
                long currentTimeMillis = System.currentTimeMillis();
                a(i2, i3, i4, currentTimeMillis, "闯关默认书名", "1", this.d0 + "", "1", this.g0);
                this.g0 = "";
                E();
                this.R = false;
                this.Q = 0;
                this.S = false;
            }
        }
    }

    public void u() {
        try {
            if (com.iBookStar.utils.s.c(this.U)) {
                CommonWebView commonWebView = this.c;
                String str = this.U;
                commonWebView.loadUrl(String.format("javascript:if(%s){%s()}", str, str));
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void userToLoginAndAuthorized(String str) {
    }

    public void v() {
        if (this.t || com.iBookStar.c.b.a(com.iBookStar.c.c.a("project_valid"), true)) {
            if (!this.H) {
                this.H = true;
                com.iBookStar.utils.l.e(new m());
            } else {
                return;
            }
        }
        B0 = false;
    }

    /* JADX WARNING: Removed duplicated region for block: B:28:0x0072  */
    /* JADX WARNING: Removed duplicated region for block: B:31:0x007f  */
    @Override // com.iBookStar.views.CommonWebView.g2
    public void webPageChanged(String str) {
        int i2;
        if ("store".equalsIgnoreCase(str)) {
            if (this.w) {
                K();
                v vVar = this.l;
                if (vVar != null) {
                    vVar.a();
                }
                N();
            }
            this.J = "store";
        } else if ("reader".equalsIgnoreCase(str)) {
            if (this.w) {
                this.y = false;
                boolean a2 = com.iBookStar.utils.k.a(com.iBookStar.c.b.a(com.iBookStar.c.c.a("task_status_time"), 0L));
                if (a2) {
                    this.k0 = com.iBookStar.c.b.a(com.iBookStar.c.c.a("continue_read"), 1);
                    J();
                    I();
                    v vVar2 = this.l;
                    if (vVar2 != null) {
                        vVar2.b();
                    }
                }
                N();
                if (!a2) {
                    D();
                }
                i2 = 1;
            } else {
                i2 = 0;
            }
            this.J = "reader";
            if (!"profile".equalsIgnoreCase(this.J)) {
                v vVar3 = this.l;
                if (vVar3 != null) {
                    vVar3.a(1, 0);
                    this.l.a(0);
                    return;
                }
                return;
            } else if (this.l != null) {
                String c2 = com.iBookStar.utils.k.c(this.c.getUrl());
                if (com.iBookStar.utils.s.c(this.x) && this.x.equalsIgnoreCase(c2)) {
                    this.l.a(p() ? 1 : 0, 0);
                    this.l.a(i2);
                    if ("reader".equalsIgnoreCase(this.J) && com.iBookStar.c.b.a(com.iBookStar.c.c.a("project_valid"), true)) {
                        this.l.b(this.h);
                        return;
                    } else if (!this.i) {
                        return;
                    }
                } else if (!this.i) {
                    return;
                }
                this.l.c(this.c.getTitle());
                return;
            } else {
                return;
            }
        } else {
            this.J = str;
        }
        i2 = 0;
        if (!"profile".equalsIgnoreCase(this.J)) {
        }
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void webviewTitleChangeToString(String str) {
        this.g = str;
        this.b.postDelayed(new t(), 1000);
    }

    @Override // com.iBookStar.views.CommonWebView.g2
    public void withdraw() {
        try {
            String format = String.format("http://rp.ipadview.com/alipay/account/transferpage?bpid=%s&buid=%s", com.iBookStar.b.a.j, String.valueOf(com.iBookStar.c.b.j().c()));
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(Uri.parse(String.format("alipays://platformapi/startapp?appId=20000067&url=%s", URLEncoder.encode(format))));
            startActivity(intent);
        } catch (Exception unused) {
            Toast.makeText(this.a, "没有安装支付宝或者不是最新版", 0).show();
        }
        B0 = true;
    }
}