mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
Simplify some expressions.
This commit is contained in:
parent
ad7b8bd866
commit
030cc80c71
@ -17,7 +17,7 @@ object LocaleHelper {
|
|||||||
val languageName = PreferenceHelper.getString(PreferenceKeys.LANGUAGE, "sys")
|
val languageName = PreferenceHelper.getString(PreferenceKeys.LANGUAGE, "sys")
|
||||||
val locale = when {
|
val locale = when {
|
||||||
languageName == "sys" -> Locale.getDefault()
|
languageName == "sys" -> Locale.getDefault()
|
||||||
languageName.contains("-") == true -> {
|
languageName.contains("-") -> {
|
||||||
val languageParts = languageName.split("-")
|
val languageParts = languageName.split("-")
|
||||||
Locale(
|
Locale(
|
||||||
languageParts[0],
|
languageParts[0],
|
||||||
@ -41,9 +41,9 @@ object LocaleHelper {
|
|||||||
private fun updateResourcesLegacy(context: Context, locale: Locale) {
|
private fun updateResourcesLegacy(context: Context, locale: Locale) {
|
||||||
Locale.setDefault(locale)
|
Locale.setDefault(locale)
|
||||||
val resources: Resources = context.resources
|
val resources: Resources = context.resources
|
||||||
val configuration: Configuration = resources.getConfiguration()
|
val configuration = resources.configuration
|
||||||
configuration.locale = locale
|
configuration.locale = locale
|
||||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics())
|
resources.updateConfiguration(configuration, resources.displayMetrics)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDetectedCountry(context: Context): String {
|
private fun getDetectedCountry(context: Context): String {
|
||||||
|
Loading…
Reference in New Issue
Block a user