Add simpler DownloadManager constructor

PiperOrigin-RevId: 245397736
This commit is contained in:
eguven 2019-04-26 12:05:09 +01:00 committed by Oliver Woodman
parent e4f1f89f5c
commit 0128cebce1

View file

@ -193,6 +193,24 @@ public final class DownloadManager {
new DefaultDownloaderFactory(new DownloaderConstructorHelper(cache, upstreamFactory)));
}
/**
* Constructs a {@link DownloadManager}.
*
* @param context Any context.
* @param databaseProvider Provides the SQLite database in which downloads are persisted.
* @param cache A cache to be used to store downloaded data. The cache should be configured with
* an {@link CacheEvictor} that will not evict downloaded content, for example {@link
* NoOpCacheEvictor}.
* @param upstreamFactory A {@link Factory} for creating {@link DataSource}s for downloading data.
*/
public DownloadManager(
Context context, DatabaseProvider databaseProvider, Cache cache, Factory upstreamFactory) {
this(
context,
new DefaultDownloadIndex(databaseProvider),
new DefaultDownloaderFactory(new DownloaderConstructorHelper(cache, upstreamFactory)));
}
/**
* Constructs a {@link DownloadManager}.
*