package Ġcom . ing j uan oc amp o . en fil a . android . lob by . history Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Orientation Helper Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . ing j uan oc amp o . cd apter . Composite Delegate Adapter Ċ import Ġcom . ing j uan oc amp o . en fil a . android . R Ċ import Ġcom . ing j uan oc amp o . en fil a . android . lob by . list . adapter . Delegate Shift Ċ import Ġcom . ing j uan oc amp o . en fil a . android . lob by . list . view model . ViewModel List Items Ċ import Ġcom . ing j uan oc amp o . en fil a . android . utils . View Types Ċ Ċ class ĠFragment History Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance () Ġ= ĠFragment History () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġadapter : ĠComposite Delegate Adapter ĊĠĠĠ Ġval ĠviewModel : ĠViewModel List Items Ġby Ġview Models () ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinflater . inflate ( R . layout . fragment _ list _ items , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġval Ġre cycler : ĠRecyclerView Ġ= Ġview . findViewById ( R . id . recycler ) ĊĊĠĠĠĠĠĠĠ Ġadapter Ġ= ĠComposite Delegate Adapter ( 1 ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend Delegate ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠView Types . SHIFT . ordinal ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) Ġ{ ĠDelegate Shift ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġre cycler . addItem Decoration ( Divider Item Decoration ( require Context (), ĠOrientation Helper . VERTICAL )) ĊĠĠĠĠĠĠĠ Ġre cycler . adapter Ġ= Ġadapter ĊĠĠĠĠĠĠĠ ĠviewModel . state . observe ( view Lifecycle Owner , ĠObserver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter . add New Items ( it ) ĊĠĠĠĠĠĠĠ Ġ}) ĊĊĠĠĠĠĠĠĠ ĠviewModel . load ( false ) ĊĊĠĠĠ Ġ} Ċ Ċ }