-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.kt
More file actions
27 lines (20 loc) · 771 Bytes
/
App.kt
File metadata and controls
27 lines (20 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com
import android.app.Application
import android.content.Context
import android.content.res.Configuration
import com.util.LocaleManager // May change according to LocaleManager class localization in your project
// Original work : https://gist.github.com/Jasonlhy/f6d1211c4f848a3f685bd2d28c6e2eb5
class App : Application(){
override fun onCreate() {
super.onCreate()
}
// Necessary method for LocaleManager
override fun attachBaseContext(base: Context) {
super.attachBaseContext(LocaleManager.setLocale(base))
}
// Necessary method for LocaleManager
override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)
LocaleManager.setLocale(this)
}
}