package Ġcom . mal lo tec . reb . locale plugin Ċ Ċ import Ġandroid . app . Application Ċ import Ġcom . mal lo tec . reb . locale plugin . lifecycle . Locale Activity Lifecycle Callbacks Ċ import Ġcom . mal lo tec . reb . locale plugin . lifecycle . Locale Component Lifecycle Callbacks Ċ import Ġcom . mal lo tec . reb . locale plugin . utils . Activity Helper Ċ import Ġcom . mal lo tec . reb . locale plugin . utils . Broadcast Receiver Manager Ċ import Ġcom . mal lo tec . reb . locale plugin . utils . Locale Helper Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġre born Ġon Ġ 2 0 1 9 - 1 2 - 1 0 . Ċ Ġ*/ Ċ object ĠLocale Plugin Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġlocale Activity Lifecycle Callbacks : ĠLocale Activity Lifecycle Callbacks ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġlocale Component Lifecycle Callbacks : ĠLocale Component Lifecycle Callbacks ? Ġ Ġ= Ġnull ĊĊĠĠĠ Ġ// Ġ æ³¨åĨĮ ĠLifecycle Callbacks ĊĠĠĠ Ġprivate Ġfun Ġregister Lifecycle Callbacks ( application : ĠApplication ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlocale Activity Lifecycle Callbacks Ġ= ĠLocale Activity Lifecycle Callbacks () ĊĠĠĠĠĠĠĠ Ġlocale Component Lifecycle Callbacks Ġ= ĠLocale Component Lifecycle Callbacks ( application ) ĊĠĠĠĠĠĠĠ Ġapplication . register Activity Lifecycle Callbacks ( locale Activity Lifecycle Callbacks ) ĊĠĠĠĠĠĠĠ Ġapplication . register Component Callbacks ( locale Component Lifecycle Callbacks ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġ æ³¨ éĶĢ ĠLifecycle Callbacks ĊĠĠĠ Ġprivate Ġfun Ġunregister Lifecycle Callbacks ( application : ĠApplication ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlocale Activity Lifecycle Callbacks ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapplication . unregister Activity Lifecycle Callbacks ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Activity Lifecycle Callbacks Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġlocale Component Lifecycle Callbacks ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapplication . unregister Component Callbacks ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Component Lifecycle Callbacks Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinit ( application : ĠApplication , Ġupdate Interface Way : ĠInt Ġ= ĠLocale Constant . RE CREATE _ CURRENT _ ACTIVITY ): ĠLocale Plugin Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġthis . apply Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠåĪĿå§ĭåĮĸ æīĢæľī çĶ¨ åĪ°çļĦ å·¥åħ· ç±» ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Helper . init ( update Interface Way ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLocale Default SP Helper . init ( application ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLocale Helper . init ( application ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġregister Lifecycle Callbacks ( application ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġ ç¼ĵåŃĺ ç³»ç»Ł è¯Ńè¨Ģ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLocale Helper . getInstance (). cache System Locale () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġè®¾ç½® è¯Ńè¨Ģ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLocale Helper . getInstance (). update ApplicationContext ( application ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠApp Ġ ç»ĵæĿŁ æĹ¶ è°ĥçĶ¨ ĊĠĠĠ Ġfun Ġterminate ( application : ĠApplication ) Ġ{ ĊĠĠĠĠĠĠĠ Ġunregister Lifecycle Callbacks ( application ) ĊĠĠĠĠĠĠĠ ĠBroadcast Receiver Manager . unregister All Broadcast Receiver () ĊĠĠĠ Ġ} Ċ }