Skip to content
Snippets Groups Projects
Commit 35694eeb authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix ANR when setting a replay preamp value in a comma separated locale

Fixes #2599
parent b960b146
No related branches found
No related tags found
1 merge request!1450Fix ANR when setting a replay preamp value in a comma separated locale
Pipeline #240532 passed with stage
in 20 minutes and 1 second
......@@ -45,6 +45,8 @@ import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
import org.videolan.vlc.util.LocaleUtil
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
private const val TAG = "VLC/PreferencesAudio"
......@@ -133,7 +135,7 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
val newValue = sharedPreferences.getString(key, defValue)
var fmtValue = defValue
try {
fmtValue = DecimalFormat("###0.0###").format(newValue?.toDouble())
fmtValue = DecimalFormat("###0.0###", DecimalFormatSymbols(Locale.ENGLISH)).format(newValue?.toDouble())
} catch (e: IllegalArgumentException) {
Log.w(TAG, "Could not parse value: $newValue. Setting $key to $fmtValue", e)
} finally {
......
......@@ -51,6 +51,8 @@ import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.providers.PickerType
import org.videolan.vlc.util.LocaleUtil
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
private const val TAG = "VLC/PreferencesAudio"
private const val FILE_PICKER_RESULT_CODE = 10000
......@@ -157,7 +159,7 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
val newValue = sharedPreferences.getString(key, defValue)
var fmtValue = defValue
try {
fmtValue = DecimalFormat("###0.0###").format(newValue?.toDouble())
fmtValue = DecimalFormat("###0.0###", DecimalFormatSymbols(Locale.ENGLISH)).format(newValue?.toDouble())
} catch (e: IllegalArgumentException) {
Log.w(TAG, "Could not parse value: $newValue. Setting $key to $fmtValue", e)
} finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment