Commit 933f020b authored by vvb2060's avatar vvb2060 Committed by John Wu

Show dialog when hide or restore app

parent f5c02be5
...@@ -147,19 +147,33 @@ object HideAPK { ...@@ -147,19 +147,33 @@ object HideAPK {
return true return true
} }
@Suppress("DEPRECATION")
suspend fun hide(activity: Activity, label: String) { suspend fun hide(activity: Activity, label: String) {
val dialog = android.app.ProgressDialog(activity).apply {
setTitle(activity.getString(R.string.hide_app_title))
isIndeterminate = true
show()
}
val result = withContext(Dispatchers.IO) { val result = withContext(Dispatchers.IO) {
patchAndHide(activity, label) patchAndHide(activity, label)
} }
dialog.dismiss()
if (!result) { if (!result) {
Utils.toast(R.string.failure, Toast.LENGTH_LONG) Utils.toast(R.string.failure, Toast.LENGTH_LONG)
} }
} }
@Suppress("DEPRECATION")
fun restore(activity: Activity) { fun restore(activity: Activity) {
val dialog = android.app.ProgressDialog(activity).apply {
setTitle(activity.getString(R.string.restore_img_msg))
isIndeterminate = true
show()
}
val apk = DynAPK.current(activity) val apk = DynAPK.current(activity)
APKInstall.registerInstallReceiver(activity, WaitPackageReceiver(APPLICATION_ID, activity)) APKInstall.registerInstallReceiver(activity, WaitPackageReceiver(APPLICATION_ID, activity))
Shell.su("adb_pm_install $apk").submit { Shell.su("adb_pm_install $apk").submit {
dialog.dismiss()
if (!it.isSuccess) if (!it.isSuccess)
APKInstall.installHideResult(activity, apk) APKInstall.installHideResult(activity, apk)
} }
......
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