package Ġcom . sa im azar . sample . presentation Ċ Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcom . sa im azar . library . Sticky Avatar Item Decoration Ċ import Ġcom . sa im azar . sample . R Ċ import Ġcom . sa im azar . sample . datasource . ChatMessage DataSource Ċ import Ġcom . sa im azar . sample . presentation . adapter . Chat Adapter Ċ import Ġcom . sa im azar . sample . presentation . adapter . Margin Decoration Ċ import Ġkotlinx . android . synt hetic . main . activity _ main .* Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġadapter Ġ= ĠChat Adapter () ĊĠĠĠĠĠĠĠ Ġre cyclerView . layout Manager Ġ= ĠLinearLayoutManager ( this , ĠLinearLayoutManager . VERTICAL , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġre cyclerView . adapter Ġ= Ġadapter ĊĠĠĠĠĠĠĠ Ġre cyclerView . addItem Decoration ( Margin Decoration ( resources . get Dimension Pixel Offset ( R . dim en . item _ space ))) ĊĠĠĠĠĠĠĠ Ġre cyclerView . addItem Decoration ( Sticky Avatar Item Decoration ( adapter , Ġresources . get Dimension Pixel Offset ( R . dim en . item _ space ))) ĊĠĠĠĠĠĠĠ Ġadapter . update List ( ChatMessage DataSource . mock Chat List ()) ĊĠĠĠ Ġ} Ċ } Ċ