Improved performance when marking all feeditems of a feed as read

This commit is contained in:
daniel oeh 2012-06-25 13:22:26 +02:00
parent 1f31dff47f
commit a66580bfc6
3 changed files with 14 additions and 4 deletions

View File

@ -146,6 +146,18 @@ public class FeedManager {
}
}
/**
* 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.");
for (Feed feed : feeds) {

View File

@ -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);

View File

@ -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;