package Ġpress . navigation . transitions Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . appcompat . widget . Toolbar Ċ import Ġme . s aket . inbox recyclerview . Inbox RecyclerView Ċ import Ġme . s aket . inbox recyclerview . animation . Item Expand Animator Ċ import Ġme . s aket . inbox recyclerview . dim ming . Animated Visibility Color Drawable Ċ import Ġme . s aket . inbox recyclerview . dim ming . Dim Painter Ċ import Ġme . s aket . inbox recyclerview . expand er . Inbox Item Expand er Ċ import Ġme . s aket . inbox recyclerview . page . Expand able Page Layout Ċ import Ġme . s aket . press . shared . ui . Screen Key Ċ import Ġpress . extensions . do On Collapse Ċ import Ġpress . extensions . do On Expand Ċ import Ġpress . extensions . find Child Ċ import Ġpress . navigation . Screen Transition Ċ import Ġpress . navigation . Screen Transition . Transition Result Ċ import Ġpress . navigation . Screen Transition . Transition Result . Handled Ċ import Ġpress . navigation . Screen Transition . Transition Result . Ignored Ċ Ċ /** Ċ Ġ* ĠImplemented Ġby Ġscreens Ġthat Ġsupport Ġexpansion Ġof Ċ Ġ* Ġincoming Ġscreens Ġfrom Ġtheir Ġ[ Inbox RecyclerView ] Ġlist . Ċ Ġ*/ Ċ interface ĠExpand able Screen Host Ġ{ ĊĠ Ġfun Ġcreate Screen Expand er (): ĠIn box Item Expand er < Screen Key > Ċ } Ċ Ċ /** Ċ Ġ* ĠW ires Ġan Ġ[ Inbox RecyclerView ] Ġwith Ġits Ġexpand able Ċ Ġ* Ġpage Ġacross Ġscreens Ġfor Ġexpand / collapse Ġtransition . Ċ Ġ*/ Ċ class ĠExpand able Screen Transition Ġ: ĠScreen Transition Ġ{ ĊĠ Ġoverride Ġfun Ġtransition ( ĊĠĠĠ Ġfrom View : ĠView , ĊĠĠĠ Ġfrom Key : ĠScreen Key , ĊĠĠĠ Ġto View : ĠView , ĊĠĠĠ Ġto Key : ĠScreen Key , ĊĠĠĠ Ġnew Background : ĠView ?, ĊĠĠĠ Ġgoing Forward : ĠBoolean , ĊĠĠĠ ĠonComplete : Ġ() Ġ-> ĠUnit ĊĠ Ġ): ĠTransition Result Ġ{ ĊĠĠĠ Ġval Ġexpand able Host Ġ= Ġ( if Ġ( going Forward ) Ġfrom View Ġelse Ġto View ). find Child < Expand able Screen Host >() ĊĠĠĠ Ġval Ġitem Expand er Ġ= Ġexpand able Host ?. create Screen Expand er () ĊĊĠĠĠ Ġif Ġ( going Forward Ġ&& Ġto View Ġis ĠExpand able Page Layout Ġ&& Ġitem Expand er Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġfrom List Ġ= Ġfrom View . find Child < Inbox RecyclerView >() !! ĊĠĠĠĠĠ Ġfrom List . attach Page ( to View , Ġitem Expand er , Ġparent Ġ= Ġfrom View ) ĊĠĠĠĠĠ Ġitem Expand er . expand Item ( to Key , Ġimmediate Ġ= Ġ! from View . is La id Out ) ĊĠĠĠĠĠ Ġto View . do On Expand ( onComplete ) ĊĠĠĠĠĠ Ġreturn ĠHand led ĊĊĠĠĠ Ġ} Ġelse Ġif Ġ(! going Forward Ġ&& Ġfrom View Ġis ĠExpand able Page Layout Ġ&& Ġitem Expand er Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġto List Ġ= Ġto View . find Child < Inbox RecyclerView >() !! ĊĠĠĠĠĠ Ġto List . attach Page ( from View , Ġitem Expand er , Ġparent Ġ= Ġto View ) ĊĊĠĠĠĠĠ Ġ// ĠThis Ġscreen Ġmay Ġhave Ġexpanded Ġfrom Ġa Ġlist Ġitem Ġthat Ġis Ġno Ġlonger Ġvisible ĊĠĠĠĠĠ Ġ// Ġbecause Ġthe Ġkeyboard Ġcaused Ġthe Ġlist Ġto Ġresize . ĠHide Ġthe Ġkeyboard Ġbefore ĊĠĠĠĠĠ Ġ// Ġcol lap sing Ġso Ġthat Ġthe Ġlist Ġitem 's ĠView Ġis Ġadded Ġback . ĊĠĠĠĠĠ Ġto List . hide Keyboard And Run Ġ{ ĊĠĠĠĠĠĠĠ Ġitem Expand er . setItem ( from Key ) ĊĠĠĠĠĠĠĠ Ġitem Expand er . collapse () ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġfrom View . do On Collapse Ġ{ ĊĠĠĠĠĠĠĠ Ġto List . detach Page ( from View ) ĊĠĠĠĠĠĠĠ ĠonComplete () ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġreturn ĠHand led ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn ĠIgnore d ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġprepare Background ( background : ĠView , Ġforeground : ĠView , Ġforeground Key : ĠScreen Key ) Ġ{ ĊĠĠĠ Ġ// ĠBackground Ġscreens Ġare Ġexpanded Ġimmediately Ġon Ġcreation . ĠThey Ġmust Ġbe ĊĠĠĠ Ġ// Ġw ired Ġwith Ġthe Ġexpanded Ġitem Ġmanually Ġfor Ġpull - to - collapse Ġto Ġwork . ĊĠĠĠ Ġif Ġ( foreground Ġis ĠExpand able Page Layout ) Ġ{ ĊĠĠĠĠĠ Ġbackground . find Child < Expand able Screen Host >() ?. let Ġ{ Ġbg Host Ġ-> ĊĠĠĠĠĠĠĠ Ġval Ġbg List Ġ= Ġ( bg Host Ġas ĠView ). find Child < Inbox RecyclerView >() !! ĊĠĠĠĠĠĠĠ Ġval Ġitem Expand er Ġ= Ġbg Host . create Screen Expand er () ĊĠĠĠĠĠĠĠ Ġbg List . attach Page ( foreground , Ġitem Expand er , Ġbackground ) ĊĠĠĠĠĠĠĠ Ġitem Expand er . setItem ( foreground Key ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠIn box RecyclerView . attach Page ( ĊĠĠĠ Ġpage : ĠExpand able Page Layout , ĊĠĠĠ Ġitem Expand er : ĠIn box Item Expand er < Screen Key >, ĊĠĠĠ Ġparent : ĠView ĊĠ Ġ) Ġ{ ĊĠĠĠ Ġthis . item Expand er Ġ= Ġitem Expand er ĊĠĠĠ Ġthis . expand able Page Ġ= Ġpage ĊĠĠĠ Ġthis . item Expand Animator Ġ= ĠItem Expand Animator . split () ĊĠĠĠ Ġthis . dim Painter Ġ= ĠExpand able Screen Dim Painter ( ĊĠĠĠĠĠ Ġ// ĠThese Ġforeground s Ġare Ġset Ġin ĠPhone Form Factor . ĊĠĠĠĠĠ Ġlist Drawable Ġ= Ġparent . foreground Ġas ĠAnimated Visibility Color Drawable , ĊĠĠĠĠĠ Ġpage Drawable Ġ= Ġpage . foreground Ġas ĠAnimated Visibility Color Drawable ĊĠĠĠ Ġ) ĊĠĠĠ Ġpage . push Parent Toolbar On Expand ( toolbar Ġ= Ġparent . find Child < Toolbar >() !! ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠIn box RecyclerView . detach Page ( page : ĠExpand able Page Layout ) Ġ{ ĊĠĠĠ Ġthis . expand able Page Ġ= Ġnull ĊĠĠĠ Ġthis . dim Painter Ġ= ĠDim Painter . none () ĊĠĠĠ Ġpage . push Parent Toolbar On Expand ( null ) ĊĠ Ġ} Ċ } Ċ