Disable indeterminate progressbar in case of download error

Similar to the 'paused' case, but take into account that the error
can happen when the progress is 0, in which case we just hide the
progress bar.
This commit is contained in:
Gabriele M
2017-07-04 19:05:04 +02:00
parent 02f504a1fb
commit bb2f2c1005

View File

@@ -211,6 +211,9 @@ public class UpdaterService extends Service {
} }
case PAUSED_ERROR: { case PAUSED_ERROR: {
stopForeground(STOP_FOREGROUND_DETACH); stopForeground(STOP_FOREGROUND_DETACH);
int progress = update.getProgress();
// In case we pause before the first progress update
mNotificationBuilder.setProgress(progress > 0 ? 100 : 0, progress, false);
mNotificationBuilder.mActions.clear(); mNotificationBuilder.mActions.clear();
String text = getString(R.string.download_paused_error_notification); String text = getString(R.string.download_paused_error_notification);
mNotificationStyle.bigText(text); mNotificationStyle.bigText(text);