From 04bc5236fb768c26531df472ea46f67dd88da7dc Mon Sep 17 00:00:00 2001 From: androidacy-user Date: Wed, 5 Jul 2023 23:38:44 -0400 Subject: [PATCH] fix few loose ends Signed-off-by: androidacy-user --- app/src/main/AndroidManifest.xml | 1 - .../kotlin/com/fox2code/mmm/UpdateActivity.kt | 16 +++++++-------- .../com/fox2code/mmm/module/ModuleHolder.kt | 13 ++++++------ app/src/main/res/layout/activity_update.xml | 20 ++++++++++++++++--- app/src/main/res/menu/update_nav.xml | 9 +-------- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e13d2bdc..652e05e9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -79,7 +79,6 @@ (R.id.action_update) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - button.tooltipText = getString(R.string.download_update) - } + val button = findViewById(R.id.action_update) + button.text = getString(R.string.download_update) + button.icon = getDrawable(R.drawable.baseline_cloud_download_24) button.isEnabled = true + button.visibility = View.VISIBLE + button.setOnClickListener({ + downloadUpdate() + }) } // return } diff --git a/app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt b/app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt index 2ec394eb..826d4bb9 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt @@ -242,7 +242,8 @@ class ModuleHolder : Comparable { if (repoModule != null || localModuleInfo?.updateZipUrl != null && localModuleInfo.updateVersionCode > localModuleInfo.versionCode) { buttonTypeList.add(ActionButtonType.UPDATE_INSTALL) } - if (localModuleInfo != null && localModuleInfo.updateVersionCode <= localModuleInfo.versionCode) { + val rInfo = localModuleInfo?.remoteModuleInfo + if (localModuleInfo != null && rInfo != null && rInfo.moduleInfo.versionCode <= localModuleInfo.versionCode || localModuleInfo != null && localModuleInfo.updateVersionCode != Long.MIN_VALUE && localModuleInfo.updateVersionCode <= localModuleInfo.versionCode) { buttonTypeList.add(ActionButtonType.REMOTE) // set updatezipurl on moduleholder @@ -255,10 +256,10 @@ class ModuleHolder : Comparable { updateZipUrl = repoModule!!.zipUrl } // last ditch effort, try to get remoteModuleInfo from localModuleInfo - if (localModuleInfo.remoteModuleInfo != null) { - Timber.d("remoteModuleInfo: %s", localModuleInfo.remoteModuleInfo!!.zipUrl) - updateZipUrl = localModuleInfo.remoteModuleInfo!!.zipUrl - moduleInfo?.updateZipUrl = localModuleInfo.remoteModuleInfo!!.zipUrl + if (rInfo != null) { + Timber.d("remoteModuleInfo: %s", rInfo.zipUrl) + updateZipUrl = rInfo.zipUrl + moduleInfo?.updateZipUrl = rInfo.zipUrl } } val config = mainModuleConfig @@ -441,4 +442,4 @@ class ModuleHolder : Comparable { } }; } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/activity_update.xml b/app/src/main/res/layout/activity_update.xml index 2bf0012d..c8dfc7e6 100644 --- a/app/src/main/res/layout/activity_update.xml +++ b/app/src/main/res/layout/activity_update.xml @@ -24,7 +24,7 @@ - + - \ No newline at end of file + diff --git a/app/src/main/res/menu/update_nav.xml b/app/src/main/res/menu/update_nav.xml index 670cdba8..db462783 100644 --- a/app/src/main/res/menu/update_nav.xml +++ b/app/src/main/res/menu/update_nav.xml @@ -11,11 +11,4 @@ android:visible="true" app:showAsAction="ifRoom" /> - - \ No newline at end of file +