package Ġ` in `. dim igo . dim ig oin . ui . main . fragment . ing ang Ċ Ċ import Ġ` in `. dim igo . dim ig oin . R Ċ import Ġ` in `. dim igo . dim ig oin . data . model . Ing ang ApplicationModel Ċ import Ġ` in `. dim igo . dim ig oin . data . model . Ing ang Time Ċ import Ġ` in `. dim igo . dim ig oin . data . model . User Model Ċ import Ġ` in `. dim igo . dim ig oin . databinding . Fragment Ing ang Binding Ċ import Ġ` in `. dim igo . dim ig oin . ui . Base Fragment Ċ import Ġ` in `. dim igo . dim ig oin . ui . custom . Dim ig oin Dialog Ċ import Ġ` in `. dim igo . dim ig oin . ui . util . observe Event Ċ import Ġ` in `. dim igo . dim ig oin . ui . util . shared Graph ViewModel Ċ import Ġ` in `. dim igo . dim ig oin . ui . util . show Skeleton Ċ import Ġandroid . animation . Layout Transition Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . Toast Ċ import Ġandroidx . annotation . String Res Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . eth anh ua . skeleton . Skeleton Screen Ċ Ċ class ĠIn gang Fragment Ġ: ĠBase Fragment < Fragment Ing ang Binding >( R . layout . fragment _ ing ang ) Ġ{ ĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠIn gang ViewModel Ġby Ġshared Graph ViewModel ( R . id . main _ nav _ graph ) ĊĠĠĠ Ġprivate Ġvar Ġis RecyclerView Skeleton Hidden Ġ= Ġfalse ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate View ( in flater , Ġcontainer , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠĠĠĠĠĠĠĠĠ Ġvm Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġinit View () ĊĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit View () Ġ= Ġwith ( binding ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġing ang 1 Adapter Ġ= ĠIn gang App lier Recycler Adapter ( userData ) ĊĠĠĠĠĠĠĠ Ġval Ġing ang 2 Adapter Ġ= ĠIn gang App lier Recycler Adapter ( userData ) ĊĠĠĠĠĠĠĠ Ġing ang 1 Layout . app lier RecyclerView . adapter Ġ= Ġing ang 1 Adapter ĊĠĠĠĠĠĠĠ Ġing ang 2 Layout . app lier RecyclerView . adapter Ġ= Ġing ang 2 Adapter ĊĠĠĠĠĠĠĠ Ġval Ġing ang 1 Skeleton Ġ= Ġshow Ing ang App lier RecyclerView Skeleton ( ing ang 1 Layout . app lier RecyclerView ) ĊĠĠĠĠĠĠĠ Ġval Ġing ang 2 Skeleton Ġ= Ġshow Ing ang App lier RecyclerView Skeleton ( ing ang 2 Layout . app lier RecyclerView ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . ing ang Status . observe ( view Lifecycle Owner ) Ġ{ Ġing ang Status Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmax App lier Ġ= Ġing ang Status . ing ang Max App lier ĊĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 1 Adapter . set Items ( getApp liers ( ing ang Status . get Applications ( Ing ang Time . N SS 1 )), Ġmax App lier ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 2 Adapter . set Items ( getApp liers ( ing ang Status . get Applications ( Ing ang Time . N SS 2 )), Ġmax App lier ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! is RecyclerView Skeleton Hidden ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 1 Skeleton . hide () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 2 Skeleton . hide () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis RecyclerView Skeleton Hidden Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠviewModel . event . observe Event ( view Lifecycle Owner ) Ġ{ Ġevent Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( event ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠEvent . Ing ang Status Request Fail Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġshow Alert ( R . string . failed _ to _ fetch _ ing ang _ status ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! is RecyclerView Skeleton Hidden ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 1 Skeleton . hide () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġing ang 2 Skeleton . hide () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis RecyclerView Skeleton Hidden Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠEvent . Ing ang Applied Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= ĠgetString ( R . string . ing ang _ applied , Ġevent . applied Time . time Number ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠToast . makeText ( require Context (), Ġmessage , ĠToast . LENGTH _ SHORT ). show () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠEvent . Ing ang Apply Fail Ġ-> Ġshow Alert ( R . string . failed _ to _ apply _ ing ang ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠEvent . Ing ang Cancel Fail Ġ-> Ġshow Alert ( R . string . failed _ to _ cancel _ ing ang ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġing ang Container . enable Transition () ĊĠĠĠĠĠĠĠ Ġinformation Layout . enable Transition () ĊĠĠĠĠĠĠĠ Ġing ang 1 Layout . container . enable Transition () ĊĠĠĠĠĠĠĠ Ġing ang 2 Layout . container . enable Transition () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget App liers ( ing ang Applications : ĠList < Ing ang ApplicationModel >): ĠList < User Model > Ġ= ĊĠĠĠĠĠĠĠ Ġing ang Applications . map Ġ{ Ġit . app lier Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Alert (@ String Res Ġstring Id : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ ĠDim ig oin Dialog ( require Context ()). alert ( Dim ig oin Dialog . Alert Type . ERROR , Ġstring Id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Ing ang App lier RecyclerView Skeleton ( re cyclerView : ĠRecyclerView ): ĠS keleton Screen Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġre cyclerView . show Skeleton ( R . layout . item _ ing ang _ app lier _ name _ skeleton , Ġ 8 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠViewGroup . enable Transition () Ġ{ ĊĠĠĠĠĠĠĠ Ġlayout Transition . enable Transition Type ( Layout Transition . CHANG ING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsealed Ġclass ĠEvent Ġ{ ĊĠĠĠĠĠĠĠ Ġobject ĠIn gang Status Request Fail Ġ: ĠEvent () ĊĠĠĠĠĠĠĠ Ġdata Ġclass ĠIn gang Applied ( val Ġapplied Time : ĠIn gang Time ) Ġ: ĠEvent () ĊĠĠĠĠĠĠĠ Ġobject ĠIn gang Apply Fail Ġ: ĠEvent () ĊĠĠĠĠĠĠĠ Ġobject ĠIn gang Cancel Fail Ġ: ĠEvent () ĊĠĠĠ Ġ} Ċ } Ċ