当前位置: 首页>>代码示例>>Java>>正文


Java ContextSingleton类代码示例

本文整理汇总了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();
}
 
开发者ID:FauDroids,项目名称:TeamBlocks,代码行数:10,代码来源:GoogleModule.java

示例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);
}
 
开发者ID:FauDroids,项目名称:TripWeather,代码行数:9,代码来源:GeoModule.java

示例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);
}
 
开发者ID:FauDroids,项目名称:TripWeather,代码行数:9,代码来源:GeoModule.java

示例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);
}
 
开发者ID:FauDroids,项目名称:TripWeather,代码行数:9,代码来源:GeoModule.java

示例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);
}
 
开发者ID:FauDroids,项目名称:TripWeather,代码行数:16,代码来源:WeatherModule.java

示例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));
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:34,代码来源:AgitModule.java


注:本文中的roboguice.inject.ContextSingleton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。