Skip to content

Commit 6002ccd

Browse files
Now the RAM info updates every 5 seconds for more accurate display
1 parent 2a917f2 commit 6002ccd

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
applicationId = "com.d4rk.cleaner"
1515
minSdk = 26
1616
targetSdk = 34
17-
versionCode = 88
17+
versionCode = 89
1818
versionName = "2.0.0"
1919
archivesName = "${applicationId}-v${versionName}"
2020
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

app/src/main/kotlin/com/d4rk/cleaner/ui/memory/MemoryManagerComposable.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import com.d4rk.cleaner.utils.PermissionsUtils
6969
import com.d4rk.cleaner.utils.cleaning.FileUtils.formatSize
7070
import com.d4rk.cleaner.utils.compose.components.StorageProgressBar
7171
import com.d4rk.cleaner.utils.compose.bounceClick
72+
import kotlinx.coroutines.delay
7273
import kotlin.math.absoluteValue
7374
import kotlin.math.min
7475

@@ -109,6 +110,11 @@ fun MemoryManagerComposable() {
109110
if (!PermissionsUtils.hasStoragePermissions(context)) {
110111
PermissionsUtils.requestStoragePermissions(context as Activity)
111112
}
113+
114+
while (true) {
115+
delay(5000)
116+
viewModel.updateRamInfo(context)
117+
}
112118
}
113119
if (isLoading) {
114120
Box(

app/src/main/kotlin/com/d4rk/cleaner/ui/memory/MemoryManagerViewModel.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ class MemoryManagerViewModel : ViewModel() {
5858
*/
5959
fun updateRamInfo(context : Context) {
6060
viewModelScope.launch {
61-
try {
62-
_ramInfo.value = getRamInfo(context)
63-
} finally {
64-
_isLoading.value = false
65-
}
61+
_ramInfo.value = getRamInfo(context)
6662
}
6763
}
6864

0 commit comments

Comments
 (0)