package Ġjp . co . sor am its u . feature _ account _ impl . presentation . account . edit Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . view . Motion Event Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . Item Touch Helper Ċ import Ġandroidx . recyclerview . widget . ListAdapter Ċ import Ġjp . co . sor am its u . common . list . Group edList Holder Ċ import Ġjp . co . sor am its u . common . utils . inflate Child Ċ import Ġjp . co . sor am its u . feature _ account _ impl . R Ċ import Ġjp . co . sor am its u . feature _ account _ impl . presentation . account . Light Meta Account Diff Callback Ċ import Ġjp . co . sor am its u . feature _ account _ impl . presentation . account . model . Light Meta Account Ui Ċ import Ġkotlinx . android . synt hetic . main . item _ edit _ account . view . account Delete Ċ import Ġkotlinx . android . synt hetic . main . item _ edit _ account . view . account Drag Ċ import Ġkotlinx . android . synt hetic . main . item _ edit _ account . view . account Icon Ċ import Ġkotlinx . android . synt hetic . main . item _ edit _ account . view . account Title Ċ Ċ class ĠEdit Accounts Adapter ( ĊĠĠĠ Ġprivate Ġval Ġaccount Item Handler : ĠEdit Account Item Handler , ĊĠĠĠ Ġprivate Ġval Ġdrag Helper : ĠItem Touch Helper Ċ ) Ġ: ĠList Adapter < Light Meta Account Ui , ĠEdit Account Holder >( Light Meta Account Diff Callback ) Ġ{ ĊĊĠĠĠ Ġinterface ĠEdit Account Item Handler Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġdelete Clicked ( account Model : ĠLight Meta Account Ui ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠEdit Account Holder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠEdit Account Holder ( parent . inflate Child ( R . layout . item _ edit _ account ), Ġdrag Helper ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠEdit Account Holder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( getItem ( position ), Ġaccount Item Handler ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ @ Suppress Lint (" Click ableView Accessibility ") Ċ class ĠEdit Account Holder ( view : ĠView , Ġdrag Helper : ĠItem Touch Helper ) Ġ: ĠGroup edList Holder ( view ) Ġ{ ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġcontainer View . account Drag . setOn Touch Listener Ġ{ Ġ_, Ġevent Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( event . action Ġ== ĠMotion Event . ACTION _ DOWN ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdrag Helper . start Drag ( this ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġfalse ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġbind ( ĊĠĠĠĠĠĠĠ Ġaccount Model : ĠLight Meta Account Ui , ĊĠĠĠĠĠĠĠ Ġhandler : ĠEdit Accounts Adapter . Edit Account Item Handler ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( container View ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġaccount Title . text Ġ= Ġaccount Model . name ĊĠĠĠĠĠĠĠĠĠĠĠ Ġaccount Icon . setImage Drawable ( account Model . picture . value ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġicon Res Ġ= Ġif Ġ( account Model . isSelected ) ĠR . drawable . ic _ check mark _ white _ 2 4 Ġelse ĠR . drawable . ic _ delete _ symbol ĊĠĠĠĠĠĠĠĠĠĠĠ Ġaccount Delete . setImage Resource ( icon Res ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġaccount Delete . setOnClickListener Ġ{ Ġhandler . delete Clicked ( account Model ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