From 1588b60bd77776368f80b3d0f48427f5407fd5aa Mon Sep 17 00:00:00 2001 From: Selina Lin Date: Mon, 8 Jan 2024 21:58:27 +0100 Subject: [PATCH] store growing apps sorted by change --- .../fileutilities/home_page/ui/files/FilesViewModel.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/amaze/fileutilities/home_page/ui/files/FilesViewModel.kt b/app/src/main/java/com/amaze/fileutilities/home_page/ui/files/FilesViewModel.kt index af5e8580..acc28eb7 100644 --- a/app/src/main/java/com/amaze/fileutilities/home_page/ui/files/FilesViewModel.kt +++ b/app/src/main/java/com/amaze/fileutilities/home_page/ui/files/FilesViewModel.kt @@ -2021,8 +2021,12 @@ class FilesViewModel(val applicationContext: Application) : } } - val result = priorityQueue.reversed() - largeSizeDiffAppsLiveData?.postValue(result.toMutableList()) + val result = mutableListOf() + while (priorityQueue.isNotEmpty()) { + result.add(priorityQueue.remove()) + } + + largeSizeDiffAppsLiveData?.postValue(result.asReversed()) } }