package com.artemzin.qualitymatters;

import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.squareup.picasso.Picasso;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

// It's a Dagger module that provides application level dependencies.
@Module
public class ApplicationModule {

    public static final String MAIN_THREAD_HANDLER = "main_thread_handler";

    @NonNull
    private final QualityMattersApp qualityMattersApp;

    public ApplicationModule(@NonNull QualityMattersApp qualityMattersApp) {
        this.qualityMattersApp = qualityMattersApp;
    }

    @Provides @NonNull @Singleton
    public QualityMattersApp provideQualityMattersApp() {
        return qualityMattersApp;
    }

    @Provides @NonNull @Singleton
    public ObjectMapper provideObjectMapper() {
        return new ObjectMapper();
    }

    @Provides @NonNull @Named(MAIN_THREAD_HANDLER) @Singleton
    public Handler provideMainThreadHandler() {
        return new Handler(Looper.getMainLooper());
    }

    @Provides @NonNull @Singleton
    public Picasso providePicasso(@NonNull QualityMattersApp qualityMattersApp) {
        return Picasso.with(qualityMattersApp);
    }
}

@@ -176,24 +176,111 @@
 jectMapper;%0A
+import com.squareup.okhttp.OkHttpClient;%0Aimport com.squareup.picasso.OkHttpDownloader;%0A
 import com.s
@@ -1335,32 +1335,68 @@
 ualityMattersApp
+, @NonNull OkHttpClient okHttpClient
 ) %7B%0A        retu
@@ -1402,16 +1402,20 @@
 urn 
+new 
 Picasso.
 with
@@ -1414,12 +1414,15 @@
 sso.
-with
+Builder
 (qua
@@ -1436,16 +1436,105 @@
 tersApp)
+%0A                .downloader(new OkHttpDownloader(okHttpClient))%0A                .build()
 ;%0A    %7D%0A

Use OkHttp for Picasso