diff --git a/README.md b/README.md index 3d5fd7d..e3d112d 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ ##Screenshots
- - + +
@@ -32,7 +32,7 @@ repositories { ```java dependencies { - compile 'com.github.BlackBoxVision:material-calendar-view:v1.4.0' + compile 'com.github.BlackBoxVision:material-calendar-view:v1.5.1' } ``` **Maven** @@ -51,7 +51,7 @@ dependencies { com.github.BlackBoxVision material-calendar-view - v1.4.0 + v1.5.1 ``` **SBT** @@ -65,7 +65,7 @@ resolvers += "jitpack" at "https://jitpack.io" - Add the dependency in the form: ```java -libraryDependencies += "com.github.BlackBoxVision" % "material-calendar-view" % "v1.4.0" +libraryDependencies += "com.github.BlackBoxVision" % "material-calendar-view" % "v1.5.1" ``` ##Usage example @@ -85,27 +85,24 @@ This example shows all the possible customization around Material Calendar View: ```xml + android:id="@+id/calendar_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:calendarIsMultiSelectDayEnabled="false" + app:calendarIsOverflowDatesVisible="true" + app:calendarBackgroundColor="@color/colorPrimary" + app:calendarTitleTextColor="@color/colorAccent" + app:calendarCurrentDayTextColor="@color/white" + app:calendarDayOfWeekTextColor="@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:calendarButtonBackgroundColor="@color/colorAccent" + app:calendarWeekendDays="saturday|sunday"> ``` Then, in your Activity.java or Fragment.java initialize the calendar: @@ -113,24 +110,18 @@ Then, in your Activity.java or Fragment.java initialize the calendar: ```java calendarView = (CalendarView) findViewById(R.id.calendar_view); -calendarView.shouldAnimateOnEnter(true); -calendarView.setFirstDayOfWeek(Calendar.MONDAY); -calendarView.setIsOverflowDateVisible(true); -calendarView.setCurrentDay(new Date(System.currentTimeMillis())); -calendarView.setBackButtonColor(R.color.colorAccent); -calendarView.setNextButtonColor(R.color.colorAccent); -calendarView.update(Calendar.getInstance(Locale.getDefault())); -calendarView.setOnDateLongClickListener(selectedDate -> textView.setText(formatter.format(selectedDate))); -calendarView.setOnMonthChangeListener(monthDate -> { - final SimpleDateFormat df = new SimpleDateFormat("MMMM yyyy", Locale.getDefault()); +calendarView.shouldAnimateOnEnter(true) + .setFirstDayOfWeek(Calendar.MONDAY) + .setOnDateClickListener(this::onDateClick) + .setOnMonthChangeListener(this::onMonthChange) + .setOnDateLongClickListener(this::onDateLongClick) + .setOnMonthTitleClickListener(this::onMonthTitleClick); - if (null != actionBar) { - String dateStr = df.format(monthDate); - dateStr = dateStr.substring(0, 1).toUpperCase() + dateStr.substring(1, dateStr.length()); +if (calendarView.isMultiSelectDayEnabled()) { + calendarView.setOnMultipleDaySelectedListener(this::onMultipleDaySelected); +} - actionBar.setTitle(dateStr); - } -}); +calendarView.update(Calendar.getInstance(Locale.getDefault())); ``` ##Issues