Commit f6d5cb99 by andrewlewis Committed by Oliver Woodman

Add a convenience constructor for DownloadManagers

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193940183
parent adc77fd0
...@@ -29,6 +29,8 @@ import android.support.annotation.IntDef; ...@@ -29,6 +29,8 @@ import android.support.annotation.IntDef;
import android.util.Log; import android.util.Log;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.offline.DownloadAction.Deserializer; import com.google.android.exoplayer2.offline.DownloadAction.Deserializer;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Assertions;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
...@@ -94,6 +96,26 @@ public final class DownloadManager { ...@@ -94,6 +96,26 @@ public final class DownloadManager {
private boolean downloadsStopped; private boolean downloadsStopped;
/** /**
* Creates a {@link DownloadManager}.
*
* @param cache Cache instance to be used to store downloaded data.
* @param upstreamDataSourceFactory A {@link DataSource.Factory} for creating data sources for
* downloading upstream data.
* @param actionSaveFile File to save active actions.
* @param deserializers Used to deserialize {@link DownloadAction}s.
*/
public DownloadManager(
Cache cache,
DataSource.Factory upstreamDataSourceFactory,
String actionSaveFile,
Deserializer... deserializers) {
this(
new DownloaderConstructorHelper(cache, upstreamDataSourceFactory),
actionSaveFile,
deserializers);
}
/**
* Constructs a {@link DownloadManager}. * Constructs a {@link DownloadManager}.
* *
* @param constructorHelper A {@link DownloaderConstructorHelper} to create {@link Downloader}s * @param constructorHelper A {@link DownloaderConstructorHelper} to create {@link Downloader}s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment