use of dagger.Provides in project Telecine by JakeWharton.
the class TelecineModule method provideAnalytics.
@Provides
@Singleton
Analytics provideAnalytics() {
if (BuildConfig.DEBUG) {
return new Analytics() {
@Override
public void send(Map<String, String> params) {
Timber.tag("Analytics").d(String.valueOf(params));
}
};
}
GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(app);
Tracker tracker = googleAnalytics.newTracker(BuildConfig.ANALYTICS_KEY);
// ms? s? better be s.
tracker.setSessionTimeout(300);
return new Analytics.GoogleAnalytics(tracker);
}
use of dagger.Provides in project BookReader by JustWayward.
the class BookApiModule method provideOkHttpClient.
@Provides
public OkHttpClient provideOkHttpClient() {
LoggingInterceptor logging = new LoggingInterceptor(new Logger());
logging.setLevel(LoggingInterceptor.Level.BODY);
OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).connectTimeout(20 * 1000, TimeUnit.MILLISECONDS).readTimeout(20 * 1000, TimeUnit.MILLISECONDS).retryOnConnectionFailure(// 失败重发
true).addInterceptor(new HeaderInterceptor()).addInterceptor(logging);
return builder.build();
}
use of dagger.Provides in project SpotiQ by ZinoKader.
the class AppModule method providePartiesRepository.
@Provides
@Singleton
PartiesRepository providePartiesRepository() {
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
DatabaseReference databaseReference = firebaseDatabase.getReference().child(FirebaseConstants.CHILD_PARTYLIST);
return new PartiesRepository(databaseReference);
}
use of dagger.Provides in project jianshi by wingjay.
the class AppModule method provideOkHttpClient.
@Provides
@Singleton
OkHttpClient provideOkHttpClient(GlobalRequestInterceptor globalRequestInterceptor) {
OkHttpClient.Builder builder = new OkHttpClient.Builder().connectionPool(new ConnectionPool(5, 59, TimeUnit.SECONDS)).connectTimeout(20, TimeUnit.SECONDS).readTimeout(20, TimeUnit.SECONDS).addInterceptor(globalRequestInterceptor).retryOnConnectionFailure(false);
if (BuildConfig.DEBUG) {
builder.addNetworkInterceptor(new StethoInterceptor());
}
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
httpLoggingInterceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE);
builder.addInterceptor(httpLoggingInterceptor);
return builder.build();
}
use of dagger.Provides in project dobby-android by InceptAi.
the class ProdModule method providesNetworkLayer.
@Singleton
@Provides
public NetworkLayer providesNetworkLayer(DobbyApplication application, DobbyThreadpool threadpool, DobbyEventBus eventBus) {
NetworkLayer networkLayer = new NetworkLayer(application.getApplicationContext(), threadpool, eventBus);
application.getProdComponent().inject(networkLayer);
networkLayer.initialize();
return networkLayer;
}
Aggregations