Limit download progress percentage to range 0-100

For nobil the percentage reaches 101. I haven't figured out why nobil's data
is out of sync.

When querying nobil for the total number of chargers we get:
Norway: 4957
Sweden: 9108
------------
       14065

.. but the data dump we download has:
Norway: 5168
Sweden: 9059
------------
       14227
This commit is contained in:
Robert Högberg
2026-05-31 23:12:20 +02:00
committed by Johan von Forstner
parent abb00f144b
commit 0cbb2d82c0

View File

@@ -654,7 +654,7 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
binding.progressBar2.isIndeterminate = res.progress == null
binding.progressBar2.progress = ((res.progress ?: 0f) * 100f).toInt().coerceIn(0, 100)
binding.search.hint = if (res.progress != null) {
getString(R.string.downloading_chargers_percent, (res.progress * 100f))
getString(R.string.downloading_chargers_percent, (res.progress * 100f).coerceIn(0f, 100f))
} else {
getString(R.string.search)
}