From e37d266b06a00782e03f810707130b467e30238d Mon Sep 17 00:00:00 2001 From: Sergei Bolotov Date: Thu, 18 Jul 2024 22:45:37 -0700 Subject: [PATCH] Calculate values for filter categories from the list of values. --- .../src/main/java/de/mm20/launcher2/search/SearchFilters.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/base/src/main/java/de/mm20/launcher2/search/SearchFilters.kt b/core/base/src/main/java/de/mm20/launcher2/search/SearchFilters.kt index 3edc61e3..05e8ad9d 100644 --- a/core/base/src/main/java/de/mm20/launcher2/search/SearchFilters.kt +++ b/core/base/src/main/java/de/mm20/launcher2/search/SearchFilters.kt @@ -17,9 +17,11 @@ data class SearchFilters( val events: Boolean = true, val tools: Boolean = true, ) { + private val categories = listOf(apps, websites, articles, places, files, shortcuts, contacts, events, tools) + val allCategoriesEnabled - get() = apps && websites && articles && places && files && shortcuts && contacts && events && tools + get() = categories.all { it } val enabledCategories: Int - get() = apps.toInt() + websites.toInt() + articles.toInt() + places.toInt() + files.toInt() + shortcuts.toInt() + contacts.toInt() + events.toInt() + tools.toInt() + get() = categories.count { it } }