From 4b5160c30c87972026e65876ee3a5707895f0c19 Mon Sep 17 00:00:00 2001 From: Daniel Oeh Date: Thu, 19 Apr 2012 19:18:05 +0200 Subject: [PATCH] Added Logging messages --- res/values/strings.xml | 1 + src/de/podfetcher/activity/AddFeedActivity.java | 2 ++ src/de/podfetcher/storage/DownloadRequester.java | 13 ++++++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index ba495bcad..eef0f2a54 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -24,6 +24,7 @@ Download successful Download failed Download pending + Download running diff --git a/src/de/podfetcher/activity/AddFeedActivity.java b/src/de/podfetcher/activity/AddFeedActivity.java index c1e5f5f14..273cabf2e 100644 --- a/src/de/podfetcher/activity/AddFeedActivity.java +++ b/src/de/podfetcher/activity/AddFeedActivity.java @@ -5,6 +5,7 @@ import android.widget.Button; import android.widget.EditText; import android.view.View; import android.app.ProgressDialog; +import android.util.Log; import de.podfetcher.R; import de.podfetcher.feed.Feed; import de.podfetcher.storage.DownloadRequester; @@ -78,6 +79,7 @@ public class AddFeedActivity extends SherlockActivity { dialog.dismiss(); finish(); }else { + Log.d(TAG, "Changing message of dialog."); dialog.setMessage(AddFeedActivity.this.getString(observer.getResult())); } return null; diff --git a/src/de/podfetcher/storage/DownloadRequester.java b/src/de/podfetcher/storage/DownloadRequester.java index e346ccdad..d18d442fe 100644 --- a/src/de/podfetcher/storage/DownloadRequester.java +++ b/src/de/podfetcher/storage/DownloadRequester.java @@ -198,7 +198,7 @@ public class DownloadRequester { break; case DownloadManager.STATUS_RUNNING: Log.d(TAG, "Download is running."); - result = getDownloadStatus(cursor, DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR); + result = R.string.download_running; break; case DownloadManager.STATUS_FAILED: Log.d(TAG, "Download failed."); @@ -210,11 +210,12 @@ public class DownloadRequester { Log.d(TAG, "Download pending."); result = R.string.download_pending; break; - + } try { - client.call(); + client.call(); }catch (Exception e) { + Log.e(TAG, "Error happened when calling client: " + e.getMessage()); } if(done) { @@ -222,12 +223,14 @@ public class DownloadRequester { } else { try { sleep(waiting_intervall); - }catch (InterruptedException e) {} + }catch (InterruptedException e) { + Log.w(TAG, "Thread was interrupted while waiting."); + } } } Log.d(TAG, "Thread stopped."); } - + public void setClient(Callable callable) { this.client = callable; }