Added a refreshAllFeeds method without callback

This commit is contained in:
ByteHamster 2018-05-26 23:20:47 +02:00
parent aa25ab5ff4
commit 9ce48bd86b
3 changed files with 14 additions and 3 deletions

View File

@ -224,7 +224,7 @@ public class AllEpisodesFragment extends Fragment {
case R.id.refresh_item:
List<Feed> 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:

View File

@ -285,7 +285,7 @@ public class QueueFragment extends Fragment {
case R.id.refresh_item:
List<Feed> feeds = ((MainActivity) getActivity()).getFeeds();
if (feeds != null) {
DBTasks.refreshAllFeeds(getActivity(), feeds, null);
DBTasks.refreshAllFeeds(getActivity(), feeds);
}
return true;
case R.id.clear_queue:

View File

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