Fixed Feed syncing

This commit is contained in:
daniel oeh 2012-06-14 14:45:32 +02:00
parent 922b868914
commit ee9662e73d
1 changed files with 6 additions and 10 deletions

View File

@ -39,7 +39,7 @@ public class FeedManager {
public void refreshAllFeeds(Context context) { public void refreshAllFeeds(Context context) {
Log.d(TAG, "Refreshing all feeds."); Log.d(TAG, "Refreshing all feeds.");
for (Feed feed : feeds) { for (Feed feed : feeds) {
requester.downloadFeed(context, feed); requester.downloadFeed(context, new Feed(feed.getDownload_url(), new Date()));
} }
} }
@ -85,17 +85,13 @@ public class FeedManager {
for (FeedItem item : newFeed.getItems()) { for (FeedItem item : newFeed.getItems()) {
FeedItem oldItem = searchFeedItemByLink(savedFeed, FeedItem oldItem = searchFeedItemByLink(savedFeed,
item.getLink()); item.getLink());
if (oldItem != null) { if (oldItem == null) {
FeedItem newItem = searchFeedItemByLink(newFeed, // item is new
item.getLink()); savedFeed.getItems().add(item);
if (newItem != null) {
newItem.setRead(oldItem.isRead());
}
} }
} }
newFeed.setId(savedFeed.getId()); savedFeed.setLastUpdate(newFeed.getLastUpdate());
savedFeed = newFeed; setFeed(context, savedFeed);
setFeed(context, newFeed);
} }
} }