Hide progress bar for end state download notifications

Now we're reusing the builder, it's necessary to set maxProgress
back to 0 to avoid the progress bar appearing for end state
notifications.

PiperOrigin-RevId: 232520007
This commit is contained in:
olly 2019-02-05 19:05:59 +00:00 committed by Oliver Woodman
parent 0bf9ebf91e
commit ebfbb4f915

View File

@ -98,6 +98,7 @@ public final class DownloadNotificationHelper {
contentIntent,
message,
titleStringId,
/* maxProgress= */ 100,
progress,
indeterminate,
/* ongoing= */ true,
@ -142,7 +143,8 @@ public final class DownloadNotificationHelper {
contentIntent,
message,
titleStringId,
/* progress= */ 0,
/* maxProgress= */ 0,
/* currentProgress= */ 0,
/* indeterminateProgress= */ false,
/* ongoing= */ false,
/* showWhen= */ true);
@ -153,7 +155,8 @@ public final class DownloadNotificationHelper {
@Nullable PendingIntent contentIntent,
@Nullable String message,
@StringRes int titleStringId,
int progress,
int maxProgress,
int currentProgress,
boolean indeterminateProgress,
boolean ongoing,
boolean showWhen) {
@ -163,7 +166,7 @@ public final class DownloadNotificationHelper {
notificationBuilder.setContentIntent(contentIntent);
notificationBuilder.setStyle(
message == null ? null : new NotificationCompat.BigTextStyle().bigText(message));
notificationBuilder.setProgress(/* max= */ 100, progress, indeterminateProgress);
notificationBuilder.setProgress(maxProgress, currentProgress, indeterminateProgress);
notificationBuilder.setOngoing(ongoing);
notificationBuilder.setShowWhen(showWhen);
return notificationBuilder.build();