Skip to content

Commit

Permalink
Now the RAM info updates every 5 seconds for more accurate display
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 10, 2024
1 parent 2a917f2 commit 6002ccd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
applicationId = "com.d4rk.cleaner"
minSdk = 26
targetSdk = 34
versionCode = 88
versionCode = 89
versionName = "2.0.0"
archivesName = "${applicationId}-v${versionName}"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import com.d4rk.cleaner.utils.PermissionsUtils
import com.d4rk.cleaner.utils.cleaning.FileUtils.formatSize
import com.d4rk.cleaner.utils.compose.components.StorageProgressBar
import com.d4rk.cleaner.utils.compose.bounceClick
import kotlinx.coroutines.delay
import kotlin.math.absoluteValue
import kotlin.math.min

Expand Down Expand Up @@ -109,6 +110,11 @@ fun MemoryManagerComposable() {
if (!PermissionsUtils.hasStoragePermissions(context)) {
PermissionsUtils.requestStoragePermissions(context as Activity)
}

while (true) {
delay(5000)
viewModel.updateRamInfo(context)
}
}
if (isLoading) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ class MemoryManagerViewModel : ViewModel() {
*/
fun updateRamInfo(context : Context) {
viewModelScope.launch {
try {
_ramInfo.value = getRamInfo(context)
} finally {
_isLoading.value = false
}
_ramInfo.value = getRamInfo(context)
}
}

Expand Down

0 comments on commit 6002ccd

Please sign in to comment.