diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-26 17:56:47 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-26 17:56:47 +0200 |
commit | 81295bc07f7c558e18c02b03421bdbfd3d3c28c6 (patch) | |
tree | 5c2befecb2dd94d19704a74d6ef057333ab9db37 /src/de/podfetcher | |
parent | f4fa5dce5f1943d1a5724d529f6bd0be35674cb3 (diff) | |
download | AntennaPod-81295bc07f7c558e18c02b03421bdbfd3d3c28c6.zip |
Made startup loading more stable
Diffstat (limited to 'src/de/podfetcher')
-rw-r--r-- | src/de/podfetcher/feed/FeedManager.java | 20 | ||||
-rw-r--r-- | src/de/podfetcher/storage/PodDBAdapter.java | 2 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 745ebf461..36588dcfd 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -122,6 +122,9 @@ public class FeedManager { if (!item.isRead()) { unreadItems.remove(item); } + if (queue.contains(item)) { + removeQueueItem(context, item); + } if (item.getMedia() != null && item.getMedia().isDownloaded()) { File mediaFile = new File(item.getMedia().getFile_url()); mediaFile.delete(); @@ -375,7 +378,7 @@ public class FeedManager { } private void extractFeedlistFromCursor(Context context, PodDBAdapter adapter) { - + Log.d(TAG, "Extracting Feedlist"); Cursor feedlistCursor = adapter.getAllFeedsCursor(); if (feedlistCursor.moveToFirst()) { do { @@ -416,6 +419,7 @@ public class FeedManager { private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context, Feed feed, Cursor itemlistCursor, PodDBAdapter adapter) { + Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle()); ArrayList<FeedItem> items = new ArrayList<FeedItem>(); if (itemlistCursor.moveToFirst()) { do { @@ -453,6 +457,7 @@ public class FeedManager { private void extractDownloadLogFromCursor(Context context, PodDBAdapter adapter) { + Log.d(TAG, "Extracting DownloadLog"); Cursor logCursor = adapter.getDownloadLogCursor(); if (logCursor.moveToFirst()) { do { @@ -490,6 +495,7 @@ public class FeedManager { } private void extractQueueFromCursor(Context context, PodDBAdapter adapter) { + Log.d(TAG, "Extracting Downloadqueue"); Cursor cursor = adapter.getQueueCursor(); if (cursor.moveToFirst()) { do { @@ -497,9 +503,15 @@ public class FeedManager { .getColumnIndex(PodDBAdapter.KEY_ID)); Feed feed = getFeed(cursor.getLong(cursor .getColumnIndex(PodDBAdapter.KEY_FEED))); - FeedItem item = getFeedItem( - cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed); - queue.add(index, item); + if (feed != null) { + FeedItem item = getFeedItem( + cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed); + if (item != null) { + queue.add(index, item); + } + } + + } while (cursor.moveToNext()); } cursor.close(); diff --git a/src/de/podfetcher/storage/PodDBAdapter.java b/src/de/podfetcher/storage/PodDBAdapter.java index d12f225e8..4169d4570 100644 --- a/src/de/podfetcher/storage/PodDBAdapter.java +++ b/src/de/podfetcher/storage/PodDBAdapter.java @@ -472,6 +472,7 @@ public class PodDBAdapter { .getColumnIndex(KEY_FILE_URL)), cursor.getString(cursor .getColumnIndex(KEY_DOWNLOAD_URL)), cursor.getInt(cursor .getColumnIndex(KEY_DOWNLOADED)) > 0); + cursor.close(); return media; } @@ -492,6 +493,7 @@ public class PodDBAdapter { .getColumnIndex(KEY_FILE_URL)), cursor.getString(cursor .getColumnIndex(KEY_DOWNLOAD_URL)), cursor.getInt(cursor .getColumnIndex(KEY_DOWNLOADED)) > 0); + cursor.close(); return image; } |