From 2df0fb4774d054e8f394dfefd62a0511db29d17e Mon Sep 17 00:00:00 2001 From: Daniel Oeh Date: Mon, 28 May 2012 16:38:51 +0200 Subject: [PATCH] Added GUI sketches, fixed a bug in the FeedManager --- .gitignore | 3 +++ src/de/podfetcher/feed/FeedManager.java | 4 +++- src/de/podfetcher/feed/FeedMedia.java | 6 +++--- src/de/podfetcher/storage/PodDBAdapter.java | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 85e16977e..7ee72a3b6 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ local.properties # Eclipse project files .classpath .project + +# other +*.odg# diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 8baee5a1d..65692a2ea 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -227,7 +227,9 @@ public class FeedManager { item.setLink(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_LINK))); item.setDescription(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_DESCRIPTION))); item.setPubDate(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_PUBDATE))); - item.setMedia(adapter.getFeedMedia(itemlistCursor.getLong(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_MEDIA)))); + item.setMedia(adapter.getFeedMedia( + itemlistCursor.getLong( + itemlistCursor.getColumnIndex(PodDBAdapter.KEY_MEDIA)), item)); item.setRead((itemlistCursor.getInt(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_READ)) > 0) ? true : false); items.add(item); diff --git a/src/de/podfetcher/feed/FeedMedia.java b/src/de/podfetcher/feed/FeedMedia.java index 23594d465..1234cc0bd 100644 --- a/src/de/podfetcher/feed/FeedMedia.java +++ b/src/de/podfetcher/feed/FeedMedia.java @@ -5,8 +5,7 @@ public class FeedMedia extends FeedFile{ private long position; private long size; // File size in Byte private String mime_type; - - private FeedItem item; // TODO remove + private FeedItem item; public FeedMedia(FeedItem i, String download_url, long size, String mime_type) { this.item = i; @@ -15,10 +14,11 @@ public class FeedMedia extends FeedFile{ this.mime_type = mime_type; } - public FeedMedia(long id, long length, long position, long size, String mime_type, + public FeedMedia(long id, FeedItem item, long length, long position, long size, String mime_type, String file_url, String download_url) { super(); this.id = id; + this.item = item; this.length = length; this.position = position; this.size = size; diff --git a/src/de/podfetcher/storage/PodDBAdapter.java b/src/de/podfetcher/storage/PodDBAdapter.java index 76266f0d8..6884965f8 100644 --- a/src/de/podfetcher/storage/PodDBAdapter.java +++ b/src/de/podfetcher/storage/PodDBAdapter.java @@ -269,7 +269,7 @@ public class PodDBAdapter { return c; } - public FeedMedia getFeedMedia(long row_index) throws SQLException{ + public FeedMedia getFeedMedia(long row_index, FeedItem owner) throws SQLException{ open(); Cursor cursor = db.query(TABLE_NAME_FEED_MEDIA, null, KEY_ID + "=?", new String[]{String.valueOf(row_index)}, null, null, null); @@ -278,6 +278,7 @@ public class PodDBAdapter { throw new SQLException("No FeedMedia found at index: " + row_index); } FeedMedia media = new FeedMedia(row_index, + owner, cursor.getLong(cursor.getColumnIndex(KEY_LENGTH)), cursor.getLong(cursor.getColumnIndex(KEY_POSITION)), cursor.getLong(cursor.getColumnIndex(KEY_SIZE)),