diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadService.java | 16 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 11 |
2 files changed, 4 insertions, 23 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index cb2fdcb2..9c7cb459 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -130,7 +130,6 @@ public class DownloadService extends Service { private int cachedPosition = 0; private long downloadRevision; private boolean downloadOngoing = false; - private DownloadFile lastDownloaded = null; private AudioEffectsController effectsController; private boolean showVisualization; @@ -1592,25 +1591,12 @@ public class DownloadService extends Service { } if(!backgroundDownloadList.isEmpty()) { - DownloadFile speedFile = null; - // Updating existing notification - if(downloadOngoing) { - // Changing download, use speed of last DownloadFile - if(revision != downloadRevision && lastDownloaded != null) { - speedFile = lastDownloaded; - } else { - // Updated mid-download - speedFile = currentDownloading; - } - } - Util.showDownloadingNotification(this, currentDownloading, backgroundDownloadList.size(), speedFile); + Util.showDownloadingNotification(this, currentDownloading, backgroundDownloadList.size()); downloadRevision = revision; - lastDownloaded = currentDownloading; downloadOngoing = true; } else if(backgroundDownloadList.isEmpty() && downloadOngoing) { Util.hideDownloadingNotification(this); downloadOngoing = false; - lastDownloaded = null; } // Delete obsolete .partial and .complete files. diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java index 72886329..4243c853 100644 --- a/src/github/daneren2005/dsub/util/Util.java +++ b/src/github/daneren2005/dsub/util/Util.java @@ -1113,12 +1113,12 @@ public final class Util { DSubWidgetProvider.notifyInstances(context, downloadService, false); } - public static void showDownloadingNotification(final Context context, DownloadFile file, int size, DownloadFile speedFile) { + public static void showDownloadingNotification(final Context context, DownloadFile file, int size) { Intent cancelIntent = new Intent(context, DownloadService.class); cancelIntent.setAction(DownloadService.CANCEL_DOWNLOADS); PendingIntent cancelPI = PendingIntent.getService(context, 0, cancelIntent, 0); - String currentDownloading, currentSize, speed; + String currentDownloading, currentSize; if(file != null) { currentDownloading = file.getSong().getTitle(); currentSize = Util.formatBytes(file.getEstimatedSize()); @@ -1126,11 +1126,6 @@ public final class Util { currentDownloading = "none"; currentSize = "0"; } - if(speedFile != null) { - speed = Long.toString(speedFile.getBytesPerSecond() / 1024); - } else { - speed = "0"; - } NotificationCompat.Builder builder; builder = new NotificationCompat.Builder(context) @@ -1138,7 +1133,7 @@ public final class Util { .setContentTitle(context.getResources().getString(R.string.download_downloading_title, size)) .setContentText(context.getResources().getString(R.string.download_downloading_summary, currentDownloading)) .setStyle(new NotificationCompat.BigTextStyle() - .bigText(context.getResources().getString(R.string.download_downloading_summary_expanded, currentDownloading, currentSize, speed))) + .bigText(context.getResources().getString(R.string.download_downloading_summary_expanded, currentDownloading, currentSize))) .setProgress(10, 5, true) .setOngoing(true) .addAction(R.drawable.notification_close, |