A customizable calendar for android.
Add the dependency to your build.gradle
compile 'com.rajesh.customcalendar:app:1.0.1'
The simplest way to add calendar to your app:
<com.rajesh.customcalendar.Calendar
android:id="@+id/customCalendar"
app:identifier="customCalendar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
- 'identifier' is a mandatory attribute , value of which should be the id of the view .
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.rajesh.customcalendar.Calendar
app:startYear="2006"
app:endYear="2017"
app:monthYearTextColor="@android:color/black"
app:monthYearBackgroundColor="@android:color/holo_green_dark"
app:todayTextColor="@android:color/holo_green_dark"
app:todayBackgroundColor="@android:color/black"
app:expandedCalendarBackgroundColor="@android:color/holo_green_dark"
app:expandedCalendarTextColor="@android:color/holo_blue_dark"
app:expandedCalendarSelectedColor="@android:color/holo_red_dark"
app:calendarBackground="@android:color/holo_green_dark"
app:calendarTextColor="@android:color/holo_purple"
app:calendarSelectedColor="@android:color/white"
app:eventDotColor="@android:color/white"
android:id="@+id/customCalendar"
app:identifier="customCalendar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
getTodayDate()
- Returns today's dategetSelected()
- Returns current selected datesetEventDates(ArrayList<LocalDate>)
- Add events to a list of datesaddEvent(LocalDate)
- Add event to a datedeleteEvent(LocalDate)
- DeleteEvent from a dategetEventDates
- Returns array of dates which has events.deleteEvent(LocalDate)
- DeleteEvent from a datedeleteEvent(LocalDate)
- DeleteEvent from a date
calendarInstance.setCalendarListener(new Calendar.CalendarListener() {
@Override
public void onExpand() {
//called on calendar expand
}
@Override
public void onCollapse() {
//called on calendar collapse
}
@Override
public void onDateChange(LocalDate date) {
//called when calendar selected date changes
}
@Override
public void onTodayClick() {
//when today button clicked
}
});
- setEventDotColor(int color)
- setMonthYearTextColor(int color)
- setMonthYearBackgroundColor(int color)
- setExpandedCalendarSelectedColor(int color)
- setExpandedCalendarTextColor(int color)
- setExpandedCalendarBackgroundColor(int color)
- setTodayBackgroundColor(int color)
- setTodayTextColor(int color)
- setCalendarBackground(int color)
- setCalendarTextColor(int color)
- setCalendarSelectedColor(int color)
Note: color here is the color resource id
Feel free to contact me in twitter or create an issue