package Ġcom . example . t mdb demo . ui . dashboard Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcom . example . t mdb demo . R Ċ import Ġcom . example . t mdb demo . data . models . response . Results Item Ċ import Ġcom . example . t mdb demo . di . components . Activity Component Ċ import Ġcom . example . t mdb demo . ui . base . Base Activity Ċ import Ġcom . example . t mdb demo . ui . search . Search Activity Ċ import Ġkotlinx . android . synt hetic . main . activity _ dash _ board .* Ċ Ċ class ĠDash Board Activity Ġ: ĠBase Activity < Dash Board ViewModel >() Ġ{ ĊĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcarousel Adapter : ĠCar ousel Adapter ĊĠĠĠ Ġval Ġtrend ing List Ġ= ĠArrayList < Results Item >() ĊĊĊĠĠĠ Ġoverride Ġfun Ġinject Dependency ( component : ĠActivity Component ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcomponent . inject Activity ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġsetup Views ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġadd View Listeners () ĊĠĠĠĠĠĠĠ Ġcarousel Adapter Ġ= ĠCar ousel Adapter ( this , Ġtrend ing List ) ĊĠĠĠĠĠĠĠ Ġrv Trend . set Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠ Ġrv Trend . layout Manager Ġ= ĠLinearLayoutManager ( this , Linear LayoutManager . HORIZONTAL , false ) ĊĠĠĠĠĠĠĠ Ġrv Trend . adapter Ġ= Ġcarousel Adapter ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġadd View Listeners () Ġ{ ĊĠĠĠĠĠĠĠ Ġcv Search . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( this , ĠSearch Activity :: class . java )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Layout Resource (): ĠInt Ġ= ĠR . layout . activity _ dash _ board ĊĊĠĠĠ Ġoverride Ġfun Ġsetup Observer s () Ġ{ ĊĊĠĠĠĠĠĠĠ ĠviewModel . get Trend ing Data (). observe ( this , ĠObserver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtrend ing List . addAll ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcarousel Adapter . notify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} Ċ } Ċ