package Ġfa ith . ch ang li u . ord a Ċ Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġfa ith . ch ang li u . base . data . models . Request Ċ import Ġfa ith . ch ang li u . base . utils . sn ack Confirm Ċ import Ġkotlinx . android . synt hetic . main . cell _ order . view .* Ċ Ċ class ĠRequests Adapter ( Ċĉ ĉ var Ġrequests : ĠArrayList < Request >, Ċĉ ĉ private Ġval ĠonUpdate : Ġ( Request ) Ġ-> ĠUnit , Ċĉ ĉ private Ġval ĠonDelete : Ġ( Request ) Ġ-> ĠUnit , Ċĉ ĉ private Ġval ĠonClick : Ġ( Request ) Ġ-> ĠUnit Ċ ) Ġ: ĠRecyclerView . Adapter < Requests Adapter . ViewHolder >() Ġ{ ĊĊ ĉ override Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠViewHolder Ġ{ Ċĉ ĉ val Ġview Ġ= ĠLayoutInflater . from ( parent . context ). inflate ( R . layout . cell _ request , Ġparent , Ġfalse ) Ċĉ ĉ return ĠViewHolder ( view ) Ċ ĉ } ĊĊ ĉ override Ġfun ĠgetItem Count (): ĠInt Ġ{ Ċĉ ĉ return Ġrequests . size Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder , Ġposition : ĠInt ) Ġ{ Ċĉ ĉ holder . bind ( requests [ position ]) Ċ ĉ } ĊĊ ĉ inner Ġclass ĠViewHolder ( v : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( v ) Ġ{ ĊĊĉ ĉ fun Ġbind ( request : ĠRequest ) Ġ{ Ċĉĉ ĉ item View . apply Ġ{ Ċĉĉĉ ĉ m Tv Title . text Ġ= Ġrequest . title Ċĉĉĉ ĉ m Tv Memo . text Ġ= Ġrequest . description Ċĉĉĉ ĉ m Btn Delete . setOnClickListener Ġ{ Ċĉĉĉĉ ĉ sn ack Confirm ( it , Ġ" Confirm Ġto Ġdelete ") Ġ{ Ċĉĉĉĉĉ ĉ onDelete ( request ) Ċĉĉĉĉ ĉ } Ċĉĉĉ ĉ } Ċĉĉĉ ĉ m Btn Edit . setOnClickListener Ġ{ Ċĉĉĉĉ ĉ on Update ( request ) Ċĉĉĉ ĉ } Ċĉĉĉ ĉ m Cell View . setOnClickListener Ġ{ Ċĉĉĉĉ ĉ onClick ( request ) Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ }