Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java

Issue 2523603005: Don't show the remaining time for offline page downloads (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import android.app.ActivityManager; 7 import android.app.ActivityManager;
8 import android.app.DownloadManager; 8 import android.app.DownloadManager;
9 import android.app.Notification; 9 import android.app.Notification;
10 import android.app.NotificationManager; 10 import android.app.NotificationManager;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ? R.string.download_notification_pending : R.string.download_sta rted); 268 ? R.string.download_notification_pending : R.string.download_sta rted);
269 NotificationCompat.Builder builder = buildNotification( 269 NotificationCompat.Builder builder = buildNotification(
270 android.R.drawable.stat_sys_download, fileName, contentText); 270 android.R.drawable.stat_sys_download, fileName, contentText);
271 boolean indeterminate = (percentage == INVALID_DOWNLOAD_PERCENTAGE) || i sDownloadPending; 271 boolean indeterminate = (percentage == INVALID_DOWNLOAD_PERCENTAGE) || i sDownloadPending;
272 builder.setOngoing(true); 272 builder.setOngoing(true);
273 // Avoid moving animations while download is not downloading. 273 // Avoid moving animations while download is not downloading.
274 if (!isDownloadPending) { 274 if (!isDownloadPending) {
275 builder.setProgress(100, percentage, indeterminate); 275 builder.setProgress(100, percentage, indeterminate);
276 } 276 }
277 builder.setPriority(Notification.PRIORITY_HIGH); 277 builder.setPriority(Notification.PRIORITY_HIGH);
278 if (!indeterminate) { 278 if (!indeterminate && !isOfflinePage) {
279 String duration = formatRemainingTime(mContext, timeRemainingInMilli s); 279 String duration = formatRemainingTime(mContext, timeRemainingInMilli s);
280 if (Build.VERSION.CODENAME.equals("N") 280 if (Build.VERSION.CODENAME.equals("N")
281 || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { 281 || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
282 builder.setSubText(duration); 282 builder.setSubText(duration);
283 } else { 283 } else {
284 builder.setContentInfo(duration); 284 builder.setContentInfo(duration);
285 } 285 }
286 } 286 }
287 int notificationId = getNotificationId(downloadGuid); 287 int notificationId = getNotificationId(downloadGuid);
288 int itemType = isOfflinePage ? DownloadSharedPreferenceEntry.ITEM_TYPE_O FFLINE_PAGE 288 int itemType = isOfflinePage ? DownloadSharedPreferenceEntry.ITEM_TYPE_O FFLINE_PAGE
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 return context.getString(R.string.remaining_duration_minutes, minute s); 883 return context.getString(R.string.remaining_duration_minutes, minute s);
884 } else if (minutes > 0) { 884 } else if (minutes > 0) {
885 return context.getString(R.string.remaining_duration_one_minute); 885 return context.getString(R.string.remaining_duration_one_minute);
886 } else if (seconds == 1) { 886 } else if (seconds == 1) {
887 return context.getString(R.string.remaining_duration_one_second); 887 return context.getString(R.string.remaining_duration_one_second);
888 } else { 888 } else {
889 return context.getString(R.string.remaining_duration_seconds, second s); 889 return context.getString(R.string.remaining_duration_seconds, second s);
890 } 890 }
891 } 891 }
892 } 892 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698