my tariffs preference: add summary

This commit is contained in:
johan12345
2021-08-26 09:29:13 +02:00
parent 7188a2aa64
commit 7fcb187dda
4 changed files with 16 additions and 8 deletions

View File

@@ -70,13 +70,18 @@ class SettingsFragment : PreferenceFragmentCompat(),
}
private fun updateMyTariffsSummary() {
myTariffsPreference.summary = if (prefs.chargepriceMyTariffsAll) {
getString(R.string.chargeprice_all_tariffs_selected)
} else {
val n = prefs.chargepriceMyTariffs?.size ?: 0
requireContext().resources
.getQuantityString(R.plurals.chargeprice_some_tariffs_selected, n, n)
}
myTariffsPreference.summary =
if (prefs.chargepriceMyTariffsAll) {
getString(R.string.chargeprice_all_tariffs_selected)
} else {
val n = prefs.chargepriceMyTariffs?.size ?: 0
requireContext().resources
.getQuantityString(
R.plurals.chargeprice_some_tariffs_selected,
n,
n
) + "\n" + getString(R.string.pref_my_tariffs_summary)
}
}
private fun updateMyVehiclesSummary() {

View File

@@ -199,6 +199,7 @@
<string name="pref_chargeprice_currency">Währung</string>
<string name="pref_my_tariffs">Meine Tarife</string>
<string name="chargeprice_all_tariffs_selected">alle Tarife ausgewählt</string>
<string name="pref_my_tariffs_summary">(werden im Preisvergleich hervorgehoben)</string>
<string name="license">Lizenz</string>
<string name="settings_charger_data">Ladesäulen</string>
<string name="pref_data_source">Datenquelle</string>

View File

@@ -197,6 +197,7 @@
<string name="chargeprice_no_compatible_connectors">None of the connectors on this charging station is compatible with your vehicle.</string>
<string name="pref_chargeprice_currency">Currency</string>
<string name="pref_my_tariffs">My charging plans</string>
<string name="pref_my_tariffs_summary">(will be highlighted in price comparison)</string>
<string name="chargeprice_all_tariffs_selected">all plans selected</string>
<string name="license">License</string>
<string name="settings_charger_data">Charging stations</string>

View File

@@ -55,7 +55,8 @@
app:defaultToAll="false" />
<net.vonforst.evmap.ui.MultiSelectDialogPreference
android:key="chargeprice_my_tariffs"
android:title="@string/pref_my_tariffs" />
android:title="@string/pref_my_tariffs"
android:summary="@string/pref_my_tariffs_summary" />
<ListPreference
android:key="chargeprice_currency"
android:title="@string/pref_chargeprice_currency"