package Ġfn c . com . see king _ s hel ter . listing page Ċ Ċ import Ġandroid . support . v 4 . app . Fragment Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 7 . widget . Linear LayoutManager Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġfn c . com . see king _ s hel ter . model . Listing Data Fragment Contract Ċ import Ġfn c . com . see king _ s hel ter . R Ċ import Ġfn c . com . see king _ s hel ter . adapters . Listing Adapter Ċ import Ġfn c . com . see king _ s hel ter . extensions . change Fragment Ċ import Ġfn c . com . see king _ s hel ter . listing detail sp age . Details Fragment Ċ import Ġfn c . com . see king _ s hel ter . model . Model Ċ import Ġfn c . com . see king _ s hel ter . responses . Listing Response Ċ import Ġkotlinx . android . synt hetic . main . listing _ fragment .* Ċ Ċ class ĠListing Fragment Ġ: ĠFragment (), ĠListing Data Fragment Contract . Can Get List ings Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcity : ĠString ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġre cyclerView : ĠRecyclerView ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġview Adapter : ĠRecyclerView . Adapter < *> ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġview Manager : ĠRecyclerView . LayoutManager ĊĠĠĠ Ġprivate Ġval Ġlisting Model Ġ= ĠModel ( this ) ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġroot Ġ= Ġinflater . inflate ( R . layout . listing _ fragment , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġlisting Model . fetch All Places () ĊĠĠĠĠĠĠĠ Ġreturn Ġroot ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon List ings Loaded ( list ings : ĠList < Listing Response >) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcity List ings Ġ= Ġif Ġ( city Ġ== Ġ" Other ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlist ings . filter Ġ{ Ġit . city . isEmpty () Ġ} ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlist ings . filter Ġ{ Ġit . city Ġ== Ġcity Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġview Manager Ġ= ĠLinearLayoutManager ( context ) ĊĠĠĠĠĠĠĠ Ġview Adapter Ġ= ĠListing Adapter ( city List ings , ĠListing Adapter . ORG AN IZATION _ NAME ) Ġ{ Ġthis . change Fragment ( Details Fragment . newInstance ( it )) Ġ} ĊĊĠĠĠĠĠĠĠ Ġre cyclerView Ġ= Ġlisting _ recycler . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout Manager Ġ= Ġview Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter Ġ= Ġview Adapter ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġtitle . text Ġ= Ġcity ĊĠĠĠĠĠĠĠ Ġloading _ spinner . visibility Ġ= ĠView . GONE ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance ( city : ĠString ): ĠListing Fragment Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfragment Ġ= ĠListing Fragment () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfragment . city Ġ= Ġcity ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfragment ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }