|
|
@ -27,9 +27,7 @@ import com.todoroo.astrid.data.Task
|
|
|
|
import com.todoroo.astrid.service.TaskCreator
|
|
|
|
import com.todoroo.astrid.service.TaskCreator
|
|
|
|
import com.todoroo.astrid.timers.TimerControlSet.TimerControlSetCallback
|
|
|
|
import com.todoroo.astrid.timers.TimerControlSet.TimerControlSetCallback
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
|
import kotlinx.coroutines.NonCancellable
|
|
|
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
import kotlinx.coroutines.withContext
|
|
|
|
|
|
|
|
import org.tasks.LocalBroadcastManager
|
|
|
|
import org.tasks.LocalBroadcastManager
|
|
|
|
import org.tasks.R
|
|
|
|
import org.tasks.R
|
|
|
|
import org.tasks.activities.TagSettingsActivity
|
|
|
|
import org.tasks.activities.TagSettingsActivity
|
|
|
@ -175,10 +173,11 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
|
|
|
|
val intent = intent
|
|
|
|
val intent = intent
|
|
|
|
val openFilter = intent.hasExtra(OPEN_FILTER)
|
|
|
|
val openFilter = intent.hasExtra(OPEN_FILTER)
|
|
|
|
val loadFilter = intent.hasExtra(LOAD_FILTER)
|
|
|
|
val loadFilter = intent.hasExtra(LOAD_FILTER)
|
|
|
|
val tef = taskEditFragment
|
|
|
|
if (openFilter || loadFilter) {
|
|
|
|
if (tef != null && (openFilter || loadFilter)) {
|
|
|
|
taskEditFragment?.let {
|
|
|
|
lifecycleScope.launch(NonCancellable) {
|
|
|
|
lifecycleScope.launch {
|
|
|
|
tef.save()
|
|
|
|
it.save()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (loadFilter || !openFilter && filter == null) {
|
|
|
|
if (loadFilter || !openFilter && filter == null) {
|
|
|
@ -312,9 +311,7 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
|
|
|
|
lifecycleScope.launch {
|
|
|
|
lifecycleScope.launch {
|
|
|
|
taskEditFragment?.let {
|
|
|
|
taskEditFragment?.let {
|
|
|
|
it.editViewModel.cleared.removeObservers(this@MainActivity)
|
|
|
|
it.editViewModel.cleared.removeObservers(this@MainActivity)
|
|
|
|
withContext(NonCancellable) {
|
|
|
|
it.save()
|
|
|
|
it.save()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clearUi()
|
|
|
|
clearUi()
|
|
|
|
val fragment = newTaskEditFragment(
|
|
|
|
val fragment = newTaskEditFragment(
|
|
|
@ -344,7 +341,7 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
taskEditFragment?.let {
|
|
|
|
taskEditFragment?.let {
|
|
|
|
if (preferences.backButtonSavesTask()) {
|
|
|
|
if (preferences.backButtonSavesTask()) {
|
|
|
|
lifecycleScope.launch(NonCancellable) {
|
|
|
|
lifecycleScope.launch {
|
|
|
|
it.save()
|
|
|
|
it.save()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|