Open jaymins-nimblechapps opened 4 years ago
How can i add the event for specific day and specific time?
I've altered the populate method to look like this
private fun populate2(week: Week, force: Boolean = false) {
if (!force && calendar.cachedEvents.contains(week))
return
val events = mutableListOf<Event>()
var i = 0
while (i < dataholder.size && i < dataholder.size-1) {
var start = dataholder[i + 3].dropLast(1).toLong()
var end = start + dataholder[i + 4].dropLast(1).toLong()
if(start >= week.start && start < week.end) {
events.add(BaseEvent(
dataholder[i], //TITLE
dataholder[i + 1], //Desciption
dataholder[i + 2]toInt(), //Color
start, //Start time
end, //End time
false))
}
i += 5
}
calendar.setEventsForWeek(week, events)
}
dataholder is a global list where I'm storing events in every 5 elements. It's a really lazy solution but I just needed it to work so I could see if this calendar was usable for my project. I would suggest using a different library though, this one has a pretty big bug that freezes the app if you swipe forward too many times and almost no documentation for adding, updating, or removing events. Let me know if you find a better alternative.
How can i add the event for specific day and specific time?