Improve some aspects of the Downloader implementation

This commit is contained in:
Mauricio Colli 2018-02-21 08:05:23 -03:00
parent 99e0f0c3e4
commit 1d2c616ce0
No known key found for this signature in database
GPG key ID: F200BFD6F29DDD85
4 changed files with 61 additions and 30 deletions

View file

@ -15,6 +15,8 @@ import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.LeakDirectoryProvider;
import com.squareup.leakcanary.RefWatcher;
import org.schabi.newpipe.extractor.Downloader;
import java.io.File;
import java.util.concurrent.TimeUnit;
@ -33,7 +35,12 @@ public class DebugApp extends App {
public void onCreate() {
super.onCreate();
initStetho();
Downloader.client = new OkHttpClient.Builder().addNetworkInterceptor(new StethoInterceptor()).readTimeout(30, TimeUnit.SECONDS).build();
}
@Override
protected Downloader getDownloader() {
return org.schabi.newpipe.Downloader.init(new OkHttpClient.Builder()
.addNetworkInterceptor(new StethoInterceptor()));
}
private void initStetho() {