package Ġorg . od k . collect . android . projects Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . graphics . Color Ċ import Ġandroid . graphics . drawable . Color Drawable Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . View . IN VISIBLE Ċ import Ġandroid . view . View . VISIBLE Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Dialog Fragment Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġorg . od k . collect . android . R Ċ import Ġorg . od k . collect . android . activities . About Activity Ċ import Ġorg . od k . collect . android . activities . view models . Current Project ViewModel Ċ import Ġorg . od k . collect . android . databinding . Project Settings Dialog Layout Binding Ċ import Ġorg . od k . collect . android . injection . D agger Utils Ċ import Ġorg . od k . collect . android . preferences . dialogs . Admin Password Dialog Fragment Ċ import Ġorg . od k . collect . android . preferences . screens . Admin Preferences Activity Ċ import Ġorg . od k . collect . android . preferences . screens . General Preferences Activity Ċ import Ġorg . od k . collect . android . utilities . Admin Password Provider Ċ import Ġorg . od k . collect . android . utilities . Dialog Utils Ċ import Ġorg . od k . collect . android . utilities . Toast Utils Ċ import Ġorg . od k . collect . projects . Add Project Dialog Ċ import Ġorg . od k . collect . projects . Project Ċ import Ġorg . od k . collect . projects . Projects Repository Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠProject Settings Dialog Ġ: ĠDialog Fragment () Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġadmin Password Provider : ĠAdmin Password Provider ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġprojects Repository : ĠProjects Repository ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġcurrent Project Provider : ĠCurrent Project Provider ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġcurrent Project ViewModel Factory : ĠCurrent Project ViewModel . Factory ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠProject Settings Dialog Layout Binding ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcurrent Project ViewModel : ĠCurrent Project ViewModel ĊĊĠĠĠ Ġoverride Ġfun Ġon Attach ( context : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Attach ( context ) ĊĠĠĠĠĠĠĠ ĠD agger Utils . getComponent ( context ). inject ( this ) ĊĊĠĠĠĠĠĠĠ Ġcurrent Project ViewModel Ġ= ĠViewModel Provider ( require Activity (), Ġcurrent Project ViewModel Factory )[ Current Project ViewModel :: class . java ] ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġdialog ?. window ?. setBackground Drawable ( Color Drawable ( Color . TRANSP ARENT )) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠProject Settings Dialog Layout Binding . inflate ( in flater ) ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġsetup Current Project View () ĊĠĠĠĠĠĠĠ Ġinf late ListOf In Active Projects ( view . context ) ĊĊĠĠĠĠĠĠĠ Ġbinding . close Icon . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . general Settings Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( require Context (), ĠGeneral Preferences Activity :: class . java )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . admin Settings Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( admin Password Provider . isAdmin Password Set ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġargs Ġ= ĠBundle (). also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . put Serializable ( Admin Password Dialog Fragment . ARG _ ACTION , ĠAdmin Password Dialog Fragment . Action . ADMIN _ SETTINGS ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDialog Utils . show IfNot Showing ( Admin Password Dialog Fragment :: class . java , Ġargs , Ġrequire Activity (). support FragmentManager ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( require Context (), ĠAdmin Preferences Activity :: class . java )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . add Project Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDialog Utils . show IfNot Showing ( Add Project Dialog :: class . java , Ġrequire Activity (). support FragmentManager ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . about Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( require Context (), ĠAbout Activity :: class . java )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinf late ListOf In Active Projects ( context : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( projects Repository . getAll (). none Ġ{ Ġit . uuid Ġ!= Ġcurrent Project Provider . getCurrent ProjectId () Ġ}) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . top Divider . visibility Ġ= ĠIN VISIBLE ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . top Divider . visibility Ġ= ĠVIS IBLE ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġprojects Repository . getAll (). filter Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . uuid Ġ!= Ġcurrent Project Provider . getCurrent ProjectId () ĊĠĠĠĠĠĠĠ Ġ}. forEach Ġ{ Ġproject Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġproject View Ġ= ĠProject ListItem View ( context ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġproject View . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġswitch Project ( project ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġproject View . project Ġ= Ġproject ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproject View . content Description Ġ= ĠgetString ( R . string . switch _ to _ project , Ġproject . name ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . project List . addView ( project View ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġswitch Project ( project : ĠProject ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcurrent Project Provider . setCurrent Project ( project . uuid ) ĊĠĠĠĠĠĠĠ Ġcurrent Project ViewModel . setCurrent Project ( project ) ĊĠĠĠĠĠĠĠ ĠToast Utils . show Long Toast ( getString ( R . string . sw itched _ project , Ġproject . name )) ĊĠĠĠĠĠĠĠ Ġdismiss () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Current Project View () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Project Ġ= Ġcurrent Project Provider . getCurrent Project () Ġ?: Ġreturn ĊĊĠĠĠĠĠĠĠ Ġbinding . current Project . project Ġ= Ġcurrent Project ĊĠĠĠĠĠĠĠ Ġbinding . current Project . content Description Ġ= ĠgetString ( R . string . using _ project , Ġcurrent Project . name ) ĊĠĠĠ Ġ} Ċ } Ċ