Source:
public static DownloadManagerBuilder newInstance(Context context, Handler callbackHandler, @DrawableRes final int notificationIcon) { Log.setShowLogs(true); Context applicationContext = context.getApplicationContext(); FilePersistenceCreator filePersistenceCreator = FilePersistenceCreator.newInternalFilePersistenceCreator(applicationContext); DownloadsPersistence downloadsPersistence = RoomDownloadsPersistence.newInstance(applicationContext); OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setConnectTimeout(5, TimeUnit.SECONDS); okHttpClient.setWriteTimeout(5, TimeUnit.SECONDS); okHttpClient.setReadTimeout(5, TimeUnit.SECONDS); HttpClient httpClient = new WrappedOkHttpClient(okHttpClient); NetworkRequestCreator requestCreator = new NetworkRequestCreator(); FileSizeRequester fileSizeRequester = new NetworkFileSizeRequester(httpClient, requestCreator); FileDownloader fileDownloader = new NetworkFileDownloader(httpClient, requestCreator); NotificationCustomizer<DownloadBatchStatus> notificationCustomizer = new NotificationCustomizer<DownloadBatchStatus>() { private static final boolean NOT_INDETERMINATE = false; @Override public Notification customNotificationFrom(NotificationCompat.Builder builder, DownloadBatchStatus payload) { DownloadBatchTitle downloadBatchTitle = payload.getDownloadBatchTitle(); int percentageDownloaded = payload.percentageDownloaded(); int bytesFileSize = (int) payload.bytesTotalSize(); int bytesDownloaded = (int) payload.bytesDownloaded(); String title = downloadBatchTitle.asString(); String content = percentageDownloaded + "% downloaded"; return builder .setProgress(bytesFileSize, bytesDownloaded, NOT_INDETERMINATE) .setSmallIcon(notificationIcon) .setContentTitle(title) .setContentText(content) .build(); } }; NotificationConfig<DownloadBatchStatus> notificationConfig = new NotificationConfig<>( context, context.getResources().getString(R.string.download_notification_channel_name), context.getResources().getString(R.string.download_notification_channel_description), notificationCustomizer, NotificationManagerCompat.IMPORTANCE_LOW ); ConnectionType connectionTypeAllowed = ConnectionType.ALL; boolean allowNetworkRecovery = true; CallbackThrottleCreator.Type callbackThrottleCreatorType = CallbackThrottleCreator.Type.THROTTLE_BY_PROGRESS_INCREASE; return new DownloadManagerBuilder( applicationContext, callbackHandler, filePersistenceCreator, downloadsPersistence, fileSizeRequester, fileDownloader, notificationConfig, connectionTypeAllowed, allowNetworkRecovery, callbackThrottleCreatorType ); }

Target:
public static DownloadManagerBuilder newInstance(Context context, Handler callbackHandler, @DrawableRes final int notificationIcon) { Log.setShowLogs(true); Context applicationContext = context.getApplicationContext(); FilePersistenceCreator filePersistenceCreator = FilePersistenceCreator.newInternalFilePersistenceCreator(applicationContext); DownloadsPersistence downloadsPersistence = RoomDownloadsPersistence.newInstance(applicationContext); OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setConnectTimeout(5, TimeUnit.SECONDS); okHttpClient.setWriteTimeout(5, TimeUnit.SECONDS); okHttpClient.setReadTimeout(5, TimeUnit.SECONDS); HttpClient httpClient = new WrappedOkHttpClient(okHttpClient); NetworkRequestCreator requestCreator = new NetworkRequestCreator(); FileSizeRequester fileSizeRequester = new NetworkFileSizeRequester(httpClient, requestCreator); FileDownloader fileDownloader = new NetworkFileDownloader(httpClient, requestCreator); NotificationCustomizer<DownloadBatchStatus> notificationCustomizer = new DownloadNotificationCustomizer(notificationIcon); NotificationConfig<DownloadBatchStatus> notificationConfig = new NotificationConfig<>( context, context.getResources().getString(R.string.download_notification_channel_name), context.getResources().getString(R.string.download_notification_channel_description), notificationCustomizer, NotificationManagerCompat.IMPORTANCE_LOW ); ConnectionType connectionTypeAllowed = ConnectionType.ALL; boolean allowNetworkRecovery = true; CallbackThrottleCreator.Type callbackThrottleCreatorType = CallbackThrottleCreator.Type.THROTTLE_BY_PROGRESS_INCREASE; return new DownloadManagerBuilder( applicationContext, callbackHandler, filePersistenceCreator, downloadsPersistence, fileSizeRequester, fileDownloader, notificationConfig, connectionTypeAllowed, allowNetworkRecovery, callbackThrottleCreatorType ); }