Compare commits

..

1 commit

Author SHA1 Message Date
9cd866f464
feat: discovery 2025-03-10 09:55:46 +08:00

View file

@ -2,14 +2,15 @@ package net.typeblog.lpac_jni
interface ProfileDownloadCallback { interface ProfileDownloadCallback {
companion object { companion object {
fun lookupStateFromProgress(progress: Int): DownloadState = when (progress) { fun lookupStateFromProgress(progress: Int): DownloadState =
0 -> DownloadState.Preparing when (progress) {
20 -> DownloadState.Connecting 0 -> DownloadState.Preparing
40 -> DownloadState.Authenticating 20 -> DownloadState.Connecting
60 -> DownloadState.Downloading 40 -> DownloadState.Authenticating
80 -> DownloadState.Finalizing 60 -> DownloadState.Downloading
else -> throw IllegalArgumentException("Unknown state") 80 -> DownloadState.Finalizing
} else -> throw IllegalArgumentException("Unknown state")
}
} }
enum class DownloadState(val progress: Int) { enum class DownloadState(val progress: Int) {