package Ġio . github . yun ato . my record timer . model . dao . cal endars Ċ Ċ import Ġandroid . content . Context Ċ import Ġio . github . yun ato . my record timer . R Ċ import Ġio . github . yun ato . my record timer . model . dao . cal endars . calendar . Local Calendar Dao Ċ import Ġio . github . yun ato . my record timer . model . dao . cal endars . event . Local Event Dao Ċ import Ġio . github . yun ato . my record timer . model . entity . Record Ċ Ċ class ĠLocal Dao Ġprivate Ġconstructor ( val Ġcontext : ĠContext ){ ĊĊĠĠĠ Ġprivate Ġval Ġcalendar Dao : ĠLocal Calendar Dao Ġby Ġlazy { ĊĠĠĠĠĠĠĠ ĠLocal Calendar Dao ( context ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġevent Dao : ĠLocal Event Dao Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠLocal Event Dao ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Calendar (){ ĊĠĠĠĠĠĠĠ Ġif (! calendar Dao . check Exist Calendar ()) Ġcalendar Dao . create Calendar () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġlog Calendar Info (){ ĊĠĠĠĠĠĠĠ Ġif ( calendar Dao . check Exist Calendar ()) Ġcalendar Dao . log Calendar Info () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetAll Event Items (): ĠList < Record >{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif ( calendar Dao . check Exist Calendar ()) Ġevent Dao . getAll Event Items () ĊĠĠĠĠĠĠĠ Ġelse ĠlistOf () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Event Items On Day ( year : ĠInt , Ġmonth : ĠInt , Ġday OfMonth : ĠInt ): ĠList < Record >{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif ( calendar Dao . check Exist Calendar ()) Ġreturn Ġevent Dao . getEvent Items On Day ( year , Ġmonth , Ġday OfMonth ) ĊĠĠĠĠĠĠĠ Ġelse ĠlistOf () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Event From Id ( id : ĠLong ): ĠRecord { ĊĠĠĠĠĠĠĠ Ġreturn Ġif ( calendar Dao . check Exist Calendar ()) Ġreturn Ġevent Dao . getEvent From Id ( id ) ĊĠĠĠĠĠĠĠ Ġelse ĠRecord ("", Ġ 0 , Ġ 0 , Ġcontext . resources . getString ( R . string . edit _ text _ title _ no ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . resources . getString ( R . string . edit _ text _ memo _ no ), Ġ- 1 , Ġ 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinsert Event Items ( event Items : ĠList < Record >): ĠList < String >{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif ( calendar Dao . check Exist Calendar ()) Ġreturn Ġevent Dao . insert Event Items ( event Items ) ĊĠĠĠĠĠĠĠ Ġelse ĠlistOf () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete Event Item ( eventId : ĠLong ){ ĊĠĠĠĠĠĠĠ Ġif ( calendar Dao . check Exist Calendar ()) Ġevent Dao . delete Event Item ( eventId ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun ĠgetInstance ( context : ĠContext ?): ĠLocal Dao Ġ= ĠLocal Dao ( context Ġ?: Ġthrow ĠIllegalArgumentException (" context Ġis Ġnull ")) ĊĠĠĠ Ġ} Ċ } Ċ