导航菜单

页面标题

页面副标题

Antivirus Cleaner v1.2.0.0 - t1.java 源代码

正在查看: Antivirus Cleaner v1.2.0.0 应用的 t1.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.applovin.impl;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.applovin.adview.AppLovinAdView;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.adview.AppLovinVideoView;
import com.applovin.impl.r5;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.w0;
import com.applovin.impl.y7;
import com.applovin.sdk.AppLovinAdClickListener;
import com.applovin.sdk.AppLovinAdDisplayListener;
import com.applovin.sdk.AppLovinAdVideoPlaybackListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class t1 extends p1 implements AppLovinCommunicatorSubscriber {
    private final u1 J;
    private MediaPlayer K;
    private final View L;
    protected final AppLovinVideoView M;
    protected final com.applovin.impl.a N;
    protected final com.applovin.impl.adview.g O;
    protected e0 P;
    protected final ImageView Q;
    protected com.applovin.impl.adview.l R;
    protected final ProgressBar S;
    protected ProgressBar T;
    protected ImageView U;
    private final e V;
    private final d W;
    private final Handler X;
    private final Handler Y;
    protected final w0 Z;

    protected final w0 f7830a0;

    private final boolean f7831b0;

    protected boolean f7832c0;

    protected long f7833d0;

    private int f7834e0;

    private int f7835f0;

    protected boolean f7836g0;

    private boolean f7837h0;

    private final AtomicBoolean f7838i0;

    private final AtomicBoolean f7839j0;

    private long f7840k0;

    private long f7841l0;

    public class a implements w0.b {

        final int f7842a;

        public a(int i4) {
            this.f7842a = i4;
        }

        @Override
        public void a() {
            if (t1.this.P != null) {
                long seconds = this.f7842a - TimeUnit.MILLISECONDS.toSeconds(r0.M.getCurrentPosition());
                if (seconds <= 0) {
                    t1.this.f6944t = true;
                } else if (t1.this.N()) {
                    t1.this.P.setProgress((int) seconds);
                }
            }
        }

        @Override
        public boolean b() {
            return t1.this.N();
        }
    }

    public class b implements w0.b {

        final Integer f7844a;

        public b(Integer num) {
            this.f7844a = num;
        }

        @Override
        public void a() {
            t1 t1Var = t1.this;
            if (t1Var.f7836g0) {
                t1Var.S.setVisibility(8);
            } else {
                t1.this.S.setProgress((int) ((t1Var.M.getCurrentPosition() / t1.this.f7833d0) * this.f7844a.intValue()));
            }
        }

        @Override
        public boolean b() {
            return !t1.this.f7836g0;
        }
    }

    public class c implements w0.b {

        final long f7846a;

        final Integer f7847b;

        final Long f7848c;

        public c(long j4, Integer num, Long l4) {
            this.f7846a = j4;
            this.f7847b = num;
            this.f7848c = l4;
        }

        @Override
        public void a() {
            t1.this.T.setProgress((int) ((t1.this.f6940p / this.f7846a) * this.f7847b.intValue()));
            t1.this.f6940p += this.f7848c.longValue();
        }

        @Override
        public boolean b() {
            return t1.this.f6940p < this.f7846a;
        }
    }

    public class d implements y7.a {
        private d() {
        }

        @Override
        public void a(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Closing ad from video button...");
            }
            t1.this.c();
        }

        @Override
        public void b(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Clicking through from video button...");
            }
            t1.this.a(lVar.getAndClearLastClickEvent(), (Bundle) null);
        }

        @Override
        public void c(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Fully Watched from video button...");
            }
            t1.this.G = true;
        }

        @Override
        public void d(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Skipping video from video button...");
            }
            t1.this.R();
        }

        public d(t1 t1Var, a aVar) {
            this();
        }

        @Override
        public void a(com.applovin.impl.adview.l lVar, Bundle bundle) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Attempting to launch Direct Download from video button...");
            }
            t1.this.a(lVar.getAndClearLastClickEvent(), bundle);
        }

        @Override
        public void b(Uri uri, com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            w6.b(uri, t1.this.f6932h.getController().g(), t1.this.f6926b);
        }

        @Override
        public void a(Uri uri, com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Attempting to load a url from video button...");
            }
            w6.a(uri, t1.this.f6932h.getController(), t1.this.f6926b);
        }
    }

    public class e implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnInfoListener, MediaPlayer.OnCompletionListener, AppLovinTouchToClickListener.OnClickListener {
        private e() {
        }

        @Override
        public void onClick(View view, MotionEvent motionEvent) {
            t1.this.a(motionEvent, (Bundle) null);
        }

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "Video completed");
            }
            t1.this.f7837h0 = true;
            t1 t1Var = t1.this;
            if (!t1Var.f6942r) {
                t1Var.Q();
            } else if (t1Var.h()) {
                t1.this.x();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i4, int i5) {
            t1.this.d("Video view error (" + i4 + "," + i5 + ")");
            t1.this.M.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i4, int i5) {
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i4 + ", " + i5 + ")");
            }
            if (i4 == 701) {
                t1.this.P();
                return false;
            }
            if (i4 != 3) {
                if (i4 != 702) {
                    return false;
                }
                t1.this.B();
                return false;
            }
            t1.this.Z.b();
            t1 t1Var = t1.this;
            if (t1Var.O != null) {
                t1Var.M();
            }
            t1.this.B();
            if (!t1.this.D.b()) {
                return false;
            }
            t1.this.u();
            return false;
        }

        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            t1.this.K = mediaPlayer;
            mediaPlayer.setOnInfoListener(t1.this.V);
            mediaPlayer.setOnErrorListener(t1.this.V);
            float f4 = !t1.this.f7832c0 ? 1 : 0;
            mediaPlayer.setVolume(f4, f4);
            t1.this.f6943s = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            t1.this.c(mediaPlayer.getDuration());
            t1.this.L();
            com.applovin.impl.sdk.n nVar = t1.this.f6927c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + t1.this.K);
            }
        }

        public e(t1 t1Var, a aVar) {
            this();
        }
    }

    public class f implements View.OnClickListener {
        private f() {
        }

        @Override
        public void onClick(View view) {
            t1 t1Var = t1.this;
            if (view == t1Var.O) {
                t1Var.R();
                return;
            }
            if (view == t1Var.Q) {
                t1Var.S();
                return;
            }
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f6927c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(t1 t1Var, a aVar) {
            this();
        }
    }

    public t1(com.applovin.impl.sdk.ad.b bVar, Activity activity, Map map, com.applovin.impl.sdk.j jVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(bVar, activity, map, jVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.J = new u1(this.f6925a, this.f6928d, this.f6926b);
        a aVar = null;
        this.U = null;
        e eVar = new e(this, aVar);
        this.V = eVar;
        d dVar = new d(this, aVar);
        this.W = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.X = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.Y = handler2;
        w0 w0Var = new w0(handler, this.f6926b);
        this.Z = w0Var;
        this.f7830a0 = new w0(handler2, this.f6926b);
        boolean H0 = this.f6925a.H0();
        this.f7831b0 = H0;
        this.f7832c0 = z6.e(this.f6926b);
        this.f7835f0 = -1;
        this.f7838i0 = new AtomicBoolean();
        this.f7839j0 = new AtomicBoolean();
        this.f7840k0 = -2L;
        this.f7841l0 = 0L;
        if (!bVar.hasVideoUrl()) {
            throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
        }
        AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
        this.M = appLovinVideoView;
        appLovinVideoView.setOnPreparedListener(eVar);
        appLovinVideoView.setOnCompletionListener(eVar);
        appLovinVideoView.setOnErrorListener(eVar);
        bVar.e().putString("video_view_address", q7.a(appLovinVideoView));
        View view = new View(activity);
        this.L = view;
        boolean z3 = false;
        view.setBackgroundColor(Color.argb(254, 0, 0, 0));
        if (((Boolean) jVar.a(l4.f6118h1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.f6122i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.f6122i0, activity, eVar));
            view.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view2, MotionEvent motionEvent) {
                    boolean a4;
                    a4 = t1.a(view2, motionEvent);
                    return a4;
                }
            });
        }
        f fVar = new f(this, aVar);
        if (bVar.h0() >= 0) {
            com.applovin.impl.adview.g gVar = new com.applovin.impl.adview.g(bVar.Y(), activity);
            this.O = gVar;
            gVar.setVisibility(8);
            gVar.setOnClickListener(fVar);
        } else {
            this.O = null;
        }
        if (a(this.f7832c0, jVar)) {
            ImageView imageView = new ImageView(activity);
            this.Q = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            d(this.f7832c0);
        } else {
            this.Q = null;
        }
        String e02 = bVar.e0();
        if (StringUtils.isValidString(e02)) {
            y7 y7Var = new y7(jVar);
            y7Var.a(new WeakReference(dVar));
            com.applovin.impl.adview.l lVar = new com.applovin.impl.adview.l(bVar.d0(), bVar, y7Var, activity);
            this.R = lVar;
            lVar.a(e02);
        } else {
            this.R = null;
        }
        if (H0) {
            com.applovin.impl.a aVar2 = new com.applovin.impl.a(activity, ((Integer) jVar.a(l4.f6114g2)).intValue(), R.attr.progressBarStyleLarge);
            this.N = aVar2;
            aVar2.setColor(Color.parseColor("#75FFFFFF"));
            aVar2.setBackgroundColor(Color.parseColor("#00000000"));
            aVar2.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.N = null;
        }
        int d4 = d();
        if (((Boolean) jVar.a(l4.L1)).booleanValue() && d4 > 0) {
            z3 = true;
        }
        if (this.P == null && z3) {
            this.P = new e0(activity);
            int q4 = bVar.q();
            this.P.setTextColor(q4);
            this.P.setTextSize(((Integer) jVar.a(l4.K1)).intValue());
            this.P.setFinishedStrokeColor(q4);
            this.P.setFinishedStrokeWidth(((Integer) jVar.a(l4.J1)).intValue());
            this.P.setMax(d4);
            this.P.setProgress(d4);
            w0Var.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d4));
        }
        if (!bVar.o0()) {
            this.S = null;
            return;
        }
        Long l4 = (Long) jVar.a(l4.f6099d2);
        Integer num = (Integer) jVar.a(l4.f6104e2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.S = progressBar;
        a(progressBar, bVar.n0(), num.intValue());
        w0Var.a("PROGRESS_BAR", l4.longValue(), new b(num));
    }

    private void J() {
        com.applovin.impl.adview.l lVar;
        p7 f02 = this.f6925a.f0();
        if (f02 == null || !f02.j() || this.f7836g0 || (lVar = this.R) == null) {
            return;
        }
        final boolean z3 = lVar.getVisibility() == 4;
        final long h4 = f02.h();
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                t1.this.b(z3, h4);
            }
        });
    }

    public void K() {
        if (this.f7836g0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.f6926b.f0().isApplicationPaused()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        if (this.f7835f0 < 0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.f7835f0 + "ms for MediaPlayer: " + this.K);
        }
        this.M.seekTo(this.f7835f0);
        this.M.start();
        this.Z.b();
        this.f7835f0 = -1;
        a(new Runnable() {
            @Override
            public final void run() {
                t1.this.F();
            }
        }, 250L);
    }

    public void M() {
        if (this.f7839j0.compareAndSet(false, true)) {
            a(this.O, this.f6925a.h0(), new Runnable() {
                @Override
                public final void run() {
                    t1.this.G();
                }
            });
        }
    }

    public static boolean a(View view, MotionEvent motionEvent) {
        return true;
    }

    private void e(boolean z3) {
        this.f7834e0 = z();
        if (z3) {
            this.M.pause();
        } else {
            this.M.stopPlayback();
        }
    }

    public void L() {
        long U;
        long millis;
        if (this.f6925a.T() >= 0 || this.f6925a.U() >= 0) {
            if (this.f6925a.T() >= 0) {
                U = this.f6925a.T();
            } else {
                com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.f6925a;
                long j4 = this.f7833d0;
                long j5 = j4 > 0 ? j4 : 0L;
                if (aVar.X0()) {
                    int g12 = (int) ((com.applovin.impl.sdk.ad.a) this.f6925a).g1();
                    if (g12 > 0) {
                        millis = TimeUnit.SECONDS.toMillis(g12);
                    } else {
                        int p4 = (int) aVar.p();
                        if (p4 > 0) {
                            millis = TimeUnit.SECONDS.toMillis(p4);
                        }
                    }
                    j5 += millis;
                }
                U = (long) (j5 * (this.f6925a.U() / 100.0d));
            }
            b(U);
        }
    }

    public boolean N() {
        return (this.f6944t || this.f7836g0 || !this.M.isPlaying()) ? false : true;
    }

    public boolean O() {
        return h() && !C();
    }

    public void P() {
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                t1.this.H();
            }
        });
    }

    public void Q() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        e(this.f6925a.d1());
        long R = this.f6925a.R();
        if (R > 0) {
            this.f6940p = 0L;
            Long l4 = (Long) this.f6926b.a(l4.f6144m2);
            Integer num = (Integer) this.f6926b.a(l4.f6159p2);
            ProgressBar progressBar = new ProgressBar(this.f6928d, null, R.attr.progressBarStyleHorizontal);
            this.T = progressBar;
            a(progressBar, this.f6925a.Q(), num.intValue());
            this.f7830a0.a("POSTITIAL_PROGRESS_BAR", l4.longValue(), new c(R, num, l4));
            this.f7830a0.b();
        }
        this.J.a(this.f6934j, this.f6933i, this.f6932h, this.T);
        a("javascript:al_onPoststitialShow(" + this.f6947w + "," + this.f6948x + ");", this.f6925a.D());
        if (this.f6934j != null) {
            if (this.f6925a.p() >= 0) {
                a(this.f6934j, this.f6925a.p(), new Runnable() {
                    @Override
                    public final void run() {
                        t1.this.I();
                    }
                });
            } else {
                this.f6934j.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        com.applovin.impl.adview.g gVar = this.f6934j;
        if (gVar != null) {
            arrayList.add(new u3(gVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = this.f6933i;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = this.f6933i;
            arrayList.add(new u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = this.T;
        if (progressBar2 != null) {
            arrayList.add(new u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        this.f6925a.getAdEventTracker().b(this.f6932h, arrayList);
        o();
        this.f7836g0 = true;
    }

    public void R() {
        this.f7840k0 = SystemClock.elapsedRealtime() - this.f7841l0;
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Attempting to skip video with skip time: " + this.f7840k0 + "ms");
        }
        if (!O()) {
            A();
            return;
        }
        u();
        m();
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.D.e();
    }

    public void S() {
        MediaPlayer mediaPlayer = this.K;
        if (mediaPlayer == null) {
            return;
        }
        try {
            float f4 = this.f7832c0 ? 1.0f : 0.0f;
            mediaPlayer.setVolume(f4, f4);
            boolean z3 = !this.f7832c0;
            this.f7832c0 = z3;
            d(z3);
            a(this.f7832c0, 0L);
        } catch (Throwable unused) {
        }
    }

    public void d(String str) {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.b("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.f6925a);
        }
        if (this.f7838i0.compareAndSet(false, true)) {
            if (((Boolean) this.f6926b.a(l4.I0)).booleanValue()) {
                this.f6926b.C().d(this.f6925a, com.applovin.impl.sdk.j.n());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.B;
            if (appLovinAdDisplayListener instanceof f2) {
                ((f2) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            this.f6926b.A().a(this.f6925a instanceof a7 ? "handleVastVideoError" : "handleVideoError", str, this.f6925a);
            c();
        }
    }

    @Override
    public void f() {
        super.f();
        this.J.a(this.R);
        this.J.a((View) this.O);
        if (!h() || this.f7836g0) {
            x();
        }
    }

    @Override
    public String getCommunicatorId() {
        return "FullscreenVideoAdPresenter";
    }

    @Override
    public void l() {
        super.a(z(), this.f7831b0, C(), this.f7840k0);
    }

    @Override
    public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
        if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
            Bundle messageData = appLovinCommunicatorMessage.getMessageData();
            if (messageData.getLong("ad_id") == this.f6925a.getAdIdNumber() && this.f7831b0) {
                int i4 = messageData.getInt("load_response_code");
                String string = messageData.getString("load_exception_message");
                if ((string == null && i4 >= 200 && i4 < 300) || this.f7837h0 || this.M.isPlaying()) {
                    return;
                }
                d("Video cache error during stream. ResponseCode=" + i4 + ", exception=" + string);
            }
        }
    }

    @Override
    public void q() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.f6926b.a(l4.J5)).booleanValue()) {
                a8.b(this.R);
                this.R = null;
            }
            if (this.f7831b0) {
                AppLovinCommunicator.getInstance(this.f6928d).unsubscribe(this, "video_caching_failed");
            }
            AppLovinVideoView appLovinVideoView = this.M;
            if (appLovinVideoView != null) {
                appLovinVideoView.pause();
                this.M.stopPlayback();
            }
            MediaPlayer mediaPlayer = this.K;
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.n.c("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
        }
        super.q();
    }

    @Override
    public void u() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.f7835f0 = this.M.getCurrentPosition();
        this.M.pause();
        this.Z.c();
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Paused video at position " + this.f7835f0 + "ms");
        }
    }

    @Override
    public void v() {
        a((ViewGroup) null);
    }

    @Override
    public void x() {
        this.J.a(this.f6935k);
        this.f6939o = SystemClock.elapsedRealtime();
    }

    public void E() {
        com.applovin.impl.a aVar = this.N;
        if (aVar != null) {
            aVar.b();
        }
    }

    public void F() {
        com.applovin.impl.a aVar = this.N;
        if (aVar != null) {
            aVar.a();
            final com.applovin.impl.a aVar2 = this.N;
            Objects.requireNonNull(aVar2);
            a(new Runnable() {
                @Override
                public final void run() {
                    a.this.b();
                }
            }, 2000L);
        }
    }

    public void G() {
        this.f7840k0 = -1L;
        this.f7841l0 = SystemClock.elapsedRealtime();
    }

    public void H() {
        com.applovin.impl.a aVar = this.N;
        if (aVar != null) {
            aVar.a();
        }
    }

    public void I() {
        this.f6939o = SystemClock.elapsedRealtime();
    }

    public void A() {
        this.f6947w++;
        if (this.f6925a.B()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.a("AppLovinFullscreenActivity", "Dismissing ad on video skip...");
            }
            c();
        } else {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.a("AppLovinFullscreenActivity", "Skipping video...");
            }
            Q();
        }
    }

    public void B() {
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                t1.this.E();
            }
        });
    }

    public boolean C() {
        if (this.G && this.f6925a.a1()) {
            return true;
        }
        return D();
    }

    public boolean D() {
        return z() >= this.f6925a.j0();
    }

    @Override
    public void b(boolean z3) {
        super.b(z3);
        if (z3) {
            a(0L);
            if (this.f7836g0) {
                this.f7830a0.b();
                return;
            }
            return;
        }
        if (this.f7836g0) {
            this.f7830a0.c();
        } else {
            u();
        }
    }

    public void c(long j4) {
        this.f7833d0 = j4;
    }

    public int z() {
        long currentPosition = this.M.getCurrentPosition();
        if (this.f7837h0) {
            return 100;
        }
        return currentPosition > 0 ? (int) ((currentPosition / this.f7833d0) * 100.0f) : this.f7834e0;
    }

    @Override
    public void c() {
        this.Z.a();
        this.f7830a0.a();
        this.X.removeCallbacksAndMessages(null);
        this.Y.removeCallbacksAndMessages(null);
        l();
        super.c();
    }

    @Override
    public void e() {
        super.e();
        x();
    }

    @Override
    public void a(ViewGroup viewGroup) {
        String str;
        this.J.a(this.Q, this.O, this.R, this.N, this.S, this.P, this.M, this.L, this.f6932h, this.f6933i, this.U, viewGroup);
        if (k0.g() && (str = this.f6926b.g0().getExtraParameters().get("audio_focus_request")) != null) {
            this.M.setAudioFocusRequest(Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.f7831b0)) {
            return;
        }
        this.M.setVideoURI(this.f6925a.p0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        com.applovin.impl.adview.k kVar = this.f6933i;
        if (kVar != null) {
            kVar.b();
        }
        this.M.start();
        if (this.f7831b0) {
            P();
        }
        this.f6932h.renderAd(this.f6925a);
        if (this.O != null) {
            this.f6926b.j0().a(new f6(this.f6926b, "scheduleSkipButton", new Runnable() {
                @Override
                public final void run() {
                    t1.this.M();
                }
            }), r5.b.TIMEOUT, this.f6925a.i0(), true);
        }
        super.c(this.f7832c0);
    }

    public void b(boolean z3, long j4) {
        if (z3) {
            q7.a(this.R, j4, (Runnable) null);
        } else {
            q7.b(this.R, j4, (Runnable) null);
        }
    }

    private void d(boolean z3) {
        if (k0.d()) {
            AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.f6928d.getDrawable(z3 ? com.applovin.sdk.R.drawable.applovin_ic_unmute_to_mute : com.applovin.sdk.R.drawable.applovin_ic_mute_to_unmute);
            if (animatedVectorDrawable != null) {
                this.Q.setScaleType(ImageView.ScaleType.FIT_XY);
                this.Q.setImageDrawable(animatedVectorDrawable);
                animatedVectorDrawable.start();
                return;
            }
        }
        ImageViewUtils.setImageUri(this.Q, z3 ? this.f6925a.M() : this.f6925a.c0(), this.f6926b);
    }

    @Override
    public void b() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Continue video from prompt - will resume in onWindowFocusChanged(true) when alert dismisses");
        }
    }

    @Override
    public void a(final String str, long j4) {
        super.a(str, j4);
        if (this.R == null || j4 < 0 || !StringUtils.isValidString(str)) {
            return;
        }
        a(new Runnable() {
            @Override
            public final void run() {
                t1.this.a(str);
            }
        }, j4);
    }

    public void a(String str) {
        a8.a(this.R, str, "AppLovinFullscreenActivity", this.f6926b);
    }

    private void a(ProgressBar progressBar, int i4, int i5) {
        progressBar.setMax(i5);
        progressBar.setPadding(0, 0, 0, 0);
        if (k0.d()) {
            progressBar.setProgressTintList(ColorStateList.valueOf(i4));
        }
    }

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.f6925a.G0()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f6927c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri g02 = this.f6925a.g0();
            if (g02 != null) {
                if (!((Boolean) this.f6926b.a(l4.f6196x)).booleanValue() || (context = this.f6928d) == null) {
                    AppLovinAdView appLovinAdView = this.f6932h;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : com.applovin.impl.sdk.j.n();
                }
                this.f6926b.k().trackAndLaunchVideoClick(this.f6925a, g02, motionEvent, bundle, this, context);
                l2.a(this.A, this.f6925a);
                this.f6948x++;
                return;
            }
            return;
        }
        J();
    }

    @Override
    public void a(long j4) {
        a(new Runnable() {
            @Override
            public final void run() {
                t1.this.K();
            }
        }, j4);
    }

    private static boolean a(boolean z3, com.applovin.impl.sdk.j jVar) {
        if (!((Boolean) jVar.a(l4.V1)).booleanValue()) {
            return false;
        }
        if (!((Boolean) jVar.a(l4.W1)).booleanValue() || z3) {
            return true;
        }
        return ((Boolean) jVar.a(l4.Y1)).booleanValue();
    }

    @Override
    public void a() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f6927c.a("AppLovinFullscreenActivity", "Skipping video from prompt");
        }
        A();
    }
}