package Ġcom . money tree . app . ui . level Member Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . ImageView Ċ import Ġandroidx . core . view . set Padding Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . money tree . app . R Ċ import Ġcom . money tree . app . common . utils . add Text Ċ import Ġcom . money tree . app . common . utils . isValid List Ċ import Ġcom . money tree . app . databinding . Layout Level Member Item Binding Ċ import Ġcom . money tree . app . databinding . Layout Member Tree Binding Ċ import Ġcom . money tree . app . repository . network . responses . NS Level Member Tree Data Ċ import Ġcom . money tree . app . repository . network . responses . NS Member Tree Data Ċ Ċ class ĠLevel Member Tree Re cycle Adapter ( ĊĠĠĠ Ġactivity NS : ĠActivity Ċ ) Ġ: ĠRecyclerView . Adapter < RecyclerView . ViewHolder >() Ġ{ ĊĠĠĠ Ġprivate Ġval Ġactivity : ĠActivity Ġ= Ġactivity NS ĊĠĠĠ Ġprivate Ġval Ġmember Data : ĠMutable List < NS Level Member Tree Data > Ġ= Ġarray ListOf () ĊĊĠĠĠ Ġfun Ġupdate Data ( member List : ĠMutable List < NS Level Member Tree Data >) Ġ{ ĊĠĠĠĠĠĠĠ Ġmember Data . addAll ( member List ) ĊĠĠĠĠĠĠĠ Ġif Ġ( member List . isValid List ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotify Item Range Changed ( 0 , Ġmember Data . size Ġ- Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġclear Data () Ġ{ ĊĠĠĠĠĠĠĠ Ġmember Data . clear () ĊĠĠĠĠĠĠĠ Ġnotify DataSet Changed () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠRecyclerView . ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmember View Ġ= ĠLayout Level Member Item Binding . inflate ( LayoutInflater . from ( parent . context ), Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn ĠNS Member Tree ViewHolder ( member View ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder Rec : ĠRecyclerView . ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( holder Rec Ġis ĠNS Member Tree ViewHolder ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġholder : ĠNS Member Tree ViewHolder Ġ= Ġholder Rec ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . bind ( member Data [ holder . absolute Adapter Position ]) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġmember Data . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠThe Ġview Ġholder Ġfor Ġmember Ġtree Ġlist ĊĠĠĠĠ Ġ* ĊĠĠĠĠ Ġ* Ġ@ property Ġv oucher Binding ĠThe Ġmember Ġtree Ġlist Ġview Ġbinding ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġinner Ġclass ĠNS Member Tree ViewHolder ( private Ġval Ġv oucher Binding : ĠLayout Level Member Item Binding ) Ġ: ĊĠĠĠĠĠĠĠ ĠRecyclerView . ViewHolder ( voucher Binding . root ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ/** ĊĠĠĠĠĠĠĠĠ Ġ* ĠTo Ġbind Ġthe Ġmember Ġtree Ġdetails Ġview Ġinto ĠRe cycler Ġview Ġwith Ġgiven Ġdata ĊĠĠĠĠĠĠĠĠ Ġ* ĊĠĠĠĠĠĠĠĠ Ġ* Ġ@ param Ġresponse ĠThe Ġmember Ġtree Ġdetails ĊĠĠĠĠĠĠĠĠ Ġ*/ ĊĠĠĠĠĠĠĠ Ġfun Ġbind ( response : ĠNS Level Member Tree Data ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwith ( voucher Binding ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwith ( response ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtv Level No . text Ġ= Ġadd Text ( activity , ĠR . string . level _ no , Ġlevel No !! ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtv Active Member . text Ġ= Ġadd Text ( activity , ĠR . string . active _ members , Ġcnt !! ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtv Direct . text Ġ= Ġadd Text ( activity , ĠR . string . direct , Ġrep Total . toString ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtv Rep urchase . text Ġ= Ġadd Text ( activity , ĠR . string . rep urchase _ data , Ġrep urchase . toString ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }