package Ġcom . dark piv . android nv p . ui . home Ċ Ċ import Ġandroid . graphics . Color Ċ import Ġandroid . graphics . drawable . Gradient Drawable Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . dark piv . android nv p . model . S quad Ċ import Ġkotlinx . android . synt hetic . main . item _ s quad . view .* ĊĊ Ċ class ĠList S quad Adapter ( private Ġval Ġitems : ĠMutable List < S quad > Ġ= Ġmutable ListOf ()) Ġ: ĠRecyclerView . Adapter < List S quad Holder >() Ġ{ ĊĠ Ġoverride Ġfun Ġset Has Stable Ids ( has Stable Ids : ĠBoolean ) Ġ{ ĊĠĠĠ Ġsuper . set Has Stable Ids ( true ) ĊĠ Ġ} ĊĊĠ Ġfun Ġrefresh Data ( data : ĠList < S quad >) Ġ{ ĊĠĠĠ Ġthis . items . clear () ĊĠĠĠ Ġthis . items . addAll ( data ) ĊĠĠĠ Ġnotify DataSet Changed () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠList S quad Holder Ġ{ ĊĠĠĠ Ġreturn ĠList S quad Holder ( LayoutInflater . from ( parent . context ). inflate ( com . dark piv . android nv p . R . layout . item _ s quad , Ġparent , Ġfalse )) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠ Ġreturn Ġitems . size ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠList S quad Holder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠ Ġval Ġdata Ġ= Ġitems [ position ] ĊĠĠĠ Ġholder . item View . s quad Name . text Ġ= Ġdata . name ĊĠĠĠ Ġholder . item View . total Tasks . text Ġ= Ġ" Total Ġtasks : Ġ${ data . total Tasks }" ĊĠĠĠ Ġwhen Ġ( data . expert ise Roles ?. size ) Ġ{ ĊĠĠĠĠĠ Ġnull , Ġ 0 Ġ-> Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 1 . visibility Ġ= ĠView . IN VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 2 . visibility Ġ= ĠView . IN VISIBLE ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠ 1 Ġ-> Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 1 . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 2 . visibility Ġ= ĠView . IN VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 1 . text Ġ= Ġdata . expert ise Roles ! ![ 0 ]. short Name ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġelse Ġ-> Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 1 . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 2 . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 1 . text Ġ= Ġdata . expert ise Roles ! ![ 0 ]. short Name ĊĠĠĠĠĠĠĠ Ġholder . item View . expert ise Role 2 . text Ġ= Ġdata . expert ise Roles ! ![ 1 ]. short Name ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġholder . item View . expert ise Role 1 . background Ġ= Ġget Gradient Drawable () ĊĠĠĠ Ġholder . item View . expert ise Role 2 . background Ġ= Ġget Gradient Drawable () ĊĊĠ Ġ} Ċ } Ċ Ċ fun Ġget Gradient Drawable (): ĠGradient Drawable Ġ{ ĊĠ Ġval Ġdraw Ġ= ĠGradient Drawable () ĊĠ Ġdraw . shape Ġ= ĠGradient Drawable . RECT ANGLE ĊĠ Ġdraw . setColor ( Color . parse Color ( colors . random ())) ĊĠ Ġdraw . corner Radius Ġ= Ġ 3 0 F ĊĠ Ġreturn Ġdraw Ċ } Ċ Ċ val Ġcolors Ġ= Ġmutable ListOf < String > ("# 5 E 9 7 F 6 ", Ġ"# 9 CCC 6 5 ", Ġ"# FF 8 A 6 5 ", Ġ"# 9 E 9 E 9 E ", Ġ"# BA 6 8 C 8 ") Ċ Ċ class ĠList S quad Holder ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view )