Material Events on Calendar is now on Git
After so much time from writing the article about to develop material events on calendar with Kotlin in android, now I have pushed library for same on Github.
To use this without giving your time and efforts, to save your time to make your project fill with event calendar, use this library as shown below.
Link for library on Github is
To add this library in your code, you will need to add maven(jitpack.io) in your root gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Now, paste this dependency in your app level gradle file
dependencies {
...
implementation 'com.github.chintan369:Material-Event-On-Calendar:latest-release'
}
Latest release you can find on github
And lastly put it in your layout.xml file as
<com.chintanpatel.materialeventcalendar.CalenderView
android:id="@+id/eventCalendar"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
and in your class/ kotlin file, you can use to add event as below.
val eventList: ArrayList<EventItem> = arrayListOf()
eventList.add(
EventItem("21-11-2018", "29-11-2018", "Gujarat Trip", "#EEFFCC", "1")
)
eventList.add(
EventItem("30-11-2018", "02-12-2018", "Meeting")
)
eventCalendar.setCalenderEventClickListener(object : CalenderView.CalenderEventClickListener {
override fun onEventClick(eventItem: EventItem) {
//put your logic on event click
}
})
eventCalendar.addEventList(eventList)
eventCalendar.addEvent(
EventItem("05-12-2018", "07-12-2018")
)
Pass true as second argument in addEventList() / addEvent(), if you want to clear previous events and add only you passed in first argument.
You can also change the header text color using setHeaderColor(color)
That’s Done.
Please give your comments if you like this work. Thanks