导航菜单

页面标题

页面副标题

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

正在查看: All File Recovery v1.0.2 应用的 C2965v1.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.C2910r5;
import com.applovin.impl.C2972w0;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.adview.AppLovinVideoView;
import com.applovin.impl.adview.C2745g;
import com.applovin.impl.sdk.C2932k;
import com.applovin.impl.sdk.C2936o;
import com.applovin.impl.sdk.ad.AbstractC2922b;
import com.applovin.impl.sdk.ad.C2921a;
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.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 C2965v1 extends AbstractC2906r1 implements AppLovinCommunicatorSubscriber {

    private final C2973w1 f43231N;

    private MediaPlayer f43232O;

    private final View f43233P;

    protected final AppLovinVideoView f43234Q;

    protected final C2730a f43235R;

    protected final C2745g f43236S;

    protected C2776e0 f43237T;

    protected final ImageView f43238U;

    protected com.applovin.impl.adview.l f43239V;

    protected final ProgressBar f43240W;

    protected ProgressBar f43241X;

    protected ImageView f43242Y;

    private final e f43243Z;

    private final d f43244a0;

    private final Handler f43245b0;

    private final Handler f43246c0;

    protected final C2972w0 f43247d0;

    protected final C2972w0 f43248e0;

    private final boolean f43249f0;

    protected boolean f43250g0;

    protected long f43251h0;

    private int f43252i0;

    private int f43253j0;

    protected boolean f43254k0;

    private boolean f43255l0;

    private final AtomicBoolean f43256m0;

    private final AtomicBoolean f43257n0;

    private long f43258o0;

    private long f43259p0;

    public class a implements C2972w0.b {

        final int f43260a;

        public a(int i10) {
            this.f43260a = i10;
        }

        @Override
        public void a() {
            if (C2965v1.this.f43237T != null) {
                long seconds = this.f43260a - TimeUnit.MILLISECONDS.toSeconds(r0.f43234Q.getCurrentPosition());
                if (seconds <= 0) {
                    C2965v1.this.f42406v = true;
                } else if (C2965v1.this.R()) {
                    C2965v1.this.f43237T.setProgress((int) seconds);
                }
            }
        }

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

    public class b implements C2972w0.b {

        final Integer f43262a;

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

        @Override
        public void a() {
            C2965v1 c2965v1 = C2965v1.this;
            if (c2965v1.f43254k0) {
                c2965v1.f43240W.setVisibility(8);
            } else {
                C2965v1.this.f43240W.setProgress((int) ((c2965v1.f43234Q.getCurrentPosition() / C2965v1.this.f43251h0) * this.f43262a.intValue()));
            }
        }

        @Override
        public boolean b() {
            return !C2965v1.this.f43254k0;
        }
    }

    public class c implements C2972w0.b {

        final long f43264a;

        final Integer f43265b;

        final Long f43266c;

        public c(long j10, Integer num, Long l10) {
            this.f43264a = j10;
            this.f43265b = num;
            this.f43266c = l10;
        }

        @Override
        public void a() {
            C2965v1.this.f43241X.setProgress((int) ((C2965v1.this.f42402r / this.f43264a) * this.f43265b.intValue()));
            C2965v1 c2965v1 = C2965v1.this;
            c2965v1.f42402r = this.f43266c.longValue() + c2965v1.f42402r;
        }

        @Override
        public boolean b() {
            return C2965v1.this.f42402r < this.f43264a;
        }
    }

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

        @Override
        public void a(com.applovin.impl.adview.l lVar) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Closing ad from video button...");
            }
            C2965v1.this.a("video_button");
        }

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

        @Override
        public void c(com.applovin.impl.adview.l lVar) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Fully Watched from video button...");
            }
            C2965v1.this.f42382K = true;
        }

        @Override
        public void d(com.applovin.impl.adview.l lVar) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Skipping video from video button...");
            }
            C2965v1.this.V();
        }

        public d(C2965v1 c2965v1, a aVar) {
            this();
        }

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

        @Override
        public void b(Uri uri, com.applovin.impl.adview.l lVar) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            AbstractC2978w6.c(uri, C2965v1.this.f42393i.getController().g(), C2965v1.this.f42386b);
        }

        @Override
        public void a(Uri uri, com.applovin.impl.adview.l lVar) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Attempting to load a url from video button...");
            }
            AbstractC2978w6.a(uri, C2965v1.this.f42393i.getController(), C2965v1.this.f42386b);
        }
    }

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

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

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "Video completed");
            }
            C2965v1.this.f43255l0 = true;
            C2965v1 c2965v1 = C2965v1.this;
            if (!c2965v1.f42404t) {
                c2965v1.U();
            } else if (c2965v1.i()) {
                C2965v1.this.B();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i10, int i11) {
            C2965v1.this.g(K.O0.a("Video view error (", i10, ",", i11, L7.j.f9293d));
            C2965v1.this.f43234Q.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i10, int i11) {
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", K.O0.a("MediaPlayer Info: (", i10, ", ", i11, L7.j.f9293d));
            }
            if (i10 == 701) {
                C2965v1.this.T();
                return false;
            }
            if (i10 != 3) {
                if (i10 != 702) {
                    return false;
                }
                C2965v1.this.F();
                return false;
            }
            C2965v1.this.f43247d0.b();
            C2965v1 c2965v1 = C2965v1.this;
            if (c2965v1.f43236S != null) {
                c2965v1.Q();
            }
            C2965v1.this.F();
            if (!C2965v1.this.f42379H.b()) {
                return false;
            }
            C2965v1.this.w();
            return false;
        }

        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            C2965v1.this.f43232O = mediaPlayer;
            mediaPlayer.setOnInfoListener(C2965v1.this.f43243Z);
            mediaPlayer.setOnErrorListener(C2965v1.this.f43243Z);
            float f10 = !C2965v1.this.f43250g0 ? 1 : 0;
            mediaPlayer.setVolume(f10, f10);
            C2965v1.this.f42405u = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            C2965v1.this.d(mediaPlayer.getDuration());
            C2965v1.this.P();
            C2936o c2936o = C2965v1.this.f42387c;
            if (C2936o.a()) {
                C2965v1.this.f42387c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + C2965v1.this.f43232O);
            }
        }

        public e(C2965v1 c2965v1, a aVar) {
            this();
        }
    }

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

        @Override
        public void onClick(View view) {
            C2965v1 c2965v1 = C2965v1.this;
            if (view == c2965v1.f43236S) {
                c2965v1.V();
                return;
            }
            if (view == c2965v1.f43238U) {
                c2965v1.W();
            } else if (C2936o.a()) {
                C2965v1.this.f42387c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(C2965v1 c2965v1, a aVar) {
            this();
        }
    }

    public C2965v1(AbstractC2922b abstractC2922b, Activity activity, Map map, C2932k c2932k, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(abstractC2922b, activity, map, c2932k, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.f43231N = new C2973w1(this.f42385a, this.f42388d, this.f42386b);
        a aVar = null;
        this.f43242Y = null;
        e eVar = new e(this, aVar);
        this.f43243Z = eVar;
        d dVar = new d(this, aVar);
        this.f43244a0 = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.f43245b0 = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.f43246c0 = handler2;
        C2972w0 c2972w0 = new C2972w0(handler, this.f42386b);
        this.f43247d0 = c2972w0;
        this.f43248e0 = new C2972w0(handler2, this.f42386b);
        boolean Q02 = this.f42385a.Q0();
        this.f43249f0 = Q02;
        this.f43250g0 = AbstractC3002z6.e(this.f42386b);
        this.f43253j0 = -1;
        this.f43256m0 = new AtomicBoolean();
        this.f43257n0 = new AtomicBoolean();
        this.f43258o0 = -2L;
        this.f43259p0 = 0L;
        if (!abstractC2922b.hasVideoUrl()) {
            throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
        }
        AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
        this.f43234Q = appLovinVideoView;
        appLovinVideoView.setOnPreparedListener(eVar);
        appLovinVideoView.setOnCompletionListener(eVar);
        appLovinVideoView.setOnErrorListener(eVar);
        abstractC2922b.h().putString("video_view_address", q7.a(appLovinVideoView));
        View view = new View(activity);
        this.f43233P = view;
        boolean z10 = false;
        view.setBackgroundColor(Color.argb(X4.d.f22711l, 0, 0, 0));
        if (((Boolean) c2932k.a(C2837l4.f41369k1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(c2932k, C2837l4.f41352i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(c2932k, C2837l4.f41352i0, activity, eVar));
            view.setOnTouchListener(new E5());
        }
        f fVar = new f(this, aVar);
        if (abstractC2922b.o0() >= 0) {
            C2745g c2745g = new C2745g(abstractC2922b.e0(), activity);
            this.f43236S = c2745g;
            c2745g.setVisibility(8);
            c2745g.setOnClickListener(fVar);
        } else {
            this.f43236S = null;
        }
        if (a(this.f43250g0, c2932k)) {
            ImageView imageView = new ImageView(activity);
            this.f43238U = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            e(this.f43250g0);
        } else {
            this.f43238U = null;
        }
        String l02 = abstractC2922b.l0();
        if (StringUtils.isValidString(l02)) {
            y7 y7Var = new y7(c2932k);
            y7Var.a(new WeakReference(dVar));
            com.applovin.impl.adview.l lVar = new com.applovin.impl.adview.l(abstractC2922b.k0(), abstractC2922b, y7Var, activity);
            this.f43239V = lVar;
            lVar.a(l02);
        } else {
            this.f43239V = null;
        }
        if (Q02) {
            C2730a c2730a = new C2730a(activity, ((Integer) c2932k.a(C2837l4.f41394n2)).intValue(), R.attr.progressBarStyleLarge);
            this.f43235R = c2730a;
            c2730a.setColor(Color.parseColor("#75FFFFFF"));
            c2730a.setBackgroundColor(Color.parseColor("#00000000"));
            c2730a.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.f43235R = null;
        }
        int d10 = d();
        if (((Boolean) c2932k.a(C2837l4.f41235S1)).booleanValue() && d10 > 0) {
            z10 = true;
        }
        if (this.f43237T == null && z10) {
            this.f43237T = new C2776e0(activity);
            int t10 = abstractC2922b.t();
            this.f43237T.setTextColor(t10);
            this.f43237T.setTextSize(((Integer) c2932k.a(C2837l4.f41228R1)).intValue());
            this.f43237T.setFinishedStrokeColor(t10);
            this.f43237T.setFinishedStrokeWidth(((Integer) c2932k.a(C2837l4.f41221Q1)).intValue());
            this.f43237T.setMax(d10);
            this.f43237T.setProgress(d10);
            c2972w0.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d10));
        }
        if (!abstractC2922b.v0()) {
            this.f43240W = null;
            return;
        }
        Long l10 = (Long) c2932k.a(C2837l4.f41370k2);
        Integer num = (Integer) c2932k.a(C2837l4.f41378l2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.f43240W = progressBar;
        a(progressBar, abstractC2922b.u0(), num.intValue());
        c2972w0.a("PROGRESS_BAR", l10.longValue(), new b(num));
    }

    private void N() {
        com.applovin.impl.adview.l lVar;
        p7 m02 = this.f42385a.m0();
        if (m02 == null || !m02.j() || this.f43254k0 || (lVar = this.f43239V) == null) {
            return;
        }
        final boolean z10 = lVar.getVisibility() == 4;
        final long h10 = m02.h();
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                C2965v1.this.b(z10, h10);
            }
        });
    }

    public void O() {
        if (this.f43254k0) {
            if (C2936o.a()) {
                this.f42387c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.f42386b.m0().isApplicationPaused()) {
            if (C2936o.a()) {
                this.f42387c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        if (this.f43253j0 < 0) {
            if (C2936o.a()) {
                this.f42387c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (C2936o.a()) {
            this.f42387c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.f43253j0 + "ms for MediaPlayer: " + this.f43232O);
        }
        this.f43234Q.seekTo(this.f43253j0);
        this.f43234Q.start();
        this.f43247d0.b();
        this.f43253j0 = -1;
        a(new Runnable() {
            @Override
            public final void run() {
                C2965v1.this.J();
            }
        }, 250L);
    }

    public void Q() {
        if (this.f43257n0.compareAndSet(false, true)) {
            a(this.f43236S, this.f42385a.o0(), new Runnable() {
                @Override
                public final void run() {
                    C2965v1.this.K();
                }
            });
        }
    }

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

    private void e(boolean z10) {
        if (AbstractC2825k0.d()) {
            AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.f42388d.getDrawable(z10 ? com.applovin.sdk.R.drawable.applovin_ic_unmute_to_mute : com.applovin.sdk.R.drawable.applovin_ic_mute_to_unmute);
            if (animatedVectorDrawable != null) {
                this.f43238U.setScaleType(ImageView.ScaleType.FIT_XY);
                this.f43238U.setImageDrawable(animatedVectorDrawable);
                animatedVectorDrawable.start();
                return;
            }
        }
        ImageViewUtils.setImageUri(this.f43238U, z10 ? this.f42385a.Q() : this.f42385a.j0(), this.f42386b);
    }

    private void f(boolean z10) {
        this.f43252i0 = D();
        if (z10) {
            this.f43234Q.pause();
        } else {
            this.f43234Q.stopPlayback();
        }
    }

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

    @Override
    public void B() {
        this.f43231N.a(this.f42396l);
        this.f42401q = SystemClock.elapsedRealtime();
    }

    public void P() {
        long Z10;
        long millis;
        if (this.f42385a.Y() >= 0 || this.f42385a.Z() >= 0) {
            if (this.f42385a.Y() >= 0) {
                Z10 = this.f42385a.Y();
            } else {
                C2921a c2921a = (C2921a) this.f42385a;
                long j10 = this.f43251h0;
                long j11 = j10 > 0 ? j10 : 0L;
                if (c2921a.f1()) {
                    int p12 = (int) ((C2921a) this.f42385a).p1();
                    if (p12 > 0) {
                        millis = TimeUnit.SECONDS.toMillis(p12);
                    } else {
                        int s10 = (int) c2921a.s();
                        if (s10 > 0) {
                            millis = TimeUnit.SECONDS.toMillis(s10);
                        }
                    }
                    j11 += millis;
                }
                Z10 = (long) ((this.f42385a.Z() / 100.0d) * j11);
            }
            c(Z10);
        }
    }

    public boolean R() {
        return (this.f42406v || this.f43254k0 || !this.f43234Q.isPlaying()) ? false : true;
    }

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

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

    public void U() {
        C2965v1 c2965v1;
        if (C2936o.a()) {
            this.f42387c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        f(this.f42385a.m1());
        long W10 = this.f42385a.W();
        if (W10 > 0) {
            this.f42402r = 0L;
            Long l10 = (Long) this.f42386b.a(C2837l4.f41442t2);
            Integer num = (Integer) this.f42386b.a(C2837l4.f41466w2);
            ProgressBar progressBar = new ProgressBar(this.f42388d, null, R.attr.progressBarStyleHorizontal);
            this.f43241X = progressBar;
            a(progressBar, this.f42385a.V(), num.intValue());
            c2965v1 = this;
            this.f43248e0.a("POSTITIAL_PROGRESS_BAR", l10.longValue(), c2965v1.new c(W10, num, l10));
            c2965v1.f43248e0.b();
        } else {
            c2965v1 = this;
        }
        c2965v1.f43231N.a(c2965v1.f42395k, c2965v1.f42394j, c2965v1.f42393i, c2965v1.f43241X);
        StringBuilder sb2 = new StringBuilder("javascript:al_onPoststitialShow(");
        sb2.append(c2965v1.f42409y);
        sb2.append(",");
        a(android.support.v4.media.c.a(sb2, c2965v1.f42410z, ");"), c2965v1.f42385a.H());
        if (c2965v1.f42395k != null) {
            if (c2965v1.f42385a.s() >= 0) {
                a(c2965v1.f42395k, c2965v1.f42385a.s(), new Runnable() {
                    @Override
                    public final void run() {
                        C2965v1.this.M();
                    }
                });
            } else {
                c2965v1.f42395k.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        C2745g c2745g = c2965v1.f42395k;
        if (c2745g != null) {
            arrayList.add(new C2959u3(c2745g, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = c2965v1.f42394j;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = c2965v1.f42394j;
            arrayList.add(new C2959u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = c2965v1.f43241X;
        if (progressBar2 != null) {
            arrayList.add(new C2959u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        c2965v1.f42385a.getAdEventTracker().b(c2965v1.f42393i, arrayList);
        q();
        c2965v1.f43254k0 = true;
    }

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

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

    public void d(long j10) {
        this.f43251h0 = j10;
    }

    public void g(String str) {
        if (C2936o.a()) {
            C2936o c2936o = this.f42387c;
            StringBuilder a10 = j.l.a("Encountered media error: ", str, " for ad: ");
            a10.append(this.f42385a);
            c2936o.b("AppLovinFullscreenActivity", a10.toString());
        }
        if (this.f43256m0.compareAndSet(false, true)) {
            if (((Boolean) this.f42386b.a(C2837l4.f41185L0)).booleanValue()) {
                this.f42386b.H().d(this.f42385a, C2932k.o());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.f42377F;
            if (appLovinAdDisplayListener instanceof InterfaceC2787f2) {
                ((InterfaceC2787f2) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            String str2 = this.f42385a instanceof C2738a7 ? "handleVastVideoError" : "handleVideoError";
            this.f42386b.E().a(str2, str, this.f42385a);
            HashMap<String, String> hashMap = CollectionUtils.hashMap("source", str2);
            CollectionUtils.putStringIfValid("error_message", str, hashMap);
            this.f42386b.g().a(C2989y1.f43499s, this.f42385a, hashMap);
            a("media_error");
        }
    }

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

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

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

    @Override
    public void s() {
        if (C2936o.a()) {
            this.f42387c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.f42386b.a(C2837l4.f41225Q5)).booleanValue()) {
                a8.b(this.f43239V);
                this.f43239V = null;
            }
            if (this.f43249f0) {
                AppLovinCommunicator.getInstance(this.f42388d).unsubscribe(this, "video_caching_failed");
            }
            AppLovinVideoView appLovinVideoView = this.f43234Q;
            if (appLovinVideoView != null) {
                appLovinVideoView.pause();
                this.f43234Q.stopPlayback();
            }
            MediaPlayer mediaPlayer = this.f43232O;
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        } catch (Throwable th) {
            C2936o.c("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
        }
        super.s();
    }

    @Override
    public void w() {
        if (C2936o.a()) {
            this.f42387c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.f43253j0 = this.f43234Q.getCurrentPosition();
        this.f43234Q.pause();
        this.f43247d0.c();
        if (C2936o.a()) {
            this.f42387c.a("AppLovinFullscreenActivity", "Paused video at position " + this.f43253j0 + "ms");
        }
    }

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

    public void I() {
        C2730a c2730a = this.f43235R;
        if (c2730a != null) {
            c2730a.b();
        }
    }

    public void J() {
        C2730a c2730a = this.f43235R;
        if (c2730a != null) {
            c2730a.a();
            final C2730a c2730a2 = this.f43235R;
            Objects.requireNonNull(c2730a2);
            a(new Runnable() {
                @Override
                public final void run() {
                    C2730a.this.b();
                }
            }, 2000L);
        }
    }

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

    public void L() {
        C2730a c2730a = this.f43235R;
        if (c2730a != null) {
            c2730a.a();
        }
    }

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

    public int D() {
        long currentPosition = this.f43234Q.getCurrentPosition();
        if (this.f43255l0) {
            return 100;
        }
        return currentPosition > 0 ? (int) ((currentPosition / this.f43251h0) * 100.0f) : this.f43252i0;
    }

    public void E() {
        this.f42409y++;
        if (this.f42385a.E()) {
            if (C2936o.a()) {
                this.f42387c.a("AppLovinFullscreenActivity", "Dismissing ad on video skip...");
            }
            a("video_skip");
        } else {
            if (C2936o.a()) {
                this.f42387c.a("AppLovinFullscreenActivity", "Skipping video...");
            }
            U();
        }
    }

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

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

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

    @Override
    public void b(boolean z10) {
        super.b(z10);
        if (z10) {
            b(0L);
            if (this.f43254k0) {
                this.f43248e0.b();
                return;
            }
            return;
        }
        if (this.f43254k0) {
            this.f43248e0.c();
        } else {
            w();
        }
    }

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

    @Override
    public void a(ViewGroup viewGroup) {
        String str;
        this.f43231N.a(this.f43238U, this.f43236S, this.f43239V, this.f43235R, this.f43240W, this.f43237T, this.f43234Q, this.f43233P, this.f42393i, this.f42394j, this.f43242Y, viewGroup);
        if (AbstractC2825k0.g() && (str = this.f42386b.n0().getExtraParameters().get("audio_focus_request")) != null) {
            this.f43234Q.setAudioFocusRequest(Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.f43249f0)) {
            return;
        }
        this.f43234Q.setVideoURI(this.f42385a.w0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        com.applovin.impl.adview.k kVar = this.f42394j;
        if (kVar != null) {
            kVar.b();
        }
        this.f43234Q.start();
        if (this.f43249f0) {
            T();
        }
        this.f42393i.renderAd(this.f42385a);
        if (this.f43236S != null) {
            this.f42386b.q0().a(new C2791f6(this.f42386b, "scheduleSkipButton", new Runnable() {
                @Override
                public final void run() {
                    C2965v1.this.Q();
                }
            }), C2910r5.b.TIMEOUT, this.f42385a.p0(), true);
        }
        super.c(this.f43250g0);
    }

    public void b(boolean z10, long j10) {
        if (z10) {
            q7.a(this.f43239V, j10, (Runnable) null);
        } else {
            q7.b(this.f43239V, j10, (Runnable) null);
        }
    }

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

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

    @Override
    public void g() {
        super.g();
        this.f43231N.a(this.f43239V);
        this.f43231N.a((View) this.f43236S);
        if (!i() || this.f43254k0) {
            B();
        }
    }

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

    private void a(ProgressBar progressBar, int i10, int i11) {
        progressBar.setMax(i11);
        progressBar.setPadding(0, 0, 0, 0);
        if (AbstractC2825k0.d()) {
            progressBar.setProgressTintList(ColorStateList.valueOf(i10));
        }
    }

    @Override
    public void a(String str) {
        this.f43247d0.a();
        this.f43248e0.a();
        this.f43245b0.removeCallbacksAndMessages(null);
        this.f43246c0.removeCallbacksAndMessages(null);
        if (!((Boolean) this.f42386b.a(C2837l4.f41374k6)).booleanValue()) {
            AbstractC2922b abstractC2922b = this.f42385a;
            if (abstractC2922b != null) {
                abstractC2922b.a(str);
            }
            n();
        }
        super.a(str);
    }

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.f42385a.P0()) {
            if (C2936o.a()) {
                this.f42387c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri n02 = this.f42385a.n0();
            if (n02 != null) {
                if (!((Boolean) this.f42386b.a(C2837l4.f41471x)).booleanValue() || (context = this.f42388d) == null) {
                    AppLovinAdView appLovinAdView = this.f42393i;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : C2932k.o();
                }
                this.f42386b.k().trackAndLaunchVideoClick(this.f42385a, n02, motionEvent, bundle, this, context);
                AbstractC2835l2.a(this.f42376E, this.f42385a);
                this.f42410z++;
                return;
            }
            return;
        }
        N();
    }

    private static boolean a(boolean z10, C2932k c2932k) {
        if (!((Boolean) c2932k.a(C2837l4.f41306c2)).booleanValue()) {
            return false;
        }
        if (!((Boolean) c2932k.a(C2837l4.f41314d2)).booleanValue() || z10) {
            return true;
        }
        return ((Boolean) c2932k.a(C2837l4.f41330f2)).booleanValue();
    }

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