package Ġorg . re kotlin example . github . routes ĊĊ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . util . Log Ċ import Ġorg . re kotlin example . github . controllers . Repo List Activity Ċ import Ġorg . re kotlin example . github . controllers . Repo ViewModel Ċ import Ġorg . re kotlin example . github . controllers . WebView Activity Ċ import Ġorg . re kotlin example . github . controllers . Welcome Activity Ċ import Ġorg . re kotlin example . github . main Store Ċ import Ġorg . re kotlin router . Rout able Ċ import Ġorg . re kotlin router . Route Element Identifier Ċ import Ġorg . re kotlin router . Routing Completion Handler Ċ Ċ /** Ċ * ĠCreated Ġby ĠM oh an ra j ĠKar at ad ip al ay am Ġon Ġ 1 4 / 1 0 / 1 7 . Ċ */ Ċ val Ġlogin Route : ĠRoute Element Identifier Ġ= Ġ" Login Activity " Ċ val Ġrepo List Route : ĠRoute Element Identifier Ġ= Ġ" Repo List Activity " Ċ val Ġwelcome Route : ĠRoute Element Identifier Ġ= Ġ" Welcome Activity " Ċ val Ġrepo Detail Route : ĠRoute Element Identifier Ġ= Ġ" WebView Activity " Ċ Ċ // ĠRoutes Ġhelper Ġmethods Ċ Ċ object ĠRout able Helper Ġ{ ĊĊĠĠĠĠ Ġfun Ġcreate Welcome Activity And Rout able ( context : ĠContext ): ĠWelcome Rout able Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġwelcome Intent Ġ= ĠIntent ( context , ĠWelcome Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġwelcome Intent . set Flags ( Intent . FLAG _ ACTIVITY _ NEW _ TASK ) ĊĠĠĠĠĠĠĠ Ġcontext . startActivity ( welcome Intent ) ĊĠĠĠĠĠĠĠ Ġreturn ĠWelcome Rout able ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Repo List Activity And Rout able ( context : ĠContext ): ĠRepo List Rout able Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrepo List Intent Ġ= ĠIntent ( context , ĠRepo List Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġrepo List Intent . flags Ġ= ĠIntent . FLAG _ ACTIVITY _ NEW _ TASK ĊĠĠĠĠĠĠĠ Ġcontext . startActivity ( repo List Intent ) ĊĠĠĠĠĠĠĠ Ġreturn ĠRepo List Rout able ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Repo Detail Activity And Rout able ( context : ĠContext ): ĠRepo Detail Rout able Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrepo Detail Intent Ġ= ĠIntent ( context , ĠWebView Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Route Ġ= Ġmain Store . state . navigation State . route ĊĠĠĠĠĠĠĠ Ġval Ġintent Data Ġ= Ġmain Store . state . navigation State . get Route Specific State < Repo ViewModel >( current Route ) ĊĠĠĠĠĠĠĠ Ġrepo Detail Intent . putExtra (" repo ", intent Data ) ĊĠĠĠĠĠĠĠ Ġrepo Detail Intent . set Flags ( Intent . FLAG _ ACTIVITY _ NEW _ TASK ) ĊĠĠĠĠĠĠĠ Ġcontext . startActivity ( repo Detail Intent ) ĊĠĠĠĠĠĠĠ Ġreturn ĠRepo Detail Rout able ( context ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ // TODO : Ġcheck Ġthis Ġoption Ġof Ġopen Ġclass Ċ open Ġclass ĠBasic Rout able ( open Ġvar Ġcontext : ĠContext ): ĠRout able Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġto : ĠRoute Element Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĊĠĠĠĠĠĠĠ Ġreturn ĠBasic Rout able ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcompletion Handler () ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠBasic Rout able ( context ) ĊĠĠĠ Ġ} Ċ Ċ } ĊĊ Ċ class ĠRoot Rout able ( override Ġ Ġvar Ġcontext : ĠContext ): ĠBasic Rout able ( context ) Ġ{ Ċ // ĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ċ // ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , Ċ // ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ Ċ // ĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġif ( route Element Identifier Ġ== Ġlogin Route ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠLogin Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ( route Element Identifier Ġ== Ġwelcome Route ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Welcome Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn ĠLogin Rout able ( context ) ĊĠĠĠ Ġ} Ċ Ċ // ĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , Ċ // ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġto : ĠRoute Element Identifier , Ċ // ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanimated : ĠBoolean , Ċ // ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ Ċ // ĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") Ċ // ĠĠĠ Ġ} Ċ Ċ } Ċ Ċ class ĠLogin Rout able ( val Ġcontext : ĠContext ) Ġ: ĠRout able Ġ{ ĊĊĠĠĠ Ġval ĠTAG Ġ= Ġ" Router ĠLogin Rout able " ĊĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , Ġto : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( from Ġ== Ġrepo List Route Ġ&& Ġto Ġ== Ġwelcome Route ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Welcome Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse { ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġthis ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġif ( route Element Identifier Ġ== Ġrepo List Route ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Repo List Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ( route Element Identifier Ġ== Ġwelcome Route ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Welcome Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLog . d ( TAG ," Fatal ĠErr ror Ġ--- Ġstart Ġof Ġar bit art y Ġroute ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRepo List Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} Ċ Ċ } ĊĊĊ Ċ class ĠRepo List Rout able Ġ( val Ġcontext : ĠContext ): ĠRout able Ġ{ ĊĠĠĠ Ġval ĠTAG Ġ= Ġ" Router ĠRepo List Rout able " ĊĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , Ġto : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG ," Repo List Rout able Ġpop Route Segment ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġif ( route Element Identifier Ġ== Ġrepo Detail Route ){ ĊĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Repo Detail Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn ĠRepo Detail Rout able ( context ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ class ĠRepo Detail Rout able Ġ( val Ġcontext : ĠContext ): ĠRout able Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , Ġto : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĠĠĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ ĊĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĠĠĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ class ĠWelcome Rout able Ġ( val Ġcontext : ĠContext ): ĠRout able Ġ{ ĊĠĠĠ Ġval ĠTAG Ġ= Ġ" Welcome Rout able " ĊĠĠĠ Ġoverride Ġfun Ġchange Route Segment ( from : ĠRoute Element Identifier , Ġto : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĠĠĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpop Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG , Ġ" DO ĠNothing Ġ--- ĠIn side Ġfrom Ġpop Route Segment () Ġroute Element Identifier Ġis Ġ${ route Element Identifier } Ġ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġpush Route Segment ( route Element Identifier : ĠRoute Element Identifier , Ġanimated : ĠBoolean , Ġcompletion Handler : ĠRouting Completion Handler ): ĠRout able Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( route Element Identifier Ġ== Ġrepo List Route ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRout able Helper . create Repo List Activity And Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTODO (" not Ġimplemented ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRepo List Rout able ( context ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }