package Ġcom . ps . om ar mat tr . q al by . ui . dialog Ċ Ċ import Ġandroid . media . MediaPlayer Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . google . android . material . bottom sheet . Bottom Sheet Dialog Fragment Ċ import Ġcom . ps . om ar mat tr . q al by . BR Ċ import Ġcom . ps . om ar mat tr . q al by . R Ċ import Ġcom . ps . om ar mat tr . q al by . adapter . Generic Adapter Ċ import Ġcom . ps . om ar mat tr . q al by . databinding . Dialog M ue zz in Binding Ċ import Ġcom . ps . om ar mat tr . q al by . model . Az an Ċ import Ġcom . ps . om ar mat tr . q al by . other . Function Constant Ċ import Ġcom . ps . om ar mat tr . q al by . other . PREFER ENCES _ DEFAULT _ AZ AN Ċ import Ġcom . ps . om ar mat tr . q al by . ui . view model . Sol ah ViewModel Ċ import Ġcom . ps . om ar mat tr . q al by . util . Preferences Manager Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ import Ġjavax . inject . Inject Ċ @ Android EntryPoint Ċ class ĠM ue zz in Dialog Ġ: ĠBottom Sheet Dialog Fragment (), ĊĠĠĠ ĠGeneric Adapter . On ListItem View ClickListener < Az an > Ġ{ ĊĠĠĠ Ġprivate Ġval Ġm Binding Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠDialog M ue zz in Binding . inflate ( layout Inflater ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġm Adapter Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠGeneric Adapter ( R . layout . item _ az an , ĠBR . az an , Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel : ĠSol ah ViewModel ĊĊĠĠĠ Ġlateinit Ġvar Ġmedia Player : ĠMedia Player ĊĠĠĠ Ġlateinit Ġvar Ġpreferences Manager : ĠPreferences Manager ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ) Ġ= Ġm Binding . root ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġpreferences Manager Ġ= ĠPreferences Manager ( require Context ()) ĊĠĠĠĠĠĠĠ Ġmedia Player Ġ= ĠMedia Player . create ( context , ĠR . raw . da ood sub uh long ) ĊĠĠĠĠĠĠĠ Ġm Adapter . data Ġ= ĠFunction Constant . get Az an List () ĊĠĠĠĠĠĠĠ Ġm Adapter . notify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġm Binding . rc Az an . adapter Ġ= Ġm Adapter ĊĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonClick Item ( item ViewModel : ĠAz an , Ġtype : ĠInt , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( media Player . is Playing ) Ġmedia Player . stop () ĊĠĠĠĠĠĠĠ Ġmedia Player Ġ= ĠMedia Player . create ( context , Ġitem ViewModel . media ) ĊĠĠĠĠĠĠĠ Ġmedia Player . start () ĊĠĠĠĠĠĠĠ Ġpreferences Manager . editor . put Int ( PREFER ENCES _ DEFAULT _ AZ AN , Ġitem ViewModel . media ) ĊĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Pause () Ġ{ ĊĠĠĠĠĠĠĠ Ġpreferences Manager . editor . apply () ĊĠĠĠĠĠĠĠ Ġif Ġ( media Player . is Playing ) Ġmedia Player . stop () ĊĠĠĠĠĠĠĠ Ġsuper . on Pause () ĊĠĠĠ Ġ} Ċ Ċ }