package com.google.android.gms.internal.ads;

import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.os.Handler;
import android.os.Looper;
import com.google.android.material.datepicker.MaterialCalendar;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import tv.danmaku.ijk.media.player.ui.IjkVideoView;

/* JADX INFO: loaded from: classes2.dex */
public final class p80 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Object f15293a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Object f15294b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f15295c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f15296d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f15297e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final Object f15298f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Object f15299g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Object f15300h;

    public p80(a80 a80Var, Context context, String str, n7.f4 f4Var) {
        this.f15293a = a80Var;
        this.f15294b = lg2.a(context);
        lg2 lg2VarA = lg2.a(f4Var);
        this.f15295c = lg2VarA;
        lg2 lg2VarA2 = lg2.a(str);
        this.f15296d = lg2VarA2;
        a80 a80Var2 = (a80) this.f15293a;
        og2 og2Var = a80Var2.f8543l;
        this.f15297e = jg2.a(new ot0(og2Var, 8));
        og2 og2VarA = jg2.a(new ot0(a80Var2.M0, 18));
        this.f15298f = og2VarA;
        og2 og2Var2 = (og2) this.f15294b;
        og2 og2Var3 = a80Var2.f8527d;
        lg2 lg2Var = a80Var2.J;
        og2 og2Var4 = (og2) this.f15297e;
        og2 og2VarA2 = jg2.a(new oa0(og2Var2, og2Var3, lg2Var, og2Var4, og2VarA, za2.C, 15));
        this.f15299g = og2VarA2;
        this.f15300h = jg2.a(new com.google.android.gms.ads.nonagon.signalgeneration.z(og2Var2, lg2VarA, lg2VarA2, og2VarA2, og2Var4, og2VarA, a80Var2.f8539j, a80Var2.K, og2Var, 5));
    }

    public final te.h a() {
        Activity activity = (Activity) this.f15295c;
        if (activity == null || activity.isFinishing() || activity.isDestroyed()) {
            return null;
        }
        IjkVideoView ijkVideoView = (IjkVideoView) this.f15296d;
        return new te.h(ijkVideoView.isPlaying(), ijkVideoView.getCurrentPosition(), (int) ijkVideoView.getBufferedPosition());
    }

    public final void b() {
        c();
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = (ScheduledThreadPoolExecutor) this.f15294b;
        if (scheduledThreadPoolExecutor != null) {
            scheduledThreadPoolExecutor.shutdownNow();
            this.f15294b = null;
        }
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor2 = (ScheduledThreadPoolExecutor) this.f15299g;
        if (scheduledThreadPoolExecutor2 != null) {
            scheduledThreadPoolExecutor2.shutdownNow();
            this.f15299g = null;
        }
        ((Handler) this.f15300h).removeCallbacksAndMessages(null);
    }

    public final void c() {
        Object obj = this.f15298f;
        if (((String) obj).startsWith("/storage") || ((String) obj).startsWith("/data")) {
            return;
        }
        Object obj2 = this.f15293a;
        if (((ScheduledThreadPoolExecutor) obj2) == null) {
            return;
        }
        ((ScheduledThreadPoolExecutor) obj2).shutdownNow();
        this.f15293a = null;
    }

    public final void d() {
        String str = (String) this.f15298f;
        if (str.startsWith("/storage") || str.startsWith("/data")) {
            return;
        }
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = (ScheduledThreadPoolExecutor) this.f15293a;
        if (scheduledThreadPoolExecutor == null || scheduledThreadPoolExecutor.isShutdown()) {
            ScheduledThreadPoolExecutor scheduledThreadPoolExecutor2 = new ScheduledThreadPoolExecutor(1);
            scheduledThreadPoolExecutor2.setRemoveOnCancelPolicy(true);
            scheduledThreadPoolExecutor2.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
            this.f15293a = scheduledThreadPoolExecutor2;
            scheduledThreadPoolExecutor2.scheduleWithFixedDelay(new te.g(this, 1), 0L, 1L, TimeUnit.SECONDS);
        }
    }

    public final void e() {
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = (ScheduledThreadPoolExecutor) this.f15294b;
        if (scheduledThreadPoolExecutor == null || scheduledThreadPoolExecutor.isShutdown()) {
            ScheduledThreadPoolExecutor scheduledThreadPoolExecutor2 = new ScheduledThreadPoolExecutor(1);
            scheduledThreadPoolExecutor2.setRemoveOnCancelPolicy(true);
            scheduledThreadPoolExecutor2.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
            this.f15294b = scheduledThreadPoolExecutor2;
            scheduledThreadPoolExecutor2.scheduleWithFixedDelay(new te.g(this, 2), 0L, 1L, TimeUnit.SECONDS);
        }
    }

    public final void f() {
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = (ScheduledThreadPoolExecutor) this.f15299g;
        if (scheduledThreadPoolExecutor == null || scheduledThreadPoolExecutor.isShutdown()) {
            ScheduledThreadPoolExecutor scheduledThreadPoolExecutor2 = new ScheduledThreadPoolExecutor(1);
            scheduledThreadPoolExecutor2.setRemoveOnCancelPolicy(true);
            scheduledThreadPoolExecutor2.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
            this.f15299g = scheduledThreadPoolExecutor2;
            scheduledThreadPoolExecutor2.scheduleWithFixedDelay(new te.g(this, 0), 5L, 5L, TimeUnit.MINUTES);
        }
    }

    public p80(Context context) {
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(q9.c.c(context, x8.c.materialCalendarStyle, MaterialCalendar.class.getCanonicalName()).data, x8.m.MaterialCalendar);
        this.f15293a = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_dayStyle, 0));
        this.f15299g = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_dayInvalidStyle, 0));
        this.f15294b = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_daySelectedStyle, 0));
        this.f15295c = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_dayTodayStyle, 0));
        ColorStateList colorStateList = q9.d.getColorStateList(context, typedArrayObtainStyledAttributes, x8.m.MaterialCalendar_rangeFillColor);
        this.f15296d = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_yearStyle, 0));
        this.f15297e = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_yearSelectedStyle, 0));
        this.f15298f = com.google.android.material.datepicker.d.a(context, typedArrayObtainStyledAttributes.getResourceId(x8.m.MaterialCalendar_yearTodayStyle, 0));
        Paint paint = new Paint();
        this.f15300h = paint;
        paint.setColor(colorStateList.getDefaultColor());
        typedArrayObtainStyledAttributes.recycle();
    }

    public p80(Activity activity, IjkVideoView ijkVideoView, String str) {
        this.f15300h = new Handler(Looper.getMainLooper());
        this.f15295c = activity;
        this.f15296d = ijkVideoView;
        this.f15298f = str;
    }
}
