mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Allow multiple progress notifications
This commit is contained in:
parent
d510224e2a
commit
07bfdf3e4d
@ -63,7 +63,7 @@ public class Const {
|
|||||||
public static final int MAGISK_UPDATE_NOTIFICATION_ID = 4;
|
public static final int MAGISK_UPDATE_NOTIFICATION_ID = 4;
|
||||||
public static final int APK_UPDATE_NOTIFICATION_ID = 5;
|
public static final int APK_UPDATE_NOTIFICATION_ID = 5;
|
||||||
public static final int DTBO_NOTIFICATION_ID = 7;
|
public static final int DTBO_NOTIFICATION_ID = 7;
|
||||||
public static final int DOWNLOAD_PROGRESS_ID = 8;
|
public static final int HIDE_MANAGER_NOTIFICATION_ID = 8;
|
||||||
public static final String UPDATE_NOTIFICATION_CHANNEL = "update";
|
public static final String UPDATE_NOTIFICATION_CHANNEL = "update";
|
||||||
public static final String PROGRESS_NOTIFICATION_CHANNEL = "progress";
|
public static final String PROGRESS_NOTIFICATION_CHANNEL = "progress";
|
||||||
}
|
}
|
||||||
|
@ -133,9 +133,9 @@ public class PatchAPK {
|
|||||||
NotificationCompat.Builder progress =
|
NotificationCompat.Builder progress =
|
||||||
Notifications.progress(mm.getString(R.string.hide_manager_title));
|
Notifications.progress(mm.getString(R.string.hide_manager_title));
|
||||||
NotificationManagerCompat mgr = NotificationManagerCompat.from(mm);
|
NotificationManagerCompat mgr = NotificationManagerCompat.from(mm);
|
||||||
mgr.notify(Const.ID.DOWNLOAD_PROGRESS_ID, progress.build());
|
mgr.notify(Const.ID.HIDE_MANAGER_NOTIFICATION_ID, progress.build());
|
||||||
boolean b = patchAndHide();
|
boolean b = patchAndHide();
|
||||||
mgr.cancel(Const.ID.DOWNLOAD_PROGRESS_ID);
|
mgr.cancel(Const.ID.HIDE_MANAGER_NOTIFICATION_ID);
|
||||||
if (!b) Utils.toast(R.string.hide_manager_fail_toast, Toast.LENGTH_LONG);
|
if (!b) Utils.toast(R.string.hide_manager_fail_toast, Toast.LENGTH_LONG);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ public class ProgressNotification implements DownloadProgressListener {
|
|||||||
MagiskManager mm = Data.MM();
|
MagiskManager mm = Data.MM();
|
||||||
mgr = NotificationManagerCompat.from(mm);
|
mgr = NotificationManagerCompat.from(mm);
|
||||||
builder = Notifications.progress(title);
|
builder = Notifications.progress(title);
|
||||||
mgr.notify(Const.ID.DOWNLOAD_PROGRESS_ID, builder.build());
|
|
||||||
prevTime = System.currentTimeMillis();
|
prevTime = System.currentTimeMillis();
|
||||||
|
update();
|
||||||
Utils.toast(mm.getString(R.string.downloading_toast, title), Toast.LENGTH_SHORT);
|
Utils.toast(mm.getString(R.string.downloading_toast, title), Toast.LENGTH_SHORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class ProgressNotification implements DownloadProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
mgr.notify(Const.ID.DOWNLOAD_PROGRESS_ID, builder.build());
|
mgr.notify(hashCode(), builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dlDone() {
|
public void dlDone() {
|
||||||
@ -64,6 +64,6 @@ public class ProgressNotification implements DownloadProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
mgr.cancel(Const.ID.DOWNLOAD_PROGRESS_ID);
|
mgr.cancel(hashCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user