package Ġcom . y ves ch ion g . macro fit . present ers Ċ Ċ import Ġcom . y ves ch ion g . macro fit . bus . EventBus Ċ import Ġcom . y ves ch ion g . macro fit . bus . events . Update Events Ċ import Ġcom . y ves ch ion g . macro fit . contracts . N utr ition Fact s View Contract Ċ import Ġcom . y ves ch ion g . macro fit . models . N utr ition Fact Ċ import Ġcom . y ves ch ion g . macro fit . repositories . N utr ition Fact s Repository Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠN utr ition Fact s List Presenter < V Ġ: ĠN utr ition Fact s View Contract . View > Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġbus : ĠEvent Bus , ĊĠĠĠ Ġprivate Ġval Ġn utr ition Fact s Repository : ĠN utr ition Fact s Repository Ċ ) Ġ: ĠRoot Presenter < V >(), ĠN utr ition Fact s View Contract . Presenter < V > Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġon Attach ( view : ĠV ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Attach ( view ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠFor Ġnow , Ġthe Ġadd , Ġedit , Ġand Ġdelete Ġevents Ġwill Ġjust Ġcause ĊĠĠĠĠĠĠĠ Ġ// Ġa Ġcomplete Ġfetch Ġof Ġthe Ġn utr ition Ġfacts Ġtable ĊĠĠĠĠĠĠĠ Ġbus . listen < Update Events . Added N utr ition Fact Event >(). handle N utr ition Fact Event () ĊĠĠĠĠĠĠĠ Ġbus . listen < Update Events . Edited N utr ition Fact Event >(). handle N utr ition Fact Event () ĊĠĠĠĠĠĠĠ Ġbus . listen < Update Events . Deleted N utr ition Fact Event >(). handle N utr ition Fact Event () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠHandles Ġany Ġsimilar Ġprocesses ĊĠĠĠ Ġprivate Ġfun ĠObservable < out ĠUpdate Events . N utr ition Fact Event >. handle N utr ition Fact Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġcall Ġ{ Ġfetch N utr ition () Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġfetch N utr ition () Ġ{ ĊĠĠĠĠĠĠĠ Ġn utr ition Fact s Repository . getN utr ition Fact s () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe Ġ{ Ġview ?. show N utr ition ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo Dis pos ables () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Card Clicked ( nut r ition Fact : ĠN utr ition Fact ) Ġ{ ĊĠĠĠĠĠĠĠ Ġview ?. show Edit N utr ition Fact Activity ( nut r ition Fact ) ĊĠĠĠ Ġ} Ċ } Ċ