package Ġcom . mo kel ab . demo . sam collection Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . mo kel ab . demo . binding . Binding Fragment Ċ import Ġcom . mo kel ab . demo . sam collection . databinding . Main Fragment Binding Ċ import Ġcom . mo kel ab . demo . sam collection . databinding . Menu List Fragment Binding Ċ Ċ abstract Ġclass ĠMenu List Fragment Ġ: ĠBinding Fragment < Menu List Fragment Binding >() Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġre cycler : ĠRecyclerView ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġadapter : ĠMenu ListAdapter ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewData Binding ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠMenu List Fragment Binding Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbinding Ġ= ĠMenu List Fragment Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĊĠĠĠĠĠĠĠ Ġthis . adapter Ġ= ĠMenu ListAdapter ( context !! , Ġthis . listener ) ĊĠĠĠĠĠĠĠ Ġthis . adapter . submit List ( this . onCreate Menu Label ()) ĊĊĠĠĠĠĠĠĠ Ġthis . recycler Ġ= Ġbinding . recycler ĊĠĠĠĠĠĠĠ Ġthis . recycler . layout Manager Ġ= ĠLinearLayoutManager ( context , ĠLinearLayoutManager . VERTICAL , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġthis . recycler . adapter Ġ= Ġthis . adapter ĊĊĠĠĠĠĠĠĠ Ġreturn Ġbinding ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġlistener Ġ= Ġ ĠView . OnClickListener Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġposition Ġ= Ġthis . recycler . getChild Adapter Position ( it ) ĊĠĠĠĠĠĠĠ Ġthis . on MenuItem Clicked ( position ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġabstract Ġfun ĠonCreate Menu Label (): ĠList < String > ĊĊĠĠĠ Ġabstract Ġfun Ġon MenuItem Clicked ( position : ĠInt ) Ċ Ċ }