Search in sources :

Example 31 with Provides

use of dagger.Provides in project philm by chrisbanes.

the class NetworkProvider method provideTmdbClient.

@Provides
@Singleton
public Tmdb provideTmdbClient(@CacheDirectory File cacheLocation) {
    Tmdb tmdb = new PhilmTmdb(cacheLocation);
    tmdb.setApiKey(Constants.TMDB_API_KEY);
    tmdb.setIsDebug(Constants.DEBUG_NETWORK);
    return tmdb;
}
Also used : Tmdb(com.uwetrottmann.tmdb.Tmdb) PhilmTmdb(app.philm.in.network.PhilmTmdb) PhilmTmdb(app.philm.in.network.PhilmTmdb) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 32 with Provides

use of dagger.Provides in project DraggablePanel by pedrovgs.

the class MainModule method provideTvShowCollectionRendererBuilder.

/**
   * Provisioning of a RendererBuilder implementation to work with tv shows ListView. More
   * information in this library: {@link https://github.com/pedrovgs/Renderers}
   */
@Provides
protected TvShowCollectionRendererBuilder provideTvShowCollectionRendererBuilder(Context context) {
    List<Renderer<TvShowViewModel>> prototypes = new LinkedList<Renderer<TvShowViewModel>>();
    prototypes.add(new TvShowRenderer(context));
    return new TvShowCollectionRendererBuilder(prototypes);
}
Also used : PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) Renderer(com.pedrogomez.renderers.Renderer) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) TvShowViewModel(com.github.pedrovgs.sample.viewmodel.TvShowViewModel) TvShowCollectionRendererBuilder(com.github.pedrovgs.sample.renderer.rendererbuilder.TvShowCollectionRendererBuilder) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) LinkedList(java.util.LinkedList) Provides(dagger.Provides)

Example 33 with Provides

use of dagger.Provides in project reark by reark.

the class NetworkModule method provideOkHttpClient.

@Provides
@Singleton
public OkHttpClient provideOkHttpClient(@Named("networkInterceptors") List<Interceptor> networkInterceptors) {
    OkHttpClient.Builder okBuilder = new OkHttpClient().newBuilder();
    okBuilder.networkInterceptors().addAll(networkInterceptors);
    return okBuilder.build();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 34 with Provides

use of dagger.Provides in project FloatingSearchView by renaudcerrato.

the class RetrofitModule method provideHttpClient.

@Provides
@Singleton
OkHttpClient provideHttpClient() {
    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient httpClient = new OkHttpClient();
    httpClient.interceptors().add(logging);
    return httpClient;
}
Also used : OkHttpClient(com.squareup.okhttp.OkHttpClient) HttpLoggingInterceptor(com.squareup.okhttp.logging.HttpLoggingInterceptor) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 35 with Provides

use of dagger.Provides in project Rutgers-Course-Tracker by tevjef.

the class ClientModule method providesRMPClient.

@Provides
@Singleton
public RMPClient providesRMPClient(OkHttpClient client, Gson gson) {
    OkHttpClient okClient = client.clone();
    okClient.setConnectTimeout(CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    okClient.setReadTimeout(READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("http://rutgersapp.tevindev.me:8080/").setLogLevel(RestAdapter.LogLevel.FULL).setConverter(new GsonConverter(gson)).setClient(new OkClient(okClient)).build();
    return new RMPClient(restAdapter.create(ClientService.class));
}
Also used : GsonConverter(retrofit.converter.GsonConverter) RMPClient(com.tevinjeffrey.rmp.client.RMPClient) OkHttpClient(com.squareup.okhttp.OkHttpClient) ClientService(com.tevinjeffrey.rmp.client.ClientService) OkClient(retrofit.client.OkClient) RestAdapter(retrofit.RestAdapter) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

Provides (dagger.Provides)52 Singleton (javax.inject.Singleton)39 OkHttpClient (okhttp3.OkHttpClient)11 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)11 OkHttpClient (com.squareup.okhttp.OkHttpClient)5 GsonBuilder (com.google.gson.GsonBuilder)4 Cache (okhttp3.Cache)4 StethoInterceptor (com.facebook.stetho.okhttp3.StethoInterceptor)3 File (java.io.File)3 Named (javax.inject.Named)3 Retrofit (retrofit2.Retrofit)3 Bundle (android.os.Bundle)2 LoginManager (com.byoutline.kickmaterial.managers.LoginManager)2 MovieFragment (com.dev.base.mvp.view.fragment.MovieFragment)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 PlaceRenderer (com.github.pedrovgs.sample.renderer.PlaceRenderer)2 TvShowRenderer (com.github.pedrovgs.sample.renderer.TvShowRenderer)2 Gson (com.google.gson.Gson)2 BindingsGroup (dagger.internal.BindingsGroup)2 SetBinding (dagger.internal.SetBinding)2