Author: Adam Evyčędo <git@apiote.xyz>
add legacy defaults for locale
app/src/main/java/xyz/apiote/bimba/czwek/units/UnitSystem.kt | 10 +++++
diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/units/UnitSystem.kt b/app/src/main/java/xyz/apiote/bimba/czwek/units/UnitSystem.kt index 2af9ab4bc7f3e06e89f8f5710b05770dcbe1b287..5eb08d0ec6755433ff0c4278094fd23c552076fb 100644 --- a/app/src/main/java/xyz/apiote/bimba/czwek/units/UnitSystem.kt +++ b/app/src/main/java/xyz/apiote/bimba/czwek/units/UnitSystem.kt @@ -31,7 +31,15 @@ Metric } } - private fun forLocale(country: String): UnitSystem = Metric // TODO + private fun forLocale(country: String): UnitSystem = if (setOf( + "AG", "BS", "BZ", "DM", "GD", "MH", "FM", "PW", "KN", "LC", "VC", "GB", "AI", "VG", + "IO", "KY", "FK", "MS", "SH", "TC", "GG", "IM", "JE", "US", "AS", "GU", "MP", "PR", "VI" + ).contains(country) + ) { + Imperial + } else { + Metric + } private fun getDefault() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { forMeasureSystem(LocaleData.getMeasurementSystem(ULocale.forLocale(Locale.getDefault())))