package o; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.TextView; import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.datepicker.MaterialCalendar; import com.google.android.material.datepicker.MaterialCalendarGridView; import com.google.android.material.datepicker.MaterialDatePicker; import java.util.Calendar; import java.util.Iterator; import o.C17052tZT; /* renamed from: o.tEr, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C17009tEr extends RecyclerView.Sts { private final AbstractC16801rOL a; final MaterialCalendar.IeS b; private final int c; public final FOT d; private final OAR e; @Override // androidx.recyclerview.widget.RecyclerView.Sts public final /* synthetic */ void onBindViewHolder(HBt hBt, int i) { HBt hBt2 = hBt; Calendar c = OnG.c(this.d.b.c); c.add(2, i); UJG ujg = new UJG(c); TextView textView = hBt2.e; if (ujg.b == null) { ujg.b = C17195uiA.b(ujg.c.getTimeInMillis()); } textView.setText(ujg.b); MaterialCalendarGridView materialCalendarGridView = (MaterialCalendarGridView) hBt2.c.findViewById(C17052tZT.ZqN.month_grid); if (materialCalendarGridView.a() != null && ujg.equals(materialCalendarGridView.a().d)) { materialCalendarGridView.invalidate(); Zpz a = materialCalendarGridView.a(); Iterator it = a.j.iterator(); while (it.hasNext()) { a.b(materialCalendarGridView, it.next().longValue()); } OAR oar = a.e; if (oar != null) { Iterator it2 = oar.b().iterator(); while (it2.hasNext()) { a.b(materialCalendarGridView, it2.next().longValue()); } a.j = a.e.b(); } } else { Zpz zpz = new Zpz(ujg, this.e, this.d, this.a); materialCalendarGridView.setNumColumns(ujg.e); materialCalendarGridView.setAdapter((ListAdapter) zpz); } materialCalendarGridView.setOnItemClickListener(new AdapterView.OnItemClickListener(this, materialCalendarGridView) { // from class: o.tEr.4 private C17009tEr c; private MaterialCalendarGridView e; { this.c = this; this.e = materialCalendarGridView; } @Override // android.widget.AdapterView.OnItemClickListener public final void onItemClick(AdapterView adapterView, View view, int i2, long j) { Zpz a2 = this.e.a(); if (i2 < a2.d.e(a2.a.d) || i2 > (a2.d.e(a2.a.d) + a2.d.a) - 1) { return; } this.c.b.d(this.e.a().getItem(i2).longValue()); } }); } public C17009tEr(Context context, OAR oar, FOT fot, AbstractC16801rOL abstractC16801rOL, MaterialCalendar.IeS ieS) { UJG ujg = fot.b; UJG ujg2 = fot.a; UJG ujg3 = fot.e; if (ujg.c.compareTo(ujg3.c) > 0) { throw new IllegalArgumentException("firstPage cannot be after currentPage"); } if (ujg3.c.compareTo(ujg2.c) > 0) { throw new IllegalArgumentException("currentPage cannot be after lastPage"); } this.c = (Zpz.c * context.getResources().getDimensionPixelSize(C17052tZT.HBt.mtrl_calendar_day_height)) + (MaterialDatePicker.e(context, android.R.attr.windowFullscreen) ? context.getResources().getDimensionPixelSize(C17052tZT.HBt.mtrl_calendar_day_height) : 0); this.d = fot; this.e = oar; this.a = abstractC16801rOL; this.b = ieS; setHasStableIds(true); } /* renamed from: o.tEr$HBt */ /* loaded from: classes2.dex */ public static class HBt extends RecyclerView.zJl { final MaterialCalendarGridView c; final TextView e; HBt(LinearLayout linearLayout, boolean z) { super(linearLayout); TextView textView = (TextView) linearLayout.findViewById(C17052tZT.ZqN.month_title); this.e = textView; ViewCompat.c((View) textView, true); this.c = (MaterialCalendarGridView) linearLayout.findViewById(C17052tZT.ZqN.month_grid); if (z) { return; } textView.setVisibility(8); } } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final int getItemCount() { return this.d.c; } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final long getItemId(int i) { Calendar c = OnG.c(this.d.b.c); c.add(2, i); return new UJG(c).c.getTimeInMillis(); } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final /* synthetic */ HBt onCreateViewHolder(ViewGroup viewGroup, int i) { LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(viewGroup.getContext()).inflate(C17052tZT.tOB.mtrl_calendar_month_labeled, viewGroup, false); if (MaterialDatePicker.e(viewGroup.getContext(), android.R.attr.windowFullscreen)) { linearLayout.setLayoutParams(new RecyclerView.saX(-1, this.c)); return new HBt(linearLayout, true); } return new HBt(linearLayout, false); } }