package Ġru . semp er _ viv ent em . backdrop view . ui . gallery Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Grid LayoutManager Ċ import Ġandroidx . recyclerview . widget . Linear Snap Helper Ċ import Ġkotlinx . android . synt hetic . main . screen _ gallery . view .* Ċ import Ġru . semp er _ viv ent em . backdrop view . R Ċ import Ġru . semp er _ viv ent em . backdrop view . ui . common . Screen Ċ import Ġru . semp er _ viv ent em . domain . Items Factory ĊĊ Ċ class ĠGallery Screen Ġ: ĠScreen () Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠS NAP _ COUNT Ġ= Ġ 2 ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġval Ġlayout Id : ĠInt Ġ= ĠR . layout . screen _ gallery ĊĊĠĠĠ Ġprivate Ġval Ġgallery Adapter Ġ= ĠGallery Adapter () ĊĠĠĠ Ġprivate Ġval Ġsnap Helper Ġ= ĠLinear Snap Helper () ĊĊĠĠĠ Ġoverride Ġfun Ġon Init View ( view : ĠView ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġwith ( view . re cyclerView ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout Manager Ġ= ĠGrid LayoutManager ( context , ĠS NAP _ COUNT , ĠGrid LayoutManager . HORIZONTAL , Ġfalse ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter Ġ= Ġgallery Adapter ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Item Decoration ( Divider Item Decoration ( context , ĠDiv ider Item Decoration . HORIZONTAL ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthis . set Drawable ( context . get Drawable ( R . drawable . divider _ empty )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Item Decoration ( Divider Item Decoration ( context , ĠDiv ider Item Decoration . VERTICAL ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthis . set Drawable ( context . get Drawable ( R . drawable . divider _ empty )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġwith ( snap Helper ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġattach To RecyclerView ( view . re cyclerView ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġgallery Adapter . set Items ( Items Factory . getDefault ()) ĊĠĠĠ Ġ} Ċ }