diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/App.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/App.kt
index 8dbac5b8..d5ce3d8f 100644
--- a/app/src/main/kotlin/com/simplemobiletools/filemanager/App.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/App.kt
@@ -2,10 +2,18 @@ package com.simplemobiletools.filemanager
import android.app.Application
import com.github.ajalt.reprint.core.Reprint
+import com.simplemobiletools.filemanager.extensions.config
+import java.util.*
class App : Application() {
override fun onCreate() {
super.onCreate()
+
+ if (config.useEnglish) {
+ val conf = resources.configuration
+ conf.locale = Locale.ENGLISH
+ resources.updateConfiguration(conf, resources.displayMetrics)
+ }
Reprint.initialize(this)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt
index a2bfa6c4..9b08e281 100644
--- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt
@@ -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) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt
index 26993fe4..747378a6 100644
--- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt
@@ -7,12 +7,14 @@ import com.simplemobiletools.commons.dialogs.SecurityDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection
import com.simplemobiletools.commons.extensions.updateTextColors
+import com.simplemobiletools.commons.extensions.useEnglishToggled
import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT
import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS
import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.extensions.config
import com.simplemobiletools.filemanager.helpers.RootHelpers
import kotlinx.android.synthetic.main.activity_settings.*
+import java.util.*
class SettingsActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -24,6 +26,7 @@ class SettingsActivity : SimpleActivity() {
super.onResume()
setupCustomizeColors()
+ setupUseEnglish()
setupManageFavorites()
setupShowHidden()
setupPasswordProtection()
@@ -44,6 +47,16 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupUseEnglish() {
+ settings_use_english_holder.beVisibleIf(Locale.getDefault().language != "en")
+ settings_use_english.isChecked = config.useEnglish
+ settings_use_english_holder.setOnClickListener {
+ settings_use_english.toggle()
+ config.useEnglish = settings_use_english.isChecked
+ useEnglishToggled()
+ }
+ }
+
private fun setupShowHidden() {
settings_show_hidden.isChecked = config.showHidden
settings_show_hidden_holder.setOnClickListener {
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 47b98047..d8fb1c29 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -49,6 +49,26 @@
+
+
+
+
+
+