adding a toggle for forcing English language

This commit is contained in:
tibbi
2017-11-09 20:51:11 +01:00
parent 29a746d15e
commit a9bb73fcaa
4 changed files with 58 additions and 0 deletions

View File

@ -28,6 +28,8 @@ class MainActivity : SimpleActivity() {
private val BACK_PRESS_TIMEOUT = 5000
private var wasBackJustPressed = false
private var mStoredUseEnglish = false
private lateinit var fragment: ItemsFragment
override fun onCreate(savedInstanceState: Bundle?) {
@ -44,13 +46,24 @@ class MainActivity : SimpleActivity() {
tryInitFileManager()
checkWhatsNewDialog()
checkIfRootAvailable()
storeStateVariables()
}
override fun onResume() {
super.onResume()
if (mStoredUseEnglish != config.useEnglish) {
restartActivity()
return
}
invalidateOptionsMenu()
}
override fun onPause() {
super.onPause()
storeStateVariables()
}
override fun onDestroy() {
super.onDestroy()
config.temporarilyShowHidden = false
@ -72,6 +85,10 @@ class MainActivity : SimpleActivity() {
return true
}
private fun storeStateVariables() {
mStoredUseEnglish = config.useEnglish
}
private fun tryInitFileManager() {
handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) {