-
Notifications
You must be signed in to change notification settings - Fork 42
Events Calendar
Deepan edited this page Sep 25, 2018
·
8 revisions
Events Calendar is a developer-friendly library that helps you achieve a cool Calendar UI with events mapping. You can customise every pixel of the calendar as per your wish and still achieve in implementing all the functionalities of the native android calendar in addition with adding dots to the calendar which represents the presence of an event on the respective dates. It can be done easily, you are just a few steps away from implementing your own badass looking Calendar for your very own project!
dependencies {
implementation 'com.github.tizisdeepan:dots:1.0.1'
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
<com.events.calendar.views.EventsCalendar
android:id="@+id/eventsCalendar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:overScrollMode="never"
app:eventDotColor="#ff0000"
app:isBoldTextOnSelectionEnabled="true"
app:monthTitleColor="#ffffff"
app:primaryTextColor="#c4c4c4"
app:secondaryTextColor="#666666"
app:selectedTextColor="#000000"
app:selectionColor="#ffe600"
app:weekHeaderColor="#c6c6c6" />
class MainActivity : AppCompatActivity(), EventsCalendar.Callback {
...
override fun onMonthChanged(monthStartDate: Calendar?) {
Log.e("MON", "CHANGED")
}
override fun onDaySelected(selectedDate: Calendar?) {
Log.e("DAY", "SELECTED")
}
}
//set today's date [today: Calendar Object]
eventsCalendar.setToday(today)
//set starting month [start: Calendar Object] and ending month [end: Calendar Object]
eventsCalendar.setMonthRange(start, end)
//set start day of the week as you wish [startday: Int, doReset: Boolean]
eventsCalendar.setWeekStartDay(Calendar.SUNDAY, false)
//set current date and scrolls the calendar to the corresponding month of the selected date [today: Calendar]
eventsCalendar.setCurrentSelectedDate(today)
//set font for dates
eventsCalendar.setDatesTypeface(typeface)
//set font for title of the calendar
eventsCalendar.setMonthTitleTypeface(typeface)
//set font for week names
eventsCalendar.setWeekHeaderTypeface(typeface)
//set the callback for EventsCalendar.Listener
eventsCalendar.setCallback(this)