导航菜单

页面标题

页面副标题

All File Recovery v1.0.2 - C0705v1.java 源代码

正在查看: All File Recovery v1.0.2 应用的 C0705v1.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.C0650r5;
import com.applovin.impl.C0712w0;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.adview.AppLovinVideoView;
import com.applovin.impl.adview.C0485g;
import com.applovin.impl.sdk.C0672k;
import com.applovin.impl.sdk.C0676o;
import com.applovin.impl.sdk.ad.AbstractC0662b;
import com.applovin.impl.sdk.ad.C0661a;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
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.facebook.internal.C0752a;
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class C0705v1 extends AbstractC0646r1 implements AppLovinCommunicatorSubscriber {
    private final C0713w1 N;
    private MediaPlayer O;
    private final View P;
    protected final AppLovinVideoView Q;
    protected final C0470a R;
    protected final C0485g S;
    protected C0516e0 T;
    protected final ImageView U;
    protected com.applovin.impl.adview.l V;
    protected final ProgressBar W;
    protected ProgressBar X;
    protected ImageView Y;
    private final e Z;
    private final d a0;
    private final Handler b0;
    private final Handler c0;
    protected final C0712w0 d0;
    protected final C0712w0 e0;
    private final boolean f0;
    protected boolean g0;
    protected long h0;
    private int i0;
    private int j0;
    protected boolean k0;
    private boolean l0;
    private final AtomicBoolean m0;
    private final AtomicBoolean n0;
    private long o0;
    private long p0;

    public class a implements C0712w0.b {
        final int a;

        public a(int i) {
            this.a = i;
        }

        @Override
        public void a() {
            if (C0705v1.this.T != null) {
                long seconds = this.a - TimeUnit.MILLISECONDS.toSeconds(r0.Q.getCurrentPosition());
                if (seconds <= 0) {
                    C0705v1.this.v = true;
                } else if (C0705v1.this.R()) {
                    C0705v1.this.T.setProgress((int) seconds);
                }
            }
        }

        @Override
        public boolean b() {
            return C0705v1.this.R();
        }
    }

    public class b implements C0712w0.b {
        final Integer a;

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

        @Override
        public void a() {
            C0705v1 c0705v1 = C0705v1.this;
            if (c0705v1.k0) {
                c0705v1.W.setVisibility(8);
            } else {
                C0705v1.this.W.setProgress((int) ((c0705v1.Q.getCurrentPosition() / C0705v1.this.h0) * this.a.intValue()));
            }
        }

        @Override
        public boolean b() {
            return !C0705v1.this.k0;
        }
    }

    public class c implements C0712w0.b {
        final long a;
        final Integer b;
        final Long c;

        public c(long j, Integer num, Long l) {
            this.a = j;
            this.b = num;
            this.c = l;
        }

        @Override
        public void a() {
            C0705v1.this.X.setProgress((int) ((C0705v1.this.r / this.a) * this.b.intValue()));
            C0705v1 c0705v1 = C0705v1.this;
            c0705v1.r = this.c.longValue() + c0705v1.r;
        }

        @Override
        public boolean b() {
            return C0705v1.this.r < this.a;
        }
    }

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

        @Override
        public void a(com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Closing ad from video button...");
            }
            C0705v1.this.a("video_button");
        }

        @Override
        public void b(com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Clicking through from video button...");
            }
            C0705v1.this.a(lVar.getAndClearLastClickEvent(), (Bundle) null);
        }

        @Override
        public void c(com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Fully Watched from video button...");
            }
            C0705v1.this.K = true;
        }

        @Override
        public void d(com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Skipping video from video button...");
            }
            C0705v1.this.V();
        }

        public d(C0705v1 c0705v1, a aVar) {
            this();
        }

        @Override
        public void a(com.applovin.impl.adview.l lVar, Bundle bundle) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Attempting to launch Direct Download from video button...");
            }
            C0705v1.this.a(lVar.getAndClearLastClickEvent(), bundle);
        }

        @Override
        public void b(Uri uri, com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            AbstractC0718w6.c(uri, C0705v1.this.i.getController().g(), C0705v1.this.b);
        }

        @Override
        public void a(Uri uri, com.applovin.impl.adview.l lVar) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Attempting to load a url from video button...");
            }
            AbstractC0718w6.a(uri, C0705v1.this.i.getController(), C0705v1.this.b);
        }
    }

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

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

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "Video completed");
            }
            C0705v1.this.l0 = true;
            C0705v1 c0705v1 = C0705v1.this;
            if (!c0705v1.t) {
                c0705v1.U();
            } else if (c0705v1.i()) {
                C0705v1.this.B();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
            C0705v1.this.g(K.O0.a("Video view error (", i, ",", i2, ")"));
            C0705v1.this.Q.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", K.O0.a("MediaPlayer Info: (", i, ", ", i2, ")"));
            }
            if (i == 701) {
                C0705v1.this.T();
                return false;
            }
            if (i != 3) {
                if (i != 702) {
                    return false;
                }
                C0705v1.this.F();
                return false;
            }
            C0705v1.this.d0.b();
            C0705v1 c0705v1 = C0705v1.this;
            if (c0705v1.S != null) {
                c0705v1.Q();
            }
            C0705v1.this.F();
            if (!C0705v1.this.H.b()) {
                return false;
            }
            C0705v1.this.w();
            return false;
        }

        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            C0705v1.this.O = mediaPlayer;
            mediaPlayer.setOnInfoListener(C0705v1.this.Z);
            mediaPlayer.setOnErrorListener(C0705v1.this.Z);
            float f = !C0705v1.this.g0 ? 1 : 0;
            mediaPlayer.setVolume(f, f);
            C0705v1.this.u = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            C0705v1.this.d(mediaPlayer.getDuration());
            C0705v1.this.P();
            C0676o c0676o = C0705v1.this.c;
            if (C0676o.a()) {
                C0705v1.this.c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + C0705v1.this.O);
            }
        }

        public e(C0705v1 c0705v1, a aVar) {
            this();
        }
    }

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

        @Override
        public void onClick(View view) {
            C0705v1 c0705v1 = C0705v1.this;
            if (view == c0705v1.S) {
                c0705v1.V();
                return;
            }
            if (view == c0705v1.U) {
                c0705v1.W();
            } else if (C0676o.a()) {
                C0705v1.this.c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(C0705v1 c0705v1, a aVar) {
            this();
        }
    }

    public C0705v1(AbstractC0662b abstractC0662b, Activity activity, Map map, C0672k c0672k, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(abstractC0662b, activity, map, c0672k, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.N = new C0713w1(this.a, this.d, this.b);
        a aVar = null;
        this.Y = null;
        e eVar = new e(this, aVar);
        this.Z = eVar;
        d dVar = new d(this, aVar);
        this.a0 = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.b0 = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.c0 = handler2;
        C0712w0 c0712w0 = new C0712w0(handler, this.b);
        this.d0 = c0712w0;
        this.e0 = new C0712w0(handler2, this.b);
        boolean Q0 = this.a.Q0();
        this.f0 = Q0;
        this.g0 = AbstractC0742z6.e(this.b);
        this.j0 = -1;
        this.m0 = new AtomicBoolean();
        this.n0 = new AtomicBoolean();
        this.o0 = -2L;
        this.p0 = 0L;
        if (!abstractC0662b.hasVideoUrl()) {
            throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
        }
        AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
        this.Q = appLovinVideoView;
        appLovinVideoView.setOnPreparedListener(eVar);
        appLovinVideoView.setOnCompletionListener(eVar);
        appLovinVideoView.setOnErrorListener(eVar);
        abstractC0662b.h().putString("video_view_address", q7.a(appLovinVideoView));
        View view = new View(activity);
        this.P = view;
        boolean z = false;
        view.setBackgroundColor(Color.argb(X4.d.l, 0, 0, 0));
        if (((Boolean) c0672k.a(C0577l4.k1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(c0672k, C0577l4.i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(c0672k, C0577l4.i0, activity, eVar));
            view.setOnTouchListener(new E5());
        }
        f fVar = new f(this, aVar);
        if (abstractC0662b.o0() >= 0) {
            C0485g c0485g = new C0485g(abstractC0662b.e0(), activity);
            this.S = c0485g;
            c0485g.setVisibility(8);
            c0485g.setOnClickListener(fVar);
        } else {
            this.S = null;
        }
        if (a(this.g0, c0672k)) {
            ImageView imageView = new ImageView(activity);
            this.U = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            e(this.g0);
        } else {
            this.U = null;
        }
        String l0 = abstractC0662b.l0();
        if (StringUtils.isValidString(l0)) {
            y7 y7Var = new y7(c0672k);
            y7Var.a(new WeakReference(dVar));
            com.applovin.impl.adview.l lVar = new com.applovin.impl.adview.l(abstractC0662b.k0(), abstractC0662b, y7Var, activity);
            this.V = lVar;
            lVar.a(l0);
        } else {
            this.V = null;
        }
        if (Q0) {
            C0470a c0470a = new C0470a(activity, ((Integer) c0672k.a(C0577l4.n2)).intValue(), R.attr.progressBarStyleLarge);
            this.R = c0470a;
            c0470a.setColor(Color.parseColor("#75FFFFFF"));
            c0470a.setBackgroundColor(Color.parseColor("#00000000"));
            c0470a.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.R = null;
        }
        int d2 = d();
        if (((Boolean) c0672k.a(C0577l4.S1)).booleanValue() && d2 > 0) {
            z = true;
        }
        if (this.T == null && z) {
            this.T = new C0516e0(activity);
            int t = abstractC0662b.t();
            this.T.setTextColor(t);
            this.T.setTextSize(((Integer) c0672k.a(C0577l4.R1)).intValue());
            this.T.setFinishedStrokeColor(t);
            this.T.setFinishedStrokeWidth(((Integer) c0672k.a(C0577l4.Q1)).intValue());
            this.T.setMax(d2);
            this.T.setProgress(d2);
            c0712w0.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d2));
        }
        if (!abstractC0662b.v0()) {
            this.W = null;
            return;
        }
        Long l = (Long) c0672k.a(C0577l4.k2);
        Integer num = (Integer) c0672k.a(C0577l4.l2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.W = progressBar;
        a(progressBar, abstractC0662b.u0(), num.intValue());
        c0712w0.a("PROGRESS_BAR", l.longValue(), new b(num));
    }

    private void N() {
        com.applovin.impl.adview.l lVar;
        p7 m0 = this.a.m0();
        if (m0 == null || !m0.j() || this.k0 || (lVar = this.V) == null) {
            return;
        }
        final boolean z = lVar.getVisibility() == 4;
        final long h = m0.h();
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                C0705v1.this.b(z, h);
            }
        });
    }

    public void O() {
        if (this.k0) {
            if (C0676o.a()) {
                this.c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.b.m0().isApplicationPaused()) {
            if (C0676o.a()) {
                this.c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        if (this.j0 < 0) {
            if (C0676o.a()) {
                this.c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.j0 + "ms for MediaPlayer: " + this.O);
        }
        this.Q.seekTo(this.j0);
        this.Q.start();
        this.d0.b();
        this.j0 = -1;
        a(new Runnable() {
            @Override
            public final void run() {
                C0705v1.this.J();
            }
        }, 250L);
    }

    public void Q() {
        if (this.n0.compareAndSet(false, true)) {
            a(this.S, this.a.o0(), new Runnable() {
                @Override
                public final void run() {
                    C0705v1.this.K();
                }
            });
        }
    }

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

    private void e(boolean z) {
        if (AbstractC0565k0.d()) {
            AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.d.getDrawable(z ? com.applovin.sdk.R.drawable.applovin_ic_unmute_to_mute : com.applovin.sdk.R.drawable.applovin_ic_mute_to_unmute);
            if (animatedVectorDrawable != null) {
                this.U.setScaleType(ImageView.ScaleType.FIT_XY);
                this.U.setImageDrawable(animatedVectorDrawable);
                animatedVectorDrawable.start();
                return;
            }
        }
        ImageViewUtils.setImageUri(this.U, z ? this.a.Q() : this.a.j0(), this.b);
    }

    private void f(boolean z) {
        this.i0 = D();
        if (z) {
            this.Q.pause();
        } else {
            this.Q.stopPlayback();
        }
    }

    public void h(String str) {
        a8.a(this.V, str, "AppLovinFullscreenActivity", this.b);
    }

    @Override
    public void B() {
        this.N.a(this.l);
        this.q = SystemClock.elapsedRealtime();
    }

    public void P() {
        long Z;
        long millis;
        if (this.a.Y() >= 0 || this.a.Z() >= 0) {
            if (this.a.Y() >= 0) {
                Z = this.a.Y();
            } else {
                C0661a c0661a = (C0661a) this.a;
                long j = this.h0;
                long j2 = j > 0 ? j : 0L;
                if (c0661a.f1()) {
                    int p1 = (int) ((C0661a) this.a).p1();
                    if (p1 > 0) {
                        millis = TimeUnit.SECONDS.toMillis(p1);
                    } else {
                        int s = (int) c0661a.s();
                        if (s > 0) {
                            millis = TimeUnit.SECONDS.toMillis(s);
                        }
                    }
                    j2 += millis;
                }
                Z = (long) ((this.a.Z() / 100.0d) * j2);
            }
            c(Z);
        }
    }

    public boolean R() {
        return (this.v || this.k0 || !this.Q.isPlaying()) ? false : true;
    }

    public boolean S() {
        return i() && !G();
    }

    public void T() {
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                C0705v1.this.L();
            }
        });
    }

    public void U() {
        C0705v1 c0705v1;
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        f(this.a.m1());
        long W = this.a.W();
        if (W > 0) {
            this.r = 0L;
            Long l = (Long) this.b.a(C0577l4.t2);
            Integer num = (Integer) this.b.a(C0577l4.w2);
            ProgressBar progressBar = new ProgressBar(this.d, null, R.attr.progressBarStyleHorizontal);
            this.X = progressBar;
            a(progressBar, this.a.V(), num.intValue());
            c0705v1 = this;
            this.e0.a("POSTITIAL_PROGRESS_BAR", l.longValue(), c0705v1.new c(W, num, l));
            c0705v1.e0.b();
        } else {
            c0705v1 = this;
        }
        c0705v1.N.a(c0705v1.k, c0705v1.j, c0705v1.i, c0705v1.X);
        StringBuilder sb = new StringBuilder("javascript:al_onPoststitialShow(");
        sb.append(c0705v1.y);
        sb.append(",");
        a(android.support.v4.media.c.a(sb, c0705v1.z, ");"), c0705v1.a.H());
        if (c0705v1.k != null) {
            if (c0705v1.a.s() >= 0) {
                a(c0705v1.k, c0705v1.a.s(), new Runnable() {
                    @Override
                    public final void run() {
                        C0705v1.this.M();
                    }
                });
            } else {
                c0705v1.k.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        C0485g c0485g = c0705v1.k;
        if (c0485g != null) {
            arrayList.add(new C0699u3(c0485g, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = c0705v1.j;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = c0705v1.j;
            arrayList.add(new C0699u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = c0705v1.X;
        if (progressBar2 != null) {
            arrayList.add(new C0699u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        c0705v1.a.getAdEventTracker().b(c0705v1.i, arrayList);
        q();
        c0705v1.k0 = true;
    }

    public void V() {
        this.o0 = SystemClock.elapsedRealtime() - this.p0;
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", android.support.v4.media.session.g.a(new StringBuilder("Attempting to skip video with skip time: "), this.o0, "ms"));
        }
        if (!S()) {
            E();
            return;
        }
        w();
        o();
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.H.e();
    }

    public void W() {
        MediaPlayer mediaPlayer = this.O;
        if (mediaPlayer == null) {
            return;
        }
        try {
            float f2 = this.g0 ? 1.0f : 0.0f;
            mediaPlayer.setVolume(f2, f2);
            boolean z = !this.g0;
            this.g0 = z;
            e(z);
            a(this.g0, 0L);
        } catch (Throwable unused) {
        }
    }

    public void d(long j) {
        this.h0 = j;
    }

    public void g(String str) {
        if (C0676o.a()) {
            C0676o c0676o = this.c;
            StringBuilder a2 = j.l.a("Encountered media error: ", str, " for ad: ");
            a2.append(this.a);
            c0676o.b("AppLovinFullscreenActivity", a2.toString());
        }
        if (this.m0.compareAndSet(false, true)) {
            if (((Boolean) this.b.a(C0577l4.L0)).booleanValue()) {
                this.b.H().d(this.a, C0672k.o());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.F;
            if (appLovinAdDisplayListener instanceof InterfaceC0527f2) {
                ((InterfaceC0527f2) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            String str2 = this.a instanceof C0478a7 ? "handleVastVideoError" : "handleVideoError";
            this.b.E().a(str2, str, this.a);
            HashMap<String, String> hashMap = CollectionUtils.hashMap("source", str2);
            CollectionUtils.putStringIfValid(C0752a.Y, str, hashMap);
            this.b.g().a(C0729y1.s, this.a, hashMap);
            a("media_error");
        }
    }

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

    @Override
    public void n() {
        super.a(D(), this.f0, G(), this.o0);
    }

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

    @Override
    public void s() {
        if (C0676o.a()) {
            this.c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.b.a(C0577l4.Q5)).booleanValue()) {
                a8.b(this.V);
                this.V = null;
            }
            if (this.f0) {
                AppLovinCommunicator.getInstance(this.d).unsubscribe(this, "video_caching_failed");
            }
            AppLovinVideoView appLovinVideoView = this.Q;
            if (appLovinVideoView != null) {
                appLovinVideoView.pause();
                this.Q.stopPlayback();
            }
            MediaPlayer mediaPlayer = this.O;
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        } catch (Throwable th) {
            C0676o.c("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
        }
        super.s();
    }

    @Override
    public void w() {
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.j0 = this.Q.getCurrentPosition();
        this.Q.pause();
        this.d0.c();
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Paused video at position " + this.j0 + "ms");
        }
    }

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

    public void I() {
        C0470a c0470a = this.R;
        if (c0470a != null) {
            c0470a.b();
        }
    }

    public void J() {
        C0470a c0470a = this.R;
        if (c0470a != null) {
            c0470a.a();
            final C0470a c0470a2 = this.R;
            Objects.requireNonNull(c0470a2);
            a(new Runnable() {
                @Override
                public final void run() {
                    C0470a.this.b();
                }
            }, 2000L);
        }
    }

    public void K() {
        this.o0 = -1L;
        this.p0 = SystemClock.elapsedRealtime();
    }

    public void L() {
        C0470a c0470a = this.R;
        if (c0470a != null) {
            c0470a.a();
        }
    }

    public void M() {
        this.q = SystemClock.elapsedRealtime();
    }

    public int D() {
        long currentPosition = this.Q.getCurrentPosition();
        if (this.l0) {
            return 100;
        }
        return currentPosition > 0 ? (int) ((currentPosition / this.h0) * 100.0f) : this.i0;
    }

    public void E() {
        this.y++;
        if (this.a.E()) {
            if (C0676o.a()) {
                this.c.a("AppLovinFullscreenActivity", "Dismissing ad on video skip...");
            }
            a("video_skip");
        } else {
            if (C0676o.a()) {
                this.c.a("AppLovinFullscreenActivity", "Skipping video...");
            }
            U();
        }
    }

    public void F() {
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                C0705v1.this.I();
            }
        });
    }

    public boolean G() {
        if (this.K && this.a.j1()) {
            return true;
        }
        return H();
    }

    public boolean H() {
        return D() >= this.a.q0();
    }

    @Override
    public void b(boolean z) {
        super.b(z);
        if (z) {
            b(0L);
            if (this.k0) {
                this.e0.b();
                return;
            }
            return;
        }
        if (this.k0) {
            this.e0.c();
        } else {
            w();
        }
    }

    @Override
    public void f() {
        super.f();
        B();
    }

    @Override
    public void a(ViewGroup viewGroup) {
        String str;
        this.N.a(this.U, this.S, this.V, this.R, this.W, this.T, this.Q, this.P, this.i, this.j, this.Y, viewGroup);
        if (AbstractC0565k0.g() && (str = this.b.n0().getExtraParameters().get("audio_focus_request")) != null) {
            this.Q.setAudioFocusRequest(Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.f0)) {
            return;
        }
        this.Q.setVideoURI(this.a.w0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        com.applovin.impl.adview.k kVar = this.j;
        if (kVar != null) {
            kVar.b();
        }
        this.Q.start();
        if (this.f0) {
            T();
        }
        this.i.renderAd(this.a);
        if (this.S != null) {
            this.b.q0().a(new C0531f6(this.b, "scheduleSkipButton", new Runnable() {
                @Override
                public final void run() {
                    C0705v1.this.Q();
                }
            }), C0650r5.b.TIMEOUT, this.a.p0(), true);
        }
        super.c(this.g0);
    }

    public void b(boolean z, long j) {
        if (z) {
            q7.a(this.V, j, (Runnable) null);
        } else {
            q7.b(this.V, j, (Runnable) null);
        }
    }

    @Override
    public void b(long j) {
        a(new Runnable() {
            @Override
            public final void run() {
                C0705v1.this.O();
            }
        }, j);
    }

    @Override
    public void b() {
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Continue video from prompt - will resume in onWindowFocusChanged(true) when alert dismisses");
        }
    }

    @Override
    public void g() {
        super.g();
        this.N.a(this.V);
        this.N.a((View) this.S);
        if (!i() || this.k0) {
            B();
        }
    }

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

    private void a(ProgressBar progressBar, int i, int i2) {
        progressBar.setMax(i2);
        progressBar.setPadding(0, 0, 0, 0);
        if (AbstractC0565k0.d()) {
            progressBar.setProgressTintList(ColorStateList.valueOf(i));
        }
    }

    @Override
    public void a(String str) {
        this.d0.a();
        this.e0.a();
        this.b0.removeCallbacksAndMessages(null);
        this.c0.removeCallbacksAndMessages(null);
        if (!((Boolean) this.b.a(C0577l4.f434k6)).booleanValue()) {
            AbstractC0662b abstractC0662b = this.a;
            if (abstractC0662b != null) {
                abstractC0662b.a(str);
            }
            n();
        }
        super.a(str);
    }

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.a.P0()) {
            if (C0676o.a()) {
                this.c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri n0 = this.a.n0();
            if (n0 != null) {
                if (!((Boolean) this.b.a(C0577l4.x)).booleanValue() || (context = this.d) == null) {
                    AppLovinAdView appLovinAdView = this.i;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : C0672k.o();
                }
                this.b.k().trackAndLaunchVideoClick(this.a, n0, motionEvent, bundle, this, context);
                AbstractC0575l2.a(this.E, this.a);
                this.z++;
                return;
            }
            return;
        }
        N();
    }

    private static boolean a(boolean z, C0672k c0672k) {
        if (!((Boolean) c0672k.a(C0577l4.c2)).booleanValue()) {
            return false;
        }
        if (!((Boolean) c0672k.a(C0577l4.d2)).booleanValue() || z) {
            return true;
        }
        return ((Boolean) c0672k.a(C0577l4.f2)).booleanValue();
    }

    @Override
    public void a() {
        if (C0676o.a()) {
            this.c.a("AppLovinFullscreenActivity", "Skipping video from prompt");
        }
        E();
    }
}