package Ġcom . jay . flutter _ hybrid _ android . flutter Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġcom . jay . flutter _ hybrid _ android . App Ċ import Ġcom . jay . flutter _ hybrid _ android . databinding . Fragment Flutter View Binding Ċ import Ġcom . jay . flutter _ hybrid _ android . flutter . engine . Flutter Helper Ċ import Ġio . flutter . embedding . android . Flutter Texture View Ċ import Ġio . flutter . embedding . android . Flutter View Ċ import Ġio . flutter . embedding . engine . Flutter Engine Ċ Ċ /** Ċ Ġ* Ġ@ author Ġj ay d roid Ċ Ġ* Ġ@ version Ġ 1 . 0 Ċ Ġ* Ġ@ date Ġ 2 0 2 1 / 8 / 3 0 Ċ Ġ*/ Ċ abstract Ġclass ĠBase Flutter View Fragment Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġflutter Engine : ĠFlutter Engine ? Ġ= ĊĠĠĠĠĠĠĠ ĠApp . app ?. let Ġ{ ĠFlutter Helper . instance . get Flutter Engine ( it ) Ġ} ĊĠĠĠ Ġprotected Ġvar Ġflutter View : ĠFlutter View ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġcached Ġ= ĠFlutter Helper . instance . is Init Finish () ĊĠĠĠ Ġprivate Ġvar Ġ_ binding : ĠFragment Flutter View Binding ? Ġ= Ġnull ĊĠĠĠ Ġvar Ġtv Info : ĠTextView ? Ġ= Ġnull ĊĊĠĠĠ Ġ// ĠThis Ġproperty Ġis Ġonly Ġvalid Ġbetween ĠonCreate View Ġand Ġon Destroy View . ĊĠĠĠ Ġprivate Ġval Ġbinding Ġget () Ġ= Ġ_ binding !! ĊĊĊĠĠĠ Ġoverride Ġfun Ġon Activity Created ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Activity Created ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġ// Ġ æ³¨åĨĮ flutter / platform _ views Ġæı Ĵ ä»¶ ä»¥ ä¾¿ èĥ½å¤Ł å¤ĦçĲĨ native Ġview ĊĠĠĠĠĠĠĠ Ġif Ġ(! cached ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġflutter Engine ?. platform Views Controller ?. attach ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġactivity , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġflutter Engine . renderer , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġflutter Engine . dart Executor ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= ĠFragment Flutter View Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġval Ġroot : ĠViewGroup Ġ= Ġbinding . root ĊĠĠĠĠĠĠĠ Ġtv Info Ġ= Ġbinding . tv Info ĊĠĠĠĠĠĠĠ Ġ// æ·»åĬł ĠFlutter View ĊĠĠĠĠĠĠĠ Ġroot . addView ( create Flutter View ( require Context ())) ĊĠĠĠĠĠĠĠ Ġreturn Ġroot ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġcreate Flutter View ( context : ĠContext ): ĠFlutter View Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ä½¿çĶ¨ Flutter Texture View æĿ¥ è¿Ľè¡Į æ¸²æŁĵ ï¼Į ä»¥ è§Ħ éģ¿ Flutter Surface View åİĭ åĲİåı° åĽŀ æĿ¥ åĲİ çķĮéĿ¢ è¢« å¤į çĶ¨çļĦ éĹ®é¢ĺ ĊĠĠĠĠĠĠĠ Ġval Ġflutter Texture View Ġ= ĠFlutter Texture View ( require Activity ()) ĊĠĠĠĠĠĠĠ Ġflutter View Ġ= ĠFlutter View ( context , Ġflutter Texture View ) ĊĠĠĠĠĠĠĠ Ġreturn Ġflutter View !! ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonStart () Ġ{ ĊĠĠĠĠĠĠĠ Ġflutter Engine ?. let Ġ{ Ġflutter View ?. attach To Flutter Engine ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġsuper . onStart () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ Ġ// for Ġflutter Ġ>= Ġv 1 . 1 7 ĊĠĠĠĠĠĠĠ Ġflutter Engine ?. lifecycle Channel ?. app Is Res umed () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Pause () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Pause () ĊĠĠĠĠĠĠĠ Ġflutter Engine ?. lifecycle Channel ?. app IsIn active () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Stop () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Stop () ĊĠĠĠĠĠĠĠ Ġflutter Engine ?. lifecycle Channel ?. app Is Paused () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Detach () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Detach () ĊĠĠĠĠĠĠĠ Ġflutter Engine ?. lifecycle Channel ?. app Is Detached () ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= Ġnull ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy () ĊĠĠĠĠĠĠĠ Ġflutter View ?. detach From Flutter Engine () ĊĠĠĠ Ġ} Ċ Ċ }