package o;

import android.icu.text.DateFormat;
import android.icu.text.DisplayContext;
import android.icu.util.TimeZone;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class TP implements Comparable, Parcelable {
    public static final Parcelable.Creator<TP> CREATOR = new C2487t1(13);
    public final Calendar l;
    public final int m;
    public final int n;

    /* renamed from: o, reason: collision with root package name */
    public final int f340o;
    public final int p;
    public final long q;
    public String r;

    public TP(Calendar calendar) {
        calendar.set(5, 1);
        Calendar calendarA = AbstractC1789li0.a(calendar);
        this.l = calendarA;
        this.m = calendarA.get(2);
        this.n = calendarA.get(1);
        this.f340o = calendarA.getMaximum(7);
        this.p = calendarA.getActualMaximum(5);
        this.q = calendarA.getTimeInMillis();
    }

    public static TP a(int i, int i2) {
        Calendar calendarC = AbstractC1789li0.c(null);
        calendarC.set(1, i);
        calendarC.set(2, i2);
        return new TP(calendarC);
    }

    public static TP b(long j) {
        Calendar calendarC = AbstractC1789li0.c(null);
        calendarC.setTimeInMillis(j);
        return new TP(calendarC);
    }

    public final String c() {
        if (this.r == null) {
            long timeInMillis = this.l.getTimeInMillis();
            Locale locale = Locale.getDefault();
            AtomicReference atomicReference = AbstractC1789li0.a;
            DateFormat instanceForSkeleton = DateFormat.getInstanceForSkeleton("yMMMM", locale);
            instanceForSkeleton.setTimeZone(TimeZone.getTimeZone("UTC"));
            instanceForSkeleton.setContext(DisplayContext.CAPITALIZATION_FOR_STANDALONE);
            this.r = instanceForSkeleton.format(new Date(timeInMillis));
        }
        return this.r;
    }

    @Override // java.lang.Comparable
    public final int compareTo(Object obj) {
        return this.l.compareTo(((TP) obj).l);
    }

    public final int d(TP tp) {
        if (!(this.l instanceof GregorianCalendar)) {
            throw new IllegalArgumentException("Only Gregorian calendars are supported.");
        }
        return (tp.m - this.m) + ((tp.n - this.n) * 12);
    }

    @Override // android.os.Parcelable
    public final int describeContents() {
        return 0;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof TP)) {
            return false;
        }
        TP tp = (TP) obj;
        return this.m == tp.m && this.n == tp.n;
    }

    public final int hashCode() {
        return Arrays.hashCode(new Object[]{Integer.valueOf(this.m), Integer.valueOf(this.n)});
    }

    @Override // android.os.Parcelable
    public final void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.n);
        parcel.writeInt(this.m);
    }
}
