package Ġcom . android training . personal r utine app . data Base Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . room . Database Ċ import Ġandroidx . room . Room Ċ import Ġandroidx . room . Room Database Ċ import Ġandroidx . room . Type Converters Ċ import Ġcom . android training . personal r utine app . converter . Date Type Converter Ċ import Ġcom . android training . personal r utine app . converter . List Converter Ċ import Ġcom . android training . personal r utine app . dao .* Ċ import Ġcom . android training . personal r utine app . entity . Exercise Ċ import Ġcom . android training . personal r utine app . entity . Gender Ċ import Ġcom . android training . personal r utine app . entity . Routine Ċ import Ġcom . android training . personal r utine app . entity . Tra ine e Ċ Ċ @ Database ( entities Ġ= Ġ[ Exercise :: class , ĠGender :: class , ĠRout ine :: class , ĠTra ine e :: class ], Ġversion Ġ= Ġ 1 ) Ċ @ Type Converters ( Date Type Converter :: class , ĠList Converter :: class ) Ċ abstract Ġclass ĠApp Database Ġ: ĠRoom Database () Ġ{ ĊĠĠĠ Ġabstract Ġfun Ġexercise Dao (): ĠExercise Dao ĊĠĠĠ Ġabstract Ġfun Ġgender Dao (): ĠGender Dao ĊĠĠĠ Ġabstract Ġfun Ġroutine Dao (): ĠRout ine Dao ĊĠĠĠ Ġabstract Ġfun Ġtra ine e Dao (): ĠTra ine e Dao ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġvar ĠINSTANCE : ĠApp Database ? Ġ= Ġnull ĊĊĠĠĠĠĠĠĠ Ġfun Ġget AppData Base ( context : ĠContext ): ĠApp Database ? Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( INSTANCE Ġ== Ġnull ){ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsynchronized ( App Database :: class ){ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠINSTANCE Ġ= ĠRoom . database Builder ( context . application Context , ĠApp Database :: class . java , Ġ" my DB "). build () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠINSTANCE ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġfun Ġdestroy Data Base (){ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠINSTANCE Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }