From 608af14ce96dbf9cdb353e44a056c143a03ba4a9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 21 Nov 2017 15:17:17 +0100 Subject: [PATCH] add a toggle for using english --- app/src/main/AndroidManifest.xml | 1 + .../com/simplemobiletools/camera/App.kt | 17 ++++ .../camera/activities/MainActivity.kt | 86 +++++++++---------- .../camera/activities/SettingsActivity.kt | 14 +++ app/src/main/res/layout/activity_settings.xml | 20 +++++ 5 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/camera/App.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 93d7a541..6e3fb1bc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -19,6 +19,7 @@ tools:node="remove"/> ().apply { add(Release(33, R.string.release_33)) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index 16829cca..49bb00df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -7,12 +7,15 @@ import com.simplemobiletools.camera.BuildConfig import com.simplemobiletools.camera.R import com.simplemobiletools.camera.extensions.config import com.simplemobiletools.commons.dialogs.FilePickerDialog +import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.commons.extensions.updateTextColors +import com.simplemobiletools.commons.extensions.useEnglishToggled import com.simplemobiletools.commons.helpers.LICENSE_GLIDE import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN import kotlinx.android.synthetic.main.activity_settings.* import java.io.File +import java.util.* class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -24,6 +27,7 @@ class SettingsActivity : SimpleActivity() { super.onResume() setupCustomizeColors() + setupUseEnglish() setupSavePhotosFolder() setupShowPreview() setupSound() @@ -56,6 +60,16 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupUseEnglish() { + settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || 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 setupSavePhotosFolder() { settings_save_photos.text = getLastPart(config.savePhotosFolder) settings_save_photos_holder.setOnClickListener { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1050ca78..1e616fba 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -30,6 +30,26 @@ + + + + + +