in app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksViewModel.kt [110:136]
fun setFiltering(requestType: TasksFilterType) {
savedStateHandle.set(TASKS_FILTER_SAVED_STATE_KEY, requestType)
// Depending on the filter type, set the filtering label, icon drawables, etc.
when (requestType) {
ALL_TASKS -> {
setFilter(
R.string.label_all, R.string.no_tasks_all,
R.drawable.logo_no_fill, true
)
}
ACTIVE_TASKS -> {
setFilter(
R.string.label_active, R.string.no_tasks_active,
R.drawable.ic_check_circle_96dp, false
)
}
COMPLETED_TASKS -> {
setFilter(
R.string.label_completed, R.string.no_tasks_completed,
R.drawable.ic_verified_user_96dp, false
)
}
}
// Refresh list
loadTasks(false)
}