From 2064796f91658f39f02b066ed33c7c8394c90f79 Mon Sep 17 00:00:00 2001 From: Daniel Oeh Date: Wed, 30 May 2012 17:49:17 +0200 Subject: [PATCH] Fixed progress bug in DownloadObserver --- src/de/podfetcher/service/DownloadObserver.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/de/podfetcher/service/DownloadObserver.java b/src/de/podfetcher/service/DownloadObserver.java index 34e253dfb..ddf2d4572 100644 --- a/src/de/podfetcher/service/DownloadObserver.java +++ b/src/de/podfetcher/service/DownloadObserver.java @@ -60,20 +60,16 @@ public class DownloadObserver extends AsyncTask { int progressPercent = getDownloadProgress(cursor); switch(status) { case DownloadManager.STATUS_SUCCESSFUL: - Log.d(TAG, "Download was successful."); statusMsg = R.string.download_successful; return Boolean.valueOf(true); case DownloadManager.STATUS_RUNNING: - Log.d(TAG, "Download is running."); statusMsg = R.string.download_running; break; case DownloadManager.STATUS_FAILED: - Log.d(TAG, "Download failed."); statusMsg = R.string.download_failed; requester.notifyDownloadService(context); return Boolean.valueOf(false); case DownloadManager.STATUS_PENDING: - Log.d(TAG, "Download pending."); statusMsg = R.string.download_pending; break; @@ -109,7 +105,7 @@ public class DownloadObserver extends AsyncTask { if (c.moveToFirst()) { long size = c.getLong(c.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)); long soFar = c.getLong(c.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)); - int progress = (int) ((soFar / size) * 100); + int progress = (int) (((double) soFar / (double) size) * 100); Log.d(TAG, "Setting progress to " + progress); return progress; } else {