Merge pull request #957 from CepGamer/cepgamer/filterRefactor
Calculate values for filter categories from the list of values.
This commit is contained in:
commit
61a9e018d5
@ -17,9 +17,11 @@ data class SearchFilters(
|
|||||||
val events: Boolean = true,
|
val events: Boolean = true,
|
||||||
val tools: Boolean = true,
|
val tools: Boolean = true,
|
||||||
) {
|
) {
|
||||||
|
private val categories = listOf(apps, websites, articles, places, files, shortcuts, contacts, events, tools)
|
||||||
|
|
||||||
val allCategoriesEnabled
|
val allCategoriesEnabled
|
||||||
get() = apps && websites && articles && places && files && shortcuts && contacts && events && tools
|
get() = categories.all { it }
|
||||||
|
|
||||||
val enabledCategories: Int
|
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 }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user