From de1361d99d8428a7a911e0c06599d3427bde3f23 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 4 Dec 2024 17:08:55 +0300 Subject: [PATCH] android: don't show unfinished downloads. Set progress to 1.0f when done --- android/app/src/main/java/su/xash/engine/model/Game.kt | 4 ++++ .../src/main/java/su/xash/engine/workers/FileCopyWorker.kt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/android/app/src/main/java/su/xash/engine/model/Game.kt b/android/app/src/main/java/su/xash/engine/model/Game.kt index 704d283589..d8a389c700 100644 --- a/android/app/src/main/java/su/xash/engine/model/Game.kt +++ b/android/app/src/main/java/su/xash/engine/model/Game.kt @@ -108,6 +108,10 @@ class Game(val ctx: Context, val basedir: DocumentFile, var installed: Boolean = } fun checkIfGamedir(file: DocumentFile): Boolean { + // exclude unfinished downloads + if (file.name?.startsWith('.') == true) + return false + file.findFile("liblist.gam")?.let { return true } file.findFile("gameinfo.txt")?.let { return true } return false diff --git a/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt b/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt index fdc284f144..00603ce262 100644 --- a/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt +++ b/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt @@ -41,6 +41,8 @@ class FileCopyWorker(ctx: Context, params: WorkerParameters) : CoroutineWorker(c source.copyDirTo(applicationContext, this@FileCopyWorker, target) target.renameTo(gamedir) + + setProgress(workDataOf(Progress to 1f)) } return Result.success() }