package Ġcom . kotlin extension . base Ċ Ċ import Ġandroid . app . Dialog Ċ import Ġandroid . arch . lifecycle . ViewModel Provider Ċ import Ġandroid . databinding . Data Binding Util Ċ import Ġandroid . databinding . ViewData Binding Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . annotation . Layout Res Ċ import Ġandroid . support . annotation . Nullable Ċ import Ġandroid . support . v 4 . app . Fragment Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġcom . kotlin extension . R Ċ import Ġdagger . android . Dispatch ing Android Injector Ċ import Ġdagger . android . support . Has Support Fragment Injector Ċ import Ġjavax . inject . Inject Ċ Ċ abstract Ġclass ĠBase Activity < V DB Ġ: ĠView Data Binding , ĠB VM Ġ: Base ViewModel <* >> Ġ: ĠAppCompatActivity (), ĠHas Support Fragment Injector Ġ{ Ċ ĉ late init Ġvar Ġm ViewData Binding : ĠV DB Ċ ĉ late init Ġvar Ġm ViewModel : ĠB VM Ċ ĉ private Ġlateinit Ġvar Ġdialog : ĠDialog ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġfragment Injector : ĠDispatch ing Android Injector < Fragment > ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory : ĠViewModel Provider . Factory ĊĊĠĠĠ Ġoverride Ġfun Ġsupport Fragment Injector (): ĠDispatch ing Android Injector < Fragment > Ġ= Ġfragment Injector ĊĊ ĉ override Ġfun ĠonCreate (@ Nullable ĠsavedInstanceState : ĠBundle ?) Ġ{ Ċĉ ĉ super . onCreate ( savedInstanceState ) Ċĉ ĉ perform Data Binding () Ċĉ ĉ init Progress Dialog () Ċĉ ĉ init Ob serve () Ċ ĉ } ĊĊ ĉ private Ġfun Ġperform Data Binding () Ġ{ Ċĉ ĉ m ViewData Binding Ġ= ĠData Binding Util . set ContentView ( this , Ġget Layout Id ()) Ċĉ ĉ m ViewModel Ġ= Ġget ViewModel () Ċĉ ĉ m ViewData Binding . set Variable ( get Binding Variable (), Ġm ViewModel ) Ċĉ ĉ m ViewData Binding . execute Pending Bindings () Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Pause () Ġ{ Ċĉ ĉ super . on Pause () Ċĉ ĉ hide Progress Dialog () Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Destroy () Ġ{ Ċĉ ĉ super . on Destroy () Ċĉ ĉ clear Memory () Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Low Memory () Ġ{ Ċĉ ĉ super . on Low Memory () Ċĉ ĉ clear Memory () Ċ ĉ } ĊĊ ĉ private Ġfun Ġclear Memory () Ġ{ Ċĉ ĉ try Ġ{ Ċĉĉ ĉ System . gc () Ċĉĉ ĉ Runtime . get Runtime (). gc () Ċĉ ĉ } Ġcatch Ġ( e : ĠException ) Ġ{ Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ @ Layout Res Ċ ĉ abstract Ġfun Ġget Layout Id (): ĠInt Ċ ĉ abstract Ġfun Ġget ViewModel (): ĠB VM Ċ ĉ abstract Ġfun Ġget Binding Variable (): ĠInt Ċ ĉ abstract Ġfun Ġinit Ob serve () ĊĊ ĉ fun Ġinit Progress Dialog () Ġ{ Ċĉ ĉ dialog Ġ= ĠDialog ( this , ĠR . style . Theme Dialog Fullscreen ) Ċĉ ĉ dialog . set ContentView ( R . layout . layout _ loading _ view ) Ċĉ ĉ dialog . set Cancel able ( false ) Ċĉ ĉ dialog . set Canceled On Touch Outside ( false ) Ċ ĉ } ĊĊ ĉ fun Ġshow Progress Dialog () Ġ{ Ċĉ ĉ if Ġ(! dialog . is Showing ) Ċĉĉ ĉ dialog . show () Ċ ĉ } ĊĊ ĉ fun Ġhide Progress Dialog () Ġ{ Ċĉ ĉ dialog . dismiss () Ċ ĉ } Ċ } Ċ