package Ġcom . mat he ws achin . f ate grand autom ata . ui . card _ priority Ċ Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . core . content . edit Ċ import Ġandroidx . recyclerview . widget . Item Touch Helper Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . mat he ws achin . f ate grand autom ata . R Ċ import Ġcom . mat he ws achin . f ate grand autom ata . scripts . Card Score Ċ import Ġcom . mat he ws achin . f ate grand autom ata . scripts . modules . get Card Scores Ċ import Ġcom . mat he ws achin . f ate grand autom ata . scripts . prefs . default Card Priority Ċ import Ġcom . mat he ws achin . f ate grand autom ata . scripts . prefs . default Prefs Ċ import Ġcom . mat he ws achin . f ate grand autom ata . scripts . prefs . getString Pref Ċ import Ġcom . mat he ws achin . f ate grand autom ata . util . I On Start Drag Listener Ċ import Ġcom . mat he ws achin . f ate grand autom ata . util . Item Touch Helper Callback Ċ import Ġkotlinx . android . synt hetic . main . card _ priority .* Ċ Ċ fun ĠString . filter Cap it als (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġthis ĊĠĠĠĠĠĠĠ Ġ. as Sequence () ĊĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit . is UpperCase () Ġ} ĊĠĠĠĠĠĠĠ Ġ. join ToString ( separator Ġ= Ġ"") Ċ } Ċ Ċ class ĠCard Priority Activity Ġ: ĠAppCompatActivity (), ĠI On Start Drag Listener Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġitem Touch Helper : ĠItem Touch Helper ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcard Scores : ĠMutable List < Card Score > ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . card _ priority ) ĊĊĠĠĠĠĠĠĠ Ġvar Ġcard Priority Ġ= ĠgetString Pref ( R . string . pref _ card _ priority ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠHandle Ġsimple Ġmode Ġand Ġempty Ġstring ĊĠĠĠĠĠĠĠ Ġif Ġ( card Priority . length Ġ== Ġ 3 Ġ|| Ġcard Priority . isBlank ()) ĊĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcard Priority Ġ= Ġdefault Card Priority ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġcard Scores Ġ= Ġget Card Scores ( card Priority ). to Mutable List () ĊĊĠĠĠĠĠĠĠ Ġval Ġadapter Ġ= ĠCard Priority Adapter ( card Scores , Ġthis ) ĊĊĠĠĠĠĠĠĠ Ġval Ġre cyclerView Ġ= Ġcard _ priority _ lv ĊĠĠĠĠĠĠĠ Ġre cyclerView . set Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠ Ġre cyclerView . adapter Ġ= Ġadapter ĊĠĠĠĠĠĠĠ Ġre cyclerView . layout Manager Ġ= ĠLinearLayoutManager ( this , ĠLinearLayoutManager . HORIZONTAL , Ġfalse ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcallback Ġ= ĠItem Touch Helper Callback ( adapter ) ĊĠĠĠĠĠĠĠ Ġitem Touch Helper Ġ= ĠItem Touch Helper ( callback ) ĊĠĠĠĠĠĠĠ Ġitem Touch Helper . attach To RecyclerView ( re cyclerView ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Pause () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Pause () ĊĊĠĠĠĠĠĠĠ Ġval Ġvalue Ġ= Ġcard Scores . join ToString Ġ{ Ġit . toString (). filter Cap it als () Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġkey Ġ= ĠgetString ( R . string . pref _ card _ priority ) ĊĠĠĠĠĠĠĠ Ġdefault Prefs . edit ( commit Ġ= Ġtrue ) Ġ{ Ġput String ( key , Ġvalue ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonStart Drag ( ViewHolder : ĠRecyclerView . ViewHolder ) Ġ{ ĊĠĠĠĠĠĠĠ Ġitem Touch Helper . start Drag ( ViewHolder ) ĊĠĠĠ Ġ} Ċ } Ċ