package Ġcom . app . v itr in ova app . ui . main . products _ detail Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroid . view . View Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . app . v itr in ova app . R Ċ import Ġcom . app . v itr in ova app . data . model . discover . Product Ċ import Ġcom . app . v itr in ova app . databinding . Fragment Product Detail Binding Ċ import Ġcom . app . v itr in ova app . ui . main . MainActivity Ċ Ċ class ĠProducts Detail Fragment ( private Ġval Ġtoolbar Title : ĠString , Ġprivate Ġval Ġproducts : ĠList < Product >) Ġ: ĠFragment ( R . layout . fragment _ product _ detail ) Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġproducts Detail Adapter : ĠProducts Detail Adapter ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠFragment Product Detail Binding ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠFragment Product Detail Binding . bind ( view ) ĊĊĠĠĠĠĠĠĠ Ġinit View () ĊĠĠĠĠĠĠĠ Ġinit Click () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit View () Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Title . text = toolbar Title ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproducts Detail Adapter Ġ= ĠProducts Detail Adapter ( products ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġre cyclerView Products . layout Manager Ġ= ĠLinearLayoutManager ( require Context (), RecyclerView . VERTICAL , false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġre cyclerView Products . adapter = products Detail Adapter ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Click (){ ĊĠĠĠĠĠĠĠ Ġbinding . run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbtn Back . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( activity Ġas ĠMainActivity ). on Back Pressed () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }