package Ġcom . p unto gr is . re cap . feature _ re cap . presentation . main _ feed . explore Ċ Ċ import Ġandroid . app . Dialog Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . fragment . app . Dialog Fragment Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġcom . google . android . material . dialog . Material AlertDialog Builder Ċ import Ġcom . p unto gr is . re cap . R Ċ import Ġcom . p unto gr is . re cap . feature _ re cap . domain . model . Re cap Order Ċ import Ġcom . p unto gr is . re cap . feature _ re cap . presentation . main _ feed . Home ViewModel Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ Ċ @ Android EntryPoint Ċ class ĠRe cap Order Dialog Ġ: ĠDialog Fragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠHome ViewModel Ġby Ġview Models ( owner Producer Ġ= Ġ{ Ġrequire Parent Fragment () Ġ}) ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate Dialog ( savedInstanceState : ĠBundle ?): ĠDialog Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġorder Options Ġ= Ġenum Values < Re cap Order >(). map Ġ{ ĠgetString ( it . title Res ) Ġ}. to Typed Array () ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Selection Ġ= ĠviewModel . re cap Order . value ?. ordinal Ġ?: Ġ 0 ĊĊĠĠĠĠĠĠĠ Ġreturn ĠMaterial AlertDialog Builder ( require Context ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setTitle ( R . string . sort _ by ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Single Choice Items ( order Options , Ġcurrent Selection ) Ġ{ Ġdialog , Ġwhich Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( which Ġ!= Ġcurrent Selection ) ĠviewModel . order Re cap sBy ( which ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdialog . dismiss () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. create () ĊĠĠĠ Ġ} Ċ }