android: don't show unfinished downloads. Set progress to 1.0f when done

This commit is contained in:
Alibek Omarov 2024-12-04 17:08:55 +03:00
parent e731775f70
commit de1361d99d
2 changed files with 6 additions and 0 deletions

View file

@ -108,6 +108,10 @@ class Game(val ctx: Context, val basedir: DocumentFile, var installed: Boolean =
} }
fun checkIfGamedir(file: DocumentFile): 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("liblist.gam")?.let { return true }
file.findFile("gameinfo.txt")?.let { return true } file.findFile("gameinfo.txt")?.let { return true }
return false return false

View file

@ -41,6 +41,8 @@ class FileCopyWorker(ctx: Context, params: WorkerParameters) : CoroutineWorker(c
source.copyDirTo(applicationContext, this@FileCopyWorker, target) source.copyDirTo(applicationContext, this@FileCopyWorker, target)
target.renameTo(gamedir) target.renameTo(gamedir)
setProgress(workDataOf(Progress to 1f))
} }
return Result.success() return Result.success()
} }