/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 0 Ġlittle gn al Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġcom . little gn al . flutter embedding addon . flutter _ embedding _ addon _ example Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġcom . little gn al . flutter embedding addon . Addon Flutter Activity Ċ import Ġio . flutter . embedding . engine . Flutter Engine Ċ Ċ class ĠCustom Flutter Activity Ġ: ĠAdd on Flutter Activity () Ġ{ ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġprivate Ġconst Ġval ĠEX TRA _ CUSTOM _ INITIAL _ ROUTE Ġ= Ġ" custom _ initial _ route " ĊĊĠĠĠ Ġfun Ġopen Custom New Flutter Activity ( context : ĠContext , Ġinitial Route : ĠString ? Ġ= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent ( context , ĠCustom Flutter Activity :: class . java ) ĊĠĠĠĠĠ Ġif Ġ( initial Route Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( EXTRA _ CUSTOM _ INITIAL _ ROUTE , Ġinitial Route ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġcontext . startActivity ( intent ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġlateinit Ġvar Ġnavigation Channel : ĠNative Navigation Channel ĊĊĠ Ġprivate Ġvar Ġis Push Initial Route Ġ= Ġfalse ĊĊĠ Ġoverride Ġfun Ġconfigure Flutter Engine ( flutter Engine : ĠFlutter Engine ) Ġ{ ĊĠĠĠ Ġsuper . configure Flutter Engine ( flutter Engine ) ĊĊĠĠĠ Ġnavigation Channel Ġ= ĊĠĠĠĠĠ ĠNative Navigation Channel ( flutter Engine . dart Executor , Ġpush Route Callback Ġ= Ġ{ ĊĠĠĠĠĠĠĠ Ġopen Custom New Flutter Activity ( this , Ġit ) ĊĠĠĠĠĠ Ġ}, Ġpop Callback Ġ= Ġ{ ĊĠĠĠĠĠĠĠ Ġfinish () ĊĠĠĠĠĠ Ġ}) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Flutter Ui Displayed () Ġ{ ĊĠĠĠ Ġsuper . on Flutter Ui Displayed () ĊĊĠĠĠ Ġif Ġ(! is Push Initial Route ) Ġ{ ĊĠĠĠĠĠ Ġval Ġroute Ġ= Ġintent . getString Extra ( EXTRA _ CUSTOM _ INITIAL _ ROUTE ) Ġ?: Ġ"/" ĊĠĠĠĠĠ Ġnavigation Channel . push Replacement Named ( route ) ĊĊĠĠĠĠĠ Ġis Push Initial Route Ġ= Ġtrue ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }