Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/weekend days #576

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

youssefelerian
Copy link

-disabled weekend days

  • update gradle

- add holiday Days feature
- update gradle
-disabled weekend days
-update grade
-disabled weekend days
- update gradle
@wdullaer
Copy link
Owner

wdullaer commented Apr 9, 2019

This looks like a good feature to have.
I will try to do a detailed review later this week.

@youssefelerian
Copy link
Author

youssefelerian commented Apr 15, 2019 via email

Copy link
Owner

@wdullaer wdullaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not update the DefaultDateRangeLimiter test suite. You should provide some unit and property tests that prove that the interactions of the disabled weekdays with the existing functionality work as expected.

@@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't update gradle in a feature PR, unless it's required for the functionality you are building.

This avoids merge conflicts if gradle gets upgraded in master before your PR lands

*
* @param weekendDays an Array of Calendar Objects containing the disabled dates
*/
public void setWeekendDays(@NonNull List<Integer> weekendDays) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the naming here. There's nothing about a weekend day which implies that it's disabled. Some people might have the exact opposite requirement.

Maybe setDisabledWeekDays?

*
* @param weekendDays an Array of Calendar Objects containing the disabled dates
*/
public void setWeekendDays(@NonNull List<Integer> weekendDays) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use this in the signature? https://docs.oracle.com/javase/8/docs/api/java/time/DayOfWeek.html (it has utility methods to convert to a Calendar int later on).

That might be a more intuitive signature than int.

@@ -143,7 +164,8 @@ public int getMaxYear() {
}

@Override
public @NonNull Calendar getStartDate() {
public @NonNull
Calendar getStartDate() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to make sure the start date is not on a disabled weekday

@@ -155,7 +177,8 @@ public int getMaxYear() {
}

@Override
public @NonNull Calendar getEndDate() {
public @NonNull
Calendar getEndDate() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to make sure the end date is not on a disabled weekday

@@ -203,7 +232,8 @@ private boolean isAfterMax(@NonNull Calendar calendar) {
}

@Override
public @NonNull Calendar setToNearestDate(@NonNull Calendar calendar) {
public @NonNull
Calendar setToNearestDate(@NonNull Calendar calendar) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setToNearest will need to take the disabled weekdays into account (you don't want to return a date that is disabled)

<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this?

@@ -39,8 +42,10 @@
private Calendar mMaxDate;
private TreeSet<Calendar> selectableDays = new TreeSet<>();
private HashSet<Calendar> disabledDays = new HashSet<>();
private List<Integer> weekendDays = new ArrayList<>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a set makes more sense than a list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants