[Android] Force restarting the app when changing theme while locale is changed

Nicolas Pomepuy git at videolan.org
Tue May 19 10:04:11 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 19 09:22:22 2020 +0200| [8e85b930a238f7001e52a24f2890f104b5da3870] | committer: Nicolas Pomepuy

Force restarting the app when changing theme while locale is changed

Fixes #1244

> https://code.videolan.org/videolan/vlc-android/commit/8e85b930a238f7001e52a24f2890f104b5da3870
---

 .../src/org/videolan/vlc/gui/preferences/PreferencesUi.kt            | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
index c740c1632..81ce54785 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
@@ -36,6 +36,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import org.videolan.medialibrary.interfaces.Medialibrary
 import org.videolan.resources.AndroidDevices
+import org.videolan.resources.AppContextProvider
 import org.videolan.tools.*
 import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.R
@@ -124,7 +125,9 @@ class PreferencesUi : BasePreferenceFragment(), SharedPreferences.OnSharedPrefer
                 UiTools.restartDialog(requireActivity())
             }
             "browser_show_all_files", "video_min_group_length" -> (activity as PreferencesActivity).setRestart()
-            KEY_APP_THEME -> (activity as PreferencesActivity).exitAndRescan()
+            KEY_APP_THEME -> {
+                if (!AppContextProvider.locale.isNullOrEmpty()) UiTools.restartDialog(requireActivity()) else (activity as PreferencesActivity).exitAndRescan()
+            }
             LIST_TITLE_ELLIPSIZE -> {
                 Settings.listTitleEllipsize = sharedPreferences.getString(LIST_TITLE_ELLIPSIZE, "0")?.toInt() ?: 0
                 (activity as PreferencesActivity).setRestart()



More information about the Android mailing list