[Android] Fix local values access

Geoffrey Métais git at videolan.org
Tue Apr 30 14:41:34 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 30 14:37:05 2019 +0200| [3dbc436aaa7079c7a159d690f61792c474287123] | committer: Geoffrey Métais

Fix local values access

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

 vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
index d4ca5fe85..53f930429 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
@@ -466,17 +466,13 @@ object UiTools {
         }
 
 
-        val finalLocaleEntries = ArrayList<String>(localeTreeMap.size + 1)
-        val finalLocaleEntryValues = ArrayList<String>(localeTreeMap.size + 1)
-
-        finalLocaleEntries[0] = context.getString(R.string.device_default)
-        finalLocaleEntryValues[0] = ""
+        val finalLocaleEntries = ArrayList<String>(localeTreeMap.size + 1).apply { add(0, context.getString(R.string.device_default)) }
+        val finalLocaleEntryValues = ArrayList<String>(localeTreeMap.size + 1).apply { add(0, "") }
 
         var i = 1
         for ((key, value) in localeTreeMap) {
-            finalLocaleEntries[i] = key
-            finalLocaleEntryValues[i] = value
-
+            finalLocaleEntries.add(i, key)
+            finalLocaleEntryValues.add(i, value)
             i++
         }
 



More information about the Android mailing list