// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/format/DayFormatter.java
// public interface DayFormatter {
// 
//   /**
//    * Default format for displaying the day.
//    */
//   String DEFAULT_FORMAT = "d";
// 
//   /**
//    * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
//    */
//   DayFormatter DEFAULT = new DateFormatDayFormatter();
// 
//   /**
//    * Format a given day into a string
//    *
//    * @param day the day
//    * @return a label for the day
//    */
//   @NonNull String format(@NonNull CalendarDay day);
// }
// 
// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/format/WeekDayFormatter.java
// public interface WeekDayFormatter {
//   /**
//    * Convert a given day of the week into a label.
//    *
//    * @param dayOfWeek the day of the week as returned by {@linkplain DayOfWeek#getValue()}.
//    * @return a label for the day of week.
//    */
//   CharSequence format(DayOfWeek dayOfWeek);
// 
//   /**
//    * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
//    */
//   WeekDayFormatter DEFAULT = new CalendarWeekDayFormatter();
// }
// 
// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
// public static boolean showOtherMonths(@ShowOtherDates int showOtherDates) {
//   return (showOtherDates & SHOW_OTHER_MONTHS) != 0;
// }


import android.os.Build;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.prolificinteractive.materialcalendarview.MaterialCalendarView.ShowOtherDates;
import com.prolificinteractive.materialcalendarview.format.DayFormatter;
import com.prolificinteractive.materialcalendarview.format.WeekDayFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.threeten.bp.DayOfWeek;
import org.threeten.bp.LocalDate;
import org.threeten.bp.temporal.TemporalField;
import org.threeten.bp.temporal.WeekFields;
import static com.prolificinteractive.materialcalendarview.MaterialCalendarView.SHOW_DEFAULTS;
import static com.prolificinteractive.materialcalendarview.MaterialCalendarView.showOtherMonths;
  }

  private void buildWeekDays(LocalDate calendar) {
    LocalDate local = calendar;
    for (int i = 0; i < DEFAULT_DAYS_IN_WEEK; i++) {
      WeekDayView weekDayView = new WeekDayView(getContext(), local.getDayOfWeek());
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        weekDayView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
      }
      weekDayViews.add(weekDayView);
      addView(weekDayView);
      local = local.plusDays(1);
    }
  }

  protected void addDayView(Collection<DayView> dayViews, LocalDate temp) {
    CalendarDay day = CalendarDay.from(temp);
    DayView dayView = new DayView(getContext(), day);
    dayView.setOnClickListener(this);
    dayView.setOnLongClickListener(this);
    dayViews.add(dayView);
    addView(dayView, new LayoutParams());
  }

  protected LocalDate resetAndGetWorkingCalendar() {
    final TemporalField firstDayOfWeek = WeekFields.of(this.firstDayOfWeek, 1).dayOfWeek();
    final LocalDate temp = getFirstViewDay().getDate().with(firstDayOfWeek, 1);
    int dow = temp.getDayOfWeek().getValue();
    int delta = getFirstDayOfWeek().getValue() - dow;
    //If the delta is positive, we want to remove a week
// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/format/DayFormatter.java
// public interface DayFormatter {
// 
//   /**
//    * Default format for displaying the day.
//    */
//   String DEFAULT_FORMAT = "d";
// 
//   /**
//    * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
//    */
//   DayFormatter DEFAULT = new DateFormatDayFormatter();
// 
//   /**
//    * Format a given day into a string
//    *
//    * @param day the day
//    * @return a label for the day
//    */
//   @NonNull String format(@NonNull CalendarDay day);
// }
// 
// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/format/WeekDayFormatter.java
// public interface WeekDayFormatter {
//   /**
//    * Convert a given day of the week into a label.
//    *
//    * @param dayOfWeek the day of the week as returned by {@linkplain DayOfWeek#getValue()}.
//    * @return a label for the day of week.
//    */
//   CharSequence format(DayOfWeek dayOfWeek);
// 
//   /**
//    * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
//    */
//   WeekDayFormatter DEFAULT = new CalendarWeekDayFormatter();
// }
// 
// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
// public static boolean showOtherMonths(@ShowOtherDates int showOtherDates) {
//   return (showOtherDates & SHOW_OTHER_MONTHS) != 0;
// }


// Path: library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerView.java
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.prolificinteractive.materialcalendarview.MaterialCalendarView.ShowOtherDates;
import com.prolificinteractive.materialcalendarview.format.DayFormatter;
import com.prolificinteractive.materialcalendarview.format.WeekDayFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.threeten.bp.DayOfWeek;
import org.threeten.bp.LocalDate;
import org.threeten.bp.temporal.TemporalField;
import org.threeten.bp.temporal.WeekFields;
import static com.prolificinteractive.materialcalendarview.MaterialCalendarView.SHOW_DEFAULTS;
import static com.prolificinteractive.materialcalendarview.MaterialCalendarView.showOtherMonths;

  }

  private void buildWeekDays(LocalDate calendar) {
    LocalDate local = calendar;
    for (int i = 0; i < DEFAULT_DAYS_IN_WEEK; i++) {
      WeekDayView weekDayView = new WeekDayView(getContext(), local.getDayOfWeek());
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        weekDayView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
      }
      weekDayViews.add(weekDayView);
      addView(weekDayView);
      local = local.plusDays(1);
    }
  }

  protected void addDayView(Collection<DayView> dayViews, LocalDate temp) {
    CalendarDay day = CalendarDay.from(temp);
    DayView dayView = new DayView(getContext(), day);
    dayView.setOnClickListener(this);
    dayView.setOnLongClickListener(this);
    dayViews.add(dayView);
    addView(dayView, new LayoutParams());
  }

  protected LocalDate resetAndGetWorkingCalendar() {
    final TemporalField firstDayOfWeek = WeekFields.of(this.firstDayOfWeek, 1).dayOfWeek();
    final LocalDate temp = getFirstViewDay().getDate().with(firstDayOfWeek, 1);
    int dow = temp.getDayOfWeek().getValue();
    int delta = getFirstDayOfWeek().getValue() - dow;
    //If the delta is positive, we want to remove a week
    boolean removeRow = showOtherMonths(showOtherDates) ? delta >= 0 : delta > 0;