package Ġcom . id an atz . one adapter . internal . holders Ċ Ċ import Ġandroid . animation . Animator Ċ import Ġandroid . graphics . Canvas Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . annotation . Layout Res Ċ import Ġcom . id an atz . one adapter . external . event _ hooks . Event Hooks Map Ċ import Ġcom . id an atz . one adapter . external . event _ hooks . Swipe Event Hook Ċ import Ġcom . id an atz . one adapter . external . interfaces . Diff able Ċ import Ġcom . id an atz . one adapter . internal . selection . One Item Detail Ċ import Ġcom . id an atz . one adapter . external . states . States Map Ċ import Ġcom . id an atz . one adapter . internal . utils . extensions . inflate Layout Ċ Ċ internal Ġabstract Ġclass ĠOne ViewHolder < M Ġ: ĠDiff able >( Ċĉ ĉ parent : ĠViewGroup , Ċĉ ĉ @ Layout Res Ġlayout ResourceId : ĠInt , Ċĉ ĉ first Bind Animation : ĠAn imator ? Ġ= Ġnull , Ċĉ ĉ val Ġstates Hooks Map : ĠStates Map < M >? Ġ= Ġnull , Ġ// ĠNot Ġall ĠView Hold ers Ġwill Ġhave Ġstates Ġconfigured Ċĉ ĉ val Ġevents Hooks Map : ĠEvent Hooks Map < M >? Ġ= Ġnull Ġ// ĠNot Ġall ĠView Hold ers Ġwill Ġhave Ġevents Ġconfigured Ċ ) Ġ: ĠRecyclerView . ViewHolder ( parent . context . inflate Layout ( layout ResourceId , Ġparent , Ġfalse )) Ġ{ ĊĊ ĉ late init Ġvar Ġview Binder : ĠView Binder Ċ ĉ late init Ġvar Ġmetadata : ĠMetadata Ċ ĉ late init Ġvar Ġmodel : ĠM ĊĊ ĉ val Ġfirst Bind Animation : ĠAn imator ? Ġ= Ġfirst Bind Animation ?. clone () ĊĊ ĉ // Ġinternal Ġflags Ċ ĉ var Ġis Sw ip ing Ġ= Ġfalse ĊĊ ĉ abstract Ġfun Ġon Created () Ċ ĉ abstract Ġfun Ġon Bind ( model : ĠM ) Ċ ĉ abstract Ġfun Ġon Un bind ( model : ĠM ) Ċ ĉ abstract Ġfun ĠonClick ed ( model : ĠM ) Ċ ĉ abstract Ġfun Ġon Swipe ( canvas : ĠCanvas , Ġx Axis Offset : ĠFloat ) Ċ ĉ abstract Ġfun Ġon Swipe Complete ( model : ĠM , Ġswipe Direction : ĠSw ipe Event Hook . Swipe Direction ) Ċ ĉ abstract Ġfun Ġon Selected ( model : ĠM , Ġselected : ĠBoolean ) ĊĊ ĉ fun ĠonCreate ViewHolder () Ġ{ Ċĉ ĉ this . view Binder Ġ= ĠView Binder ( item View ) Ċĉ ĉ handle Event Hooks () Ċĉ ĉ on Created () Ċ ĉ } ĊĊ ĉ fun Ġon Bind ViewHolder ( model : ĠM , Ġ Ġmetadata : ĠMetadata ) Ġ{ Ċĉ ĉ this . model Ġ= Ġmodel Ċĉ ĉ this . metadata Ġ= Ġmetadata ĊĊĉ ĉ handle Animations () Ċĉ ĉ on Bind ( model ) Ċ ĉ } ĊĊ ĉ fun Ġon Bind Selection ( model : ĠM , Ġselected : ĠBoolean ) Ġ{ Ċĉ ĉ if Ġ( states Hooks Map ?. is Selection State Configured () Ġ== Ġtrue ) Ġ{ Ċĉĉ ĉ metadata Ġ= Ġmetadata . copy ( Ċĉĉĉĉ ĉ selection Metadata Ġ= Ġobject Ġ: ĠSelection Metadata Ġ{ Ċĉĉĉĉĉ ĉ override Ġval Ġis Selected : ĠBoolean Ġ= Ġselected Ċĉĉĉĉ ĉ } Ċĉĉ ĉ ) Ċĉĉ ĉ on Selected ( model , Ġselected ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ fun Ġcreate Item Lookup Information (): ĠOne Item Detail ? Ġ{ Ċĉ ĉ if Ġ( is Sw ip ing ) Ġ// Ġwhile Ġsw ip ing Ġdisable Ġthe Ġoption Ġto Ġselect Ċĉĉ ĉ return Ġnull ĊĊĉ ĉ return Ġstates Hooks Map ?. getSelection State ()?. config ?. let Ġ{ Ġselection State Config Ġ-> Ċĉĉ ĉ if Ġ( selection State Config . enabled ) ĠOne Item Detail ( adapter Position , ĠitemId , Ġselection State Config . selection Trigger ) Ċĉĉ ĉ else Ġnull Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ fun Ġon Swipe ViewHolder ( canvas : ĠCanvas , Ġx Axis Offset : ĠFloat ) Ġ{ Ċĉ ĉ on Swipe ( canvas , Ġx Axis Offset ) Ċ ĉ } ĊĊ ĉ fun Ġon Swipe ViewHolder Complete ( swipe Direction : ĠSw ipe Event Hook . Swipe Direction ) Ġ{ Ċĉ ĉ if Ġ( events Hooks Map ?. is Swipe Event Hook Configured () Ġ== Ġtrue ) Ġ{ Ċĉĉ ĉ metadata Ġ= Ġmetadata . copy ( Ċĉĉĉĉ ĉ swipe Metadata Ġ= Ġobject Ġ: ĠSw ipe Metadata Ġ{ Ċĉĉĉĉĉ ĉ override Ġval Ġswipe Direction : ĠSw ipe Event Hook . Swipe Direction Ġ= Ġswipe Direction Ċĉĉĉĉ ĉ } Ċĉĉ ĉ ) Ċĉĉ ĉ on Swipe Complete ( model , Ġswipe Direction ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġhandle Animations () Ġ{ Ċĉ ĉ if Ġ( metadata . is Anim ating ) Ġ{ Ċĉĉ ĉ first Bind Animation ?. setTarget ( item View ) Ċĉĉ ĉ first Bind Animation ?. start () Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ first Bind Animation ?. end () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġhandle Event Hooks () Ġ{ Ċĉ ĉ if Ġ( events Hooks Map ?. is Click Event Hook Configured () Ġ== Ġtrue ) Ġ{ Ċĉĉ ĉ item View . setOnClickListener Ġ{ Ċĉĉĉ ĉ if Ġ( metadata . position Ġ!= ĠRecyclerView . NO _ POSITION ) Ġ{ Ċĉĉĉĉ ĉ on Clicked ( model ) Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ }