package Ġme . yk rank . s 1 next . view . adapter . delegate Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . databinding . Data Binding Util Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . github . yk rank . android tools . widget . Rx Bus Ċ import Ġme . yk rank . s 1 next . App Ċ import Ġme . yk rank . s 1 next . R Ċ import Ġme . yk rank . s 1 next . data . api . model . F avour ite Ċ import Ġme . yk rank . s 1 next . databinding . Item F avour ite Binding Ċ import Ġme . yk rank . s 1 next . view model . F avour ite ViewModel Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠF avour ite Adapter Delegate ( context : ĠContext ) Ġ: ĠBase Adapter Delegate < F avour ite , ĠF avour ite Adapter Delegate . Binding ViewHolder >( context , ĠF avour ite :: class . java ) Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġm Rx Bus : ĠRx Bus ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠApp . app Component . inject ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġpublic Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup ): ĠRecyclerView . ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbinding Ġ= ĠData Binding Util . inflate < Item F avour ite Binding >( m LayoutInflater , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . layout . item _ fav our ite , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġbinding . model Ġ= ĠF avour ite ViewModel () ĊĠĠĠĠĠĠĠ Ġbinding . rx Bus Ġ= Ġm Rx Bus ĊĠĠĠĠĠĠĠ Ġreturn ĠBinding ViewHolder ( binding ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder Data ( t : ĠF avour ite , Ġposition : ĠInt , Ġholder : ĠBinding ViewHolder , Ġpayload s : ĠList < Any >) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbinding Ġ= Ġholder . item F avour ite Binding ĊĠĠĠĠĠĠĠ Ġbinding . model ?. fav our ite ?. set ( t ) ĊĠĠĠĠĠĠĠ Ġbinding . execute Pending Bindings () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠBinding ViewHolder ( val Ġitem F avour ite Binding : ĠItem F avour ite Binding ) Ġ: ĠRecyclerView . ViewHolder ( item F avour ite Binding . root ) Ċ } Ċ