package Ġcom . jud op ay . jud okit . android . ui . edit card . adapter Ċ Ċ import Ġandroid . animation . Object Animator Ċ import Ġandroid . animation . Value Animator Ċ import Ġandroid . content . res . Color State List Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġandroid . view . View Ċ import Ġandroidx . core . view . set Padding Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . google . android . material . shape . Corner Family Ċ import Ġcom . google . android . material . shape . Material Shape Drawable Ċ import Ġcom . google . android . material . shape . Shape Appearance Model Ċ import Ġcom . jud op ay . jud okit . android . R Ċ import Ġcom . jud op ay . jud okit . android . ui . edit card . color Res Ċ import Ġkotlinx . android . synt hetic . main . color _ picker _ item . view .* Ċ Ċ private Ġconst Ġval ĠSC ALE _ SELECTED Ġ= Ġ 1 . 4 f Ċ private Ġconst Ġval ĠSC ALE _ UN SELECTED Ġ= Ġ 1 f Ċ Ċ class ĠColor Picker ViewHolder ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view ) Ġ{ ĊĠĠĠ Ġfun Ġbind ( model : ĠColor Picker Item , Ġlistener : ĠColor Picker Adapter Listener ?) Ġ= Ġwith ( item View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcorner Radius Ġ= Ġcontext . resources . get Dimension ( R . dim en . corner _ radius _ 2 _ 8 dp ) ĊĠĠĠĠĠĠĠ Ġval Ġscale Ġ= Ġif Ġ( model . isSelected ) ĠSC ALE _ SELECTED Ġelse ĠSC ALE _ UN SELECTED ĊĠĠĠĠĠĠĠ Ġval Ġpadding Ġ= Ġif Ġ( model . isSelected ) Ġresources . get Dimension ( R . dim en . space _ 1 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. toInt () Ġelse Ġresources . get Dimension ( R . dim en . space _ 4 ). toInt () ĊĊĠĠĠĠĠĠĠ ĠValue Animator . of Int ( color Container . padding Start , Ġpadding ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Update Listener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcolor Container . set Padding ( Integer . parseInt ( it . animated Value . toString ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstart () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠObject Animator . of Float ( color Container , Ġ" scale X ", Ġscale ). start () ĊĠĠĠĠĠĠĠ ĠObject Animator . of Float ( color Container , Ġ" scale Y ", Ġscale ). start () ĊĊĠĠĠĠĠĠĠ Ġcolor Preview . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbackground Ġ= Ġdrawable With ( model . pattern . color Res ( this . context ), Ġcorner Radius ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġset OnClickListener Ġ{ Ġlistener ?. invoke ( model ) Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun Ġdrawable With ( fill Color : ĠInt , Ġcorner Radius : ĠFloat ): ĠDrawable Ġ{ ĊĠĠĠ Ġval Ġshape Model Ġ= ĠShape Appearance Model . Builder () ĊĠĠĠĠĠĠĠ Ġ. set All C orners ( Corner Family . RO UN DED , Ġcorner Radius ) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġval Ġfill Color State List Ġ= ĠColor State List ( ĊĠĠĠĠĠĠĠ ĠarrayOf ( int ArrayOf (- android . R . attr . state _ enabled )), ĊĠĠĠĠĠĠĠ Ġint ArrayOf ( fill Color ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġshape Ġ= ĠMaterial Shape Drawable ( shape Model ) ĊĠĠĠ Ġshape . fill Color Ġ= Ġfill Color State List ĊĠĠĠ Ġreturn Ġshape Ċ } Ċ