|
|
@ -3,6 +3,7 @@ package org.tasks.dialogs
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
|
|
|
|
import androidx.datastore.preferences.core.booleanPreferencesKey
|
|
|
|
import androidx.lifecycle.SavedStateHandle
|
|
|
|
import androidx.lifecycle.SavedStateHandle
|
|
|
|
import androidx.lifecycle.ViewModel
|
|
|
|
import androidx.lifecycle.ViewModel
|
|
|
|
import androidx.lifecycle.viewModelScope
|
|
|
|
import androidx.lifecycle.viewModelScope
|
|
|
@ -23,7 +24,7 @@ import org.tasks.filters.FilterListItem
|
|
|
|
import org.tasks.filters.FilterProvider
|
|
|
|
import org.tasks.filters.FilterProvider
|
|
|
|
import org.tasks.filters.NavigationDrawerSubheader
|
|
|
|
import org.tasks.filters.NavigationDrawerSubheader
|
|
|
|
import org.tasks.filters.getIcon
|
|
|
|
import org.tasks.filters.getIcon
|
|
|
|
import org.tasks.preferences.Preferences
|
|
|
|
import org.tasks.preferences.TasksPreferences
|
|
|
|
import org.tasks.themes.ColorProvider
|
|
|
|
import org.tasks.themes.ColorProvider
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Inject
|
|
|
|
|
|
|
|
|
|
|
@ -35,7 +36,7 @@ class FilterPickerViewModel @Inject constructor(
|
|
|
|
private val localBroadcastManager: LocalBroadcastManager,
|
|
|
|
private val localBroadcastManager: LocalBroadcastManager,
|
|
|
|
private val inventory: Inventory,
|
|
|
|
private val inventory: Inventory,
|
|
|
|
private val colorProvider: ColorProvider,
|
|
|
|
private val colorProvider: ColorProvider,
|
|
|
|
private val preferences: Preferences,
|
|
|
|
private val tasksPreferences: TasksPreferences,
|
|
|
|
private val caldavDao: CaldavDao,
|
|
|
|
private val caldavDao: CaldavDao,
|
|
|
|
) : ViewModel() {
|
|
|
|
) : ViewModel() {
|
|
|
|
private val listsOnly = savedStateHandle[FilterSelectionActivity.EXTRA_LISTS_ONLY] ?: false
|
|
|
|
private val listsOnly = savedStateHandle[FilterSelectionActivity.EXTRA_LISTS_ONLY] ?: false
|
|
|
@ -78,7 +79,7 @@ class FilterPickerViewModel @Inject constructor(
|
|
|
|
val collapsed = !subheader.isCollapsed
|
|
|
|
val collapsed = !subheader.isCollapsed
|
|
|
|
when (subheader.subheaderType) {
|
|
|
|
when (subheader.subheaderType) {
|
|
|
|
NavigationDrawerSubheader.SubheaderType.PREFERENCE ->
|
|
|
|
NavigationDrawerSubheader.SubheaderType.PREFERENCE ->
|
|
|
|
preferences.setBoolean(subheader.id.toInt(), collapsed)
|
|
|
|
tasksPreferences.set(booleanPreferencesKey(subheader.id), collapsed)
|
|
|
|
NavigationDrawerSubheader.SubheaderType.GOOGLE_TASKS,
|
|
|
|
NavigationDrawerSubheader.SubheaderType.GOOGLE_TASKS,
|
|
|
|
NavigationDrawerSubheader.SubheaderType.CALDAV,
|
|
|
|
NavigationDrawerSubheader.SubheaderType.CALDAV,
|
|
|
|
NavigationDrawerSubheader.SubheaderType.TASKS ->
|
|
|
|
NavigationDrawerSubheader.SubheaderType.TASKS ->
|
|
|
|