mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
(WearOS) Removes task observer after all tasks are completed
The task observer is now only removed after all tasks are completed, allowing due tasks to be checked.
This commit is contained in:
parent
0461cc35f5
commit
f281e2ec0f
2 changed files with 10 additions and 1 deletions
|
|
@ -37,12 +37,16 @@ class RYAActivity : BaseActivity<ActivityRyaBinding, RYAViewModel>() {
|
|||
} else {
|
||||
binding.scrollView.isVisible = true
|
||||
createTaskListViews(value)
|
||||
viewModel.tasks.removeObserver(this)
|
||||
// only remove the observer if all tasks are completed
|
||||
if (viewModel.areAllTasksCompleted(value)) {
|
||||
viewModel.tasks.removeObserver(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
binding.ryaButton.setOnClickListener {
|
||||
binding.titleView.text = getString(R.string.check_off_yesterday)
|
||||
binding.descriptionView.isVisible = false
|
||||
|
|
|
|||
|
|
@ -72,4 +72,9 @@ constructor(
|
|||
appStateManager.endLoading()
|
||||
}
|
||||
}
|
||||
|
||||
fun areAllTasksCompleted(tasks: List<Task>): Boolean {
|
||||
return tasks.all { it.completed }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue