rework again

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 2 years ago
parent e5567c7cbb
commit 58ebbc0ba3

@ -209,12 +209,9 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
Timber.e(e) Timber.e(e)
} }
updatedModules++ updatedModules++
// update the update listener val repoProgressIncrement = STEP2 / repoDatas.size.toDouble()
// STEP1 is done so always add it val moduleProgressIncrement = repoProgressIncrement / repoModules.size.toDouble()
// step2 percentage is calculated by the number of modules updated out of total, then multiplied by the percentage of repos done updateListener.update((STEP1 + moduleProgressIncrement * updatedModules).toInt())
updateListener.update(
STEP1 + STEP2 * ((updatedModules / moduleToUpdate) * (i + 1) / repoDatas.size)
)
} }
for (repoModule in repoUpdaters[i]!!.toApply()!!) { for (repoModule in repoUpdaters[i]!!.toApply()!!) {
if (repoModule.moduleInfo.flags and ModuleInfo.FLAG_METADATA_INVALID == 0) { if (repoModule.moduleInfo.flags and ModuleInfo.FLAG_METADATA_INVALID == 0) {
@ -349,8 +346,8 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
private const val MAGISK_REPO_MANAGER = private const val MAGISK_REPO_MANAGER =
"https://magisk-modules-repo.github.io/submission/modules.json" "https://magisk-modules-repo.github.io/submission/modules.json"
private val lock = Any() private val lock = Any()
private const val STEP1 = 40 private const val STEP1 = 20
private const val STEP2 = 40 private const val STEP2 = 60
private const val STEP3 = 20 private const val STEP3 = 20
@Volatile @Volatile
@ -415,4 +412,4 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
val isAndroidacyRepoEnabled: Boolean val isAndroidacyRepoEnabled: Boolean
get() = INSTANCE != null && INSTANCE!!.androidacyRepoData != null && INSTANCE!!.androidacyRepoData!!.isEnabled get() = INSTANCE != null && INSTANCE!!.androidacyRepoData != null && INSTANCE!!.androidacyRepoData!!.isEnabled
} }
} }

Loading…
Cancel
Save