JieJing Cleaner v1.4.2版本的 MD5 值为:a574eea9fb07160f0bbb08ba0adf1c62

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


package com.anythink.expressad.video.module;

import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.multidex.MultiDexExtractor;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.anythink.expressad.atsignalcommon.windvane.WindVaneWebView;
import com.anythink.expressad.atsignalcommon.windvane.j;
import com.anythink.expressad.foundation.d.p;
import com.anythink.expressad.foundation.g.n;
import com.anythink.expressad.foundation.g.s;
import com.anythink.expressad.foundation.g.v;
import com.anythink.expressad.foundation.webview.BrowserView;
import com.anythink.expressad.video.signal.h;
import com.anythink.expressad.videocommon.b.g;
import com.baidu.mobads.sdk.internal.bf;
import com.bytedance.frameworks.core.encrypt.RequestEncryptUtils;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import l1L1L1L1L1l1LLL1LL1ll.lilil1liLi1lLL1l1l.Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll;
import org.json.JSONObject;
public class AnythinkH5EndCardView extends AnythinkBaseView implements com.anythink.expressad.atsignalcommon.d.b, com.anythink.expressad.video.signal.f, h {
    public static final int A = 20;
    public static final int B = 15;
    public static final int K = 100;
    public static final String f1667i = "orientation";
    public static final String j = "webviewshow";
    public static final String v = "anythink_reward_endcard_h5";
    public static final String w = "portrait";
    public static final String x = "landscape";
    public static final int y = 1;
    public static final int z = 2;
    public boolean C;
    public boolean D;
    public int E;
    public int F;
    public boolean G;
    public boolean H;
    public int I;
    public long J;
    public boolean L;
    public boolean M;
    public boolean N;
    public boolean O;
    public boolean P;
    public boolean Q;
    public boolean R;
    public boolean S;
    public String T;
    public boolean U;
    public boolean V;
    public View k;
    public RelativeLayout l;
    public ImageView m;
    public WindVaneWebView n;
    public Handler o;
    public String p;
    public boolean f1668q;
    public boolean r;
    public String s;
    public Handler t;
    public boolean u;

    public class a implements Runnable {
        public WeakReference<AnythinkH5EndCardView> b;

        public a(AnythinkH5EndCardView anythinkH5EndCardView) {
            this.b = new WeakReference<>(anythinkH5EndCardView);
        }

