An Event object stores a UserTask object
, an int scheduledTime
, and a boolean[] daysOfWeekToRepeat
denoting the days of the week when it should be repeated.
These Event objects are inserted into a sparse array
List<ArrayList<Event>> calendarEventsMatrix.
The structure has been tried and tested, so it works. My next step is to now design a UI that allows the user to see those events on a calendar. The user can also click on those events and add, edit, or delete events.
Here is my current design plan:
- Create an EventSlot.class that extends LinearLayout. This will be the basis for the entire calendar. Each EventSlot view will have its own onClickListener.
- Create a WeekColumn.class that extends LinearLayout. This WeekColumn will be a vertical LinearLayout that will fill itself with a bunch of EventSlot views that will somehow be numbered for every hour of the day.
- Create a EventsFrame.class that will extend LinearLayout. EventsFrame will be a horizontal LinearLayout that will fill itself with 7 of these WeekColumn views (one for every day of the week).
- Create a CalendarFrame.class that will extend ViewGroup. This will simply be the container for the EventsFrame, as well as other useful TextViews and labels. The CalendarFrame is what will be inflated and placed into my Fragment.
Assuming all of that has been set up, my next step is to assign the events in my calendarEventsMatrix to the calendar with an adapter.
Is my thinking correct?
My concern is that I don't want to be inflating a whole bunch of these views every single time the user wants to open up the schedule calendar. Should I be doing things from XML or dynamically? And what is the best adapter to extend for this calendar?