导航菜单

页面标题

页面副标题

FileWipe Pro v3.0.0 - v1.java 源代码

正在查看: FileWipe Pro v3.0.0 应用的 v1.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.CollectionUtils;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.w0;
import com.applovin.impl.z7;
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 v1 extends r1 implements AppLovinCommunicatorSubscriber {
    private final w1 N;
    private MediaPlayer O;
    private final View P;
    protected final AppLovinVideoView Q;
    protected final com.applovin.impl.a R;
    protected final com.applovin.impl.adview.g S;
    protected e0 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 f4495a0;

    private final Handler f4496b0;

    private final Handler f4497c0;

    protected final w0 f4498d0;

    protected final w0 f4499e0;

    private final boolean f4500f0;

    protected boolean f4501g0;

    protected long f4502h0;

    private int f4503i0;

    private int f4504j0;
    protected boolean k0;

    private boolean f4505l0;

    private final AtomicBoolean f4506m0;

    private final AtomicBoolean f4507n0;

    private long f4508o0;
    private long p0;

    public class a implements w0.b {

        final int f4509a;

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

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

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

    public class b implements w0.b {

        final Integer f4511a;

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

        @Override
        public void a() {
            v1 v1Var = v1.this;
            if (v1Var.k0) {
                v1Var.W.setVisibility(8);
            } else {
                v1.this.W.setProgress((int) ((v1Var.Q.getCurrentPosition() / v1.this.f4502h0) * this.f4511a.intValue()));
            }
        }

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

    public class c implements w0.b {

        final long f4513a;

        final Integer f4514b;

        final Long f4515c;

        public c(long j5, Integer num, Long l) {
            this.f4513a = j5;
            this.f4514b = num;
            this.f4515c = l;
        }

        @Override
        public void a() {
            v1.this.X.setProgress((int) ((v1.this.f3803r / this.f4513a) * this.f4514b.intValue()));
            v1 v1Var = v1.this;
            v1Var.f3803r = this.f4515c.longValue() + v1Var.f3803r;
        }

        @Override
        public boolean b() {
            return v1.this.f3803r < this.f4513a;
        }
    }

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

        @Override
        public void a(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Closing ad from video button...");
            }
            v1.this.a("video_button");
        }

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

        @Override
        public void c(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Fully Watched from video button...");
            }
            v1.this.K = true;
        }

        @Override
        public void d(com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Skipping video from video button...");
            }
            v1.this.V();
        }

        public d(v1 v1Var, a aVar) {
            this();
        }

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

        @Override
        public void b(Uri uri, com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            x6.c(uri, v1.this.f3796i.getController().g(), v1.this.f3789b);
        }

        @Override
        public void a(Uri uri, com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Attempting to load a url from video button...");
            }
            x6.a(uri, v1.this.f3796i.getController(), v1.this.f3789b);
        }
    }

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

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

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "Video completed");
            }
            v1.this.f4505l0 = true;
            v1 v1Var = v1.this;
            if (!v1Var.f3805t) {
                v1Var.U();
            } else if (v1Var.i()) {
                v1.this.B();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i10, int i11) {
            v1.this.g("Video view error (" + i10 + "," + i11 + ")");
            v1.this.Q.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i10, int i11) {
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i10 + ", " + i11 + ")");
            }
            if (i10 == 701) {
                v1.this.T();
                return false;
            }
            if (i10 != 3) {
                if (i10 != 702) {
                    return false;
                }
                v1.this.F();
                return false;
            }
            v1.this.f4498d0.b();
            v1 v1Var = v1.this;
            if (v1Var.S != null) {
                v1Var.Q();
            }
            v1.this.F();
            if (!v1.this.H.b()) {
                return false;
            }
            v1.this.w();
            return false;
        }

        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            v1.this.O = mediaPlayer;
            mediaPlayer.setOnInfoListener(v1.this.Z);
            mediaPlayer.setOnErrorListener(v1.this.Z);
            float f10 = !v1.this.f4501g0 ? 1 : 0;
            mediaPlayer.setVolume(f10, f10);
            v1.this.f3806u = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            v1.this.d(mediaPlayer.getDuration());
            v1.this.P();
            com.applovin.impl.sdk.o oVar = v1.this.f3790c;
            if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + v1.this.O);
            }
        }

        public e(v1 v1Var, a aVar) {
            this();
        }
    }

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

        @Override
        public void onClick(View view) {
            v1 v1Var = v1.this;
            if (view == v1Var.S) {
                v1Var.V();
                return;
            }
            if (view == v1Var.U) {
                v1Var.W();
            } else if (com.applovin.impl.sdk.o.a()) {
                v1.this.f3790c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(v1 v1Var, a aVar) {
            this();
        }
    }

    public v1(com.applovin.impl.sdk.ad.b bVar, Activity activity, Map map, com.applovin.impl.sdk.k kVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(bVar, activity, map, kVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.N = new w1(this.f3788a, this.f3791d, this.f3789b);
        a aVar = null;
        this.Y = null;
        e eVar = new e(this, aVar);
        this.Z = eVar;
        d dVar = new d(this, aVar);
        this.f4495a0 = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.f4496b0 = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.f4497c0 = handler2;
        w0 w0Var = new w0(handler, this.f3789b);
        this.f4498d0 = w0Var;
        this.f4499e0 = new w0(handler2, this.f3789b);
        boolean Q0 = this.f3788a.Q0();
        this.f4500f0 = Q0;
        this.f4501g0 = a7.e(this.f3789b);
        this.f4504j0 = -1;
        this.f4506m0 = new AtomicBoolean();
        this.f4507n0 = new AtomicBoolean();
        this.f4508o0 = -2L;
        this.p0 = 0L;
        if (!bVar.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);
        bVar.h().putString("video_view_address", r7.a(appLovinVideoView));
        View view = new View(activity);
        this.P = view;
        boolean z3 = false;
        view.setBackgroundColor(Color.argb(254, 0, 0, 0));
        if (((Boolean) kVar.a(l4.f2933k1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(kVar, l4.f2919i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(kVar, l4.f2919i0, activity, eVar));
            view.setOnTouchListener(new com.applovin.impl.adview.r(1));
        }
        f fVar = new f(this, aVar);
        if (bVar.o0() >= 0) {
            com.applovin.impl.adview.g gVar = new com.applovin.impl.adview.g(bVar.e0(), activity);
            this.S = gVar;
            gVar.setVisibility(8);
            gVar.setOnClickListener(fVar);
        } else {
            this.S = null;
        }
        if (a(this.f4501g0, kVar)) {
            ImageView imageView = new ImageView(activity);
            this.U = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            e(this.f4501g0);
        } else {
            this.U = null;
        }
        String l02 = bVar.l0();
        if (StringUtils.isValidString(l02)) {
            z7 z7Var = new z7(kVar);
            z7Var.a(new WeakReference(dVar));
            com.applovin.impl.adview.l lVar = new com.applovin.impl.adview.l(bVar.k0(), bVar, z7Var, activity);
            this.V = lVar;
            lVar.a(l02);
        } else {
            this.V = null;
        }
        if (Q0) {
            com.applovin.impl.a aVar2 = new com.applovin.impl.a(activity, ((Integer) kVar.a(l4.f2952n2)).intValue(), R.attr.progressBarStyleLarge);
            this.R = aVar2;
            aVar2.setColor(Color.parseColor("#75FFFFFF"));
            aVar2.setBackgroundColor(Color.parseColor("#00000000"));
            aVar2.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.R = null;
        }
        int d4 = d();
        if (((Boolean) kVar.a(l4.S1)).booleanValue() && d4 > 0) {
            z3 = true;
        }
        if (this.T == null && z3) {
            this.T = new e0(activity);
            int t3 = bVar.t();
            this.T.setTextColor(t3);
            this.T.setTextSize(((Integer) kVar.a(l4.R1)).intValue());
            this.T.setFinishedStrokeColor(t3);
            this.T.setFinishedStrokeWidth(((Integer) kVar.a(l4.Q1)).intValue());
            this.T.setMax(d4);
            this.T.setProgress(d4);
            w0Var.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d4));
        }
        if (!bVar.v0()) {
            this.W = null;
            return;
        }
        Long l = (Long) kVar.a(l4.f2934k2);
        Integer num = (Integer) kVar.a(l4.f2941l2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.W = progressBar;
        a(progressBar, bVar.u0(), num.intValue());
        w0Var.a("PROGRESS_BAR", l.longValue(), new b(num));
    }

    private void N() {
        com.applovin.impl.adview.l lVar;
        q7 m02 = this.f3788a.m0();
        if (m02 == null || !m02.j() || this.k0 || (lVar = this.V) == null) {
            return;
        }
        AppLovinSdkUtils.runOnUiThread(new com.applovin.impl.sdk.z(this, lVar.getVisibility() == 4, m02.h(), 1));
    }

    public void O() {
        if (this.k0) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.f3789b.m0().isApplicationPaused()) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        if (this.f4504j0 < 0) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.f4504j0 + "ms for MediaPlayer: " + this.O);
        }
        this.Q.seekTo(this.f4504j0);
        this.Q.start();
        this.f4498d0.b();
        this.f4504j0 = -1;
        a(new aa(this, 4), 250L);
    }

    public void Q() {
        if (this.f4507n0.compareAndSet(false, true)) {
            a(this.S, this.f3788a.o0(), new aa(this, 1));
        }
    }

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

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

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

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

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

    public void P() {
        long Z;
        long millis;
        if (this.f3788a.Y() >= 0 || this.f3788a.Z() >= 0) {
            if (this.f3788a.Y() >= 0) {
                Z = this.f3788a.Y();
            } else {
                com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.f3788a;
                long j5 = this.f4502h0;
                long j6 = j5 > 0 ? j5 : 0L;
                if (aVar.f1()) {
                    int p12 = (int) ((com.applovin.impl.sdk.ad.a) this.f3788a).p1();
                    if (p12 > 0) {
                        millis = TimeUnit.SECONDS.toMillis(p12);
                    } else {
                        int s8 = (int) aVar.s();
                        if (s8 > 0) {
                            millis = TimeUnit.SECONDS.toMillis(s8);
                        }
                    }
                    j6 += millis;
                }
                Z = (long) ((this.f3788a.Z() / 100.0d) * j6);
            }
            c(Z);
        }
    }

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

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

    public void T() {
        AppLovinSdkUtils.runOnUiThread(new aa(this, 2));
    }

    public void U() {
        v1 v1Var;
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        f(this.f3788a.m1());
        long W = this.f3788a.W();
        if (W > 0) {
            this.f3803r = 0L;
            Long l = (Long) this.f3789b.a(l4.f2996t2);
            Integer num = (Integer) this.f3789b.a(l4.w2);
            ProgressBar progressBar = new ProgressBar(this.f3791d, null, R.attr.progressBarStyleHorizontal);
            this.X = progressBar;
            a(progressBar, this.f3788a.V(), num.intValue());
            v1Var = this;
            this.f4499e0.a("POSTITIAL_PROGRESS_BAR", l.longValue(), v1Var.new c(W, num, l));
            v1Var.f4499e0.b();
        } else {
            v1Var = this;
        }
        v1Var.N.a(v1Var.f3798k, v1Var.f3797j, v1Var.f3796i, v1Var.X);
        StringBuilder sb2 = new StringBuilder("javascript:al_onPoststitialShow(");
        sb2.append(v1Var.f3810y);
        sb2.append(",");
        a(s1.a.p(sb2, v1Var.f3811z, ");"), v1Var.f3788a.H());
        if (v1Var.f3798k != null) {
            if (v1Var.f3788a.s() >= 0) {
                a(v1Var.f3798k, v1Var.f3788a.s(), new aa(this, 6));
            } else {
                v1Var.f3798k.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        com.applovin.impl.adview.g gVar = v1Var.f3798k;
        if (gVar != null) {
            arrayList.add(new u3(gVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = v1Var.f3797j;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = v1Var.f3797j;
            arrayList.add(new u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = v1Var.X;
        if (progressBar2 != null) {
            arrayList.add(new u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        v1Var.f3788a.getAdEventTracker().b(v1Var.f3796i, arrayList);
        q();
        v1Var.k0 = true;
    }

    public void V() {
        this.f4508o0 = SystemClock.elapsedRealtime() - this.p0;
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", s1.a.q(new StringBuilder("Attempting to skip video with skip time: "), this.f4508o0, "ms"));
        }
        if (!S()) {
            E();
            return;
        }
        w();
        o();
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.H.e();
    }

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

    public void d(long j5) {
        this.f4502h0 = j5;
    }

    public void g(String str) {
        if (com.applovin.impl.sdk.o.a()) {
            com.applovin.impl.sdk.o oVar = this.f3790c;
            StringBuilder l = j0.a.l("Encountered media error: ", str, " for ad: ");
            l.append(this.f3788a);
            oVar.b("AppLovinFullscreenActivity", l.toString());
        }
        if (this.f4506m0.compareAndSet(false, true)) {
            if (((Boolean) this.f3789b.a(l4.L0)).booleanValue()) {
                this.f3789b.H().d(this.f3788a, com.applovin.impl.sdk.k.o());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.F;
            if (appLovinAdDisplayListener instanceof f2) {
                ((f2) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            String str2 = this.f3788a instanceof b7 ? "handleVastVideoError" : "handleVideoError";
            this.f3789b.E().a(str2, str, this.f3788a);
            HashMap<String, String> hashMap = CollectionUtils.hashMap("source", str2);
            CollectionUtils.putStringIfValid("error_message", str, hashMap);
            this.f3789b.g().a(y1.f4711s, this.f3788a, hashMap);
            a("media_error");
        }
    }

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

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

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

    @Override
    public void s() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.f3789b.a(l4.R5)).booleanValue()) {
                b8.b(this.V);
                this.V = null;
            }
            if (this.f4500f0) {
                AppLovinCommunicator.getInstance(this.f3791d).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) {
            com.applovin.impl.sdk.o.c("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
        }
        super.s();
    }

    @Override
    public void w() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.f4504j0 = this.Q.getCurrentPosition();
        this.Q.pause();
        this.f4498d0.c();
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.a("AppLovinFullscreenActivity", "Paused video at position " + this.f4504j0 + "ms");
        }
    }

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

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

    public void J() {
        com.applovin.impl.a aVar = this.R;
        if (aVar != null) {
            aVar.a();
            com.applovin.impl.a aVar2 = this.R;
            Objects.requireNonNull(aVar2);
            a(new s8(10, aVar2), 2000L);
        }
    }

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

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

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

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

    public void E() {
        this.f3810y++;
        if (this.f3788a.E()) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.a("AppLovinFullscreenActivity", "Dismissing ad on video skip...");
            }
            a("video_skip");
        } else {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.a("AppLovinFullscreenActivity", "Skipping video...");
            }
            U();
        }
    }

    public void F() {
        AppLovinSdkUtils.runOnUiThread(new aa(this, 3));
    }

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

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

    @Override
    public void b(boolean z3) {
        super.b(z3);
        if (z3) {
            b(0L);
            if (this.k0) {
                this.f4499e0.b();
                return;
            }
            return;
        }
        if (this.k0) {
            this.f4499e0.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.f3796i, this.f3797j, this.Y, viewGroup);
        if (k0.g() && (str = this.f3789b.n0().getExtraParameters().get("audio_focus_request")) != null) {
            this.Q.setAudioFocusRequest(Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.f4500f0)) {
            return;
        }
        this.Q.setVideoURI(this.f3788a.w0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        com.applovin.impl.adview.k kVar = this.f3797j;
        if (kVar != null) {
            kVar.b();
        }
        this.Q.start();
        if (this.f4500f0) {
            T();
        }
        this.f3796i.renderAd(this.f3788a);
        if (this.S != null) {
            this.f3789b.q0().a(new f6(this.f3789b, "scheduleSkipButton", new aa(this, 5)), r5.b.TIMEOUT, this.f3788a.p0(), true);
        }
        super.c(this.f4501g0);
    }

    public void b(boolean z3, long j5) {
        if (z3) {
            r7.a(this.V, j5, (Runnable) null);
        } else {
            r7.b(this.V, j5, (Runnable) null);
        }
    }

    @Override
    public void b(long j5) {
        a(new aa(this, 0), j5);
    }

    @Override
    public void b() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f3790c.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(String str, long j5) {
        super.a(str, j5);
        if (this.V == null || j5 < 0 || !StringUtils.isValidString(str)) {
            return;
        }
        a(new k8(22, this, str), j5);
    }

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

    @Override
    public void a(String str) {
        this.f4498d0.a();
        this.f4499e0.a();
        this.f4496b0.removeCallbacksAndMessages(null);
        this.f4497c0.removeCallbacksAndMessages(null);
        if (!((Boolean) this.f3789b.a(l4.l6)).booleanValue()) {
            com.applovin.impl.sdk.ad.b bVar = this.f3788a;
            if (bVar != null) {
                bVar.a(str);
            }
            n();
        }
        super.a(str);
    }

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.f3788a.P0()) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f3790c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri n02 = this.f3788a.n0();
            if (n02 != null) {
                if (!((Boolean) this.f3789b.a(l4.f3021x)).booleanValue() || (context = this.f3791d) == null) {
                    AppLovinAdView appLovinAdView = this.f3796i;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : com.applovin.impl.sdk.k.o();
                }
                this.f3789b.k().trackAndLaunchVideoClick(this.f3788a, n02, motionEvent, bundle, this, context);
                l2.a(this.E, this.f3788a);
                this.f3811z++;
                return;
            }
            return;
        }
        N();
    }

    private static boolean a(boolean z3, com.applovin.impl.sdk.k kVar) {
        if (!((Boolean) kVar.a(l4.f2878c2)).booleanValue()) {
            return false;
        }
        if (!((Boolean) kVar.a(l4.f2885d2)).booleanValue() || z3) {
            return true;
        }
        return ((Boolean) kVar.a(l4.f2898f2)).booleanValue();
    }

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