Remove magic group keys
This commit is contained in:
parent
ec52574ae3
commit
bafd3cea14
@ -105,11 +105,11 @@ class GeolocListAdapter(
|
|||||||
|
|
||||||
fun onColorDialogDismiss(clear: Boolean) {
|
fun onColorDialogDismiss(clear: Boolean) {
|
||||||
if (clear) {
|
if (clear) {
|
||||||
Data.visits.setVisited(Data.selected_geoloc, 0)
|
Data.visits.setVisited(Data.selected_geoloc, NO_GROUP)
|
||||||
Data.saveData()
|
Data.saveData()
|
||||||
}
|
}
|
||||||
if (Data.selected_group != null && Data.selected_geoloc != null) {
|
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.saveData()
|
||||||
}
|
}
|
||||||
Data.selected_geoloc?.let { refreshCheck(it) }
|
Data.selected_geoloc?.let { refreshCheck(it) }
|
||||||
@ -148,7 +148,7 @@ class GeolocListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshCount(geoLoc: GeoLoc) {
|
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
|
val denominator = geoLoc.children.size
|
||||||
_binding.count.text = when (Settings.getStatPref(ctx)) {
|
_binding.count.text = when (Settings.getStatPref(ctx)) {
|
||||||
ctx.getString(R.string.percentages) -> ctx.getString(
|
ctx.getString(R.string.percentages) -> ctx.getString(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user