        @Override
        public final void run() {
            try {
                Thread.sleep(300L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            WeakReference<AnythinkH5EndCardView> weakReference = this.b;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            this.b.get().t.sendEmptyMessage(100);
        }
    }

    public class b implements Runnable {
        public WeakReference<AnythinkH5EndCardView> b;

        public b(AnythinkH5EndCardView anythinkH5EndCardView) {
            this.b = new WeakReference<>(anythinkH5EndCardView);
        }

        @Override
        public final void run() {
            WeakReference<AnythinkH5EndCardView> weakReference = this.b;
            if (weakReference == null || weakReference.get() == null || this.b.get().H) {
                return;
            }
            AnythinkH5EndCardView.d(this.b.get());
            this.b.get().f1668q = false;
            AnythinkH5EndCardView.this.reportRenderResult("timeout", 5);
            this.b.get().e_.a(com.anythink.expressad.video.module.a.a.R, "");
            n.a(AnythinkBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD");
        }
    }

    public static class c implements Runnable {
        public WeakReference<AnythinkH5EndCardView> a;
        public int b;

        public c(AnythinkH5EndCardView anythinkH5EndCardView, int i2) {
            this.a = new WeakReference<>(anythinkH5EndCardView);
            this.b = i2;
        }

        @Override
        public final void run() {
            WeakReference<AnythinkH5EndCardView> weakReference = this.a;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            try {
                if (this.a.get().G) {
                    n.b(AnythinkBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return");
                    return;
                }
                AnythinkH5EndCardView.l(this.a.get());
                String str = (v.b(this.a.get().b_.M()) && this.a.get().b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2";
                StringBuilder sb = new StringBuilder();
                sb.append(this.b * 1000);
                p pVar = new p(p.k, 12, sb.toString(), this.a.get().b_.M(), this.a.get().b_.aX(), this.a.get().s, "ready timeout", str);
                try {
                    if (this.a.get().b_.q() == 287) {
                        pVar.c(p.aH);
                    } else if (this.a.get().b_.q() == 94) {
                        pVar.c("1");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                pVar.f(this.a.get().b_.ao());
                this.a.get().isLoadSuccess();
            } catch (Throwable th) {
                n.b(AnythinkBaseView.TAG, th.getMessage(), th);
            }
        }
    }

    public class d implements Runnable {
        public WeakReference<AnythinkH5EndCardView> b;

        public d(AnythinkH5EndCardView anythinkH5EndCardView) {
            this.b = new WeakReference<>(anythinkH5EndCardView);
        }

        @Override
        public final void run() {
            WeakReference<AnythinkH5EndCardView> weakReference = this.b;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            AnythinkH5EndCardView.e(this.b.get());
        }
    }

    public class e implements Runnable {
        public WeakReference<AnythinkH5EndCardView> b;

        public e(AnythinkH5EndCardView anythinkH5EndCardView) {
            this.b = new WeakReference<>(anythinkH5EndCardView);
        }

        @Override
        public final void run() {
            WeakReference<AnythinkH5EndCardView> weakReference = this.b;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            AnythinkH5EndCardView.f(this.b.get());
        }
    }

    public class f implements Runnable {
        public WeakReference<AnythinkH5EndCardView> b;

        public f(AnythinkH5EndCardView anythinkH5EndCardView) {
            this.b = new WeakReference<>(anythinkH5EndCardView);
        }

        @Override
        public final void run() {
            WeakReference<AnythinkH5EndCardView> weakReference = this.b;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            if (!this.b.get().R) {
                AnythinkH5EndCardView.this.setCloseVisible(0);
            }
            AnythinkH5EndCardView.j(this.b.get());
        }
    }

    public AnythinkH5EndCardView(Context context) {
        super(context);
        this.C = false;
        this.o = new Handler();
        this.f1668q = false;
        this.r = false;
        this.D = false;
        this.E = 1;
        this.F = 1;
        this.G = false;
        this.H = false;
        this.I = 1;
        this.J = 0L;
        this.L = false;
        this.M = false;
        this.N = false;
        this.O = false;
        this.P = false;
        this.Q = false;
        this.R = false;
        this.S = false;
        this.T = "";
        this.t = new Handler(Looper.getMainLooper()) {
            @Override
            public final void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 100) {
                    return;
                }
                if (AnythinkH5EndCardView.this.L) {
                    AnythinkH5EndCardView.this.e_.a(122, "");
                }
                AnythinkH5EndCardView.this.e_.a(103, "");
            }
        };
        this.U = false;
        this.V = false;
        this.u = false;
    }

    public static boolean d(AnythinkH5EndCardView anythinkH5EndCardView) {
        anythinkH5EndCardView.H = true;
        return true;
    }

    public static boolean e(AnythinkH5EndCardView anythinkH5EndCardView) {
        anythinkH5EndCardView.P = true;
        return true;
    }

    public static boolean f(AnythinkH5EndCardView anythinkH5EndCardView) {
        anythinkH5EndCardView.Q = true;
        return true;
    }

    private void g() {
        if (this.U || this.N) {
            return;
        }
        this.U = true;
        int i2 = this.E;
        if (i2 == 0) {
            this.P = true;
            return;
        }
        this.P = false;
        if (i2 >= 0) {
            this.o.postDelayed(new d(this), this.E * 1000);
        }
    }

    public static void j() {
    }

    public static boolean j(AnythinkH5EndCardView anythinkH5EndCardView) {
        anythinkH5EndCardView.M = true;
        return true;
    }

    public static boolean l(AnythinkH5EndCardView anythinkH5EndCardView) {
        anythinkH5EndCardView.G = true;
        return true;
    }

    public boolean canBackPress() {
        ImageView imageView = this.m;
        return imageView != null && imageView.getVisibility() == 0;
    }

    @Override
    public void close() {
        try {
            onCloseViewClick();
        } catch (Exception e2) {
            n.c(AnythinkBaseView.TAG, e2.getMessage());
        }
    }

    @Override
    public void defaultShow() {
        super.defaultShow();
    }

    public void excuteEndCardShowTask(int i2) {
        this.o.postDelayed(new c(this, i2), i2 * 1000);
    }

    public void excuteTask() {
        if (this.D || this.E < 0) {
            return;
        }
        this.o.postDelayed(new f(this), this.E * 1000);
    }

    public void executeEndCardShow(int i2) {
        this.o.postDelayed(new b(this), i2 * 1000);
    }

    @Override
    public void expand(String str, boolean z2) {
    }

    @Override
    public com.anythink.expressad.foundation.d.b getMraidCampaign() {
        return this.b_;
    }

    @Override
    public void handlerPlayableException(String str) {
        if (this.r) {
            return;
        }
        this.r = true;
        this.f1668q = false;
        if (this.b_ != null) {
            p pVar = new p();
            pVar.f(this.b_.ao());
            pVar.h(this.b_.aX());
            pVar.j(str);
        }
    }

    @Override
    public void init(Context context) {
        int findLayout = findLayout(v);
        if (findLayout >= 0) {
            View inflate = this.c_.inflate(findLayout, (ViewGroup) null);
            this.k = inflate;
            this.m = (ImageView) inflate.findViewById(findID("anythink_windwv_close"));
            this.l = (RelativeLayout) inflate.findViewById(findID("anythink_windwv_content_rl"));
            this.n = new WindVaneWebView(getContext());
            this.n.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            this.l.addView(this.n);
            this.f_ = isNotNULL(this.m, this.n);
            addView(this.k, b());
            c();
            e();
        }
    }

    @Override
    public void install(com.anythink.expressad.foundation.d.b bVar) {
    }

    public boolean isLoadSuccess() {
        return this.f1668q;
    }

    public boolean isPlayable() {
        return this.D;
    }

    @Override
    public void notifyCloseBtn(int i2) {
        if (i2 == 0) {
            this.N = true;
        } else if (i2 != 1) {
        } else {
            this.O = true;
        }
    }

    public void onBackPress() {
        if (this.M || ((this.N && this.O) || (!(this.N || !this.P || this.u) || (!this.N && this.Q && this.u)))) {
            onCloseViewClick();
        }
    }

    public void onCloseViewClick() {
        try {
            if (this.n != null) {
                j.a();
                j.a((WebView) this.n, com.anythink.expressad.video.signal.a.h.g, "");
                new Thread(new a(this)).start();
                return;
            }
            this.e_.a(103, "");
            this.e_.a(119, "webview is null when closing webview");
        } catch (Exception e2) {
            this.e_.a(103, "");
            com.anythink.expressad.video.module.a.a aVar = this.e_;
            aVar.a(119, "close webview exception" + e2.getMessage());
            n.a(AnythinkBaseView.TAG, e2.getMessage());
        }
    }

    @Override
    public void onSelfConfigurationChanged(Configuration configuration) {
        super.onSelfConfigurationChanged(configuration);
        orientation(configuration);
    }

    @Override
    public void onVisibilityChanged(View view, int i2) {
        super.onVisibilityChanged(view, i2);
        if (i2 != 0 || this.S) {
            return;
        }
        this.S = true;
        setFocusableInTouchMode(true);
        requestFocus();
        requestFocusFromTouch();
    }

    @Override
    public void onWindowFocusChanged(boolean z2) {
        super.onWindowFocusChanged(z2);
        com.anythink.expressad.foundation.d.b bVar = this.b_;
        if (bVar == null || !bVar.L()) {
            return;
        }
        if (z2) {
            com.anythink.expressad.atsignalcommon.d.a.a();
            com.anythink.expressad.atsignalcommon.d.a.b(this.n, "true");
            return;
        }
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.b(this.n, "false");
    }

    @Override
    public void open(String str) {
        try {
            String au = this.b_.au();
            if (!TextUtils.isEmpty(str)) {
                this.b_.B(str);
            }
            new com.anythink.expressad.a.a(getContext(), this.s);
            this.b_.B(au);
            this.e_.a(com.anythink.expressad.video.module.a.a.Q, "");
        } catch (Exception e2) {
            n.c(AnythinkBaseView.TAG, e2.getMessage());
        }
    }

    @Override
    public void orientation(Configuration configuration) {
        try {
            JSONObject jSONObject = new JSONObject();
            if (configuration.orientation == 2) {
                jSONObject.put("orientation", "landscape");
            } else {
                jSONObject.put("orientation", "portrait");
            }
            String encodeToString = Base64.encodeToString(jSONObject.toString().getBytes(), 2);
            j.a();
            j.a((WebView) this.n, "orientation", encodeToString);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void preLoadData(com.anythink.expressad.video.signal.factory.b bVar) {
        int n;
        String a2 = a();
        if (this.f_ && this.b_ != null && !TextUtils.isEmpty(a2)) {
            BrowserView.a aVar = new BrowserView.a(this.b_);
            aVar.a(this.b_.aZ());
            this.n.setDownloadListener(aVar);
            this.n.setCampaignId(this.b_.aX());
            setCloseVisible(8);
            this.n.setApiManagerJSFactory(bVar);
            if (this.b_.L()) {
                this.n.setMraidObject(this);
            }
            this.n.setWebViewListener(new com.anythink.expressad.atsignalcommon.b.b() {
                @Override
                public final void a(WebView webView, String str) {
                    super.a(webView, str);
                    AnythinkH5EndCardView anythinkH5EndCardView = AnythinkH5EndCardView.this;
                    if (anythinkH5EndCardView.r) {
                        return;
                    }
                    anythinkH5EndCardView.f1668q = true;
                    n.a(AnythinkBaseView.TAG, "onPageFinished,url:".concat(String.valueOf(str)));
                    AnythinkH5EndCardView.this.e_.a(100, "");
                    if (AnythinkH5EndCardView.this.b_ != null) {
                        p pVar = new p();
                        pVar.f(AnythinkH5EndCardView.this.b_.ao());
                        pVar.h(AnythinkH5EndCardView.this.b_.aX());
                        pVar.b(1);
                        pVar.k(String.valueOf(System.currentTimeMillis() - AnythinkH5EndCardView.this.J));
                        pVar.a(AnythinkH5EndCardView.this.b_.M());
                        pVar.b((v.b(AnythinkH5EndCardView.this.b_.M()) && AnythinkH5EndCardView.this.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2");
                        pVar.j("");
                        if (AnythinkH5EndCardView.this.b_.q() == 287) {
                            pVar.c(p.aH);
                        } else if (AnythinkH5EndCardView.this.b_.q() == 94) {
                            pVar.c("1");
                        }
                        pVar.a(AnythinkH5EndCardView.this.b_.L() ? p.aN : p.aO);
                    }
                    AnythinkH5EndCardView.this.e_.a(120, "");
                }

                @Override
                public final void b(WebView webView, int i2) {
                    super.b(webView, i2);
                    AnythinkH5EndCardView.this.I = i2;
                    if (AnythinkH5EndCardView.this.H) {
                        return;
                    }
                    AnythinkH5EndCardView.d(AnythinkH5EndCardView.this);
                    if (i2 == 1) {
                        AnythinkH5EndCardView.this.reportRenderResult(bf.o, 4);
                        return;
                    }
                    AnythinkH5EndCardView.this.e_.a(com.anythink.expressad.video.module.a.a.R, "");
                    AnythinkH5EndCardView.this.reportRenderResult("failed", 6);
                }

                @Override
                public final void a(WebView webView, int i2, String str, String str2) {
                    super.a(webView, i2, str, str2);
                    if (AnythinkH5EndCardView.this.r) {
                        return;
                    }
                    n.a(AnythinkBaseView.TAG, "onReceivedError,url:".concat(String.valueOf(str2)));
                    com.anythink.expressad.video.module.a.a aVar2 = AnythinkH5EndCardView.this.e_;
                    aVar2.a(118, "onReceivedError " + i2 + str);
                    AnythinkH5EndCardView.this.reportRenderResult(str, 3);
                    AnythinkH5EndCardView.this.r = true;
                }

                @Override
                public final void a(WebView webView, int i2) {
                    super.a(webView, i2);
                    n.b(com.anythink.expressad.atsignalcommon.b.b.a, "h5EncardView readyStatus:" + i2 + "- isError" + AnythinkH5EndCardView.this.r);
                    AnythinkH5EndCardView.this.I = i2;
                    if (AnythinkH5EndCardView.this.r) {
                        return;
                    }
                    AnythinkH5EndCardView.a(AnythinkH5EndCardView.this, System.currentTimeMillis() - AnythinkH5EndCardView.this.J);
                }
            });
            if (TextUtils.isEmpty(this.b_.K())) {
                try {
                    this.J = System.currentTimeMillis();
                    String M = this.b_.M();
                    com.anythink.expressad.videocommon.e.c a3 = com.anythink.expressad.videocommon.e.c.a();
                    com.anythink.expressad.foundation.b.a.b();
                    com.anythink.expressad.videocommon.e.d a4 = a3.a(com.anythink.expressad.foundation.b.a.e(), this.s);
                    if (this.D && v.b(M) && (M.contains("wfr=1") || (a4 != null && a4.n() > 0))) {
                        if (M.contains("wfr=1")) {
                            String[] split = M.split(RequestEncryptUtils.PARAMETER_SEPARATOR);
                            if (split != null && split.length > 0) {
                                for (String str : split) {
                                    if (v.b(str) && str.contains("to") && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR) != null && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR).length > 0) {
                                        n = s.a((Object) str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR)[1]);
                                        break;
                                    }
                                }
                            }
                            n = 20;
                        } else {
                            if (a4 != null && a4.n() > 0) {
                                n = a4.n();
                            }
                            n = 20;
                        }
                        if (n >= 0) {
                            excuteEndCardShowTask(n);
                        } else {
                            excuteEndCardShowTask(20);
                        }
                    }
                } catch (Throwable th) {
                    n.b(AnythinkBaseView.TAG, th.getMessage(), th);
                }
            }
            setHtmlSource(com.anythink.expressad.videocommon.b.h.a().b(a2));
            if (TextUtils.isEmpty(this.p)) {
                n.a(AnythinkBaseView.TAG, "load url:".concat(String.valueOf(a2)));
                this.n.loadUrl(a2);
            } else {
                n.a(AnythinkBaseView.TAG, "load html...");
                this.n.loadDataWithBaseURL(a2, this.p, "text/html", com.anythink.expressad.foundation.f.f.g.c.b, null);
            }
        } else {
            this.e_.a(101, "");
        }
        this.u = false;
    }

    @Override
    public void readyStatus(int i2) {
    }

    public void release() {
        Handler handler = this.o;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            this.o = null;
        }
        Handler handler2 = this.t;
        if (handler2 != null) {
            handler2.removeCallbacksAndMessages(null);
            this.t = null;
        }
        this.l.removeAllViews();
        this.n.release();
        this.n = null;
    }

    public void reportRenderResult(String str, int i2) {
        if (this.b_ == null || this.r) {
            return;
        }
        p pVar = new p();
        pVar.f(this.b_.ao());
        pVar.h(this.b_.aX());
        pVar.b(i2);
        pVar.k(String.valueOf(System.currentTimeMillis() - this.J));
        pVar.a(this.b_.M());
        pVar.b((v.b(this.b_.M()) && this.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2");
        pVar.j(str);
        if (this.b_.q() == 287) {
            pVar.c(p.aH);
        } else if (this.b_.q() == 94) {
            pVar.c("1");
        }
        pVar.a(this.b_.L() ? p.aN : p.aO);
    }

    public void setCloseDelayShowTime(int i2) {
        this.E = i2;
    }

    public void setCloseVisible(int i2) {
        if (this.f_) {
            this.m.setVisibility(i2);
        }
    }

    public void setCloseVisibleForMraid(int i2) {
        if (this.f_) {
            this.R = true;
            if (i2 == 4) {
                this.m.setImageDrawable(new ColorDrawable(ItemTouchHelper.ACTION_MODE_DRAG_MASK));
            } else {
                this.m.setImageResource(findDrawable("anythink_reward_close"));
            }
            this.m.setVisibility(0);
        }
    }

    public void setError(boolean z2) {
        this.r = z2;
    }

    public void setHtmlSource(String str) {
        this.p = str;
    }

    public void setLoadPlayable(boolean z2) {
        this.u = z2;
    }

    public void setNotchValue(String str, int i2, int i3, int i4, int i5) {
        this.T = str;
        n.c(AnythinkBaseView.TAG, "NOTCH H5ENDCARD " + String.format("%1s-%2s-%3s-%4s", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5)));
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.m.getLayoutParams();
        int b2 = s.b(getContext(), 20.0f);
        layoutParams.setMargins(i2 + b2, i4 + b2, i3 + b2, i5 + b2);
        this.m.setLayoutParams(layoutParams);
    }

    public void setPlayCloseBtnTm(int i2) {
        this.F = i2;
    }

    public void setUnitId(String str) {
        this.s = str;
    }

    public void startCounterEndCardShowTimer() {
        try {
            String M = this.b_.M();
            int i2 = 15;
            if (v.b(M) && M.contains("wfl=1")) {
                String[] split = M.split(RequestEncryptUtils.PARAMETER_SEPARATOR);
                if (split != null && split.length > 0) {
                    for (String str : split) {
                        if (v.b(str) && str.contains("timeout") && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR) != null && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR).length > 0) {
                            i2 = s.a((Object) str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR)[1]);
                        }
                    }
                }
                executeEndCardShow(i2);
            }
        } catch (Throwable th) {
            n.a(AnythinkBaseView.TAG, th.getMessage());
        }
    }

    @Override
    public void toggleCloseBtn(int i2) {
        int visibility = this.m.getVisibility();
        if (i2 == 1) {
            this.M = true;
            visibility = 0;
        } else if (i2 == 2) {
            this.M = false;
            visibility = 8;
            if (this.u) {
                if (!this.V && !this.N) {
                    this.V = true;
                    int i3 = this.F;
                    if (i3 == 0) {
                        this.Q = true;
                    } else {
                        this.Q = false;
                        if (i3 >= 0) {
                            this.o.postDelayed(new e(this), this.F * 1000);
                        }
                    }
                }
            } else if (!this.U && !this.N) {
                this.U = true;
                int i4 = this.E;
                if (i4 == 0) {
                    this.P = true;
                } else {
                    this.P = false;
                    if (i4 >= 0) {
                        this.o.postDelayed(new d(this), this.E * 1000);
                    }
                }
            }
        }
        setCloseVisible(visibility);
    }

    @Override
    public void unload() {
        close();
    }

    @Override
    public void useCustomClose(boolean z2) {
        try {
            setCloseVisibleForMraid(z2 ? 4 : 0);
        } catch (Exception e2) {
            n.c(AnythinkBaseView.TAG, e2.getMessage());
        }
    }

    public void volumeChange(double d2) {
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(this.n, d2);
    }

    public void webviewshow() {
        WindVaneWebView windVaneWebView = this.n;
        if (windVaneWebView != null) {
            windVaneWebView.post(new Runnable() {
                @Override
                public final void run() {
                    try {
                        n.a(AnythinkBaseView.TAG, "webviewshow");
                        int[] iArr = new int[2];
                        AnythinkH5EndCardView.this.n.getLocationOnScreen(iArr);
                        n.c(AnythinkBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]);
                        JSONObject jSONObject = new JSONObject();
                        Context d2 = com.anythink.expressad.foundation.b.a.b().d();
                        if (d2 != null) {
                            jSONObject.put("startX", s.a(d2, iArr[0]));
                            jSONObject.put("startY", s.a(d2, iArr[1]));
                            jSONObject.put(com.anythink.expressad.foundation.f.a.P, s.c(d2));
                        }
                        String encodeToString = Base64.encodeToString(jSONObject.toString().toString().getBytes(), 2);
                        j.a();
                        j.a((WebView) AnythinkH5EndCardView.this.n, "webviewshow", encodeToString);
                        AnythinkH5EndCardView.this.e_.a(109, "");
                        AnythinkH5EndCardView.g(AnythinkH5EndCardView.this);
                        AnythinkH5EndCardView.this.startCounterEndCardShowTimer();
                        j.a();
                        j.a((WebView) AnythinkH5EndCardView.this.n, "oncutoutfetched", Base64.encodeToString(AnythinkH5EndCardView.this.T.getBytes(), 0));
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                }
            });
        }
    }

    private void f() {
        int n;
        try {
            this.J = System.currentTimeMillis();
            String M = this.b_.M();
            com.anythink.expressad.videocommon.e.c a2 = com.anythink.expressad.videocommon.e.c.a();
            com.anythink.expressad.foundation.b.a.b();
            com.anythink.expressad.videocommon.e.d a3 = a2.a(com.anythink.expressad.foundation.b.a.e(), this.s);
            if (this.D && v.b(M)) {
                if (M.contains("wfr=1") || (a3 != null && a3.n() > 0)) {
                    if (M.contains("wfr=1")) {
                        String[] split = M.split(RequestEncryptUtils.PARAMETER_SEPARATOR);
                        if (split != null && split.length > 0) {
                            for (String str : split) {
                                if (v.b(str) && str.contains("to") && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR) != null && str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR).length > 0) {
                                    n = s.a((Object) str.split(RequestEncryptUtils.NAME_VALUE_SEPARATOR)[1]);
                                    break;
                                }
                            }
                        }
                        n = 20;
                    } else {
                        if (a3 != null && a3.n() > 0) {
                            n = a3.n();
                        }
                        n = 20;
                    }
                    if (n >= 0) {
                        excuteEndCardShowTask(n);
                    } else {
                        excuteEndCardShowTask(20);
                    }
                }
            }
        } catch (Throwable th) {
            n.b(AnythinkBaseView.TAG, th.getMessage(), th);
        }
    }

