package Ġbase . core library . presentation . main Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . widget . ProgressBar Ċ import Ġandroidx . core . view . isVisible Ċ import Ġandroidx . lifecycle . lifecycle Scope Ċ import Ġandroidx . navigation . Nav Controller Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġbase . core library . R Ċ import Ġcom . github . ic aro hs 7 . un ox android arch . presentation . activities . Base Arch Activity Ċ import Ġcom . github . ic aro hs 7 . un ox android arch . state . Loading Store . toggle Loading Ċ import Ġcom . github . ic aro hs 7 . un ox android arch . state . add On Loading Listener Ċ import Ġkotlinx . coroutines . Job Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . flow . launch In Ċ Ċ abstract Ġclass ĠBase Frag holder MainActivity Ġ: ĠBase Arch Activity () Ġ{ ĊĠĠĠ Ġprivate Ġval ĠprogressBar Ġby Ġlazy Ġ{ ĠfindViewById < ProgressBar >( R . id . progress _ bar ) Ġ} ĊĠĠĠ Ġval Ġnav Controller : ĠNav Controller Ġby Ġlazy Ġ{ Ġfind Nav Controller ( R . id . nav _ host _ fragment ) Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ frag holder _ main ) ĊĠĠĠĠĠĠĠ Ġlifecycle Scope . add On Loading Listener Ġ{ ĠisLoading Ġ-> ĠprogressBar . isVisible Ġ= ĠisLoading Ġ} ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠLaunch Ġthe Ġcollection Ġof Ġthe Ġgiven ĠFlow ĊĠĠĠĠ Ġ* Ġon Ġthe Ġcoroutine Ġscope Ġof Ġthis Ġcomponent ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġfun ĠFlow <* >. launch In Scope (): ĠJob Ġ= Ġlaunch In ( lifecycle Scope ) Ċ }