package Ġcom . la oh u . kit . extensions Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . annotation . Layout Res Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . databinding . ViewData Binding Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ Ċ inline Ġfun Ġ< re ified ĠT Ġ: ĠViewModel > ĠFragment . get ViewModel ( no inline Ġcreator : Ġ(() Ġ-> ĠT )? Ġ= Ġnull ): ĠT Ġ{ ĊĠĠĠ Ġreturn Ġif Ġ( creator Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ ĠViewModel Provider ( this ). get ( T :: class . java ) ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ ĠViewModel Provider ( this , ĠSimple ViewModel Factory ( creator )). get ( T :: class . java ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ inline Ġfun Ġ< re ified ĠT Ġ: ĠViewModel > ĠFragment . getActivity ViewModel ( no inline Ġcreator : Ġ(() Ġ-> ĠT )? Ġ= Ġnull ): ĠT Ġ{ ĊĠĠĠ Ġreturn Ġactivity !!. get ViewModel ( creator ) Ċ } Ċ Ċ inline Ġfun Ġ< re ified ĠT Ġ: ĠView Data Binding > ĠFragment . data Binding View (@ Layout Res Ġlayout Id : ĠInt , Ġparent : ĠViewGroup ?): ĠT Ġ{ ĊĠĠĠ Ġval Ġinflater Ġ= ĠLayoutInflater . from ( this . context ) ĊĠĠĠ Ġval Ġbinding Ġ= ĠData Binding Util . inflate < T >( in flater , Ġlayout Id , Ġparent , Ġfalse ) ĊĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠ Ġreturn Ġbinding Ċ }