package com.google.android.material.datepicker;

import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.google.android.gms.common.R;
import java.util.Calendar;
import o.AbstractC1789li0;
import o.AbstractC2488t10;
import o.C0247Jn;
import o.C0576Wf;
import o.C0806bO;
import o.C1253g10;
import o.TP;
import o.UP;
import o.X00;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class c extends X00 {
    public final C0576Wf c;
    public final C0247Jn d;
    public final int e;

    public c(ContextThemeWrapper contextThemeWrapper, C0576Wf c0576Wf, C0247Jn c0247Jn) {
        TP tp = c0576Wf.l;
        TP tp2 = c0576Wf.m;
        TP tp3 = c0576Wf.f398o;
        if (tp.l.compareTo(tp3.l) > 0) {
            throw new IllegalArgumentException("firstPage cannot be after currentPage");
        }
        if (tp3.l.compareTo(tp2.l) > 0) {
            throw new IllegalArgumentException("currentPage cannot be after lastPage");
        }
        this.e = (contextThemeWrapper.getResources().getDimensionPixelSize(R.dimen.mtrl_calendar_day_height) * UP.d) + (C0806bO.i(contextThemeWrapper, android.R.attr.windowFullscreen) ? contextThemeWrapper.getResources().getDimensionPixelSize(R.dimen.mtrl_calendar_day_height) : 0);
        this.c = c0576Wf;
        this.d = c0247Jn;
        if (this.a.a()) {
            throw new IllegalStateException("Cannot change whether this adapter has stable IDs while the adapter has registered observers.");
        }
        this.b = true;
    }

    @Override // o.X00
    public final int a() {
        return this.c.r;
    }

    @Override // o.X00
    public final long b(int i) {
        Calendar calendarA = AbstractC1789li0.a(this.c.l.l);
        calendarA.add(2, i);
        calendarA.set(5, 1);
        Calendar calendarA2 = AbstractC1789li0.a(calendarA);
        calendarA2.get(2);
        calendarA2.get(1);
        calendarA2.getMaximum(7);
        calendarA2.getActualMaximum(5);
        calendarA2.getTimeInMillis();
        return calendarA2.getTimeInMillis();
    }

    @Override // o.X00
    public final void c(AbstractC2488t10 abstractC2488t10, int i) {
        b bVar = (b) abstractC2488t10;
        C0576Wf c0576Wf = this.c;
        Calendar calendarA = AbstractC1789li0.a(c0576Wf.l.l);
        calendarA.add(2, i);
        TP tp = new TP(calendarA);
        bVar.t.setText(tp.c());
        MaterialCalendarGridView materialCalendarGridView = (MaterialCalendarGridView) bVar.u.findViewById(R.id.month_grid);
        if (materialCalendarGridView.a() == null || !tp.equals(materialCalendarGridView.a().a)) {
            new UP(tp, c0576Wf);
            throw null;
        }
        materialCalendarGridView.invalidate();
        materialCalendarGridView.a().getClass();
        throw null;
    }

    @Override // o.X00
    public final AbstractC2488t10 d(ViewGroup viewGroup) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.mtrl_calendar_month_labeled, viewGroup, false);
        if (!C0806bO.i(viewGroup.getContext(), android.R.attr.windowFullscreen)) {
            return new b(linearLayout, false);
        }
        linearLayout.setLayoutParams(new C1253g10(-1, this.e));
        return new b(linearLayout, true);
    }
}
