Hide downloading notification earlier
I do not know why showing the notification makes it disappear earlier but even if it does not disappear earlier, the number will now be updated to show "0 downloads left" instead of incorrectly sticking with 1 download until dismissed.
This commit is contained in:
parent
4e26749757
commit
431f0bd074
|
@ -558,6 +558,7 @@ public class DownloadService extends Service {
|
||||||
if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) {
|
if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) {
|
||||||
Log.d(TAG, "Number of downloads is " + numberOfDownloads.get() + ", attempting shutdown");
|
Log.d(TAG, "Number of downloads is " + numberOfDownloads.get() + ", attempting shutdown");
|
||||||
stopSelf();
|
stopSelf();
|
||||||
|
notificationUpdater.run();
|
||||||
} else {
|
} else {
|
||||||
setupNotificationUpdater();
|
setupNotificationUpdater();
|
||||||
Notification notification = notificationManager.updateNotifications(
|
Notification notification = notificationManager.updateNotifications(
|
||||||
|
@ -616,8 +617,8 @@ public class DownloadService extends Service {
|
||||||
* Schedules the notification updater task if it hasn't been scheduled yet.
|
* Schedules the notification updater task if it hasn't been scheduled yet.
|
||||||
*/
|
*/
|
||||||
private void setupNotificationUpdater() {
|
private void setupNotificationUpdater() {
|
||||||
Log.d(TAG, "Setting up notification updater");
|
|
||||||
if (notificationUpdater == null) {
|
if (notificationUpdater == null) {
|
||||||
|
Log.d(TAG, "Setting up notification updater");
|
||||||
notificationUpdater = new NotificationUpdater();
|
notificationUpdater = new NotificationUpdater();
|
||||||
notificationUpdaterFuture = schedExecutor.scheduleAtFixedRate(notificationUpdater, 1, 1, TimeUnit.SECONDS);
|
notificationUpdaterFuture = schedExecutor.scheduleAtFixedRate(notificationUpdater, 1, 1, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue