199 lines
6.6 KiB
Java
199 lines
6.6 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.view.LayoutInflater;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import android.widget.BaseAdapter;
|
||
|
import android.widget.TextView;
|
||
|
import com.google.android.material.datepicker.MaterialCalendarGridView;
|
||
|
import java.util.Calendar;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.TimeZone;
|
||
|
import o.C17052tZT;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class Zpz extends BaseAdapter {
|
||
|
public static final int c;
|
||
|
private static final int f;
|
||
|
public final FOT a;
|
||
|
public ERL b;
|
||
|
public final UJG d;
|
||
|
public final OAR<?> e;
|
||
|
private AbstractC16801rOL h;
|
||
|
Collection<Long> j;
|
||
|
|
||
|
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||
|
public boolean hasStableIds() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public Zpz(UJG ujg, OAR<?> oar, FOT fot, AbstractC16801rOL abstractC16801rOL) {
|
||
|
this.d = ujg;
|
||
|
this.e = oar;
|
||
|
this.a = fot;
|
||
|
this.h = abstractC16801rOL;
|
||
|
this.j = oar.b();
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.Adapter
|
||
|
/* renamed from: b, reason: merged with bridge method [inline-methods] */
|
||
|
public final Long getItem(int i) {
|
||
|
if (i < this.d.e(this.a.d) || i > (this.d.e(this.a.d) + this.d.a) - 1) {
|
||
|
return null;
|
||
|
}
|
||
|
UJG ujg = this.d;
|
||
|
int e = (i - ujg.e(this.a.d)) + 1;
|
||
|
Calendar c2 = OnG.c(ujg.c);
|
||
|
c2.set(5, e);
|
||
|
return Long.valueOf(c2.getTimeInMillis());
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.Adapter
|
||
|
public long getItemId(int i) {
|
||
|
return i / this.d.e;
|
||
|
}
|
||
|
|
||
|
private void IS_(TextView textView, long j, int i) {
|
||
|
boolean z;
|
||
|
boolean z2;
|
||
|
C14391fsN c14391fsN;
|
||
|
if (textView == null) {
|
||
|
return;
|
||
|
}
|
||
|
Context context = textView.getContext();
|
||
|
boolean z3 = true;
|
||
|
boolean z4 = OnG.e().getTimeInMillis() == j;
|
||
|
Iterator<uOF<Long, Long>> it = this.e.a().iterator();
|
||
|
while (true) {
|
||
|
if (!it.hasNext()) {
|
||
|
z = false;
|
||
|
break;
|
||
|
}
|
||
|
uOF<Long, Long> next = it.next();
|
||
|
if (next.d != null && next.d.longValue() == j) {
|
||
|
z = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
Iterator<uOF<Long, Long>> it2 = this.e.a().iterator();
|
||
|
while (true) {
|
||
|
if (!it2.hasNext()) {
|
||
|
z2 = false;
|
||
|
break;
|
||
|
}
|
||
|
uOF<Long, Long> next2 = it2.next();
|
||
|
if (next2.b != null && next2.b.longValue() == j) {
|
||
|
z2 = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
String c2 = C17195uiA.c(context, j, z4, z, z2);
|
||
|
textView.setContentDescription(c2);
|
||
|
if (this.a.f.e(j)) {
|
||
|
textView.setEnabled(true);
|
||
|
Iterator<Long> it3 = this.e.b().iterator();
|
||
|
while (true) {
|
||
|
if (!it3.hasNext()) {
|
||
|
z3 = false;
|
||
|
break;
|
||
|
}
|
||
|
long longValue = it3.next().longValue();
|
||
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||
|
calendar.clear();
|
||
|
calendar.setTimeInMillis(j);
|
||
|
long timeInMillis = OnG.c(calendar).getTimeInMillis();
|
||
|
Calendar calendar2 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||
|
calendar2.clear();
|
||
|
calendar2.setTimeInMillis(longValue);
|
||
|
if (timeInMillis == OnG.c(calendar2).getTimeInMillis()) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
textView.setSelected(z3);
|
||
|
if (z3) {
|
||
|
c14391fsN = this.b.d;
|
||
|
} else if (OnG.e().getTimeInMillis() == j) {
|
||
|
c14391fsN = this.b.f;
|
||
|
} else {
|
||
|
c14391fsN = this.b.c;
|
||
|
}
|
||
|
} else {
|
||
|
textView.setEnabled(false);
|
||
|
c14391fsN = this.b.b;
|
||
|
}
|
||
|
if (this.h != null && i != -1) {
|
||
|
int i2 = this.d.g;
|
||
|
int i3 = this.d.d;
|
||
|
c14391fsN.IQ_(textView);
|
||
|
textView.setCompoundDrawables(null, null, null, null);
|
||
|
textView.setContentDescription(c2);
|
||
|
return;
|
||
|
}
|
||
|
c14391fsN.IQ_(textView);
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||
|
calendar.clear();
|
||
|
c = calendar.getMaximum(4);
|
||
|
Calendar calendar2 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||
|
calendar2.clear();
|
||
|
int maximum = calendar2.getMaximum(5);
|
||
|
Calendar.getInstance(TimeZone.getTimeZone("UTC")).clear();
|
||
|
f = (maximum + r0.getMaximum(7)) - 1;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final void b(MaterialCalendarGridView materialCalendarGridView, long j) {
|
||
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||
|
calendar.clear();
|
||
|
calendar.setTimeInMillis(j);
|
||
|
if (new UJG(calendar).equals(this.d)) {
|
||
|
Calendar c2 = OnG.c(this.d.c);
|
||
|
c2.setTimeInMillis(j);
|
||
|
int i = c2.get(5);
|
||
|
Zpz a = materialCalendarGridView.a();
|
||
|
IS_((TextView) materialCalendarGridView.getChildAt((a.d.e(a.a.d) + (i - 1)) - materialCalendarGridView.getFirstVisiblePosition()), j, i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.Adapter
|
||
|
public /* synthetic */ View getView(int i, View view, ViewGroup viewGroup) {
|
||
|
int i2;
|
||
|
Context context = viewGroup.getContext();
|
||
|
if (this.b == null) {
|
||
|
this.b = new ERL(context);
|
||
|
}
|
||
|
TextView textView = (TextView) view;
|
||
|
if (view == null) {
|
||
|
textView = (TextView) LayoutInflater.from(viewGroup.getContext()).inflate(C17052tZT.tOB.mtrl_calendar_day, viewGroup, false);
|
||
|
}
|
||
|
int e = i - this.d.e(this.a.d);
|
||
|
if (e < 0 || e >= this.d.a) {
|
||
|
textView.setVisibility(8);
|
||
|
textView.setEnabled(false);
|
||
|
i2 = -1;
|
||
|
} else {
|
||
|
i2 = e + 1;
|
||
|
textView.setTag(this.d);
|
||
|
textView.setText(String.format(textView.getResources().getConfiguration().locale, "%d", Integer.valueOf(i2)));
|
||
|
textView.setVisibility(0);
|
||
|
textView.setEnabled(true);
|
||
|
}
|
||
|
Long item = getItem(i);
|
||
|
if (item == null) {
|
||
|
return textView;
|
||
|
}
|
||
|
IS_(textView, item.longValue(), i2);
|
||
|
return textView;
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.Adapter
|
||
|
public int getCount() {
|
||
|
return f;
|
||
|
}
|
||
|
}
|