@Test public void testSelect() throws Exception { assertTrue(mWeek.select(LocalDate.parse("2014-07-31"))); assertTrue(mWeek.isSelected()); List<Day> days = mWeek.getDays(); for (int i = 0; i < days.size(); i++) { Day day = days.get(i); if (i == 3) { assertTrue(day.isSelected()); } else { assertFalse(day.isSelected()); } } }
@Override public boolean select(@NonNull LocalDate date) { if (date != null && getFrom().compareTo(date) <= 0 && getTo().compareTo(date) >= 0) { setSelected(true); for (Day day : mDays) { day.setSelected(day.getDate().isEqual(date)); } return true; } else { return false; } }
Week extends RangeUnit { @Override public boolean select(@NonNull LocalDate date) { if (date != null && getFrom().compareTo(date) <= 0 && getTo().compareTo(date) >= 0) { setSelected(true); for (Day day : mDays) { day.setSelected(day.getDate().isEqual(date)); } return true; } else { return false; } } }
Week extends RangeUnit { @Override public boolean select(@NonNull LocalDate date) { if (date != null && getFrom().compareTo(date) <= 0 && getTo().compareTo(date) >= 0) { setSelected(true); for (Day day : mDays) { day.setSelected(day.getDate().isEqual(date)); } return true; } else { return false; } } Week(@NonNull LocalDate date, @NonNull LocalDate today, @Nullable LocalDate minDate,
                @Nullable LocalDate maxDate); }
Week extends RangeUnit { @Override public boolean select(@NonNull LocalDate date) { if (date != null && getFrom().compareTo(date) <= 0 && getTo().compareTo(date) >= 0) { setSelected(true); for (Day day : mDays) { day.setSelected(day.getDate().isEqual(date)); } return true; } else { return false; } } Week(@NonNull LocalDate date, @NonNull LocalDate today, @Nullable LocalDate minDate,
                @Nullable LocalDate maxDate); @Override boolean hasNext(); @Override boolean hasPrev(); @Override boolean next(); @Override boolean prev(); @Override int getType(); @Override void deselect(@NonNull LocalDate date); @Override boolean select(@NonNull LocalDate date); @NonNull List<Day> getDays(); @Override void build(); }
Week extends RangeUnit { @Override public boolean select(@NonNull LocalDate date) { if (date != null && getFrom().compareTo(date) <= 0 && getTo().compareTo(date) >= 0) { setSelected(true); for (Day day : mDays) { day.setSelected(day.getDate().isEqual(date)); } return true; } else { return false; } } Week(@NonNull LocalDate date, @NonNull LocalDate today, @Nullable LocalDate minDate,
                @Nullable LocalDate maxDate); @Override boolean hasNext(); @Override boolean hasPrev(); @Override boolean next(); @Override boolean prev(); @Override int getType(); @Override void deselect(@NonNull LocalDate date); @Override boolean select(@NonNull LocalDate date); @NonNull List<Day> getDays(); @Override void build();  }