From bafd3cea14939eab6d297d230687c60c1948cb12 Mon Sep 17 00:00:00 2001 From: fgerber Date: Mon, 8 Apr 2024 10:45:16 +0200 Subject: [PATCH] Remove magic group keys --- .../net/helcel/beans/activity/adapter/GeolocListAdapter.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt b/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt index 2eae116..c0acb21 100644 --- a/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt +++ b/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt @@ -105,11 +105,11 @@ class GeolocListAdapter( fun onColorDialogDismiss(clear: Boolean) { if (clear) { - Data.visits.setVisited(Data.selected_geoloc, 0) + Data.visits.setVisited(Data.selected_geoloc, NO_GROUP) Data.saveData() } if (Data.selected_group != null && Data.selected_geoloc != null) { - Data.visits.setVisited(Data.selected_geoloc, Data.selected_group?.key ?: 0) + Data.visits.setVisited(Data.selected_geoloc, Data.selected_group?.key ?: NO_GROUP) Data.saveData() } Data.selected_geoloc?.let { refreshCheck(it) } @@ -148,7 +148,7 @@ class GeolocListAdapter( } private fun refreshCount(geoLoc: GeoLoc) { - val numerator = geoLoc.children.map { Data.visits.getVisited(it) != 0 }.count { it } + val numerator = geoLoc.children.map { Data.visits.getVisited(it) != NO_GROUP }.count { it } val denominator = geoLoc.children.size _binding.count.text = when (Settings.getStatPref(ctx)) { ctx.getString(R.string.percentages) -> ctx.getString(