package Ġxyz . rid soft . hal . common Ċ Ċ import Ġandroid . graphics . Canvas Ċ import Ġandroid . graphics . Path Ċ import Ġandroid . graphics . Rect F Ċ import Ġandroidx . core . graphics . to Rect Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ Ċ class ĠRo unded Corner Decoration Ġ: ĠRecyclerView . Item Decoration () Ġ{ ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠCOR NER _ RADIUS Ġ= Ġ 2 4 f ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġdefault Rect To Clip Ġ= ĠRect F ( 0 f , Ġ 0 f , Ġ 0 f , Ġ 0 f ) ĊĊĠĠĠ Ġoverride Ġfun Ġon Draw ( c : ĠCanvas , Ġparent : ĠRecyclerView , Ġstate : ĠRecyclerView . State ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Draw ( c , Ġparent , Ġstate ) ĊĠĠĠĠĠĠĠ Ġval Ġrect To Clip Ġ= Ġget Rect To Clip ( parent ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpath Ġ= ĠPath () ĊĠĠĠĠĠĠĠ Ġpath . add Round Rect ( rect To Clip , ĠCOR NER _ RADIUS , ĠCOR NER _ RADIUS , ĠPath . Direction . CW ) ĊĊĠĠĠĠĠĠĠ Ġc . clip Path ( path ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Rect To Clip ( parent : ĠRecyclerView ): ĠRect F Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrect To Clip Ġ= ĠRect F ( default Rect To Clip ) ĊĠĠĠĠĠĠĠ Ġval Ġchild Rect Ġ= ĠRect F () ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 Ġuntil Ġparent . child Count ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchild Ġ= Ġparent . getChild At ( i ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġparent . get Decorated Bounds With Margins ( child , Ġchild Rect . to Rect ()) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġrect To Clip . left Ġ= Ġrect To Clip . left . coerce At Most ( child Rect . left ); ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrect To Clip . top Ġ= Ġrect To Clip . top . coerce At Most ( child Rect . top ); ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrect To Clip . right Ġ= Ġrect To Clip . right . coerce At Least ( child Rect . right ); ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrect To Clip . bottom Ġ= Ġrect To Clip . bottom . coerce At Least ( child Rect . bottom ); ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn Ġrect To Clip ĊĠĠĠ Ġ} Ċ }