package Ġcom . kat ana . mv vm . data . local Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . kat ana . mv vm . model . Student Ċ import Ġio . reactivex . Observable Ċ import Ġjavax . inject . Inject Ċ import Ġjavax . inject . Singleton Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠK az Ġon Ġ 1 1 : 3 6 Ġ 2 0 1 8 - 1 2 - 1 8 Ċ Ġ*/ Ċ @ Singleton Ċ class ĠApp Db Helper Ġ@ Inject Ġconstructor ( private Ġval Ġapp Database : ĠApp Database ) Ġ: ĠDb Helper Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll Student (): ĠLive Data < List < Student >> Ġ= Ġapp Database . student Dao (). getAll Student () ĊĊĠĠĠ Ġoverride Ġfun Ġinsert Student ( student : ĠStudent ): ĠObservable < Long > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠObservable . from Callable Ġ{ Ġapp Database . student Dao (). insert Student ( student ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdelete Student ( student : ĠStudent ): ĠObservable < Boolean > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠObservable . from Callable Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġapp Database . student Dao (). delete Student ( student ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ċ }