add an activity extension for toggling UseEnglish

This commit is contained in:
tibbi 2017-11-08 11:52:16 +01:00
parent 75d7428cfc
commit ef3957cf1d

View file

@ -534,3 +534,11 @@ fun BaseSimpleActivity.createDirectorySync(directory: File): Boolean {
}
return directory.mkdirs()
}
fun BaseSimpleActivity.useEnglishToggled() {
val conf = resources.configuration
conf.locale = if (baseConfig.useEnglish) Locale.ENGLISH else Locale.getDefault()
resources.updateConfiguration(conf, resources.displayMetrics)
finish()
startActivity(intent)
}