    private void h() {
        if (this.V || this.N) {
            return;
        }
        this.V = true;
        int i2 = this.F;
        if (i2 == 0) {
            this.Q = true;
            return;
        }
        this.Q = false;
        if (i2 >= 0) {
            this.o.postDelayed(new e(this), this.F * 1000);
        }
    }

    private void i() {
        com.anythink.expressad.foundation.d.b bVar = this.b_;
        if (bVar == null || !bVar.L()) {
            return;
        }
        int i2 = getResources().getConfiguration().orientation;
        String str = "undefined";
        if (i2 != 0) {
            if (i2 == 1) {
                str = "portrait";
            } else if (i2 == 2) {
                str = "landscape";
            }
        }
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("orientation", str);
            jSONObject.put("locked", "true");
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        HashMap Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll(com.anythink.expressad.atsignalcommon.d.a.a, com.anythink.expressad.atsignalcommon.d.a.j, com.anythink.expressad.atsignalcommon.d.a.b, "default");
        Ll1lLl1l1LL1l1Ll2.put(com.anythink.expressad.atsignalcommon.d.a.c, "true");
        Ll1lLl1l1LL1l1Ll2.put(com.anythink.expressad.atsignalcommon.d.a.d, jSONObject);
        if (getContext() instanceof Activity) {
            DisplayMetrics displayMetrics = this.a_.getResources().getDisplayMetrics();
            int i3 = displayMetrics.widthPixels;
            int i4 = displayMetrics.heightPixels;
            DisplayMetrics displayMetrics2 = new DisplayMetrics();
            ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics2);
            com.anythink.expressad.atsignalcommon.d.a.a();
            com.anythink.expressad.atsignalcommon.d.a.a(this.n, i3, i4);
            com.anythink.expressad.atsignalcommon.d.a.a();
            com.anythink.expressad.atsignalcommon.d.a.b(this.n, displayMetrics2.widthPixels, displayMetrics2.heightPixels);
        }
        com.anythink.expressad.atsignalcommon.d.a.a();
        WindVaneWebView windVaneWebView = this.n;
        com.anythink.expressad.atsignalcommon.d.a.a(windVaneWebView, windVaneWebView.getLeft(), this.n.getTop(), this.n.getWidth(), this.n.getHeight());
        com.anythink.expressad.atsignalcommon.d.a.a();
        WindVaneWebView windVaneWebView2 = this.n;
        com.anythink.expressad.atsignalcommon.d.a.b(windVaneWebView2, windVaneWebView2.getLeft(), this.n.getTop(), this.n.getWidth(), this.n.getHeight());
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(this.n, Ll1lLl1l1LL1l1Ll2);
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(this.n, com.anythink.expressad.atsignalcommon.d.e.a);
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(this.n);
    }

