本文整理汇总了Java中com.github.aurae.retrofit2.LoganSquareConverterFactory类的典型用法代码示例。如果您正苦于以下问题:Java LoganSquareConverterFactory类的具体用法?Java LoganSquareConverterFactory怎么用?Java LoganSquareConverterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoganSquareConverterFactory类属于com.github.aurae.retrofit2包,在下文中一共展示了LoganSquareConverterFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
random = new Random();
xkcdMapper = new XkcdMapper();
executor = Executors.newSingleThreadExecutor();
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder() //
.deleteRealmIfMigrationNeeded() //
.build();
Realm.setDefaultConfiguration(realmConfiguration);
retrofit = new Retrofit.Builder().baseUrl("http://xkcd.com/")
.addConverterFactory(LoganSquareConverterFactory.create())
.build();
xkcdService = retrofit.create(XkcdService.class);
}
示例2: getRetrofit
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
@NonNull
private Retrofit getRetrofit() {
return new Retrofit.Builder()
.baseUrl(ApiService.API_ENDPOINT)
.addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
.addConverterFactory(LoganSquareConverterFactory.create())
.client(CLIENT)
.build();
}
示例3: retrofit
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
@Provides
@ActivityScope
Retrofit retrofit(OkHttpClient okHttpClient, RxJava2CallAdapterFactory rxJava2CallAdapterFactory) {
return new Retrofit.Builder().addConverterFactory(LoganSquareConverterFactory.create()) //
.baseUrl("https://api.github.com/") //
.addCallAdapterFactory(rxJava2CallAdapterFactory)
.client(okHttpClient) //
.build();
}
示例4: provideGithubService
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
@Provides
@Singleton
public GitHubService provideGithubService(@NonNull final OkHttpClient poOkHttpClient) {
final Retrofit loRetrofit = new Retrofit.Builder()
.baseUrl(mBaseUrl)
.client(poOkHttpClient)
.addConverterFactory(LoganSquareConverterFactory.create())
.build();
return loRetrofit.create(GitHubService.class);
}
示例5: provideGithubService
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
@Override
public GitHubService provideGithubService(@NonNull final OkHttpClient poOkHttpClient) {
final Retrofit loRetrofit = new Retrofit.Builder()
.baseUrl(mMockWebServer.url("/").toString())
.client(poOkHttpClient)
.addConverterFactory(LoganSquareConverterFactory.create())
.build();
return loRetrofit.create(GitHubService.class);
}
示例6: createRetrofit
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
private void createRetrofit() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
retrofit = new Retrofit.Builder()
.baseUrl(HOST_NAME)
.client(okHttpClient)
.addConverterFactory(LoganSquareConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
}
示例7: createConverterFactory
import com.github.aurae.retrofit2.LoganSquareConverterFactory; //导入依赖的package包/类
private Converter.Factory createConverterFactory() {
return LoganSquareConverterFactory.create();
}