package Ġcommon . recycler Ċ Ċ import Ġandroid . support . v 7 . widget . Default Item Animator Ċ import Ġandroid . support . v 7 . widget . Grid LayoutManager Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ Ċ fun Ġ< VH Ġ: ĠRecyclerView . ViewHolder , ĠL M Ġ: ĠRecyclerView . LayoutManager , ĠA Ġ: ĠRecyclerView . Adapter < VH >> ĊĠĠĠ Ġmk Recycler ( re cyclerView : ĠRecyclerView , Ġlayout Manager : ĠL M , Ġadapter : ĠA ): ĠPair < LM , ĠA > Ġ= ĊĠĠĠ Ġre cyclerView . let Ġ{ ĊĠĠĠĠĠ Ġit . set Has Fixed Size ( true ) ĊĠĠĠĠĠ Ġit . item Animator Ġ= ĠDefault Item Animator () ĊĠĠĠĠĠ Ġit . layout Manager Ġ= Ġlayout Manager ĊĠĠĠĠĠ Ġit . adapter Ġ= Ġadapter ĊĠĠĠĠĠ Ġreturn ĠPair ( layout Manager , Ġadapter ) ĊĠĠĠ Ġ} Ċ Ċ fun Ġ< VH Ġ: ĠRecyclerView . ViewHolder , ĠA Ġ: ĠRecyclerView . Adapter < VH >> ĠA . stable Ids (): ĠA Ġ= ĊĠĠĠ Ġapply Ġ{ Ġset Has Stable Ids ( true ) Ġ} Ċ Ċ inline Ġfun Ġfrom ( cross inline Ġf : Ġ( Int ) Ġ-> ĠInt ): ĠGrid LayoutManager . Span Size Lookup Ġ= ĊĠĠĠ Ġobject Ġ: ĠGrid LayoutManager . Span Size Lookup () Ġ{ ĊĠĠĠĠĠ Ġoverride Ġfun Ġget Span Size ( position : ĠInt ): ĠInt Ġ= Ġf ( position ) ĊĠĠĠ Ġ} Ċ Ċ inline Ġfun ĠGrid LayoutManager . span Size Lookup ( cross inline Ġf : Ġ( Int ) Ġ-> ĠInt ): ĠGrid LayoutManager Ġ= ĊĠĠĠ Ġapply Ġ{ Ġspan Size Lookup Ġ= Ġfrom ( f ) Ġ}