Chargeprice: implement currency selection (#86)

This commit is contained in:
johan12345
2021-04-28 22:41:08 +02:00
parent c9a0b270cd
commit 369b7d9410
7 changed files with 59 additions and 2 deletions

View File

@@ -122,4 +122,10 @@ class PreferenceDataSource(val context: Context) {
set(value) {
sp.edit().putBoolean("chargeprice_show_provider_customer_tariffs", value).apply()
}
var chargepriceCurrency: String
get() = sp.getString("chargeprice_currency", null) ?: "EUR"
set(value) {
sp.edit().putString("chargeprice_currency", value).apply()
}
}

View File

@@ -255,7 +255,7 @@ fun currency(currency: String): String {
"USD" -> "$"
"DKK", "SEK", "NOK" -> "kr."
"PLN" -> ""
"CHF" -> "Fr."
"CHF" -> "Fr. "
"CZK" -> ""
"GBP" -> "£"
"HRK" -> "kn"

View File

@@ -173,7 +173,8 @@ class ChargepriceViewModel(application: Application, chargepriceApiKey: String)
options = ChargepriceOptions(
batteryRange = batteryRange.value!!.map { it.toDouble() },
providerCustomerTariffs = prefs.chargepriceShowProviderCustomerTariffs,
maxMonthlyFees = if (prefs.chargepriceNoBaseFee) 0.0 else null
maxMonthlyFees = if (prefs.chargepriceNoBaseFee) 0.0 else null,
currency = prefs.chargepriceCurrency
)
}, getChargepriceLanguage())
val meta =