From 73d65d1a301948d0b8f15dc66fedad8f0a20e0ee Mon Sep 17 00:00:00 2001 From: MM20 <15646950+MM2-0@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:51:45 +0100 Subject: [PATCH] Hopefully fix app installation progress badges not disappearing --- .../java/de/mm20/launcher2/applications/AppRepository.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/applications/src/main/java/de/mm20/launcher2/applications/AppRepository.kt b/applications/src/main/java/de/mm20/launcher2/applications/AppRepository.kt index 0510772e..3781bef5 100644 --- a/applications/src/main/java/de/mm20/launcher2/applications/AppRepository.kt +++ b/applications/src/main/java/de/mm20/launcher2/applications/AppRepository.kt @@ -119,6 +119,13 @@ class AppRepository( override fun onProgressChanged(sessionId: Int, progress: Float) { val session = packageInstaller.getSessionInfo(sessionId) ?: return val pkg = session.appPackageName ?: return + if (!installingPackages.containsKey(sessionId)) { + val key = "app://$pkg" + val badge = badgeProvider.getBadge(key)?.also { it.progress = null } + ?: Badge() + badgeProvider.setBadge(key, badge) + return + } badgeProvider.updateBadge("app://$pkg", Badge(progress = progress)) }