From e900695cba4d8ffdbf2bc5d474bca0f640b693ca Mon Sep 17 00:00:00 2001 From: Jonas Lochmann Date: Mon, 1 May 2023 02:00:00 +0200 Subject: [PATCH] Allow inverting single tile for the blocked time areas --- .../android/ui/model/managechild/ManageCategoryBlockedTimes.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/timelimit/android/ui/model/managechild/ManageCategoryBlockedTimes.kt b/app/src/main/java/io/timelimit/android/ui/model/managechild/ManageCategoryBlockedTimes.kt index bef5d1b..45e6a17 100644 --- a/app/src/main/java/io/timelimit/android/ui/model/managechild/ManageCategoryBlockedTimes.kt +++ b/app/src/main/java/io/timelimit/android/ui/model/managechild/ManageCategoryBlockedTimes.kt @@ -219,7 +219,7 @@ object ManageCategoryBlockedTimes { val range = Pair(selectedMinuteOfWeek, minute).sorted().let { (from, to) -> BlockedTimesData.Range(from, to) } val oldBlockedTimeAreas = blockedTimeAreasLive.first() - val willBlockRange = isChild || oldBlockedTimeAreas.ranges.readFrom(range.first).countSetBits(range.last - range.first + 1) < (range.last - range.first) / 2 + val willBlockRange = isChild || oldBlockedTimeAreas.ranges.readFrom(range.first).countSetBits(range.last - range.first + 1) <= (range.last - range.first) / 2 val newBlockedTimeAreas = oldBlockedTimeAreas.withUpdatedRange(range, willBlockRange)