package Ġcom . zeug mas olution s . locale helper Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . res . Configuration Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġjava . util .* Ċ Ċ open Ġclass ĠLocale Aware Compat Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlocale Delegate : ĠLocale Helper Activity Delegate Ġ= ĠLocale Helper Activity Delegate Impl () ĊĊĠĠĠ Ġoverride Ġfun Ġget Delegate () Ġ= Ġlocale Delegate . get AppCompat Delegate ( super . get Delegate ()) ĊĊĠĠĠ Ġoverride Ġfun Ġattach Base Context ( new Base : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . attach Base Context ( locale Delegate . attach Base Context ( new Base )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġlocale Delegate . onCreate ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ Ġlocale Delegate . on Res umed ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Pause () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Pause () ĊĠĠĠĠĠĠĠ Ġlocale Delegate . on Paused () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Configuration Context ( override Configuration : ĠConfiguration ): ĠContext Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= Ġsuper . create Configuration Context ( override Configuration ) ĊĠĠĠĠĠĠĠ Ġreturn ĠLocale Helper . on Attach ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget ApplicationContext (): ĠContext Ġ= ĊĠĠĠĠĠĠĠ Ġlocale Delegate . getApplicationContext ( super . getApplicationContext ()) ĊĊĠĠĠ Ġopen Ġfun Ġupdate Locale ( locale : ĠLocale ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlocale Delegate . set Locale ( this , Ġlocale ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ open Ġclass ĠLocale Aware Application Ġ: ĠApplication () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlocale App Delegate Ġ= ĠLocale Helper Application Delegate () ĊĊĠĠĠ Ġoverride Ġfun Ġattach Base Context ( base : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . attach Base Context ( locale App Delegate . attach Base Context ( base )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Configuration Changed ( new Config : ĠConfiguration ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Configuration Changed ( new Config ) ĊĠĠĠĠĠĠĠ Ġlocale App Delegate . on Configuration Changed ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget ApplicationContext (): ĠContext Ġ= ĊĠĠĠĠĠĠĠ ĠLocale Helper . on Attach ( super . getApplicationContext ()) Ċ }