Search in sources :

Example 31 with Singleton

use of javax.inject.Singleton in project androidthings-deskclock by leinardi.

the class AndroidThingsModule method provideLightSensorDriverController.

@Singleton
@Provides
LightSensorDriverController provideLightSensorDriverController(@Nullable Tsl256x tsl256x) {
    Tsl256xLightSensorDriverController controller = new Tsl256xLightSensorDriverController();
    controller.setDriver(tsl256x);
    return controller;
}
Also used : Tsl256xLightSensorDriverController(com.leinardi.android.things.deskclock.sensor.Tsl256xLightSensorDriverController) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 32 with Singleton

use of javax.inject.Singleton in project android-bootstrap by sahiljain5040.

the class NetworkModule method provideGson.

@Provides
@Singleton
Gson provideGson() {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
    return gsonBuilder.create();
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 33 with Singleton

use of javax.inject.Singleton in project android-bootstrap by sahiljain5040.

the class NetworkModule method provideOkHttpCache.

@Provides
@Singleton
Cache provideOkHttpCache(Application application) {
    // 10 MiB
    int cacheSize = 10 * 1024 * 1024;
    Cache cache = new Cache(application.getCacheDir(), cacheSize);
    return cache;
}
Also used : Cache(okhttp3.Cache) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 34 with Singleton

use of javax.inject.Singleton in project Audient by komamj.

the class AudientRepositoryModule method provideCache.

@Singleton
@Provides
Cache provideCache(Context context) {
    // 10 MiB
    int cacheSize = 10 * 1024 * 1024;
    Cache cache = new Cache(context.getCacheDir(), cacheSize);
    return cache;
}
Also used : Cache(okhttp3.Cache) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 35 with Singleton

use of javax.inject.Singleton in project Audient by komamj.

the class AudientRepositoryModule method provideCache.

@Singleton
@Provides
Cache provideCache(Context context) {
    // 10 MiB
    int cacheSize = 10 * 1024 * 1024;
    Cache cache = new Cache(context.getCacheDir(), cacheSize);
    return cache;
}
Also used : Cache(okhttp3.Cache) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

Singleton (javax.inject.Singleton)168 Provides (dagger.Provides)98 Provides (com.google.inject.Provides)57 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)21 Named (javax.inject.Named)17 OkHttpClient (okhttp3.OkHttpClient)17 Cache (okhttp3.Cache)10 List (java.util.List)9 ConfigBinder.configBinder (com.facebook.airlift.configuration.ConfigBinder.configBinder)8 Binder (com.google.inject.Binder)8 Module (com.google.inject.Module)8 CachingStripeMetadataSource (com.facebook.presto.orc.CachingStripeMetadataSource)7 DwrfAwareStripeMetadataSourceFactory (com.facebook.presto.orc.DwrfAwareStripeMetadataSourceFactory)7 OrcDataSourceId (com.facebook.presto.orc.OrcDataSourceId)7 StorageStripeMetadataSource (com.facebook.presto.orc.StorageStripeMetadataSource)7 StripeMetadataSource (com.facebook.presto.orc.StripeMetadataSource)7 StripeMetadataSourceFactory (com.facebook.presto.orc.StripeMetadataSourceFactory)7 CachingOrcFileTailSource (com.facebook.presto.orc.cache.CachingOrcFileTailSource)7 OrcCacheConfig (com.facebook.presto.orc.cache.OrcCacheConfig)7 OrcFileTailSource (com.facebook.presto.orc.cache.OrcFileTailSource)7