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
857e6e83
Commit
857e6e83
authored
Dec 02, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak notifications
parent
3402981a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
9 deletions
+19
-9
InstallMethodDialog.java
.../com/topjohnwu/magisk/components/InstallMethodDialog.java
+1
-1
NotificationProgress.java
...com/topjohnwu/magisk/components/NotificationProgress.java
+11
-4
UninstallDialog.java
...java/com/topjohnwu/magisk/components/UninstallDialog.java
+1
-1
DlInstallManager.java
...ull/java/com/topjohnwu/magisk/utils/DlInstallManager.java
+5
-3
strings.xml
app/src/full/res/values/strings.xml
+1
-0
No files found.
app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java
View file @
857e6e83
...
...
@@ -76,7 +76,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
.
startDownload
(
new
DownloadListener
()
{
@Override
public
void
onDownloadComplete
()
{
progress
.
d
efault
Done
();
progress
.
d
l
Done
();
SnackbarMaker
.
make
(
a
,
a
.
getString
(
R
.
string
.
internal_storage
,
"/Download/"
+
filename
),
Snackbar
.
LENGTH_LONG
).
show
();
...
...
app/src/full/java/com/topjohnwu/magisk/components/NotificationProgress.java
View file @
857e6e83
...
...
@@ -5,6 +5,8 @@ import android.widget.Toast;
import
com.androidnetworking.interfaces.DownloadProgressListener
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Notifications
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
@@ -18,11 +20,12 @@ public class NotificationProgress implements DownloadProgressListener {
private
long
prevTime
;
public
NotificationProgress
(
String
title
)
{
mgr
=
NotificationManagerCompat
.
from
(
Data
.
MM
());
MagiskManager
mm
=
Data
.
MM
();
mgr
=
NotificationManagerCompat
.
from
(
mm
);
builder
=
Notifications
.
progress
(
title
);
mgr
.
notify
(
Const
.
ID
.
DOWNLOAD_PROGRESS_ID
,
builder
.
build
());
prevTime
=
System
.
currentTimeMillis
();
Utils
.
toast
(
"Downloading "
+
title
,
Toast
.
LENGTH_SHORT
);
Utils
.
toast
(
mm
.
getString
(
R
.
string
.
downloading_toast
,
title
)
,
Toast
.
LENGTH_SHORT
);
}
@Override
...
...
@@ -44,9 +47,13 @@ public class NotificationProgress implements DownloadProgressListener {
mgr
.
notify
(
Const
.
ID
.
DOWNLOAD_PROGRESS_ID
,
builder
.
build
());
}
public
void
d
efault
Done
()
{
public
void
d
l
Done
()
{
builder
.
setProgress
(
0
,
0
,
false
);
builder
.
setContentText
(
"Download done"
);
builder
.
setContentText
(
Data
.
MM
().
getString
(
R
.
string
.
download_complete
)
);
update
();
}
public
void
dismiss
()
{
mgr
.
cancel
(
Const
.
ID
.
DOWNLOAD_PROGRESS_ID
);
}
}
app/src/full/java/com/topjohnwu/magisk/components/UninstallDialog.java
View file @
857e6e83
...
...
@@ -50,7 +50,7 @@ public class UninstallDialog extends CustomAlertDialog {
.
startDownload
(
new
DownloadListener
()
{
@Override
public
void
onDownloadComplete
()
{
progress
.
d
efaultDone
();
progress
.
d
ismiss
();
Intent
intent
=
new
Intent
(
activity
,
Data
.
classMap
.
get
(
FlashActivity
.
class
))
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
setData
(
Uri
.
fromFile
(
zip
))
...
...
app/src/full/java/com/topjohnwu/magisk/utils/DlInstallManager.java
View file @
857e6e83
...
...
@@ -8,6 +8,7 @@ import com.androidnetworking.interfaces.DownloadListener;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.asyncs.PatchAPK
;
import
com.topjohnwu.magisk.components.NotificationProgress
;
import
com.topjohnwu.superuser.ShellUtils
;
...
...
@@ -72,7 +73,8 @@ public class DlInstallManager {
if
(!
mm
.
getPackageName
().
equals
(
Const
.
ORIG_PKG_NAME
))
{
progress
.
getBuilder
()
.
setProgress
(
0
,
0
,
true
)
.
setContentText
(
"Patching APK"
);
.
setContentTitle
(
mm
.
getString
(
R
.
string
.
hide_manager_toast
))
.
setContentText
(
""
);
progress
.
update
();
patched
=
new
File
(
apk
.
getParent
(),
"patched.apk"
);
try
{
...
...
@@ -83,7 +85,7 @@ public class DlInstallManager {
return
;
}
}
progress
.
d
efaultDone
();
progress
.
d
ismiss
();
APKInstall
.
install
(
mm
,
patched
);
}
}
...
...
@@ -92,7 +94,7 @@ public class DlInstallManager {
@Override
public
void
onDownloadComplete
(
File
apk
,
NotificationProgress
progress
)
{
progress
.
d
efaultDone
();
progress
.
d
ismiss
();
Data
.
exportPrefs
();
if
(
ShellUtils
.
fastCmdResult
(
"pm install "
+
apk
))
RootUtils
.
rmAndLaunch
(
Data
.
MM
().
getPackageName
(),
Const
.
ORIG_PKG_NAME
);
...
...
app/src/full/res/values/strings.xml
View file @
857e6e83
...
...
@@ -122,6 +122,7 @@
<string
name=
"download_file_error"
>
Error downloading file
</string>
<string
name=
"downloading_toast"
>
Downloading %1$s
</string>
<string
name=
"no_rw_storage"
>
This feature will not work without permission to write external storage.
</string>
<string
name=
"download_complete"
>
Download complete
</string>
<!--Settings Activity -->
<string
name=
"settings_general_category"
>
General
</string>
...
...
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