导航菜单

页面标题

页面副标题

CallApp v2.226 - t1.java 源代码

正在查看: CallApp v2.226 应用的 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 f10649a0;

    private final boolean f10650b0;

    protected boolean f10651c0;

    protected long f10652d0;

    private int f10653e0;

    private int f10654f0;

    protected boolean f10655g0;

    private boolean f10656h0;

    private final AtomicBoolean f10657i0;

    private final AtomicBoolean f10658j0;

    private long f10659k0;

    private long f10660l0;

    public class a implements w0.b {

        final int f10661a;

        public a(int i8) {
            this.f10661a = i8;
        }

        @Override
        public void a() {
            if (t1.this.P != null) {
                long seconds = this.f10661a - TimeUnit.MILLISECONDS.toSeconds(r0.M.getCurrentPosition());
                if (seconds <= 0) {
                    t1.this.f9889t = 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 f10663a;

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

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

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

    public class c implements w0.b {

        final long f10665a;

        final Integer f10666b;

        final Long f10667c;

        public c(long j8, Integer num, Long l8) {
            this.f10665a = j8;
            this.f10666b = num;
            this.f10667c = l8;
        }

        @Override
        public void a() {
            t1.this.T.setProgress((int) ((t1.this.f9885p / this.f10665a) * this.f10666b.intValue()));
            t1 t1Var = t1.this;
            t1Var.f9885p = this.f10667c.longValue() + t1Var.f9885p;
        }

        @Override
        public boolean b() {
            return t1.this.f9885p < this.f10665a;
        }
    }

    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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            w6.b(uri, t1.this.f9877h.getController().g(), t1.this.f9871b);
        }

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

    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.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.a("AppLovinFullscreenActivity", "Video completed");
            }
            t1.this.f10656h0 = true;
            t1 t1Var = t1.this;
            if (!t1Var.f9887r) {
                t1Var.Q();
            } else if (t1Var.h()) {
                t1.this.x();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i8, int i9) {
            t1.this.d(androidx.fragment.app.n.h(i8, i9, "Video view error (", ",", ")"));
            t1.this.M.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i8, int i9) {
            com.applovin.impl.sdk.n nVar = t1.this.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.a("AppLovinFullscreenActivity", androidx.fragment.app.n.h(i8, i9, "MediaPlayer Info: (", ", ", ")"));
            }
            if (i8 == 701) {
                t1.this.P();
                return false;
            }
            if (i8 != 3) {
                if (i8 != 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 f6 = !t1.this.f10651c0 ? 1 : 0;
            mediaPlayer.setVolume(f6, f6);
            t1.this.f9888s = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            t1.this.c(mediaPlayer.getDuration());
            t1.this.L();
            com.applovin.impl.sdk.n nVar = t1.this.f9872c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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();
            } else if (com.applovin.impl.sdk.n.a()) {
                t1.this.f9872c.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.f9870a, this.f9873d, this.f9871b);
        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.f9871b);
        this.Z = w0Var;
        this.f10649a0 = new w0(handler2, this.f9871b);
        boolean H0 = this.f9870a.H0();
        this.f10650b0 = H0;
        this.f10651c0 = z6.e(this.f9871b);
        this.f10654f0 = -1;
        this.f10657i0 = new AtomicBoolean();
        this.f10658j0 = new AtomicBoolean();
        this.f10659k0 = -2L;
        this.f10660l0 = 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 z8 = false;
        view.setBackgroundColor(Color.argb(254, 0, 0, 0));
        if (((Boolean) jVar.a(l4.f9176h1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.f9183i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.f9183i0, activity, eVar));
            view.setOnTouchListener(new com.applovin.impl.adview.q(1));
        }
        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.f10651c0, jVar)) {
            ImageView imageView = new ImageView(activity);
            this.Q = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            d(this.f10651c0);
        } 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.f9169g2)).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 d6 = d();
        if (((Boolean) jVar.a(l4.L1)).booleanValue() && d6 > 0) {
            z8 = true;
        }
        if (this.P == null && z8) {
            this.P = new e0(activity);
            int q8 = bVar.q();
            this.P.setTextColor(q8);
            this.P.setTextSize(((Integer) jVar.a(l4.K1)).intValue());
            this.P.setFinishedStrokeColor(q8);
            this.P.setFinishedStrokeWidth(((Integer) jVar.a(l4.J1)).intValue());
            this.P.setMax(d6);
            this.P.setProgress(d6);
            w0Var.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d6));
        }
        if (!bVar.o0()) {
            this.S = null;
            return;
        }
        Long l8 = (Long) jVar.a(l4.f9148d2);
        Integer num = (Integer) jVar.a(l4.f9155e2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.S = progressBar;
        a(progressBar, bVar.n0(), num.intValue());
        w0Var.a("PROGRESS_BAR", l8.longValue(), new b(num));
    }

    private void J() {
        com.applovin.impl.adview.l lVar;
        p7 f02 = this.f9870a.f0();
        if (f02 == null || !f02.j() || this.f10655g0 || (lVar = this.R) == null) {
            return;
        }
        AppLovinSdkUtils.runOnUiThread(new com.applovin.impl.sdk.y(this, lVar.getVisibility() == 4, f02.h(), 1));
    }

    public void K() {
        if (this.f10655g0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f9872c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.f9871b.f0().isApplicationPaused()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f9872c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        if (this.f10654f0 < 0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f9872c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.f10654f0 + "ms for MediaPlayer: " + this.K);
        }
        this.M.seekTo(this.f10654f0);
        this.M.start();
        this.Z.b();
        this.f10654f0 = -1;
        a(new o9(this, 4), 250L);
    }

    public void M() {
        if (this.f10658j0.compareAndSet(false, true)) {
            a(this.O, this.f9870a.h0(), new o9(this, 6));
        }
    }

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

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

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

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

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

    public void P() {
        AppLovinSdkUtils.runOnUiThread(new o9(this, 0));
    }

    public void Q() {
        t1 t1Var;
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        e(this.f9870a.d1());
        long R = this.f9870a.R();
        if (R > 0) {
            this.f9885p = 0L;
            Long l8 = (Long) this.f9871b.a(l4.f9217m2);
            Integer num = (Integer) this.f9871b.a(l4.f9241p2);
            ProgressBar progressBar = new ProgressBar(this.f9873d, null, R.attr.progressBarStyleHorizontal);
            this.T = progressBar;
            a(progressBar, this.f9870a.Q(), num.intValue());
            t1Var = this;
            this.f10649a0.a("POSTITIAL_PROGRESS_BAR", l8.longValue(), t1Var.new c(R, num, l8));
            t1Var.f10649a0.b();
        } else {
            t1Var = this;
        }
        t1Var.J.a(t1Var.f9879j, t1Var.f9878i, t1Var.f9877h, t1Var.T);
        StringBuilder sb = new StringBuilder("javascript:al_onPoststitialShow(");
        sb.append(t1Var.f9892w);
        sb.append(",");
        a(com.mobilefuse.sdk.assetsmanager.a.h(t1Var.f9893x, ");", sb), t1Var.f9870a.D());
        if (t1Var.f9879j != null) {
            if (t1Var.f9870a.p() >= 0) {
                a(t1Var.f9879j, t1Var.f9870a.p(), new o9(this, 2));
            } else {
                t1Var.f9879j.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        com.applovin.impl.adview.g gVar = t1Var.f9879j;
        if (gVar != null) {
            arrayList.add(new u3(gVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = t1Var.f9878i;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = t1Var.f9878i;
            arrayList.add(new u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = t1Var.T;
        if (progressBar2 != null) {
            arrayList.add(new u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        t1Var.f9870a.getAdEventTracker().b(t1Var.f9877h, arrayList);
        o();
        t1Var.f10655g0 = true;
    }

    public void R() {
        this.f10659k0 = SystemClock.elapsedRealtime() - this.f10660l0;
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.a("AppLovinFullscreenActivity", a1.d0.r(new StringBuilder("Attempting to skip video with skip time: "), this.f10659k0, "ms"));
        }
        if (!O()) {
            A();
            return;
        }
        u();
        m();
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.D.e();
    }

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

    public void d(String str) {
        if (com.applovin.impl.sdk.n.a()) {
            com.applovin.impl.sdk.n nVar = this.f9872c;
            StringBuilder s8 = com.mobilefuse.sdk.assetsmanager.a.s("Encountered media error: ", str, " for ad: ");
            s8.append(this.f9870a);
            nVar.b("AppLovinFullscreenActivity", s8.toString());
        }
        if (this.f10657i0.compareAndSet(false, true)) {
            if (((Boolean) this.f9871b.a(l4.I0)).booleanValue()) {
                this.f9871b.C().d(this.f9870a, com.applovin.impl.sdk.j.n());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.B;
            if (appLovinAdDisplayListener instanceof f2) {
                ((f2) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            this.f9871b.A().a(this.f9870a instanceof a7 ? "handleVastVideoError" : "handleVideoError", str, this.f9870a);
            c();
        }
    }

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

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

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

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

    @Override
    public void q() {
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.f9871b.a(l4.J5)).booleanValue()) {
                a8.b(this.R);
                this.R = null;
            }
            if (this.f10650b0) {
                AppLovinCommunicator.getInstance(this.f9873d).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.f9872c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.f10654f0 = this.M.getCurrentPosition();
        this.M.pause();
        this.Z.c();
        if (com.applovin.impl.sdk.n.a()) {
            this.f9872c.a("AppLovinFullscreenActivity", "Paused video at position " + this.f10654f0 + "ms");
        }
    }

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

    @Override
    public void x() {
        this.J.a(this.f9880k);
        this.f9884o = 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();
            com.applovin.impl.a aVar2 = this.N;
            Objects.requireNonNull(aVar2);
            a(new n8(aVar2, 9), 2000L);
        }
    }

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

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

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

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

    public void B() {
        AppLovinSdkUtils.runOnUiThread(new o9(this, 1));
    }

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

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

    @Override
    public void b(boolean z8) {
        super.b(z8);
        if (z8) {
            a(0L);
            if (this.f10655g0) {
                this.f10649a0.b();
                return;
            }
            return;
        }
        if (this.f10655g0) {
            this.f10649a0.c();
        } else {
            u();
        }
    }

    public void c(long j8) {
        this.f10652d0 = j8;
    }

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

    @Override
    public void c() {
        this.Z.a();
        this.f10649a0.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.f9877h, this.f9878i, this.U, viewGroup);
        if (k0.g() && (str = this.f9871b.g0().getExtraParameters().get("audio_focus_request")) != null) {
            this.M.setAudioFocusRequest(Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.f10650b0)) {
            return;
        }
        this.M.setVideoURI(this.f9870a.p0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        com.applovin.impl.adview.k kVar = this.f9878i;
        if (kVar != null) {
            kVar.b();
        }
        this.M.start();
        if (this.f10650b0) {
            P();
        }
        this.f9877h.renderAd(this.f9870a);
        if (this.O != null) {
            this.f9871b.j0().a(new f6(this.f9871b, "scheduleSkipButton", new o9(this, 3)), r5.b.TIMEOUT, this.f9870a.i0(), true);
        }
        super.c(this.f10651c0);
    }

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

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

    private void d(boolean z8) {
        if (k0.d()) {
            AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.f9873d.getDrawable(z8 ? 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, z8 ? this.f9870a.M() : this.f9870a.c0(), this.f9871b);
    }

    @Override
    public void a(String str, long j8) {
        super.a(str, j8);
        if (this.R == null || j8 < 0 || !StringUtils.isValidString(str)) {
            return;
        }
        a(new i8(20, this, str), j8);
    }

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

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

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.f9870a.G0()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f9872c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri g02 = this.f9870a.g0();
            if (g02 != null) {
                if (!((Boolean) this.f9871b.a(l4.f9298x)).booleanValue() || (context = this.f9873d) == null) {
                    AppLovinAdView appLovinAdView = this.f9877h;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : com.applovin.impl.sdk.j.n();
                }
                this.f9871b.k().trackAndLaunchVideoClick(this.f9870a, g02, motionEvent, bundle, this, context);
                l2.a(this.A, this.f9870a);
                this.f9893x++;
                return;
            }
            return;
        }
        J();
    }

    @Override
    public void a(long j8) {
        a(new o9(this, 5), j8);
    }

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

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