package Ġcodes . chr ish or ner . socket weather Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Context Ċ import Ġandroidx . annotation . MainThread Ċ import Ġcodes . chr ish or ner . socket weather . data . Data Config Ċ import Ġcodes . chr ish or ner . socket weather . data . Device Locator Ċ import Ġcodes . chr ish or ner . socket weather . data . Fore caster Ċ import Ġcodes . chr ish or ner . socket weather . data . Location Selection Disk Store Ċ import Ġcodes . chr ish or ner . socket weather . data . Location Selection Store Ċ import Ġcodes . chr ish or ner . socket weather . data . Network Components Ċ import Ġcodes . chr ish or ner . socket weather . data . Real Fore caster Ċ import Ġjava . time . Clock Ċ Ċ /** Ċ Ġ* ĠA Ġche ap Ġand Ġdirty Ġservice Ġlocator Ġthat Ġhouse s Ġsing letons Ġused Ġthroughout Ċ Ġ* Ġthe Ġapp . Ċ Ġ*/ Ċ interface ĠSing letons Ġ{ ĊĠ Ġval Ġdevice Locator : ĠDevice Locator ĊĠ Ġval Ġlocation Selection Store : ĠLocation Selection Store ĊĠ Ġval Ġnetwork Components : ĠNetwork Components ĊĠ Ġval Ġfore caster : ĠFore caster Ċ } Ċ Ċ private Ġvar Ġsing letons : ĠSing letons ? Ġ= Ġnull Ċ Ċ // ĠAlthough Ġthis Ġtechnically Ġdoesn 't Ġneed Ġto Ġbe Ġan Ġextension Ġon ĠContext , Ġit 's Ċ // Ġuseful Ġto Ġlimit Ġaccess Ġto Ġservice Ġloc ators Ġto Ġwhen Ġonly Ġa ĠContext Ġis Ġavailable . Ċ @ Suppress (" unused ") Ċ val ĠContext . app Sing letons ĊĠ Ġget () Ġ= ĠcheckNotNull ( sing letons ) Ġ{ Ġ" initial ise Sing letons () Ġmust Ġbe Ġcalled Ġin ĠApplication ." Ġ} Ċ Ċ @ MainThread Ċ fun ĠApplication . initial ise Sing letons () Ġ{ ĊĠ Ġsing letons Ġ= ĠSingleton Cache ( this ) Ċ } Ċ Ċ private Ġclass ĠSingleton Cache ( app : ĠApplication ) Ġ: ĠSing letons Ġ{ ĊĠ Ġoverride Ġval Ġdevice Locator : ĠDevice Locator Ġ= ĠCurrent Build Type Components . create Device Locator ( app ) ĊĠ Ġoverride Ġval Ġlocation Selection Store Ġ= ĠLocation Selection Disk Store ( app , ĠData Config . mos hi ) ĊĠ Ġoverride Ġval Ġnetwork Components Ġ= ĠCurrent Build Type Components . create Network Components ( app ) ĊĠ Ġoverride Ġval Ġfore caster Ġ= ĠReal Fore caster ( ĊĠĠĠ Ġclock Ġ= ĠClock . system Default Zone (), ĊĠĠĠ Ġapi Ġ= Ġnetwork Components . api , ĊĠĠĠ Ġlocation Selections Ġ= Ġlocation Selection Store . current Selection , ĊĠĠĠ Ġdevice Locations Ġ= Ġdevice Locator . observe Device Location () ĊĠ Ġ) Ċ } Ċ