Make DeleteTask notification quieter on some devices(Fixed #2528) (#2538)

As commit ab4fca5e does, this commit fixed the repeated notification
alarms in DeleteTask.class.

Since progress indication in notification can be cleared by calling
.setProgress(0,0,false) on notificationBuilder(As shown in DeleteTask.class).
This commit also refactored notification related code in UploadService.class.
Make progress and failed notification uses the same notificationBuilder.
This commit is contained in:
Zhao Gang 2019-03-12 19:19:09 +08:00 committed by neslihanturan
parent 52724b8be0
commit 62c14ecb66
2 changed files with 19 additions and 28 deletions

View file

@ -55,7 +55,8 @@ public class DeleteTask extends AsyncTask<Void, Integer, Boolean> {
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationBuilder = new NotificationCompat.Builder(
context,
CommonsApplication.NOTIFICATION_CHANNEL_ID_ALL);
CommonsApplication.NOTIFICATION_CHANNEL_ID_ALL)
.setOnlyAlertOnce(true);
Toast toast = new Toast(context);
toast.setGravity(Gravity.CENTER,0,0);
toast = Toast.makeText(context,"Trying to nominate "+media.getDisplayTitle()+ " for deletion",Toast.LENGTH_SHORT);