alexandroid/decompiled/jadx/sources/com/google/android/material/datepicker/DaysOfWeekAdapter.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

78 lines
2.6 KiB
Java

package com.google.android.material.datepicker;
import android.annotation.SuppressLint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.R;
import java.util.Calendar;
import java.util.Locale;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes7.dex */
class DaysOfWeekAdapter extends BaseAdapter {
private static final int CALENDAR_DAY_STYLE = 4;
private static final int NARROW_FORMAT = 4;
@NonNull
private final Calendar calendar;
private final int daysInWeek;
private final int firstDayOfWeek;
public DaysOfWeekAdapter() {
Calendar utcCalendar = UtcDates.getUtcCalendar();
this.calendar = utcCalendar;
this.daysInWeek = utcCalendar.getMaximum(7);
this.firstDayOfWeek = utcCalendar.getFirstDayOfWeek();
}
private int positionToDayOfWeek(int i) {
int i2 = i + this.firstDayOfWeek;
int i3 = this.daysInWeek;
return i2 > i3 ? i2 - i3 : i2;
}
@Override // android.widget.Adapter
public int getCount() {
return this.daysInWeek;
}
@Override // android.widget.Adapter
@Nullable
public Integer getItem(int i) {
if (i >= this.daysInWeek) {
return null;
}
return Integer.valueOf(positionToDayOfWeek(i));
}
@Override // android.widget.Adapter
public long getItemId(int i) {
return 0L;
}
@Override // android.widget.Adapter
@Nullable
@SuppressLint({"WrongConstant"})
public View getView(int i, @Nullable View view, @NonNull ViewGroup viewGroup) {
TextView textView = (TextView) view;
if (view == null) {
textView = (TextView) LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.mtrl_calendar_day_of_week, viewGroup, false);
}
this.calendar.set(7, positionToDayOfWeek(i));
textView.setText(this.calendar.getDisplayName(7, CALENDAR_DAY_STYLE, textView.getResources().getConfiguration().locale));
textView.setContentDescription(String.format(viewGroup.getContext().getString(R.string.mtrl_picker_day_of_week_column_header), this.calendar.getDisplayName(7, 2, Locale.getDefault())));
return textView;
}
public DaysOfWeekAdapter(int i) {
Calendar utcCalendar = UtcDates.getUtcCalendar();
this.calendar = utcCalendar;
this.daysInWeek = utcCalendar.getMaximum(7);
this.firstDayOfWeek = i;
}
}