package Ġjp . cor dea . recyclerview constants peed scroll demo Ċ Ċ 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 Ġjp . cor dea . recyclerview constants peed scroll demo . databinding . Fragment First Binding Ċ Ċ class ĠFirst Fragment Ġ: ĠFragment () Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠFragment First Binding ĊĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby Ġview Models < First ViewModel >() ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠFragment First Binding . inflate ( in flater ) ĊĠĠĠĠĠĠĠ Ġbinding . re cyclerView . layout Manager Ġ= ĠConstant Speed Scroll LayoutManager ( require Context ()) ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ ĠviewModel . init () ĊĠĠĠĠĠĠĠ ĠviewModel . scrollTo ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe ( view Lifecycle Owner , ĠObserver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . re cyclerView . smooth Scroll To Position ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} Ċ } Ċ