AgendaCalendarView icon indicating copy to clipboard operation
AgendaCalendarView copied to clipboard

How to add more events to current dynamically?

Open deno028 opened this issue 8 years ago • 8 comments

agendaCalendarView.init(data, minDate, maxDate, Locale.getDefault(), this);

I want to add more data to the widget after init it. Could anybody please help?

deno028 avatar Jun 01 '16 03:06 deno028

+1

TheZoker avatar Jun 25 '16 11:06 TheZoker

https://github.com/thermatk/AgendaCalendarView/tree/0569ea7acd8345cb9946ff2af64fb5983d9b6b09

ArchitSandesara avatar Jul 01 '16 15:07 ArchitSandesara

@ArchitSandesara What can I see there?

TheZoker avatar Jul 01 '16 16:07 TheZoker

@theZoker It is the sample app of adding events dynamically.

https://github.com/thermatk/AgendaCalendarView/tree/0569ea7acd8345cb9946ff2af64fb5983d9b6b09

ArchitSandesara avatar Jul 01 '16 16:07 ArchitSandesara

I downloaded the sample, but the events are being added once, and only on ".init()". Am I missing something? Where is the dynamic part?

victorhvcunha avatar Aug 03 '16 22:08 victorhvcunha

Try "init()" again with updated eventList

khalid-mahmood avatar Aug 10 '16 10:08 khalid-mahmood

I am actually using "init()" again, the problem is that this solution resets the calendar, returning it to today. The behavior I was expecting was to load each day only when requested. After digging through the source code I realised that this isn't possible the way the component is currently structured.

victorhvcunha avatar Aug 10 '16 14:08 victorhvcunha

You can add more events after the agendaCalendarView.init() by calling CalendarManager.loadEvents(). The side effect is it will forget about any initial events that were added during gendaCalendarView.init() . You will be responsible for keeping a list of ALL the events for the calendar and calling CalendarManager.loadEvents() when events are added/deleted from the list. Another side effect for doing this is it will scroll back to the current date after loading, so if today is Oct 16 and you've scrolled to say Mar 1 and you call CalendarManager.loadEvents() it will automatically scroll back to Oct 16. That's been my experience so far with this control.

Donelle avatar Oct 16 '16 20:10 Donelle