Skip to content

Commit

Permalink
Enqueue tweaks - rename FeedFileDownloadStatusRequesterInterface to a…
Browse files Browse the repository at this point in the history
… more generic DownloadStateProvider.
  • Loading branch information
orionlee committed Oct 4, 2019
1 parent 29781c3 commit 64f0dd2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.URLUtil;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;

import org.apache.commons.io.FilenameUtils;

import java.io.File;
Expand All @@ -31,7 +32,7 @@
* Sends download requests to the DownloadService. This class should always be used for starting downloads,
* otherwise they won't work correctly.
*/
public class DownloadRequester implements FeedFileDownloadStatusRequesterInterface {
public class DownloadRequester implements DownloadStateProvider {
private static final String TAG = "DownloadRequester";

private static final String FEED_DOWNLOADPATH = "cache/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

import de.danoeh.antennapod.core.feed.FeedFile;

public interface FeedFileDownloadStatusRequesterInterface {
/**
* Allow callers to query the states of downloads, but not affect them.
*/
public interface DownloadStateProvider {
/**
* @return {@code true} if the named feedfile is in the downloads list
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Options setKeepInProgressAtFront(boolean keepInProgressAtFront) {
* The logic needs to use {@link DownloadRequester#isDownloadingFile(FeedFile)} method only
*/
@VisibleForTesting
FeedFileDownloadStatusRequesterInterface requester = DownloadRequester.getInstance();
DownloadStateProvider requester = DownloadRequester.getInstance();

public ItemEnqueuePositionCalculator(@NonNull Options options) {
this.options = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static FeedItem tFI_isDownloading(int id, MockDownloadRequester requeste
return item;
}

private static class MockDownloadRequester implements FeedFileDownloadStatusRequesterInterface {
private static class MockDownloadRequester implements DownloadStateProvider {

private Map<Long, Boolean> downloadingByIds = new HashMap<>();

Expand Down

0 comments on commit 64f0dd2

Please sign in to comment.