package Ġcom . j uv etic . calc io . ui . last event ĊĊ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . j uv etic . calc io . R Ċ import Ġcom . j uv etic . calc io . core . contract . League Contract Ċ import Ġcom . j uv etic . calc io . core . presenter . past event . Past Event Interactor Ċ import Ġcom . j uv etic . calc io . core . presenter . past event . Past Event Presenter Ċ import Ġcom . j uv etic . calc io . model . event . Event Ċ import Ġcom . j uv etic . calc io . model . event . Event Result Ċ import Ġcom . j uv etic . calc io . ui . event detail . Event Detail Activity Ċ import Ġcom . j uv etic . calc io . ui . event detail . Event Detail Fragment Ċ import Ġcom . j uv etic . calc io . ui . league detail . League Detail Fragment Ċ import Ġcom . j uv etic . calc io . ui . league detail . League Detail Fragment . Companion . LE AG UE _ ID Ċ import Ġcom . j uv etic . calc io . utils . Event Detail ClickListener Ċ import Ġorg . jetbrains . ank o . An ko Logger Ċ import Ġorg . jetbrains . ank o . debug Ċ import Ġorg . jetbrains . ank o . info Ċ import Ġorg . jetbrains . ank o . support . v 4 . startActivity Ċ import Ġorg . jetbrains . ank o . support . v 4 . toast Ċ Ċ class ĠLast Events Fragment Ġ: ĠFragment (), ĠLeague Contract < Event >, ĠAn ko Logger , ĠEvent Detail ClickListener Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġle ague Id : ĠString ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġpresenter : ĠP ast Event Presenter ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġr cv Last Event : ĠRecyclerView ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance ( id : ĠString ): ĠLast Events Fragment Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlast Event Fragment Ġ= ĠLast Events Fragment () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbundle Ġ= ĠBundle () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbundle . putString ( LE AG UE _ ID , Ġid ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlast Event Fragment . arguments Ġ= Ġbundle ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġlast Event Fragment ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinflater . inflate ( R . layout . fragment _ last _ events , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġr cv Last Event Ġ= Ġview . findViewById ( R . id . rcv _ last _ event ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( arguments Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġle ague Id Ġ= Ġarguments ?. getString ( League Detail Fragment . LE AG UE _ ID ) !! ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpresenter Ġ= ĠP ast Event Presenter ( this , ĠP ast Event Interactor ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpresenter . getEvent Detail ( league Id ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon GetData Success ( data : ĠEvent ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġinfo (" Success Ġpast Ġevent ") ĊĠĠĠĠĠĠĠ Ġdata ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult : ĠList < Event Result > Ġ= Ġit . events ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlast Event Adapter : ĠLast Event Adapter ? Ġ= Ġcontext ?. let Ġ{ Ġit 1 Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLast Event Adapter ( it 1 , Ġresult , Ġthis ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġr cv Last Event . adapter Ġ= Ġlast Event Adapter ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlinear LayoutManager Ġ= ĠLinearLayoutManager ( activity ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġr cv Last Event . layout Manager Ġ= Ġlinear LayoutManager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġr cv Last Event . addItem Decoration ( Divider Item Decoration ( rcv Last Event . context , Ġlinear LayoutManager . orientation )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon GetData Failed ( message : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity ?. run On Ui Thread Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdebug (" Error Ġ$ message ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtoast (" Request Ġtimeout , Ġplease Ġtry Ġagain ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactivity ?. on Back Pressed () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Event Detail Click ( eventId : ĠString ?) Ġ{ ĊĠĠĠĠĠĠĠ ĠstartActivity < Event Detail Activity >( Event Detail Fragment . EVENT _ ID Ġto Ġevent Id ) ĊĠĠĠ Ġ} Ċ } Ċ