Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
47e23678
Commit
47e23678
authored
Oct 20, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added uninstall dialog
parent
236ad576
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
1 deletion
+57
-1
UninstallDialog.kt
...m/topjohnwu/magisk/model/events/dialog/UninstallDialog.kt
+55
-0
HomeViewModel.kt
.../java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/model/events/dialog/UninstallDialog.kt
0 → 100644
View file @
47e23678
package
com.topjohnwu.magisk.model.events.dialog
import
android.widget.Toast
import
com.topjohnwu.magisk.Info
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.model.download.DownloadService
import
com.topjohnwu.magisk.model.entity.internal.Configuration
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.view.MagiskDialog
import
com.topjohnwu.superuser.Shell
class
UninstallDialog
:
DialogEvent
()
{
override
fun
build
(
dialog
:
MagiskDialog
)
{
dialog
.
applyTitle
(
R
.
string
.
uninstall_magisk_title
)
.
applyMessage
(
R
.
string
.
uninstall_magisk_msg
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
R
.
string
.
restore_img
preventDismiss
=
true
onClick
{
restore
(
dialog
)
}
}
if
(
Info
.
remote
.
uninstaller
.
link
.
isNotEmpty
())
{
dialog
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
R
.
string
.
complete_uninstall
onClick
{
completeUninstall
()
}
}
}
}
private
fun
restore
(
dialog
:
MagiskDialog
)
{
dialog
.
applyTitle
(
R
.
string
.
restore_img
)
.
applyMessage
(
R
.
string
.
restore_img_msg
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
title
=
""
}
.
cancellable
(
false
)
Shell
.
su
(
"restore_imgs"
).
submit
{
result
->
dialog
.
dismiss
()
if
(
result
.
isSuccess
)
{
Utils
.
toast
(
R
.
string
.
restore_done
,
Toast
.
LENGTH_SHORT
)
}
else
{
Utils
.
toast
(
R
.
string
.
restore_fail
,
Toast
.
LENGTH_LONG
)
}
}
}
private
fun
completeUninstall
()
{
DownloadService
(
dialog
.
context
)
{
subject
=
DownloadSubject
.
Magisk
(
Configuration
.
Uninstall
)
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt
View file @
47e23678
...
...
@@ -14,6 +14,7 @@ import com.topjohnwu.magisk.model.events.OpenInappLinkEvent
import
com.topjohnwu.magisk.model.events.dialog.EnvFixDialog
import
com.topjohnwu.magisk.model.events.dialog.MagiskInstallDialog
import
com.topjohnwu.magisk.model.events.dialog.ManagerInstallDialog
import
com.topjohnwu.magisk.model.events.dialog.UninstallDialog
import
com.topjohnwu.magisk.model.observer.Observer
import
com.topjohnwu.magisk.redesign.compat.CompatViewModel
import
com.topjohnwu.magisk.ui.home.MagiskState
...
...
@@ -111,7 +112,7 @@ class HomeViewModel(
fun
onLinkPressed
(
link
:
String
)
=
OpenInappLinkEvent
(
link
).
publish
()
fun
onDeletePressed
()
{}
fun
onDeletePressed
()
=
UninstallDialog
().
publish
()
fun
onManagerPressed
()
=
ManagerInstallDialog
().
publish
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment