Commit ebfbb4f9 by olly Committed by Oliver Woodman

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
parent 0bf9ebf9
...@@ -98,6 +98,7 @@ public final class DownloadNotificationHelper { ...@@ -98,6 +98,7 @@ public final class DownloadNotificationHelper {
contentIntent, contentIntent,
message, message,
titleStringId, titleStringId,
/* maxProgress= */ 100,
progress, progress,
indeterminate, indeterminate,
/* ongoing= */ true, /* ongoing= */ true,
...@@ -142,7 +143,8 @@ public final class DownloadNotificationHelper { ...@@ -142,7 +143,8 @@ public final class DownloadNotificationHelper {
contentIntent, contentIntent,
message, message,
titleStringId, titleStringId,
/* progress= */ 0, /* maxProgress= */ 0,
/* currentProgress= */ 0,
/* indeterminateProgress= */ false, /* indeterminateProgress= */ false,
/* ongoing= */ false, /* ongoing= */ false,
/* showWhen= */ true); /* showWhen= */ true);
...@@ -153,7 +155,8 @@ public final class DownloadNotificationHelper { ...@@ -153,7 +155,8 @@ public final class DownloadNotificationHelper {
@Nullable PendingIntent contentIntent, @Nullable PendingIntent contentIntent,
@Nullable String message, @Nullable String message,
@StringRes int titleStringId, @StringRes int titleStringId,
int progress, int maxProgress,
int currentProgress,
boolean indeterminateProgress, boolean indeterminateProgress,
boolean ongoing, boolean ongoing,
boolean showWhen) { boolean showWhen) {
...@@ -163,7 +166,7 @@ public final class DownloadNotificationHelper { ...@@ -163,7 +166,7 @@ public final class DownloadNotificationHelper {
notificationBuilder.setContentIntent(contentIntent); notificationBuilder.setContentIntent(contentIntent);
notificationBuilder.setStyle( notificationBuilder.setStyle(
message == null ? null : new NotificationCompat.BigTextStyle().bigText(message)); message == null ? null : new NotificationCompat.BigTextStyle().bigText(message));
notificationBuilder.setProgress(/* max= */ 100, progress, indeterminateProgress); notificationBuilder.setProgress(maxProgress, currentProgress, indeterminateProgress);
notificationBuilder.setOngoing(ongoing); notificationBuilder.setOngoing(ongoing);
notificationBuilder.setShowWhen(showWhen); notificationBuilder.setShowWhen(showWhen);
return notificationBuilder.build(); return notificationBuilder.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment