本文整理汇总了Java中roboguice.inject.ContextSingleton类的典型用法代码示例。如果您正苦于以下问题:Java ContextSingleton类的具体用法?Java ContextSingleton怎么用?Java ContextSingleton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextSingleton类属于roboguice.inject包,在下文中一共展示了ContextSingleton类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideGoogleApiClient
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Provides
@Inject
@ContextSingleton
public GoogleApiClient provideGoogleApiClient(Context context) {
return new GoogleApiClient.Builder(context)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.build();
}
示例2: provideGeoCodingService
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Provides
@ContextSingleton
public GeoCodingService provideGeoCodingService(Context context) {
RestAdapter adapter = createBaseRestAdapter(context)
.setEndpoint(context.getString(R.string.google_geocoding_api_base_url))
.build();
return adapter.create(GeoCodingService.class);
}
示例3: providePlacesService
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Provides
@ContextSingleton
public PlacesService providePlacesService(Context context) {
RestAdapter adapter = createBaseRestAdapter(context)
.setEndpoint(context.getString(R.string.google_places_api_base_url))
.build();
return adapter.create(PlacesService.class);
}
示例4: provideDirectionsService
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Provides
@ContextSingleton
public DirectionsService provideDirectionsService(Context context) {
RestAdapter restAdapter = createBaseRestAdapter(context)
.setEndpoint(context.getString(R.string.google_directions_api_base_url))
.build();
return restAdapter.create(DirectionsService.class);
}
示例5: provideWeatherService
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Provides
@ContextSingleton
public WeatherService provideWeatherService(final Context context) {
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(context.getString(R.string.open_weather_base_url))
.setConverter(new JacksonConverter())
.setRequestInterceptor(new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("x-api-key", context.getString(R.string.open_weather_key));
}
})
.build();
return adapter.create(WeatherService.class);
}
示例6: configure
import roboguice.inject.ContextSingleton; //导入依赖的package包/类
@Override
protected void configure() {
install(RepositoryScope.module());
install(OperationScope.module());
bind(UserInfo.class).to(GUIUserInfo.class);
bind(ImageSession.class).toProvider(ImageSessionProvider.class).in(ContextSingleton.class);
bind(Repository.class).toProvider(RepositoryProvider.class);
bind(Ref.class).annotatedWith(named("branch")).toProvider(BranchRefProvider.class);
bind(AndroidAuthAgent.class).toProvider(AndroidAuthAgentProvider.class);
bind(GitAsyncTaskFactory.class).toProvider(newFactory(GitAsyncTaskFactory.class, GitAsyncTask.class));
bind(ContextScopedViewInflatorFactory.class).toProvider(newFactory(ContextScopedViewInflatorFactory.class,
ContextScopedViewInflator.class));
bind(SyncCampaignFactory.class).toProvider(newFactory(SyncCampaignFactory.class, SyncCampaign.class));
bind(TransportConfigCallback.class).to(AgitTransportConfig.class);
bind(CredentialsProvider.class).to(GUICredentialsProvider.class);
bind(SshSessionFactory.class).to(AndroidSshSessionFactory.class);
bind(PromptUIRegistry.class);
bind(HostKeyRepository.class).to(CuriousHostKeyRepository.class);
bind(PromptUI.class).annotatedWith(named("status-bar")).to(StatusBarPromptUI.class);
bind(RepoDomainType.class).annotatedWith(named("branch")).to(RDTBranch.class);
bind(RepoDomainType.class).annotatedWith(named("remote")).to(RDTRemote.class);
bind(RepoDomainType.class).annotatedWith(named("tag")).to(RDTTag.class);
bind(CommitViewHolderFactory.class).toProvider(newFactory(CommitViewHolderFactory.class,
CommitViewHolder.class));
bind(BranchViewHolderFactory.class).toProvider(newFactory(BranchViewHolderFactory.class,
BranchViewHolder.class));
}