From b89eaada94a27d20dcd711ead00312355dec18c3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 3 Sep 2022 15:51:17 +0200 Subject: [PATCH] allow picking any language on Android 13 --- .../pro/activities/SettingsActivity.kt | 24 +++++++++++++------ app/src/main/res/layout/activity_settings.xml | 24 +++++++++++++++++++ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index a195c1955..7fa1d10da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -22,6 +22,7 @@ import kotlinx.android.synthetic.main.activity_settings.* import java.io.File import java.io.InputStream import java.util.* +import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { private val PICK_IMPORT_SOURCE_INTENT = 1 @@ -41,6 +42,7 @@ class SettingsActivity : SimpleActivity() { private fun setupSettingItems() { setupCustomizeColors() setupUseEnglish() + setupLanguage() setupChangeDateTimeFormat() setupFileLoadingPriority() setupManageIncludedFolders() @@ -142,17 +144,25 @@ class SettingsActivity : SimpleActivity() { } private fun setupUseEnglish() { - settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en") + settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus()) settings_use_english.isChecked = config.useEnglish - - if (settings_use_english_holder.isGone()) { - settings_change_date_time_format_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } - settings_use_english_holder.setOnClickListener { settings_use_english.toggle() config.useEnglish = settings_use_english.isChecked - System.exit(0) + exitProcess(0) + } + } + + private fun setupLanguage() { + settings_language.text = Locale.getDefault().displayLanguage + settings_language_holder.beVisibleIf(isTiramisuPlus()) + + if (settings_use_english_holder.isGone() && settings_language_holder.isGone()) { + settings_change_date_time_format_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) + } + + settings_language_holder.setOnClickListener { + launchChangeAppLanguageIntent() } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 98537ee8f..d9f70c3cf 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -97,6 +97,30 @@ + + + + + + + +