diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-25 13:22:26 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-25 13:22:26 +0200 |
commit | a66580bfc62630076abbcb25674016d1f930d6dc (patch) | |
tree | 7d148ea9ef98841962a9e8d643d53f1e361d5832 /src/de/podfetcher | |
parent | 1f31dff47fb8b3ac1dd469b942a798145376a6b1 (diff) | |
download | AntennaPod-a66580bfc62630076abbcb25674016d1f930d6dc.zip |
Improved performance when marking all feeditems of a feed as read
Diffstat (limited to 'src/de/podfetcher')
-rw-r--r-- | src/de/podfetcher/feed/FeedManager.java | 12 | ||||
-rw-r--r-- | src/de/podfetcher/fragment/ItemlistFragment.java | 1 | ||||
-rw-r--r-- | src/de/podfetcher/util/FeedMenuHandler.java | 5 |
3 files changed, 14 insertions, 4 deletions
diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 417d4a4cf..b721c1746 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -145,6 +145,18 @@ public class FeedManager { unreadItems.add(item); } } + + /** + * Sets the 'read' attribute of all FeedItems of a specific feed to true + * @param context + */ + public void markFeedRead(Context context, Feed feed) { + for (FeedItem item : feed.getItems()) { + if (unreadItems.contains(item)) { + markItemRead(context, item, true); + } + } + } public void refreshAllFeeds(Context context) { Log.d(TAG, "Refreshing all feeds."); diff --git a/src/de/podfetcher/fragment/ItemlistFragment.java b/src/de/podfetcher/fragment/ItemlistFragment.java index 9e4cefeb8..6cc14548a 100644 --- a/src/de/podfetcher/fragment/ItemlistFragment.java +++ b/src/de/podfetcher/fragment/ItemlistFragment.java @@ -85,6 +85,7 @@ public class ItemlistFragment extends SherlockListFragment { @Override public void onResume() { super.onResume(); + fila.notifyDataSetChanged(); IntentFilter filter = new IntentFilter(); filter.addAction(DownloadService.ACTION_DOWNLOAD_HANDLED); filter.addAction(DownloadRequester.ACTION_DOWNLOAD_QUEUED); diff --git a/src/de/podfetcher/util/FeedMenuHandler.java b/src/de/podfetcher/util/FeedMenuHandler.java index 140b895ff..84f6d898f 100644 --- a/src/de/podfetcher/util/FeedMenuHandler.java +++ b/src/de/podfetcher/util/FeedMenuHandler.java @@ -31,10 +31,7 @@ public class FeedMenuHandler { FeedManager manager = FeedManager.getInstance(); switch (item.getItemId()) { case R.id.mark_all_read_item: - for (FeedItem feeditem : selectedFeed.getItems()) { - manager.markItemRead(context, feeditem, true); - } - + manager.markFeedRead(context, selectedFeed); break; default: return false; |