From ac93b044e65bde22c0be97440237ba3791cf83a7 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Thu, 23 Jun 2022 18:18:09 +0600 Subject: [PATCH] fixed: disable update all button on no updates --- .../java/foundation/e/apps/updates/UpdatesFragment.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt index 68016394a..7c1f38b76 100644 --- a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt @@ -144,10 +144,12 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte } WorkManager.getInstance(requireContext()) - .getWorkInfosForUniqueWorkLiveData(INSTALL_WORK_NAME).observe(viewLifecycleOwner) { + .getWorkInfosForUniqueWorkLiveData(INSTALL_WORK_NAME).observe(viewLifecycleOwner) { workInfoList -> lifecycleScope.launchWhenResumed { - binding.button.isEnabled = - !updatesViewModel.checkWorkInfoListHasAnyUpdatableWork(it) + binding.button.isEnabled = !( + it.first.isNullOrEmpty() || + updatesViewModel.checkWorkInfoListHasAnyUpdatableWork(workInfoList) + ) } } -- GitLab