package Ġcom . bad oo . ri bs . routing . router Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . os . Parcelable Ċ import Ġandroidx . lifecycle . Lifecycle Ċ import Ġcom . bad oo . ri bs . core . Node Ċ import Ġcom . bad oo . ri bs . core . modal ity . Build Params Ċ import Ġcom . bad oo . ri bs . core . plugin . Node Aware Ċ import Ġcom . bad oo . ri bs . core . plugin . Node Lifecycle Aware Ċ import Ġcom . bad oo . ri bs . core . plugin . S aves InstanceState Ċ import Ġcom . bad oo . ri bs . core . plugin . Sub tree Back Press Handler Ċ import Ġcom . bad oo . ri bs . core . plugin . View Lifecycle Aware Ċ import Ġcom . bad oo . ri bs . core . state . Composite C ancellable Ċ import Ġcom . bad oo . ri bs . core . state . Relay Ċ import Ġcom . bad oo . ri bs . core . state . Source Ċ import Ġcom . bad oo . ri bs . core . state . Time Caps ule Ċ import Ġcom . bad oo . ri bs . core . state . map Ċ import Ġcom . bad oo . ri bs . routing . activ ator . Child Activator Ċ import Ġcom . bad oo . ri bs . routing . activ ator . Routing Activator Ċ import Ġcom . bad oo . ri bs . routing . activ ator . Unhandled Child Activator Ċ import Ġcom . bad oo . ri bs . routing . resolver . Routing Resolver Ċ import Ġcom . bad oo . ri bs . routing . router . Router . Transition State . IN _ TRANS ITION Ċ import Ġcom . bad oo . ri bs . routing . router . Router . Transition State . SETT LED Ċ import Ġcom . bad oo . ri bs . routing . source . Routing Source Ċ import Ġcom . bad oo . ri bs . routing . source . changes Ċ import Ġcom . bad oo . ri bs . routing . state . feature . Routing State Pool Ċ import Ġcom . bad oo . ri bs . routing . state . feature . Transaction . Pool Command . Save InstanceState Ċ import Ġcom . bad oo . ri bs . routing . state . feature . Transaction . Pool Command . Sleep Ċ import Ġcom . bad oo . ri bs . routing . state . feature . Transaction . Pool Command . Wake Up Ċ import Ġcom . bad oo . ri bs . routing . transition . handler . Transition Handler Ċ Ċ abstract Ġclass ĠRouter < C Ġ: ĠParcel able >( ĊĠĠĠ Ġbuild Params : ĠBuild Params <* >, ĊĠĠĠ Ġprotected Ġval Ġrouting Source : ĠRouting Source < C >, ĊĠĠĠ Ġprivate Ġval Ġtransition Handler : ĠTransition Handler < C >? Ġ= Ġnull , ĊĠĠĠ Ġprivate Ġval Ġclient Child Activator : ĠChild Activator < C > Ġ= ĠUnhandled Child Activator () Ċ ) Ġ: ĠRouting Resolver < C >, ĊĠĠĠ ĠNode Aware , ĊĠĠĠ ĠNode Lifecycle Aware , ĊĠĠĠ ĠView Lifecycle Aware , ĊĠĠĠ ĠS aves InstanceState , ĊĠĠĠ ĠSub tree Back Press Handler Ġby Ġrouting Source Ġ{ ĊĊĠĠĠ Ġenum Ġclass ĠTransition State Ġ{ ĊĠĠĠĠĠĠĠ ĠSET T LED , ĠIN _ TRANS ITION ; ĊĊĠĠĠĠĠĠĠ Ġval ĠisSet tled : ĠBoolean ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget () Ġ= Ġthis Ġ== ĠSET T LED ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġvar Ġtransition State : ĠTransition State Ġ= ĠSET T LED ĊĠĠĠĠĠĠĠ Ġprivate Ġset ĊĊĠĠĠ Ġprivate Ġval Ġtransition States Relay : ĠRelay < Transition State > Ġ= ĠRelay () ĊĠĠĠ Ġval Ġtransition States : ĠSource < Transition State > Ġ= Ġtransition States Relay ĊĠĠĠĠĊĠĠĠ Ġprivate Ġval Ġcancell able Ġ= ĠComposite C ancellable () ĊĠĠĠ Ġprivate Ġval Ġtime Caps ule : ĠTime Caps ule Ġ= ĠTime Caps ule ( build Params . savedInstanceState ) ĊĠĠĠ Ġprivate Ġval Ġhas Saved State : ĠBoolean Ġ Ġ= Ġbuild Params . savedInstanceState Ġ!= Ġnull ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġrouting State Pool : ĠRouting State Pool < C > ĊĠĠĠ Ġoverride Ġlateinit Ġvar Ġnode : ĠNode < *> ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactiv ator : ĠRouting Activator < C > ĊĊĠĠĠ Ġoverride Ġfun Ġinit ( node : ĠNode <* >) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . node Ġ= Ġnode ĊĠĠĠĠĠĠĠ Ġactiv ator Ġ= ĠRouting Activator ( node , Ġclient Child Activator ) ĊĠĠĠĠĠĠĠ Ġinit Features ( node ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Features ( node : ĠNode <* >) Ġ{ ĊĠĠĠĠĠĠĠ Ġrouting State Pool Ġ= ĠRouting State Pool ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtime Caps ule Ġ= Ġtime Caps ule , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresolver Ġ= Ġthis , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactiv ator Ġ= Ġactiv ator , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġparent Node Ġ= Ġnode , Ġ// ĠTODO Ġremove ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransition Handler Ġ= Ġtransition Handler ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġcancell able Ġ+= Ġrouting State Pool ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrouting Source . on Save InstanceState ( out State ) ĊĠĠĠĠĠĠĠ Ġrouting State Pool . accept ( Save InstanceState ()) ĊĠĠĠĠĠĠĠ Ġtime Caps ule . save State ( out State ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( node Lifecycle : ĠLifecycle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcancell able Ġ+= Ġrouting Source ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. changes ( has Saved State ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe ( routing State Pool :: accept ) ĊĊĠĠĠĠĠĠĠ Ġcancell able Ġ+= Ġrouting State Pool ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġif Ġ( it . ongo ing Transitions . isEmpty ()) ĠSET T LED Ġelse ĠIN _ TRANS ITION Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtransition State Ġ= Ġit ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtransition States Relay . emit ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Attach To View () Ġ{ ĊĠĠĠĠĠĠĠ Ġrouting State Pool . accept ( Wake Up ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Detach From View () Ġ{ ĊĠĠĠĠĠĠĠ Ġrouting State Pool . accept ( Sleep ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠTODO Ġconsider Ġextending ĠDis pos ables Ġplugin ĊĠĠĠĠĠĠĠ Ġcancell able . cancel () ĊĠĠĠ Ġ} Ċ } Ċ