导航菜单

页面标题

页面副标题

MX Player v1.97.8 - u9.java 源代码

正在查看: MX Player v1.97.8 应用的 u9.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.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
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.exoplayer2.ui.d;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.bi;
import com.applovin.impl.ck;
import com.applovin.impl.qh;
import com.applovin.impl.rr;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.tm;
import com.applovin.impl.u9;
import com.applovin.impl.v4;
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 defpackage.p04;
import defpackage.qb9;
import defpackage.ua1;
import defpackage.ug0;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class u9 extends p9 implements AppLovinCommunicatorSubscriber {
    private final w9 L;
    protected final com.applovin.exoplayer2.ui.e M;
    protected final ck N;
    protected final o O;
    protected final com.applovin.impl.adview.g P;
    protected h3 Q;
    protected final ImageView R;
    protected com.applovin.impl.adview.l S;
    protected final ProgressBar T;
    protected ProgressBar U;
    private final d V;
    private final Handler W;
    private final Handler X;
    protected final v4 Y;
    protected final v4 Z;
    private final boolean a0;
    protected boolean b0;
    protected long c0;
    protected int d0;
    protected boolean e0;
    protected boolean f0;
    private long g0;
    private final AtomicBoolean h0;
    private final AtomicBoolean i0;
    private long j0;
    private long k0;

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

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

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

        @Override
        public boolean b() {
            return u9.this.T();
        }
    }

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

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

        @Override
        public void a() {
            u9 u9Var = u9.this;
            if (u9Var.e0) {
                u9Var.T.setVisibility(8);
            } else {
                u9.this.T.setProgress((int) ((u9Var.N.getCurrentPosition() / u9.this.c0) * this.a.intValue()));
            }
        }

        @Override
        public boolean b() {
            return !u9.this.e0;
        }
    }

    public class c implements v4.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() {
            u9.this.U.setProgress((int) ((u9.this.r / this.a) * this.b.intValue()));
            u9 u9Var = u9.this;
            u9Var.r = this.c.longValue() + u9Var.r;
        }

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

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

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

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

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

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

        public d(u9 u9Var, a aVar) {
            this();
        }

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

        @Override
        public void b(Uri uri, com.applovin.impl.adview.l lVar) {
            com.applovin.impl.sdk.n nVar = u9.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                u9.this.c.a("AppLovinFullscreenActivity", "Attempting to report a template error from video button...");
            }
            tp.b(uri, u9.this.i.getController().i(), u9.this.b);
        }

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

    public class e implements qh.c, d.e, AppLovinTouchToClickListener.OnClickListener {
        private e() {
        }

        @Override
        public void a(nh nhVar) {
            u9.this.d("Video view error (" + yp.a(nhVar) + ")");
            u9.this.f();
        }

        @Override
        public void b(int i) {
            com.applovin.impl.sdk.n nVar = u9.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                com.applovin.impl.sdk.n nVar2 = u9.this.c;
                StringBuilder b = se4.b(i, "Player state changed to state ", " and will play when ready: ");
                b.append(u9.this.N.l());
                nVar2.a("AppLovinFullscreenActivity", b.toString());
            }
            if (i == 2) {
                u9.this.W();
                return;
            }
            if (i != 3) {
                if (i == 4) {
                    com.applovin.impl.sdk.n nVar3 = u9.this.c;
                    if (com.applovin.impl.sdk.n.a()) {
                        u9.this.c.a("AppLovinFullscreenActivity", "Video completed");
                    }
                    u9 u9Var = u9.this;
                    u9Var.f0 = true;
                    if (!u9Var.t) {
                        u9Var.X();
                        return;
                    } else {
                        if (u9Var.l()) {
                            u9.this.V();
                            return;
                        }
                        return;
                    }
                }
                return;
            }
            u9 u9Var2 = u9.this;
            u9Var2.N.a(!u9Var2.b0 ? 1 : 0);
            u9 u9Var3 = u9.this;
            u9Var3.u = (int) TimeUnit.MILLISECONDS.toSeconds(u9Var3.N.getDuration());
            u9 u9Var4 = u9.this;
            u9Var4.c(u9Var4.N.getDuration());
            u9.this.Q();
            com.applovin.impl.sdk.n nVar4 = u9.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                u9.this.c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + u9.this.N);
            }
            u9.this.Y.b();
            u9 u9Var5 = u9.this;
            if (u9Var5.P != null) {
                u9Var5.R();
            }
            u9.this.G();
            if (u9.this.F.b()) {
                u9.this.z();
            }
        }

        @Override
        public void d(int i) {
            if (i == 0) {
                u9.this.M.c();
            }
        }

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

        public e(u9 u9Var, a aVar) {
            this();
        }
    }

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

        @Override
        public void onClick(View view) {
            u9 u9Var = u9.this;
            if (view == u9Var.P) {
                u9Var.Y();
                return;
            }
            if (view == u9Var.R) {
                u9Var.a0();
            } else if (com.applovin.impl.sdk.n.a()) {
                u9.this.c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(u9 u9Var, a aVar) {
            this();
        }
    }

    public u9(com.applovin.impl.sdk.ad.b bVar, Activity activity, Map map, com.applovin.impl.sdk.j jVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(bVar, activity, map, jVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.L = new w9(this.a, this.d, this.b);
        a aVar = null;
        d dVar = new d(this, aVar);
        this.V = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.W = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.X = handler2;
        v4 v4Var = new v4(handler, this.b);
        this.Y = v4Var;
        this.Z = new v4(handler2, this.b);
        boolean H0 = this.a.H0();
        this.a0 = H0;
        this.b0 = yp.e(this.b);
        this.g0 = -1L;
        this.h0 = new AtomicBoolean();
        this.i0 = new AtomicBoolean();
        this.j0 = -2L;
        this.k0 = 0L;
        if (!bVar.hasVideoUrl()) {
            throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
        }
        if (yp.a(sj.n1, jVar)) {
            a(!H0);
        }
        f fVar = new f(this, aVar);
        if (bVar.k0() >= 0) {
            com.applovin.impl.adview.g gVar = new com.applovin.impl.adview.g(bVar.b0(), activity);
            this.P = gVar;
            gVar.setVisibility(8);
            gVar.setOnClickListener(fVar);
        } else {
            this.P = null;
        }
        if (a(this.b0, jVar)) {
            ImageView imageView = new ImageView(activity);
            this.R = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            e(this.b0);
        } else {
            this.R = null;
        }
        String g0 = bVar.g0();
        if (StringUtils.isValidString(g0)) {
            rr rrVar = new rr(jVar);
            rrVar.a(new WeakReference(dVar));
            com.applovin.impl.adview.l lVar = new com.applovin.impl.adview.l(bVar.f0(), bVar, rrVar, activity);
            this.S = lVar;
            lVar.a(g0);
        } else {
            this.S = null;
        }
        if (H0) {
            o oVar = new o(activity, ((Integer) jVar.a(sj.G2)).intValue(), R.attr.progressBarStyleLarge);
            this.O = oVar;
            oVar.setColor(Color.parseColor("#75FFFFFF"));
            oVar.setBackgroundColor(Color.parseColor("#00000000"));
            oVar.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.O = null;
        }
        int g = g();
        boolean z = ((Boolean) jVar.a(sj.n2)).booleanValue() && g > 0;
        if (this.Q == null && z) {
            this.Q = new h3(activity);
            int q = bVar.q();
            this.Q.setTextColor(q);
            this.Q.setTextSize(((Integer) jVar.a(sj.m2)).intValue());
            this.Q.setFinishedStrokeColor(q);
            this.Q.setFinishedStrokeWidth(((Integer) jVar.a(sj.l2)).intValue());
            this.Q.setMax(g);
            this.Q.setProgress(g);
            v4Var.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(g));
        }
        if (bVar.r0()) {
            Long l = (Long) jVar.a(sj.D2);
            Integer num = (Integer) jVar.a(sj.E2);
            ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
            this.T = progressBar;
            a(progressBar, bVar.q0(), num.intValue());
            v4Var.a("PROGRESS_BAR", l.longValue(), new b(num));
        } else {
            this.T = null;
        }
        ck a2 = new ck.b(activity).a();
        this.N = a2;
        e eVar = new e(this, aVar);
        a2.a((qh.c) eVar);
        a2.a(0);
        com.applovin.exoplayer2.ui.e eVar2 = new com.applovin.exoplayer2.ui.e(activity);
        this.M = eVar2;
        eVar2.c();
        eVar2.setControllerVisibilityListener(eVar);
        eVar2.setPlayer(a2);
        eVar2.setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.F0, activity, eVar));
        bVar.e().putString("video_view_address", zq.a(eVar2));
        S();
    }

    public void L() {
        a(250L);
    }

    public void M() {
        o oVar = this.O;
        if (oVar != null) {
            oVar.a();
        }
    }

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

    private void O() {
        com.applovin.impl.adview.l lVar;
        qq i0 = this.a.i0();
        if (i0 == null || !i0.j() || this.e0 || (lVar = this.S) == null) {
            return;
        }
        final boolean z = lVar.getVisibility() == 4;
        final long h = i0.h();
        AppLovinSdkUtils.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                u9.this.b(z, h);
            }
        });
    }

    public void V() {
        this.L.a(this.l);
        this.q = SystemClock.elapsedRealtime();
    }

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

    public void e(String str) {
        tr.a(this.S, str, "AppLovinFullscreenActivity", this.b);
    }

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

    public void P() {
        if (this.e0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.k("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
                return;
            }
            return;
        }
        if (this.b.f0().isApplicationPaused()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.k("AppLovinFullscreenActivity", "Skip video resume - app paused");
                return;
            }
            return;
        }
        long j = this.g0;
        if (j < 0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Invalid last video position, isVideoPlaying=" + this.N.isPlaying());
                return;
            }
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            com.applovin.impl.sdk.n nVar = this.c;
            StringBuilder c2 = qb9.c(j, "Resuming video at position ", "ms for MediaPlayer: ");
            c2.append(this.N);
            nVar.a("AppLovinFullscreenActivity", c2.toString());
        }
        this.N.a(true);
        this.Y.b();
        this.g0 = -1L;
        if (this.N.isPlaying()) {
            return;
        }
        W();
    }

    public void Q() {
        long V;
        long millis;
        if (this.a.U() >= 0 || this.a.V() >= 0) {
            if (this.a.U() >= 0) {
                V = this.a.U();
            } else {
                com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.a;
                long j = this.c0;
                long j2 = j > 0 ? j : 0L;
                if (aVar.V0()) {
                    int j1 = (int) ((com.applovin.impl.sdk.ad.a) this.a).j1();
                    if (j1 > 0) {
                        millis = TimeUnit.SECONDS.toMillis(j1);
                    } else {
                        int p = (int) aVar.p();
                        if (p > 0) {
                            millis = TimeUnit.SECONDS.toMillis(p);
                        }
                    }
                    j2 += millis;
                }
                V = (long) ((this.a.V() / 100.0d) * j2);
            }
            b(V);
        }
    }

    public void R() {
        if (this.i0.compareAndSet(false, true)) {
            a(this.P, this.a.k0(), (Runnable) new eh(this, 11));
        }
    }

    public void S() {
        if (!yp.a(sj.n1, this.b)) {
            b(!this.a0);
        }
        Activity activity = this.d;
        bi a2 = new bi.b(new w5(activity, xp.a((Context) activity, "com.applovin.sdk"))).a(td.a(this.a.s0()));
        this.N.a(!this.b0 ? 1 : 0);
        this.N.a((be) a2);
        this.N.b();
        this.N.a(false);
    }

    public boolean T() {
        return (this.v || this.e0 || !this.M.getPlayer().isPlaying()) ? false : true;
    }

    public boolean U() {
        return l() && !H();
    }

    public void W() {
        AppLovinSdkUtils.runOnUiThread(new ug0(this, 3));
    }

    public void X() {
        Z();
        long T = this.a.T();
        if (T > 0) {
            this.r = 0L;
            Long l = (Long) this.b.a(sj.M2);
            Integer num = (Integer) this.b.a(sj.P2);
            ProgressBar progressBar = new ProgressBar(this.d, null, R.attr.progressBarStyleHorizontal);
            this.U = progressBar;
            a(progressBar, this.a.S(), num.intValue());
            this.Z.a("POSTITIAL_PROGRESS_BAR", l.longValue(), new c(T, num, l));
            this.Z.b();
        }
        this.L.a(this.k, this.j, this.i, this.U);
        StringBuilder sb = new StringBuilder("javascript:al_onPoststitialShow(");
        sb.append(this.y);
        sb.append(",");
        a(defpackage.vc.c(this.z, ");", sb), this.a.D());
        if (this.k != null) {
            if (this.a.p() >= 0) {
                a(this.k, this.a.p(), (Runnable) new pg3(this, 6));
            } else {
                this.k.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        com.applovin.impl.adview.g gVar = this.k;
        if (gVar != null) {
            arrayList.add(new og(gVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        com.applovin.impl.adview.k kVar = this.j;
        if (kVar != null && kVar.a()) {
            com.applovin.impl.adview.k kVar2 = this.j;
            arrayList.add(new og(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = this.U;
        if (progressBar2 != null) {
            arrayList.add(new og(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        this.a.getAdEventTracker().b(this.i, arrayList);
        t();
        this.e0 = true;
    }

    public void Y() {
        this.j0 = SystemClock.elapsedRealtime() - this.k0;
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", p04.d(this.j0, "ms", new StringBuilder("Attempting to skip video with skip time: ")));
        }
        if (!U()) {
            F();
            return;
        }
        z();
        r();
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.F.e();
    }

    public void Z() {
        this.d0 = E();
        this.N.a(false);
    }

    public void a0() {
        boolean z = this.b0;
        this.b0 = !z;
        this.N.a(z ? 1.0f : 0.0f);
        e(this.b0);
        a(this.b0, 0L);
    }

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

    public void d(String str) {
        if (com.applovin.impl.sdk.n.a()) {
            com.applovin.impl.sdk.n nVar = this.c;
            StringBuilder c2 = defpackage.lg.c("Encountered media error: ", str, " for ad: ");
            c2.append(this.a);
            nVar.b("AppLovinFullscreenActivity", c2.toString());
        }
        if (StringUtils.containsAtLeastOneSubstring(str, this.b.c(sj.T2))) {
            if (com.applovin.impl.sdk.n.a()) {
                ua1.a("Ignoring media error: ", str, this.c, "AppLovinFullscreenActivity");
            }
        } else if (this.h0.compareAndSet(false, true)) {
            if (yp.a(sj.j1, this.b)) {
                this.b.B().d(this.a, com.applovin.impl.sdk.j.l());
            }
            AppLovinAdDisplayListener appLovinAdDisplayListener = this.D;
            if (appLovinAdDisplayListener instanceof qb) {
                ((qb) appLovinAdDisplayListener).onAdDisplayFailed(str);
            }
            this.b.E().a(this.a instanceof aq ? "handleVastExoPlayerError" : "handleExoPlayerError", str, this.a);
            f();
        }
    }

    @Override
    public void f() {
        this.Y.a();
        this.Z.a();
        this.W.removeCallbacksAndMessages(null);
        this.X.removeCallbacksAndMessages(null);
        q();
        super.f();
    }

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

    @Override
    public void i() {
        super.i();
        V();
    }

    @Override
    public void j() {
        super.j();
        this.L.a(this.S);
        this.L.a((View) this.P);
        if (!l() || this.e0) {
            V();
        }
    }

    @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.a0) {
                int i = messageData.getInt("load_response_code");
                String string = messageData.getString("load_exception_message");
                if ((string == null && i >= 200 && i < 300) || this.f0 || this.N.isPlaying()) {
                    return;
                }
                d("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
            }
        }
    }

    @Override
    public void q() {
        super.a(E(), this.a0, H(), this.j0);
    }

    @Override
    public void v() {
        if (((Boolean) this.b.a(sj.g6)).booleanValue()) {
            tr.b(this.S);
            this.S = null;
        }
        this.N.V();
        if (this.a0) {
            AppLovinCommunicator.getInstance(this.d).unsubscribe(this, "video_caching_failed");
        }
        super.v();
    }

    @Override
    public void z() {
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        if (!this.N.isPlaying()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Nothing to pause");
                return;
            }
            return;
        }
        this.g0 = this.N.getCurrentPosition();
        this.N.a(false);
        this.Y.c();
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", p04.d(this.g0, "ms", new StringBuilder("Paused video at position ")));
        }
    }

    public void J() {
        o oVar = this.O;
        if (oVar != null) {
            oVar.b();
        }
    }

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

    public int E() {
        ck ckVar = this.N;
        if (ckVar == null) {
            return 0;
        }
        long currentPosition = ckVar.getCurrentPosition();
        if (this.f0) {
            return 100;
        }
        return currentPosition > 0 ? (int) ((currentPosition / this.c0) * 100.0f) : this.d0;
    }

    public void F() {
        this.y++;
        if (this.a.B()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Dismissing ad on video skip...");
            }
            f();
        } else {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Skipping video...");
            }
            X();
        }
    }

    public void G() {
        AppLovinSdkUtils.runOnUiThread(new vh1(this, 10));
    }

    public boolean H() {
        com.applovin.impl.sdk.ad.b bVar = this.a;
        if (bVar == null) {
            return false;
        }
        if (this.I && bVar.Y0()) {
            return true;
        }
        return I();
    }

    public boolean I() {
        return E() >= this.a.m0();
    }

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (!this.a.G0()) {
            O();
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Clicking through video");
        }
        Uri j0 = this.a.j0();
        if (j0 != null) {
            if (!((Boolean) this.b.a(sj.H)).booleanValue() || (context = this.d) == null) {
                AppLovinAdView appLovinAdView = this.i;
                context = appLovinAdView != null ? appLovinAdView.getContext() : com.applovin.impl.sdk.j.l();
            }
            this.b.i().trackAndLaunchVideoClick(this.a, j0, motionEvent, bundle, this, context);
            gc.a(this.C, this.a);
            this.z++;
        }
    }

    public void e(boolean z) {
        if (z3.f()) {
            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.R.setScaleType(ImageView.ScaleType.FIT_XY);
                this.R.setImageDrawable(animatedVectorDrawable);
                animatedVectorDrawable.start();
                return;
            }
        }
        ImageViewUtils.setImageUri(this.R, z ? this.a.L() : this.a.e0(), this.b);
    }

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

    public void c(long j) {
        this.c0 = j;
    }

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

    private static boolean a(boolean z, com.applovin.impl.sdk.j jVar) {
        if (!((Boolean) jVar.a(sj.v2)).booleanValue()) {
            return false;
        }
        if (!((Boolean) jVar.a(sj.w2)).booleanValue() || z) {
            return true;
        }
        return ((Boolean) jVar.a(sj.y2)).booleanValue();
    }

    @Override
    public void a(String str, long j) {
        super.a(str, j);
        if (this.S == null || j < 0 || !StringUtils.isValidString(str) || !((Boolean) this.b.a(sj.S2)).booleanValue()) {
            return;
        }
        a((Runnable) new up0(8, this, str), j);
    }

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

    @Override
    public void a(ViewGroup viewGroup) {
        this.L.a(this.R, this.P, this.S, this.O, this.T, this.Q, this.M, this.i, this.j, null, viewGroup);
        com.applovin.impl.adview.k kVar = this.j;
        if (kVar != null) {
            kVar.b();
        }
        this.N.a(true);
        if (this.a.b1()) {
            this.F.b(this.a, (Runnable) new s71(this, 10));
        }
        if (this.a0) {
            W();
        }
        this.i.renderAd(this.a);
        if (this.P != null) {
            this.b.j0().a(new jn(this.b, "scheduleSkipButton", new t71(this, 10)), tm.b.TIMEOUT, this.a.l0(), true);
        }
        super.d(this.b0);
    }

    @Override
    public void a(long j) {
        a((Runnable) new uh1(this, 6), j);
    }
}