Skip to content

Commit 04bc523

Browse files
fix few loose ends
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 2df47c1 commit 04bc523

File tree

5 files changed

+33
-26
lines changed

5 files changed

+33
-26
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
<activity
8080
android:name=".CrashHandler"
8181
android:exported="false"
82-
android:process=":crash"
8382
android:theme="@style/Theme.MagiskModuleManager.NoActionBar" />
8483
<activity
8584
android:name=".SetupActivity"

app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import java.io.FileOutputStream
3131
import java.io.IOException
3232
import java.sql.Timestamp
3333
import java.util.Objects
34+
import com.google.android.material.button.MaterialButton
3435

3536
class UpdateActivity : FoxActivity() {
3637
private var chgWv: WebView? = null
@@ -266,10 +267,6 @@ class UpdateActivity : FoxActivity() {
266267
statusTextView.setText(R.string.no_update_available)
267268
val changelogWebView = chgWv!!
268269
changelogWebView.loadUrl(url.replace("updates/check", "changelog"))
269-
// execute javascript to make #rfrsh-btn just reload the page
270-
changelogWebView.evaluateJavascript(
271-
"(function() { document.getElementById('rfrsh-btn').onclick = function() { location.reload(); }; })();"
272-
) { }
273270
}
274271
// check for update
275272
val shouldUpdate = AppUpdateManager.appUpdateManager.checkUpdate(true)
@@ -279,11 +276,14 @@ class UpdateActivity : FoxActivity() {
279276
// set status text to update available
280277
statusTextView.setText(R.string.update_available)
281278
// set button text to download
282-
val button = findViewById<BottomNavigationItemView>(R.id.action_update)
283-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
284-
button.tooltipText = getString(R.string.download_update)
285-
}
279+
val button = findViewById<MaterialButton>(R.id.action_update)
280+
button.text = getString(R.string.download_update)
281+
button.icon = getDrawable(R.drawable.baseline_cloud_download_24)
286282
button.isEnabled = true
283+
button.visibility = View.VISIBLE
284+
button.setOnClickListener({
285+
downloadUpdate()
286+
})
287287
}
288288
// return
289289
}

app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ class ModuleHolder : Comparable<ModuleHolder?> {
242242
if (repoModule != null || localModuleInfo?.updateZipUrl != null && localModuleInfo.updateVersionCode > localModuleInfo.versionCode) {
243243
buttonTypeList.add(ActionButtonType.UPDATE_INSTALL)
244244
}
245-
if (localModuleInfo != null && localModuleInfo.updateVersionCode <= localModuleInfo.versionCode) {
245+
val rInfo = localModuleInfo?.remoteModuleInfo
246+
if (localModuleInfo != null && rInfo != null && rInfo.moduleInfo.versionCode <= localModuleInfo.versionCode || localModuleInfo != null && localModuleInfo.updateVersionCode != Long.MIN_VALUE && localModuleInfo.updateVersionCode <= localModuleInfo.versionCode) {
246247
buttonTypeList.add(ActionButtonType.REMOTE)
247248
// set updatezipurl on moduleholder
248249

@@ -255,10 +256,10 @@ class ModuleHolder : Comparable<ModuleHolder?> {
255256
updateZipUrl = repoModule!!.zipUrl
256257
}
257258
// last ditch effort, try to get remoteModuleInfo from localModuleInfo
258-
if (localModuleInfo.remoteModuleInfo != null) {
259-
Timber.d("remoteModuleInfo: %s", localModuleInfo.remoteModuleInfo!!.zipUrl)
260-
updateZipUrl = localModuleInfo.remoteModuleInfo!!.zipUrl
261-
moduleInfo?.updateZipUrl = localModuleInfo.remoteModuleInfo!!.zipUrl
259+
if (rInfo != null) {
260+
Timber.d("remoteModuleInfo: %s", rInfo.zipUrl)
261+
updateZipUrl = rInfo.zipUrl
262+
moduleInfo?.updateZipUrl = rInfo.zipUrl
262263
}
263264
}
264265
val config = mainModuleConfig
@@ -441,4 +442,4 @@ class ModuleHolder : Comparable<ModuleHolder?> {
441442
}
442443
};
443444
}
444-
}
445+
}

app/src/main/res/layout/activity_update.xml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<ImageView
2525
android:id="@+id/update_icon"
2626
android:layout_width="101dp"
27-
android:layout_height="93dp"
27+
android:layout_height="101dp"
2828
android:layout_gravity="center"
2929
android:layout_margin="8dp"
3030
android:contentDescription="@string/update"
@@ -76,7 +76,21 @@
7676
android:text="@string/update_debug_warning"
7777
android:textAppearance="?attr/textAppearanceBody2"
7878
android:visibility="gone" />
79-
79+
<com.google.android.material.button.MaterialButton
80+
android:id="@+id/action_update"
81+
android:layout_height="wrap_content"
82+
android:layout_marginTop="4dp" android:layout_marginEnd="4dp"
83+
android:padding="12dp"
84+
android:text="@string/please_wait"
85+
android:textSize="16sp"
86+
app:icon="@drawable/ic_baseline_warning_24"
87+
app:iconGravity="textStart"
88+
app:iconPadding="8dp"
89+
app:iconTintMode="src_in"
90+
android:visibility="invisible"
91+
app:rippleColor="@color/gray_800"
92+
android:layout_width="match_parent"
93+
tools:ignore="DuplicateSpeakableTextCheck" />
8094

8195
<!-- Changelog view -->
8296
<LinearLayout
@@ -106,4 +120,4 @@
106120
app:layout_constraintTop_toBottomOf="@id/update_container"
107121
app:menu="@menu/update_nav" />
108122

109-
</androidx.constraintlayout.widget.ConstraintLayout>
123+
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/menu/update_nav.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,4 @@
1111
android:visible="true"
1212
app:showAsAction="ifRoom" />
1313

14-
<item
15-
android:id="@+id/action_update"
16-
android:enabled="false"
17-
android:icon="@drawable/ic_baseline_refresh_24"
18-
android:title="@string/update_button"
19-
android:visible="true"
20-
app:showAsAction="ifRoom" />
21-
</menu>
14+
</menu>

0 commit comments

Comments
 (0)