// Path: library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthAdapter.java
// static class MonthViewHolder extends RecyclerView.ViewHolder {
// 
//     public MonthViewHolder(MonthView itemView) {
//         super(itemView);
// 
//     }
// 
//     void bind(int position, DatePickerController mController, CalendarDay selectedCalendarDay) {
//         final int month = (position + mController.getStartDate().get(Calendar.MONTH)) % MONTHS_IN_YEAR;
//         final int year = (position + mController.getStartDate().get(Calendar.MONTH)) / MONTHS_IN_YEAR + mController.getMinYear();
// 
//         int selectedDay = -1;
//         if (isSelectedDayInMonth(selectedCalendarDay, year, month)) {
//             selectedDay = selectedCalendarDay.day;
//         }
// 
//         ((MonthView) itemView).setMonthParams(selectedDay, year, month, mController.getFirstDayOfWeek());
//         this.itemView.invalidate();
//     }
// 
//     private boolean isSelectedDayInMonth(CalendarDay selectedDay, int year, int month) {
//         return selectedDay.year == year && selectedDay.month == month;
//     }
// }
// 
// Path: library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java
// public interface OnDayClickListener {
//     void onDayClick(MonthView view, CalendarDay day);
// }


import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import com.wdullaer.materialdatetimepicker.date.MonthAdapter.MonthViewHolder;
import com.wdullaer.materialdatetimepicker.date.MonthView.OnDayClickListener;
import java.util.Calendar;
import java.util.TimeZone;
    @Override public int getItemCount() {
        Calendar endDate = mController.getEndDate();
        Calendar startDate = mController.getStartDate();
        int endMonth = endDate.get(Calendar.YEAR) * MONTHS_IN_YEAR + endDate.get(Calendar.MONTH);
        int startMonth = startDate.get(Calendar.YEAR) * MONTHS_IN_YEAR + startDate.get(Calendar.MONTH);
        return endMonth - startMonth + 1;
    }

    public abstract MonthView createMonthView(Context context);

    @Override
    public void onDayClick(MonthView view, CalendarDay day) {
        if (day != null) {
            onDayTapped(day);
        }
    }

    /**
     * Maintains the same hour/min/sec but moves the day to the tapped day.
     *
     * @param day The day that was tapped
     */
    protected void onDayTapped(CalendarDay day) {
        mController.tryVibrate();
        mController.onDayOfMonthSelected(day.year, day.month, day.day);
        setSelectedDay(day);
    }

    static class MonthViewHolder extends RecyclerView.ViewHolder {

// Path: library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthAdapter.java
// static class MonthViewHolder extends RecyclerView.ViewHolder {
// 
//     public MonthViewHolder(MonthView itemView) {
//         super(itemView);
// 
//     }
// 
//     void bind(int position, DatePickerController mController, CalendarDay selectedCalendarDay) {
//         final int month = (position + mController.getStartDate().get(Calendar.MONTH)) % MONTHS_IN_YEAR;
//         final int year = (position + mController.getStartDate().get(Calendar.MONTH)) / MONTHS_IN_YEAR + mController.getMinYear();
// 
//         int selectedDay = -1;
//         if (isSelectedDayInMonth(selectedCalendarDay, year, month)) {
//             selectedDay = selectedCalendarDay.day;
//         }
// 
//         ((MonthView) itemView).setMonthParams(selectedDay, year, month, mController.getFirstDayOfWeek());
//         this.itemView.invalidate();
//     }
// 
//     private boolean isSelectedDayInMonth(CalendarDay selectedDay, int year, int month) {
//         return selectedDay.year == year && selectedDay.month == month;
//     }
// }
// 
// Path: library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java
// public interface OnDayClickListener {
//     void onDayClick(MonthView view, CalendarDay day);
// }


// Path: library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthAdapter.java
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import com.wdullaer.materialdatetimepicker.date.MonthAdapter.MonthViewHolder;
import com.wdullaer.materialdatetimepicker.date.MonthView.OnDayClickListener;
import java.util.Calendar;
import java.util.TimeZone;

    @Override public int getItemCount() {
        Calendar endDate = mController.getEndDate();
        Calendar startDate = mController.getStartDate();
        int endMonth = endDate.get(Calendar.YEAR) * MONTHS_IN_YEAR + endDate.get(Calendar.MONTH);
        int startMonth = startDate.get(Calendar.YEAR) * MONTHS_IN_YEAR + startDate.get(Calendar.MONTH);
        return endMonth - startMonth + 1;
    }

    public abstract MonthView createMonthView(Context context);

    @Override
    public void onDayClick(MonthView view, CalendarDay day) {
        if (day != null) {
            onDayTapped(day);
        }
    }

    /**
     * Maintains the same hour/min/sec but moves the day to the tapped day.
     *
     * @param day The day that was tapped
     */
    protected void onDayTapped(CalendarDay day) {
        mController.tryVibrate();
        mController.onDayOfMonthSelected(day.year, day.month, day.day);
        setSelectedDay(day);
    }

    static class MonthViewHolder extends RecyclerView.ViewHolder {

        public MonthViewHolder(MonthView itemView) {