导航菜单

页面标题

页面副标题

Handling Master v2 - t1.java 源代码

正在查看: Handling Master v2 应用的 t1.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.applovin.impl;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.applovin.adview.AppLovinAdView;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.adview.AppLovinVideoView;
import com.applovin.impl.adview.g;
import com.applovin.impl.adview.k;
import com.applovin.impl.adview.l;
import com.applovin.impl.r5;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.w0;
import com.applovin.impl.y7;
import com.applovin.sdk.AppLovinAdClickListener;
import com.applovin.sdk.AppLovinAdDisplayListener;
import com.applovin.sdk.AppLovinAdVideoPlaybackListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class t1 extends p1 implements AppLovinCommunicatorSubscriber {
    private final u1 J;
    private MediaPlayer K;
    private final View L;
    protected final AppLovinVideoView M;
    protected final com.applovin.impl.a N;
    protected final g O;
    protected e0 P;
    protected final ImageView Q;
    protected l R;
    protected final ProgressBar S;
    protected ProgressBar T;
    protected ImageView U;
    private final e V;
    private final d W;
    private final Handler X;
    private final Handler Y;
    protected final w0 Z;
    protected final w0 a0;
    private final boolean b0;
    protected boolean c0;
    protected long d0;
    private int e0;
    private int f0;
    protected boolean g0;
    private boolean h0;
    private final AtomicBoolean i0;
    private final AtomicBoolean j0;
    private long k0;
    private long l0;

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

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

        @Override
        public void a() {
            if (t1.this.P != null) {
                long seconds = this.a - TimeUnit.MILLISECONDS.toSeconds(r0.M.getCurrentPosition());
                if (seconds <= 0) {
                    t1.this.t = true;
                } else if (t1.this.N()) {
                    t1.this.P.setProgress((int) seconds);
                }
            }
        }

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

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

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

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

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

    public class c implements w0.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() {
            t1.this.T.setProgress((int) ((t1.this.p / this.a) * this.b.intValue()));
            t1.this.p += this.c.longValue();
        }

        @Override
        public boolean b() {
            return t1.this.p < this.a;
        }
    }

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

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

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

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

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

        public d(t1 t1Var, a aVar) {
            this();
        }

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

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

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

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

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

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            com.applovin.impl.sdk.n nVar = t1.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.c.a("AppLovinFullscreenActivity", "Video completed");
            }
            t1.this.h0 = true;
            t1 t1Var = t1.this;
            if (!t1Var.r) {
                t1Var.Q();
            } else if (t1Var.h()) {
                t1.this.x();
            }
        }

        @Override
        public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
            t1.this.d("Video view error (" + i + "," + i2 + ")");
            t1.this.M.start();
            return true;
        }

        @Override
        public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
            com.applovin.impl.sdk.n nVar = t1.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.c.a("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i + ", " + i2 + ")");
            }
            if (i == 701) {
                t1.this.P();
                return false;
            }
            if (i != 3) {
                if (i != 702) {
                    return false;
                }
                t1.this.B();
                return false;
            }
            t1.this.Z.b();
            t1 t1Var = t1.this;
            if (t1Var.O != null) {
                t1Var.M();
            }
            t1.this.B();
            if (!t1.this.D.b()) {
                return false;
            }
            t1.this.u();
            return false;
        }

        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            t1.this.K = mediaPlayer;
            mediaPlayer.setOnInfoListener(t1.this.V);
            mediaPlayer.setOnErrorListener(t1.this.V);
            float f = !t1.this.c0 ? 1 : 0;
            mediaPlayer.setVolume(f, f);
            t1.this.s = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
            t1.this.c(mediaPlayer.getDuration());
            t1.this.L();
            com.applovin.impl.sdk.n nVar = t1.this.c;
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.c.a("AppLovinFullscreenActivity", "MediaPlayer prepared: " + t1.this.K);
            }
        }

        public e(t1 t1Var, a aVar) {
            this();
        }
    }

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

        @Override
        public void onClick(View view) {
            t1 t1Var = t1.this;
            if (view == t1Var.O) {
                t1Var.R();
                return;
            }
            if (view == t1Var.Q) {
                t1Var.S();
                return;
            }
            if (com.applovin.impl.sdk.n.a()) {
                t1.this.c.b("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }

        public f(t1 t1Var, a aVar) {
            this();
        }
    }

    public t1(com.applovin.impl.sdk.ad.b bVar, Activity activity, Map map, j jVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        super(bVar, activity, map, jVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
        this.J = new u1(this.a, this.d, this.b);
        a aVar = null;
        this.U = null;
        e eVar = new e(this, aVar);
        this.V = eVar;
        d dVar = new d(this, aVar);
        this.W = dVar;
        Handler handler = new Handler(Looper.getMainLooper());
        this.X = handler;
        Handler handler2 = new Handler(Looper.getMainLooper());
        this.Y = handler2;
        w0 w0Var = new w0(handler, this.b);
        this.Z = w0Var;
        this.a0 = new w0(handler2, this.b);
        boolean H0 = this.a.H0();
        this.b0 = H0;
        this.c0 = z6.e(this.b);
        this.f0 = -1;
        this.i0 = new AtomicBoolean();
        this.j0 = new AtomicBoolean();
        this.k0 = -2L;
        this.l0 = 0L;
        if (!bVar.hasVideoUrl()) {
            throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
        }
        AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
        this.M = appLovinVideoView;
        appLovinVideoView.setOnPreparedListener(eVar);
        appLovinVideoView.setOnCompletionListener(eVar);
        appLovinVideoView.setOnErrorListener(eVar);
        bVar.e().putString("video_view_address", q7.a((View) appLovinVideoView));
        View view = new View(activity);
        this.L = view;
        boolean z = false;
        view.setBackgroundColor(Color.argb(254, 0, 0, 0));
        if (((Boolean) jVar.a(l4.h1)).booleanValue()) {
            view.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.i0, activity, eVar));
        } else {
            appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(jVar, l4.i0, activity, eVar));
            view.setOnTouchListener(new iiL1i1Li1l());
        }
        f fVar = new f(this, aVar);
        if (bVar.h0() >= 0) {
            g gVar = new g(bVar.Y(), activity);
            this.O = gVar;
            gVar.setVisibility(8);
            gVar.setOnClickListener(fVar);
        } else {
            this.O = null;
        }
        if (a(this.c0, jVar)) {
            ImageView imageView = new ImageView(activity);
            this.Q = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setClickable(true);
            imageView.setOnClickListener(fVar);
            d(this.c0);
        } else {
            this.Q = null;
        }
        String e0 = bVar.e0();
        if (StringUtils.isValidString(e0)) {
            y7 y7Var = new y7(jVar);
            y7Var.a(new WeakReference(dVar));
            l lVar = new l(bVar.d0(), bVar, y7Var, activity);
            this.R = lVar;
            lVar.a(e0);
        } else {
            this.R = null;
        }
        if (H0) {
            com.applovin.impl.a aVar2 = new com.applovin.impl.a(activity, ((Integer) jVar.a(l4.g2)).intValue(), R.attr.progressBarStyleLarge);
            this.N = aVar2;
            aVar2.setColor(Color.parseColor("#75FFFFFF"));
            aVar2.setBackgroundColor(Color.parseColor("#00000000"));
            aVar2.setVisibility(8);
            AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
        } else {
            this.N = null;
        }
        int d2 = d();
        if (((Boolean) jVar.a(l4.L1)).booleanValue() && d2 > 0) {
            z = true;
        }
        if (this.P == null && z) {
            this.P = new e0(activity);
            int q = bVar.q();
            this.P.setTextColor(q);
            this.P.setTextSize(((Integer) jVar.a(l4.K1)).intValue());
            this.P.setFinishedStrokeColor(q);
            this.P.setFinishedStrokeWidth(((Integer) jVar.a(l4.J1)).intValue());
            this.P.setMax(d2);
            this.P.setProgress(d2);
            w0Var.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new a(d2));
        }
        if (!bVar.o0()) {
            this.S = null;
            return;
        }
        Long l = (Long) jVar.a(l4.d2);
        Integer num = (Integer) jVar.a(l4.e2);
        ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
        this.S = progressBar;
        a(progressBar, bVar.n0(), num.intValue());
        w0Var.a("PROGRESS_BAR", l.longValue(), new b(num));
    }

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

    public void F() {
        com.applovin.impl.a aVar = this.N;
        if (aVar != null) {
            aVar.a();
            com.applovin.impl.a aVar2 = this.N;
            Objects.requireNonNull(aVar2);
            a((Runnable) new IiiL1IilI(aVar2), 2000L);
        }
    }

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

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

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

    private void J() {
        l lVar;
        p7 f0 = this.a.f0();
        if (f0 == null || !f0.j() || this.g0 || (lVar = this.R) == null) {
            return;
        }
        AppLovinSdkUtils.runOnUiThread(new illiiiLIiL1(this, lVar.getVisibility() == 4, f0.h()));
    }

    public void K() {
        if (this.g0) {
            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;
        }
        if (this.f0 < 0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Invalid last video position");
                return;
            }
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Resuming video at position " + this.f0 + "ms for MediaPlayer: " + this.K);
        }
        this.M.seekTo(this.f0);
        this.M.start();
        this.Z.b();
        this.f0 = -1;
        a((Runnable) new I1lL1IlLlILLI(this), 250L);
    }

    public void M() {
        if (this.j0.compareAndSet(false, true)) {
            a(this.O, this.a.h0(), (Runnable) new iIilILl11(this));
        }
    }

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

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

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

    public void B() {
        AppLovinSdkUtils.runOnUiThread(new i1iL1i1ilil(this));
    }

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

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

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

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

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

    public void P() {
        AppLovinSdkUtils.runOnUiThread(new iiI1iLliILIiI(this));
    }

    public void Q() {
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Showing postitial...");
        }
        e(this.a.d1());
        long R = this.a.R();
        if (R > 0) {
            this.p = 0L;
            Long l = (Long) this.b.a(l4.m2);
            Integer num = (Integer) this.b.a(l4.p2);
            ProgressBar progressBar = new ProgressBar(this.d, null, R.attr.progressBarStyleHorizontal);
            this.T = progressBar;
            a(progressBar, this.a.Q(), num.intValue());
            this.a0.a("POSTITIAL_PROGRESS_BAR", l.longValue(), new c(R, num, l));
            this.a0.b();
        }
        this.J.a(this.j, this.i, this.h, this.T);
        a("javascript:al_onPoststitialShow(" + this.w + "," + this.x + ");", this.a.D());
        if (this.j != null) {
            if (this.a.p() >= 0) {
                a(this.j, this.a.p(), (Runnable) new I1iIiIl1Ll(this));
            } else {
                this.j.setVisibility(0);
            }
        }
        ArrayList arrayList = new ArrayList();
        g gVar = this.j;
        if (gVar != null) {
            arrayList.add(new u3(gVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
        }
        k kVar = this.i;
        if (kVar != null && kVar.a()) {
            k kVar2 = this.i;
            arrayList.add(new u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier()));
        }
        ProgressBar progressBar2 = this.T;
        if (progressBar2 != null) {
            arrayList.add(new u3(progressBar2, FriendlyObstructionPurpose.OTHER, "postitial progress bar"));
        }
        this.a.getAdEventTracker().b((View) this.h, (List) arrayList);
        o();
        this.g0 = true;
    }

    public void R() {
        this.k0 = SystemClock.elapsedRealtime() - this.l0;
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Attempting to skip video with skip time: " + this.k0 + "ms");
        }
        if (!O()) {
            A();
            return;
        }
        u();
        m();
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Prompting incentivized ad close warning");
        }
        this.D.e();
    }

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

    public void d(String str) {
        if (com.applovin.impl.sdk.n.a()) {
            this.c.b("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.a);
        }
        if (this.i0.compareAndSet(false, true)) {
            if (((Boolean) this.b.a(l4.I0)).booleanValue()) {
                this.b.C().d(this.a, j.n());
            }
            f2 f2Var = this.B;
            if (f2Var instanceof f2) {
                f2Var.onAdDisplayFailed(str);
            }
            this.b.A().a(this.a instanceof a7 ? "handleVastVideoError" : "handleVideoError", str, this.a);
            c();
        }
    }

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

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

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

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

    @Override
    public void q() {
        if (com.applovin.impl.sdk.n.a()) {
            this.c.d("AppLovinFullscreenActivity", "Destroying video components");
        }
        try {
            if (((Boolean) this.b.a(l4.J5)).booleanValue()) {
                a8.b(this.R);
                this.R = null;
            }
            if (this.b0) {
                AppLovinCommunicator.getInstance(this.d).unsubscribe(this, "video_caching_failed");
            }
            AppLovinVideoView appLovinVideoView = this.M;
            if (appLovinVideoView != null) {
                appLovinVideoView.pause();
                this.M.stopPlayback();
            }
            MediaPlayer mediaPlayer = this.K;
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.n.c("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
        }
        super.q();
    }

    @Override
    public void u() {
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Pausing video");
        }
        this.f0 = this.M.getCurrentPosition();
        this.M.pause();
        this.Z.c();
        if (com.applovin.impl.sdk.n.a()) {
            this.c.a("AppLovinFullscreenActivity", "Paused video at position " + this.f0 + "ms");
        }
    }

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

    @Override
    public void x() {
        this.J.a(this.k);
        this.o = SystemClock.elapsedRealtime();
    }

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

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

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

    @Override
    public void c() {
        this.Z.a();
        this.a0.a();
        this.X.removeCallbacksAndMessages(null);
        this.Y.removeCallbacksAndMessages(null);
        l();
        super.c();
    }

    @Override
    public void a(ViewGroup viewGroup) {
        String str;
        this.J.a(this.Q, this.O, this.R, this.N, this.S, this.P, this.M, this.L, this.h, this.i, this.U, viewGroup);
        if (k0.g() && (str = this.b.g0().getExtraParameters().get("audio_focus_request")) != null) {
            ilillLiLiiI.ilLiIi111I1ll(this.M, Integer.parseInt(str));
        }
        StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        if (a(!this.b0)) {
            return;
        }
        this.M.setVideoURI(this.a.p0());
        StrictMode.setThreadPolicy(allowThreadDiskReads);
        k kVar = this.i;
        if (kVar != null) {
            kVar.b();
        }
        this.M.start();
        if (this.b0) {
            P();
        }
        this.h.renderAd(this.a);
        if (this.O != null) {
            this.b.j0().a(new f6(this.b, "scheduleSkipButton", new I11li1LiI1L1(this)), r5.b.TIMEOUT, this.a.i0(), true);
        }
        super.c(this.c0);
    }

    @Override
    public void e() {
        super.e();
        x();
    }

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

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

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

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

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

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

    public void a(MotionEvent motionEvent, Bundle bundle) {
        Context context;
        if (this.a.G0()) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a("AppLovinFullscreenActivity", "Clicking through video");
            }
            Uri g0 = this.a.g0();
            if (g0 != null) {
                if (!((Boolean) this.b.a(l4.x)).booleanValue() || (context = this.d) == null) {
                    AppLovinAdView appLovinAdView = this.h;
                    context = appLovinAdView != null ? appLovinAdView.getContext() : j.n();
                }
                this.b.k().trackAndLaunchVideoClick(this.a, g0, motionEvent, bundle, this, context);
                l2.a(this.A, this.a);
                this.x++;
                return;
            }
            return;
        }
        J();
    }

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

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

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