Commit 6509e3d4 authored by topjohnwu's avatar topjohnwu

Use ProgressDialog when restoring images

Close #3287
parent 31705260
package com.topjohnwu.magisk.events.dialog package com.topjohnwu.magisk.events.dialog
import android.app.ProgressDialog
import android.widget.Toast import android.widget.Toast
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.Info
...@@ -17,8 +18,7 @@ class UninstallDialog : DialogEvent() { ...@@ -17,8 +18,7 @@ class UninstallDialog : DialogEvent() {
.applyMessage(R.string.uninstall_magisk_msg) .applyMessage(R.string.uninstall_magisk_msg)
.applyButton(MagiskDialog.ButtonType.POSITIVE) { .applyButton(MagiskDialog.ButtonType.POSITIVE) {
titleRes = R.string.restore_img titleRes = R.string.restore_img
preventDismiss = true onClick { restore() }
onClick { restore(dialog) }
} }
if (Info.remote.uninstaller.link.isNotEmpty()) { if (Info.remote.uninstaller.link.isNotEmpty()) {
dialog.applyButton(MagiskDialog.ButtonType.NEGATIVE) { dialog.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
...@@ -28,13 +28,12 @@ class UninstallDialog : DialogEvent() { ...@@ -28,13 +28,12 @@ class UninstallDialog : DialogEvent() {
} }
} }
private fun restore(dialog: MagiskDialog) { @Suppress("DEPRECATION")
dialog.applyTitle(R.string.restore_img) private fun restore() {
.applyMessage(R.string.restore_img_msg) val dialog = ProgressDialog(dialog.context).apply {
.applyButton(MagiskDialog.ButtonType.POSITIVE) { setMessage(dialog.context.getString(R.string.restore_img_msg))
title = "" show()
} }
.cancellable(false)
Shell.su("restore_imgs").submit { result -> Shell.su("restore_imgs").submit { result ->
dialog.dismiss() dialog.dismiss()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment