package Ġcom . fr ans isco . catalog movie kotlin . ui . trend ing Ċ Ċ import Ġandroid . arch . lifecycle . Mutable LiveData Ċ import Ġandroid . databinding . Observable ArrayList Ċ import Ġandroid . util . Log Ċ import Ġcom . fr ans isco . catalog movie kotlin . data . DataManager Ċ import Ġcom . fr ans isco . catalog movie kotlin . data . model . Movie Ċ import Ġcom . fr ans isco . catalog movie kotlin . ui . base . Base ViewModel Ċ import Ġcom . fr ans isco . catalog movie kotlin . utils . Scheduler Provider Ċ Ċ class ĠT rend ing ViewModel Ġconstructor ( data Manager : ĠData Manager , Ġscheduler Provider : ĠScheduler Provider ) Ġ: ĠBase ViewModel < Trend ing Navigator >( data Manager Ġ= Ġdata Manager , Ġscheduler Provider Ġ= Ġscheduler Provider ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġnow Playing Movie Obs ArrayList Ġ= ĠObservable ArrayList < Movie >() ĊĊĠĠĠ Ġprivate Ġval Ġnow Playing Movie LiveData : ĠMutable LiveData < List < Movie >> Ġ= ĠMutable LiveData () ĊĊĠĠĠ Ġfun Ġfetch Now Playing () Ġ{ ĊĠĠĠĠĠĠĠ Ġcomposite Disposable . add ( data Manager . get Movie Now Playing Api Call () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. compose ( scheduler Provider . io To Main Single Scheduler ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . i ( Trend ing Fragment . TAG , Ġit . results ?. size . toString ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnow Playing Movie LiveData . value Ġ= Ġit . results ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . e ( Trend ing Fragment . TAG , Ġit . message ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ})) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Now Playing Movie List LiveData (): ĠMutable LiveData < List < Movie >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġnow Playing Movie LiveData ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Now Playing Movie Obs ArrayList (): ĠObservable ArrayList < Movie > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġnow Playing Movie Obs ArrayList ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġadd Now Playing Movie Items ToList ( movies : ĠList < Movie >) Ġ{ ĊĠĠĠĠĠĠĠ Ġnow Playing Movie Obs ArrayList . clear () ĊĠĠĠĠĠĠĠ Ġnow Playing Movie Obs ArrayList . addAll ( movies ) ĊĠĠĠ Ġ} Ċ }