oday
11/15/2022, 12:32 PMprivate val categoryFilter = BrowseEventsFilter.CategoryFilter(category = MutableStateFlow(Category.All))
private val locationFilter = BrowseEventsFilter.LocationFilter(location = MutableStateFlow(null))
private val periodFilter = BrowseEventsFilter.PeriodFilter(
period = MutableStateFlow(Period.Any),
dateRange = MutableStateFlow(null)
)
and then you change them
var filtersState = MutableStateFlow(listOf(locationFilter, periodFilter, categoryFilter)) // collectAsState in the activity
// how they change
filterState?.enabled?.value = ChipStatus.ENABLED
filterState?.period?.value = period
filterState?.dateRange?.value = null
and then observe them
flowOf(periodFilter.period?.value,
periodFilter.dateRange?.value,
categoryFilter.category.value,
locationFilter.location.value
).collect {
// do something everytime their values change
}
oday
11/15/2022, 1:04 PMmerge()
brandonmcansh
11/15/2022, 2:32 PM