prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.92k stars 1.32k forks source link

Fix exceptions causing render to fail in the layout editor. #967

Open sampengilly opened 5 years ago

sampengilly commented 5 years ago

My attempt at fixing #876

The main cause with calendarMode not being set was that an exception was occurring inside the state setup in the constructor, this exception was being swallowed by the try-catch block surrounding the setup logic.

The exception that was occurring in the state setup was the ThreeTen missing zone data one. By calling AndroidThreeTen.init(context) for edit mode at the beginning of the constructor this exception can be prevented.

Another exception that was occurring was due to a null previousMonth in the TitleChanger.

While this PR results in the calendar displaying in the layout editor, the dates displayed aren't a complete representation of the month, and the calendar mode isn't properly honoured.