    public RelativeLayout.LayoutParams b() {
        return new RelativeLayout.LayoutParams(-1, -1);
    }

    @Override
    public final void c() {
        super.c();
        if (this.f_) {
            this.m.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    AnythinkH5EndCardView.this.onCloseViewClick();
                }
            });
        }
    }

    public void e() {
        if (this.f_) {
            setMatchParent();
        }
    }

    public String a() {
        com.anythink.expressad.foundation.d.b bVar = this.b_;
        if (bVar != null) {
            this.L = true;
            if (bVar.L()) {
                this.D = false;
                String K2 = this.b_.K();
                if (!TextUtils.isEmpty(K2)) {
                    File file = new File(K2);
                    try {
                        if (file.exists() && file.isFile() && file.canRead()) {
                            K2 = "file:////".concat(String.valueOf(K2));
                        } else {
                            K2 = this.b_.Y();
                        }
                        return K2;
                    } catch (Throwable th) {
                        if (com.anythink.expressad.a.a) {
                            th.printStackTrace();
                            return K2;
                        }
                        return K2;
                    }
                }
                return this.b_.Y();
            }
            String M = this.b_.M();
            if (!v.a(M)) {
                this.D = true;
                String b2 = g.a().b(M);
                if (TextUtils.isEmpty(b2)) {
                    StringBuilder lilil1liLi1lLL1l1l2 = Ll1lLl1l1LL1l1Ll.lilil1liLi1lLL1l1l(M, "&native_adtype=");
                    lilil1liLi1lLL1l1l2.append(this.b_.q());
                    return lilil1liLi1lLL1l1l2.toString();
                }
                StringBuilder lilil1liLi1lLL1l1l3 = Ll1lLl1l1LL1l1Ll.lilil1liLi1lLL1l1l(b2, "&native_adtype=");
                lilil1liLi1lLL1l1l3.append(this.b_.q());
                return lilil1liLi1lLL1l1l3.toString();
            }
            this.D = false;
            return this.b_.Y();
        }
        this.L = false;
        return null;
    }

    public static void g(AnythinkH5EndCardView anythinkH5EndCardView) {
        com.anythink.expressad.foundation.d.b bVar = anythinkH5EndCardView.b_;
        if (bVar == null || !bVar.L()) {
            return;
        }
        int i2 = anythinkH5EndCardView.getResources().getConfiguration().orientation;
        String str = "undefined";
        if (i2 != 0) {
            if (i2 == 1) {
                str = "portrait";
            } else if (i2 == 2) {
                str = "landscape";
            }
        }
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("orientation", str);
            jSONObject.put("locked", "true");
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        HashMap Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll(com.anythink.expressad.atsignalcommon.d.a.a, com.anythink.expressad.atsignalcommon.d.a.j, com.anythink.expressad.atsignalcommon.d.a.b, "default");
        Ll1lLl1l1LL1l1Ll2.put(com.anythink.expressad.atsignalcommon.d.a.c, "true");
        Ll1lLl1l1LL1l1Ll2.put(com.anythink.expressad.atsignalcommon.d.a.d, jSONObject);
        if (anythinkH5EndCardView.getContext() instanceof Activity) {
            DisplayMetrics displayMetrics = anythinkH5EndCardView.a_.getResources().getDisplayMetrics();
            int i3 = displayMetrics.widthPixels;
            int i4 = displayMetrics.heightPixels;
            DisplayMetrics displayMetrics2 = new DisplayMetrics();
            ((Activity) anythinkH5EndCardView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics2);
            com.anythink.expressad.atsignalcommon.d.a.a();
            com.anythink.expressad.atsignalcommon.d.a.a(anythinkH5EndCardView.n, i3, i4);
            com.anythink.expressad.atsignalcommon.d.a.a();
            com.anythink.expressad.atsignalcommon.d.a.b(anythinkH5EndCardView.n, displayMetrics2.widthPixels, displayMetrics2.heightPixels);
        }
        com.anythink.expressad.atsignalcommon.d.a.a();
        WindVaneWebView windVaneWebView = anythinkH5EndCardView.n;
        com.anythink.expressad.atsignalcommon.d.a.a(windVaneWebView, windVaneWebView.getLeft(), anythinkH5EndCardView.n.getTop(), anythinkH5EndCardView.n.getWidth(), anythinkH5EndCardView.n.getHeight());
        com.anythink.expressad.atsignalcommon.d.a.a();
        WindVaneWebView windVaneWebView2 = anythinkH5EndCardView.n;
        com.anythink.expressad.atsignalcommon.d.a.b(windVaneWebView2, windVaneWebView2.getLeft(), anythinkH5EndCardView.n.getTop(), anythinkH5EndCardView.n.getWidth(), anythinkH5EndCardView.n.getHeight());
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(anythinkH5EndCardView.n, Ll1lLl1l1LL1l1Ll2);
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(anythinkH5EndCardView.n, com.anythink.expressad.atsignalcommon.d.e.a);
        com.anythink.expressad.atsignalcommon.d.a.a();
        com.anythink.expressad.atsignalcommon.d.a.a(anythinkH5EndCardView.n);
    }

    private boolean a(View view) {
        this.m = (ImageView) view.findViewById(findID("anythink_windwv_close"));
        this.l = (RelativeLayout) view.findViewById(findID("anythink_windwv_content_rl"));
        this.n = new WindVaneWebView(getContext());
        this.n.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        this.l.addView(this.n);
        return isNotNULL(this.m, this.n);
    }

    public AnythinkH5EndCardView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.C = false;
        this.o = new Handler();
        this.f1668q = false;
        this.r = false;
        this.D = false;
        this.E = 1;
        this.F = 1;
        this.G = false;
        this.H = false;
        this.I = 1;
        this.J = 0L;
        this.L = false;
        this.M = false;
        this.N = false;
        this.O = false;
        this.P = false;
        this.Q = false;
        this.R = false;
        this.S = false;
        this.T = "";
        this.t = new Handler(Looper.getMainLooper()) {
            @Override
            public final void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 100) {
                    return;
                }
                if (AnythinkH5EndCardView.this.L) {
                    AnythinkH5EndCardView.this.e_.a(122, "");
                }
                AnythinkH5EndCardView.this.e_.a(103, "");
            }
        };
        this.U = false;
        this.V = false;
        this.u = false;
    }

    private void a(long j2, boolean z2) {
        String str;
        int i2;
        int i3;
        try {
            if (this.G) {
                return;
            }
            this.G = true;
            String str2 = (v.b(this.b_.M()) && this.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2";
            if (z2) {
                str = "ready timeout";
                i2 = 12;
                i3 = 2;
            } else if (this.I == 2) {
                str = "ready no";
                i2 = 11;
                i3 = 3;
            } else {
                str = "ready yes";
                i2 = 10;
                i3 = 1;
            }
            int i4 = i3;
            String str3 = str;
            p pVar = new p(p.k, i2, String.valueOf(j2), this.b_.M(), this.b_.aX(), this.s, str, str2);
            try {
                if (this.b_.q() == 287) {
                    pVar.c(p.aH);
                } else if (this.b_.q() == 94) {
                    pVar.c("1");
                }
            } catch (NullPointerException e2) {
                e2.printStackTrace();
            }
            pVar.f(this.b_.ao());
            if (isLoadSuccess() || i4 != 1) {
                return;
            }
            pVar.b(i4);
            pVar.k(String.valueOf(j2));
            pVar.b(str2);
            pVar.a(this.b_.M());
            pVar.b((v.b(this.b_.M()) && this.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2");
            pVar.h(this.b_.aX());
            pVar.j(str3);
            pVar.a(this.b_.L() ? p.aN : p.aO);
        } catch (Throwable th) {
            n.b(AnythinkBaseView.TAG, th.getMessage(), th);
        }
    }

    public static void a(AnythinkH5EndCardView anythinkH5EndCardView, long j2) {
        String str;
        int i2;
        int i3;
        try {
            if (anythinkH5EndCardView.G) {
                return;
            }
            anythinkH5EndCardView.G = true;
            String str2 = (v.b(anythinkH5EndCardView.b_.M()) && anythinkH5EndCardView.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2";
            if (anythinkH5EndCardView.I == 2) {
                str = "ready no";
                i2 = 11;
                i3 = 3;
            } else {
                str = "ready yes";
                i2 = 10;
                i3 = 1;
            }
            String str3 = str;
            int i4 = i3;
            p pVar = new p(p.k, i2, String.valueOf(j2), anythinkH5EndCardView.b_.M(), anythinkH5EndCardView.b_.aX(), anythinkH5EndCardView.s, str, str2);
            try {
                if (anythinkH5EndCardView.b_.q() == 287) {
                    pVar.c(p.aH);
                } else if (anythinkH5EndCardView.b_.q() == 94) {
                    pVar.c("1");
                }
            } catch (NullPointerException e2) {
                e2.printStackTrace();
            }
            pVar.f(anythinkH5EndCardView.b_.ao());
            if (anythinkH5EndCardView.isLoadSuccess() || i4 != 1) {
                return;
            }
            pVar.b(i4);
            pVar.k(String.valueOf(j2));
            pVar.b(str2);
            pVar.a(anythinkH5EndCardView.b_.M());
            pVar.b((v.b(anythinkH5EndCardView.b_.M()) && anythinkH5EndCardView.b_.M().contains(MultiDexExtractor.EXTRACTED_SUFFIX)) ? "1" : "2");
            pVar.h(anythinkH5EndCardView.b_.aX());
            pVar.j(str3);
            pVar.a(anythinkH5EndCardView.b_.L() ? p.aN : p.aO);
        } catch (Throwable th) {
            n.b(AnythinkBaseView.TAG, th.getMessage(), th);
        }
    }
}