Notification : Do not show negative progress

https://gitlab.com/AuroraOSS/AuroraStore/issues/141
This commit is contained in:
Rahul Patel
2019-08-12 13:22:42 +05:30
parent b37c8a9fa9
commit 4af2a8d6fd
3 changed files with 2 additions and 4 deletions

View File

@@ -354,8 +354,6 @@ public class ActionButton extends AbstractHelper {
public void onResumed(int groupId, @NotNull Download download, @NotNull FetchGroup fetchGroup) {
if (groupId == hashCode) {
int progress = fetchGroup.getGroupDownloadProgress();
if (progress < 0)
progress = 0;
notification.notifyProgress(progress, 0, hashCode);
ContextUtil.runOnUiThread(() -> {
progressStatus.setText(R.string.download_progress);

View File

@@ -62,6 +62,8 @@ public class GeneralNotification extends NotificationBase {
public void notifyProgress(int progress, long downloadedBytesPerSecond, int requestId) {
if (NotificationUtil.shouldNotify(context, app.getPackageName())) {
builder = getBuilder();
if (progress < 0)
progress = 0;
builder.setProgress(100, progress, false);
builder.setSubText(new StringBuilder().append(Util.humanReadableByteSpeed(downloadedBytesPerSecond, true)));
builder.setContentText(new StringBuilder().append(progress).append("%"));

View File

@@ -83,8 +83,6 @@ public class LiveUpdate extends BaseTask {
public void onResumed(int groupId, @NotNull Download download, @NotNull FetchGroup fetchGroup) {
if (groupId == hashCode) {
int progress = fetchGroup.getGroupDownloadProgress();
if (progress < 0)
progress = 0;
notification.notifyProgress(progress, 0, hashCode);
}
}