diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
index 689731623..39a18d2c3 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
@@ -136,6 +136,7 @@ object HideAPK {
val dialog = android.app.ProgressDialog(activity).apply {
setTitle(activity.getString(R.string.hide_app_title))
isIndeterminate = true
+ setCancelable(false)
show()
}
val result = withContext(Dispatchers.IO) {
@@ -152,6 +153,7 @@ object HideAPK {
val dialog = android.app.ProgressDialog(activity).apply {
setTitle(activity.getString(R.string.restore_img_msg))
isIndeterminate = true
+ setCancelable(false)
show()
}
val apk = DynAPK.current(activity)
diff --git a/app/src/main/java/com/topjohnwu/magisk/events/dialog/RestoreAppDialog.kt b/app/src/main/java/com/topjohnwu/magisk/events/dialog/RestoreAppDialog.kt
new file mode 100644
index 000000000..f95df9b52
--- /dev/null
+++ b/app/src/main/java/com/topjohnwu/magisk/events/dialog/RestoreAppDialog.kt
@@ -0,0 +1,22 @@
+package com.topjohnwu.magisk.events.dialog
+
+import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.tasks.HideAPK
+import com.topjohnwu.magisk.view.MagiskDialog
+
+class RestoreAppDialog : DialogEvent() {
+ override fun build(dialog: MagiskDialog) {
+ dialog.apply {
+ setTitle(R.string.settings_restore_app_title)
+ setMessage(R.string.restore_app_confirmation)
+ setButton(MagiskDialog.ButtonType.POSITIVE) {
+ text = R.string.yes
+ onClick { HideAPK.restore(dialog.ownerActivity!!) }
+ }
+ setButton(MagiskDialog.ButtonType.NEGATIVE) {
+ text = R.string.no
+ }
+ setCancelable(true)
+ }
+ }
+}
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
index 92b344295..fb8db6259 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
@@ -20,6 +20,7 @@ import com.topjohnwu.magisk.events.AddHomeIconEvent
import com.topjohnwu.magisk.events.RecreateEvent
import com.topjohnwu.magisk.events.SnackbarEvent
import com.topjohnwu.magisk.events.dialog.BiometricEvent
+import com.topjohnwu.magisk.events.dialog.RestoreAppDialog
import com.topjohnwu.magisk.ktx.activity
import com.topjohnwu.magisk.utils.Utils
import com.topjohnwu.superuser.Shell
@@ -104,7 +105,7 @@ class SettingsViewModel : BaseViewModel(), BaseSettingsItem.Callback {
is DenyListConfig ->
SettingsFragmentDirections.actionSettingsFragmentToDenyFragment().navigate()
is SystemlessHosts -> createHosts()
- is Restore -> HideAPK.restore(view.activity)
+ is Restore -> RestoreAppDialog().publish()
is AddShortcut -> AddHomeIconEvent().publish()
else -> callback()
}
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index b3de8e749..d10acf6ac 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -229,5 +229,6 @@
隐藏后应用的名字和图标可能难以识别。需要在桌面上添加具有原始名称和图标的快捷方式吗?
找不到可处理此操作的应用
重启后生效
+ 即将把隐藏的 Magisk 应用恢复回原始应用,是否继续?
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7bc3ec114..2810e31fa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -229,5 +229,6 @@
After hiding this app, its name and icon might become difficult to recognize. Do you want to add a pretty shortcut to the home screen?
No app found to handle this action
Reboot to apply changes
+ This will restore the hidden app back to the original app. Do you really want to do this?