diff --git a/README.md b/README.md index 6c5f3c1..efd5b05 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,8 @@ This example shows all the possible customization around Material Calendar View: app:calendarBackgroundColor="@color/colorPrimary" app:calendarTitleTextColor="@color/colorAccent" app:calendarCurrentDayTextColor="@color/white" - app:calendarDayOfWeekTextColor="@android:color/white" + app:calendarDayOfWeekTextColor="@color/grey" + app:calendarDayOfMonthTextColor="@android:color/white" app:calendarDisabledDayBackgroundColor="@color/colorPrimary" app:calendarDisabledDayTextColor="@android:color/darker_gray" app:calendarSelectedDayBackgroundColor="@color/colorAccent" diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index bba02dc..1d5f64a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -48,15 +48,17 @@ app:calendarIsOverflowDatesVisible="true" app:calendarBackgroundColor="@color/colorPrimary" app:calendarTitleTextColor="@color/colorAccent" - app:calendarCurrentDayTextColor="@color/white" - app:calendarDayOfWeekTextColor="@android:color/white" + app:calendarCurrentDayTextColor="@color/colorAccent" + app:calendarSelectedDayTextColor="@color/white" + app:calendarDayOfWeekTextColor="@color/grey" + app:calendarDayOfMonthTextColor="@android:color/white" app:calendarDisabledDayBackgroundColor="@color/colorPrimary" app:calendarDisabledDayTextColor="@android:color/darker_gray" app:calendarSelectedDayBackgroundColor="@color/colorAccent" app:calendarTitleBackgroundColor="@color/colorPrimary" app:calendarWeekBackgroundColor="@color/colorPrimary" app:calendarCurrentDayBackgroundColor="@color/teal500" - app:calendarWeekendTextColor="@color/colorAccent" + app:calendarWeekendTextColor="@color/red" app:calendarButtonBackgroundColor="@color/colorAccent" app:calendarWeekendDays="saturday|sunday"> diff --git a/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java b/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java index 2e85433..c1b81bc 100644 --- a/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java +++ b/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java @@ -189,6 +189,7 @@ public final class CalendarView extends LinearLayout { private int selectedDayTextColor; private int titleTextColor; private int dayOfWeekTextColor; + private int dayOfMonthTextColor; private int currentDayTextColor; private int weekendTextColor; private int weekendDays; @@ -320,7 +321,8 @@ private void takeStyles(AttributeSet attrs) { titleBackgroundColor = a.getColor(R.styleable.MaterialCalendarView_calendarTitleBackgroundColor, white); titleTextColor = a.getColor(R.styleable.MaterialCalendarView_calendarTitleTextColor, white); weekBackgroundColor = a.getColor(R.styleable.MaterialCalendarView_calendarWeekBackgroundColor, white); - dayOfWeekTextColor = a.getColor(R.styleable.MaterialCalendarView_calendarDayOfWeekTextColor, black); + dayOfWeekTextColor = a.getColor(R.styleable.MaterialCalendarView_calendarDayOfWeekTextColor, dayDisableTextColor); + dayOfMonthTextColor = a.getColor(R.styleable.MaterialCalendarView_calendarDayOfMonthTextColor, black); disabledDayBackgroundColor = a.getColor(R.styleable.MaterialCalendarView_calendarDisabledDayBackgroundColor, dayDisableBackground); disabledDayTextColor = a.getColor(R.styleable.MaterialCalendarView_calendarDisabledDayTextColor, dayDisableTextColor); selectedDayBackgroundColor = a.getColor(R.styleable.MaterialCalendarView_calendarSelectedDayBackgroundColor, daySelectedBackground); @@ -423,7 +425,7 @@ private void drawWeekView() { if (totalDayOfWeekend.length != 0) { for (int weekend : totalDayOfWeekend) { if (i == weekend) { - textView.setTextColor(weekendTextColor); + textView.setTextColor(dayOfWeekTextColor); isCommonDay = false; } } @@ -578,7 +580,7 @@ private void drawAdapterView() { } if (isCommonDay) { - textView.setTextColor(dayOfWeekTextColor); + textView.setTextColor(dayOfMonthTextColor); } if (day.isCurrentDay()) { @@ -614,7 +616,7 @@ private void clearDayViewSelection(Date currentDate) { DayView dayView = findViewByCalendar(calendar); dayView.setBackgroundColor(calendarBackgroundColor); - isCommonDay = true; + isCommonDay = !CalendarUtils.isToday(calendar); if (totalDayOfWeekend.length != 0) { for (int weekend : totalDayOfWeekend) { @@ -626,7 +628,9 @@ private void clearDayViewSelection(Date currentDate) { } if (isCommonDay) { - dayView.setTextColor(dayOfWeekTextColor); + dayView.setTextColor(dayOfMonthTextColor); + } else { + dayView.setTextColor(currentDayTextColor); } } } @@ -690,7 +694,7 @@ private void drawCurrentDay(@NonNull Date date) { if (CalendarUtils.isToday(calendar)) { final DayView dayOfMonth = findViewByCalendar(calendar); - dayOfMonth.setTextColor(currentDayTextColor); + dayOfMonth.setTextColor(dayOfMonthTextColor); Drawable d = ContextCompat.getDrawable(getContext(), R.drawable.circular_background); d.setColorFilter(currentDayBackgroundColor, PorterDuff.Mode.SRC_ATOP); @@ -1290,6 +1294,12 @@ public CalendarView setTitleTextColor(int titleTextColor) { return this; } + public CalendarView setDayOfMonthTextColor(int dayOfMonthTextColor) { + this.dayOfMonthTextColor = dayOfMonthTextColor; + invalidate(); + return this; + } + public CalendarView setDayOfWeekTextColor(int dayOfWeekTextColor) { this.dayOfWeekTextColor = dayOfWeekTextColor; invalidate(); diff --git a/materialcalendarview/src/main/res/layout/week_view1.xml b/materialcalendarview/src/main/res/layout/week_view1.xml index 43788d7..5473fe3 100644 --- a/materialcalendarview/src/main/res/layout/week_view1.xml +++ b/materialcalendarview/src/main/res/layout/week_view1.xml @@ -18,9 +18,6 @@ @@ -36,9 +33,6 @@ @@ -54,9 +48,6 @@ @@ -91,10 +79,7 @@ @@ -109,10 +94,7 @@ @@ -127,10 +109,7 @@ diff --git a/materialcalendarview/src/main/res/layout/week_view2.xml b/materialcalendarview/src/main/res/layout/week_view2.xml index 7e77bfe..8812d58 100644 --- a/materialcalendarview/src/main/res/layout/week_view2.xml +++ b/materialcalendarview/src/main/res/layout/week_view2.xml @@ -18,10 +18,7 @@ @@ -36,10 +33,7 @@ @@ -54,10 +48,7 @@ @@ -72,10 +63,7 @@ @@ -90,10 +78,7 @@ @@ -108,10 +93,7 @@ @@ -126,10 +108,7 @@ diff --git a/materialcalendarview/src/main/res/layout/week_view3.xml b/materialcalendarview/src/main/res/layout/week_view3.xml index 9d04a9c..5418739 100644 --- a/materialcalendarview/src/main/res/layout/week_view3.xml +++ b/materialcalendarview/src/main/res/layout/week_view3.xml @@ -18,10 +18,7 @@ @@ -36,10 +33,7 @@ @@ -54,10 +48,7 @@ @@ -72,10 +63,7 @@ @@ -90,10 +78,7 @@ @@ -108,10 +93,7 @@ @@ -126,10 +108,7 @@ diff --git a/materialcalendarview/src/main/res/layout/week_view4.xml b/materialcalendarview/src/main/res/layout/week_view4.xml index 6c2968c..cf3406c 100644 --- a/materialcalendarview/src/main/res/layout/week_view4.xml +++ b/materialcalendarview/src/main/res/layout/week_view4.xml @@ -18,10 +18,7 @@ @@ -36,10 +33,7 @@ @@ -54,10 +48,7 @@ @@ -72,10 +63,7 @@ @@ -90,10 +78,7 @@ @@ -108,10 +93,7 @@ @@ -126,10 +108,7 @@ diff --git a/materialcalendarview/src/main/res/layout/week_view5.xml b/materialcalendarview/src/main/res/layout/week_view5.xml index fad4efc..ebf6da5 100644 --- a/materialcalendarview/src/main/res/layout/week_view5.xml +++ b/materialcalendarview/src/main/res/layout/week_view5.xml @@ -18,10 +18,7 @@ @@ -36,10 +33,7 @@ @@ -54,10 +48,7 @@ @@ -72,10 +63,7 @@ @@ -90,10 +78,7 @@ @@ -108,10 +93,7 @@ @@ -126,10 +108,7 @@ diff --git a/materialcalendarview/src/main/res/layout/week_view6.xml b/materialcalendarview/src/main/res/layout/week_view6.xml index 41d80de..1778501 100644 --- a/materialcalendarview/src/main/res/layout/week_view6.xml +++ b/materialcalendarview/src/main/res/layout/week_view6.xml @@ -18,10 +18,7 @@ @@ -36,10 +33,7 @@ @@ -54,10 +48,7 @@ @@ -72,10 +63,7 @@ @@ -90,10 +78,7 @@ @@ -108,10 +93,7 @@ @@ -126,10 +108,7 @@ diff --git a/materialcalendarview/src/main/res/values/attrs.xml b/materialcalendarview/src/main/res/values/attrs.xml index f634e26..ca74a6e 100644 --- a/materialcalendarview/src/main/res/values/attrs.xml +++ b/materialcalendarview/src/main/res/values/attrs.xml @@ -13,6 +13,7 @@ + diff --git a/materialcalendarview/src/main/res/values/styles.xml b/materialcalendarview/src/main/res/values/styles.xml index 552a9e2..8eecb78 100644 --- a/materialcalendarview/src/main/res/values/styles.xml +++ b/materialcalendarview/src/main/res/values/styles.xml @@ -17,7 +17,7 @@ @@ -25,6 +25,9 @@ - \ No newline at end of file +