Back to project page android-test-demo.
The source code is released under:
MIT License
If you think the Android project android-test-demo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.andydyer.androidtestdemo.api; /* w w w . jav a2s .c o m*/ import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.andydyer.androidtestdemo.ui.fragments.EventListFragment; import org.andydyer.androidtestdemo.ui.LoginActivity; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; import retrofit.android.AndroidLog; import retrofit.converter.GsonConverter; /** * Created by andy on 8/23/14. */ @Module(injects = {EventListFragment.class, LoginActivity.class}) public class ApiServiceModule { @Provides @Singleton public ApiService provideApiService() { Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create(); return new RestAdapter.Builder() .setEndpoint(ApiService.API_URL) .setConverter(new GsonConverter(gson)) .setLogLevel(RestAdapter.LogLevel.FULL).setLog(new AndroidLog("API")) .build() .create(ApiService.class); } @Provides @Singleton public AuthenticationService provideAuthenticationService() { return null; // not implemented } }