From 9ce48bd86bc5f32f197f2f5b0d3a78596b9c15fe Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 26 May 2018 23:20:47 +0200 Subject: [PATCH] Added a refreshAllFeeds method without callback --- .../antennapod/fragment/AllEpisodesFragment.java | 2 +- .../danoeh/antennapod/fragment/QueueFragment.java | 2 +- .../de/danoeh/antennapod/core/storage/DBTasks.java | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index 209d5bca8..f3846c8a4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -224,7 +224,7 @@ public class AllEpisodesFragment extends Fragment { case R.id.refresh_item: List feeds = ((MainActivity) getActivity()).getFeeds(); if (feeds != null) { - DBTasks.refreshAllFeeds(getActivity(), feeds, null); + DBTasks.refreshAllFeeds(getActivity(), feeds); } return true; case R.id.mark_all_read_item: diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 349b4bd8f..85abdd281 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -285,7 +285,7 @@ public class QueueFragment extends Fragment { case R.id.refresh_item: List feeds = ((MainActivity) getActivity()).getFeeds(); if (feeds != null) { - DBTasks.refreshAllFeeds(getActivity(), feeds, null); + DBTasks.refreshAllFeeds(getActivity(), feeds); } return true; case R.id.clear_queue: diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index 22a7b64fe..da500fd3e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -151,6 +151,17 @@ public final class DBTasks { private static final AtomicBoolean isRefreshing = new AtomicBoolean(false); + /** + * Refreshes a given list of Feeds in a separate Thread. This method might ignore subsequent calls if it is still + * enqueuing Feeds for download from a previous call + * + * @param context Might be used for accessing the database + * @param feeds List of Feeds that should be refreshed. + */ + public static void refreshAllFeeds(final Context context, final List feeds) { + refreshAllFeeds(context, feeds, null); + } + /** * Refreshes a given list of Feeds in a separate Thread. This method might ignore subsequent calls if it is still * enqueuing Feeds for download from a previous call @@ -348,7 +359,7 @@ public final class DBTasks { Log.d(TAG, "last refresh: " + Converter.getDurationStringLocalized(context, System.currentTimeMillis() - lastRefresh) + " ago"); if(lastRefresh <= System.currentTimeMillis() - interval) { - DBTasks.refreshAllFeeds(context, null, null); + DBTasks.refreshAllFeeds(context, null); } }