diff --git a/src/de/podfetcher/activity/FeedlistActivity.java b/src/de/podfetcher/activity/FeedlistActivity.java index fb5d67cb8..b3dec3949 100644 --- a/src/de/podfetcher/activity/FeedlistActivity.java +++ b/src/de/podfetcher/activity/FeedlistActivity.java @@ -48,6 +48,9 @@ public class FeedlistActivity extends SherlockListActivity { case R.id.add_feed: startActivity(new Intent(this, AddFeedActivity.class)); return true; + case R.id.all_feed_refresh: + manager.refreshAllFeeds(this); + return true; default: return super.onOptionsItemSelected(item); } diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 031cdaca5..2630846e6 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import de.podfetcher.storage.*; import android.content.Context; import android.database.Cursor; +import android.util.Log; /** @@ -21,12 +22,13 @@ public class FeedManager { private ArrayList feeds; private ArrayList categories; - + private DownloadRequester requester; private FeedManager() { feeds = new ArrayList(); categories = new ArrayList(); + requester = DownloadRequester.getInstance(); } @@ -37,6 +39,13 @@ public class FeedManager { return singleton; } + public void refreshAllFeeds(Context context) { + Log.d(TAG, "Refreshing all feeds."); + for(Feed feed : feeds) { + requester.downloadFeed(context, feed); + } + } + private void addNewFeed(Context context, Feed feed) { feeds.add(feed); feed.setId(setFeed(context, feed)); @@ -68,9 +77,11 @@ public class FeedManager { // Look up feed in the feedslist Feed savedFeed = searchFeedByLink(newFeed.getLink()); if(savedFeed == null) { + Log.d(TAG, "Found no existing Feed with title " + newFeed.getTitle() + ". Adding as new one."); // Add a new Feed addNewFeed(context, newFeed); }else { + Log.d(TAG, "Feed with title " + newFeed.getTitle() + " already exists. Syncing new with existing one."); // Look for new or updated Items for(FeedItem item : newFeed.getItems()) { FeedItem oldItem = searchFeedItemByLink(savedFeed, item.getLink()); diff --git a/src/de/podfetcher/storage/DownloadRequester.java b/src/de/podfetcher/storage/DownloadRequester.java index 3316e67c1..cd3bf311e 100644 --- a/src/de/podfetcher/storage/DownloadRequester.java +++ b/src/de/podfetcher/storage/DownloadRequester.java @@ -51,6 +51,7 @@ public class DownloadRequester { } private void download(Context context, ArrayList type, FeedFile item, File dest, boolean visibleInUI) { + Log.d(TAG, "Requesting download of url "+ item.getDownload_url()); type.add(item); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(item.getDownload_url())); //request.allowScanningByMediaScanner();