[Android] Fix some language issues

Nicolas Pomepuy git at videolan.org
Thu Aug 8 13:35:01 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Aug  7 14:25:36 2019 +0200| [b469eb865e535bce6e6fc076bc2e02483a256753] | committer: Geoffrey Métais

Fix some language issues

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

 vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt          |  9 +--------
 .../src/org/videolan/vlc/gui/preferences/PreferencesUi.kt     |  2 --
 .../src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt     | 11 ++---------
 .../src/org/videolan/vlc/gui/tv/preferences/PreferencesUi.kt  |  2 --
 4 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
index 3603fccca..f7a31841d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
@@ -17,10 +17,7 @@ open class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
     lateinit var settings: SharedPreferences
 
     override fun onCreate(savedInstanceState: Bundle?) {
-        if (!localeSet) {
-            UiTools.setLocale(this)
-            localeSet = true
-        }
+        UiTools.setLocale(this)
         settings = Settings.getInstance(this)
         /* Theme must be applied before super.onCreate */
         applyTheme()
@@ -41,8 +38,4 @@ open class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
         cancel()
         super.onDestroy()
     }
-
-    companion object {
-        var localeSet = false
-    }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
index 19e7760f0..4d6905b94 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
@@ -32,7 +32,6 @@ import androidx.preference.TwoStatePreference
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import org.videolan.vlc.R
-import org.videolan.vlc.gui.BaseActivity
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.util.*
 
@@ -100,7 +99,6 @@ class PreferencesUi : BasePreferenceFragment(), SharedPreferences.OnSharedPrefer
     override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
         when (key) {
             "set_locale" -> {
-                BaseActivity.localeSet = false
                 (activity as PreferencesActivity).setRestart()
                 UiTools.restartDialog(requireActivity())
             }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
index 907c42be6..cec26c316 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
@@ -54,13 +54,9 @@ abstract class BaseTvActivity : FragmentActivity(), CoroutineScope by MainScope(
     @Volatile
     private var currentlyVisible = false
 
-
     override fun onCreate(savedInstanceState: Bundle?) {
         //Init Medialibrary if KO
-        if (!localeSet) {
-            UiTools.setLocale(this)
-            localeSet = true
-        }
+        UiTools.setLocale(this)
         if (savedInstanceState != null) startMedialibrary(firstRun = false, upgrade = false, parse = true)
         super.onCreate(savedInstanceState)
         mediaLibrary = AbstractMedialibrary.getInstance()
@@ -101,6 +97,7 @@ abstract class BaseTvActivity : FragmentActivity(), CoroutineScope by MainScope(
         KeyHelper.manageModifiers(event)
         return super.onKeyUp(keyCode, event)
     }
+
     protected abstract fun refresh()
 
     protected open fun onParsingServiceStarted() {}
@@ -123,8 +120,4 @@ abstract class BaseTvActivity : FragmentActivity(), CoroutineScope by MainScope(
             MediaParsingService.newStorages.value = null
         })
     }
-
-    companion object {
-        var localeSet = false
-    }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesUi.kt b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesUi.kt
index 4d30291c8..5330f7701 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesUi.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesUi.kt
@@ -34,7 +34,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.helpers.UiTools
-import org.videolan.vlc.gui.tv.browser.BaseTvActivity
 import org.videolan.vlc.util.*
 
 
@@ -73,7 +72,6 @@ class PreferencesUi : BasePreferenceFragment(), SharedPreferences.OnSharedPrefer
     override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
         when (key) {
             "set_locale" -> {
-                BaseTvActivity.localeSet = false
                 (activity as PreferencesActivity).setRestartApp()
                 UiTools.restartDialog(activity)
             }



More information about the Android mailing list