diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-18 16:05:23 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-18 16:05:23 +0200 |
commit | 245f272a3510ccc816aeedd8b215d5491e08c67a (patch) | |
tree | 4a3b77261493bb3b86975a6f4987241b4dfef332 /src/de/podfetcher/feed/FeedManager.java | |
parent | 113ccff68f89a62d99250233016510eeefd0859b (diff) | |
download | AntennaPod-245f272a3510ccc816aeedd8b215d5491e08c67a.zip |
Improved the way the AddFeedActivity is waiting for the download to
finish
Diffstat (limited to 'src/de/podfetcher/feed/FeedManager.java')
-rw-r--r-- | src/de/podfetcher/feed/FeedManager.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 5c8a2450c..4c77c2059 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -106,7 +106,7 @@ public class FeedManager { new Date())); } } - + public long addDownloadStatus(Context context, DownloadStatus status) { PodDBAdapter adapter = new PodDBAdapter(context); downloadLog.add(status); @@ -263,6 +263,15 @@ public class FeedManager { return null; } + public DownloadStatus getDownloadStatus(long statusId) { + for (DownloadStatus status : downloadLog) { + if (status.getId() == statusId) { + return status; + } + } + return null; + } + /** Reads the database */ public void loadDBData(Context context) { PodDBAdapter adapter = new PodDBAdapter(context); @@ -375,10 +384,14 @@ public class FeedManager { feedfile = getFeedMedia(feedfileId); } if (feedfile != null) { // otherwise ignore status - boolean successful = logCursor.getInt(logCursor.getColumnIndex(PodDBAdapter.KEY_SUCCESSFUL)) > 0; - int reason = logCursor.getInt(logCursor.getColumnIndex(PodDBAdapter.KEY_REASON)); - Date completionDate = new Date(logCursor.getLong(logCursor.getColumnIndex(PodDBAdapter.KEY_COMPLETION_DATE))); - downloadLog.add(new DownloadStatus(id, feedfile, successful, reason, completionDate)); + boolean successful = logCursor.getInt(logCursor + .getColumnIndex(PodDBAdapter.KEY_SUCCESSFUL)) > 0; + int reason = logCursor.getInt(logCursor + .getColumnIndex(PodDBAdapter.KEY_REASON)); + Date completionDate = new Date(logCursor.getLong(logCursor + .getColumnIndex(PodDBAdapter.KEY_COMPLETION_DATE))); + downloadLog.add(new DownloadStatus(id, feedfile, + successful, reason, completionDate)); } } while (logCursor.moveToNext()); |