Skip to content
Snippets Groups Projects
Unverified Commit 24e979f6 authored by axelherbstreith's avatar axelherbstreith Committed by GitHub
Browse files

Transnational country list names not changing when language is changed (EXPOSUREAPP-4416) (#2053)

* Changed access of country list names

* Removed CachedString from Country items

* Linting
parent 88ed9427
No related branches found
No related tags found
No related merge requests found
package de.rki.coronawarnapp.ui package de.rki.coronawarnapp.ui
import android.content.Context
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import de.rki.coronawarnapp.R import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.util.ui.CachedString
enum class Country( enum class Country(
val code: String, val code: String,
...@@ -43,5 +43,7 @@ enum class Country( ...@@ -43,5 +43,7 @@ enum class Country(
SI("si", R.string.country_name_si, R.drawable.ic_country_si), SI("si", R.string.country_name_si, R.drawable.ic_country_si),
SK("sk", R.string.country_name_sk, R.drawable.ic_country_sk); SK("sk", R.string.country_name_sk, R.drawable.ic_country_sk);
val label = CachedString { it.getString(labelRes) } fun getLabel(context: Context): String {
return context.getString(labelRes)
}
} }
...@@ -25,10 +25,10 @@ class CountryListView(context: Context, attrs: AttributeSet) : LinearLayout(cont ...@@ -25,10 +25,10 @@ class CountryListView(context: Context, attrs: AttributeSet) : LinearLayout(cont
set(value) { set(value) {
field = value.sortedWith { a, b -> field = value.sortedWith { a, b ->
// Sort country list alphabetically // Sort country list alphabetically
Collator.getInstance().compare(a.label.get(context), b.label.get(context)) Collator.getInstance().compare(a.getLabel(context), b.getLabel(context))
}.also { countries -> }.also { countries ->
adapterCountryFlags.countryList = countries adapterCountryFlags.countryList = countries
countryNames.text = countries.joinToString(", ") { it.label.get(context) } countryNames.text = countries.joinToString(", ") { it.getLabel(context) }
} }
} }
......
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