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


Java AgeraCallAdapterFactory类代码示例

本文整理汇总了Java中me.drakeet.retrofit2.adapter.agera.AgeraCallAdapterFactory的典型用法代码示例。如果您正苦于以下问题:Java AgeraCallAdapterFactory类的具体用法?Java AgeraCallAdapterFactory怎么用?Java AgeraCallAdapterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AgeraCallAdapterFactory类属于me.drakeet.retrofit2.adapter.agera包,在下文中一共展示了AgeraCallAdapterFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNetEngine

import me.drakeet.retrofit2.adapter.agera.AgeraCallAdapterFactory; //导入依赖的package包/类
public Retrofit getNetEngine(){
    return new Retrofit.Builder()
            .baseUrl("http://gank.io/api/data/福利/10/")
            .client(new OkHttpClient())
            .addCallAdapterFactory(AgeraCallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .build();
}
 
开发者ID:zjutkz,项目名称:AgeraBeauty,代码行数:9,代码来源:BeautyService.java

示例2: RetrofitHelper

import me.drakeet.retrofit2.adapter.agera.AgeraCallAdapterFactory; //导入依赖的package包/类
/**
 * initializes the Retrofit to work with {@link AgeraCallAdapterFactory}
 */
public RetrofitHelper() {
    retrofit = new Retrofit.Builder()
            .baseUrl(API_BASE_URL)
            .client(new OkHttpClient())
            .addCallAdapterFactory(AgeraCallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .build();
}
 
开发者ID:BlackGoblin,项目名称:AgeraRetrofit,代码行数:12,代码来源:RetrofitHelper.java

示例3: onCreate

import me.drakeet.retrofit2.adapter.agera.AgeraCallAdapterFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    textView = (TextView) findViewById(R.id.text);

    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl("http://gank.io/api/data/Android/10/")
        .client(new OkHttpClient())
        .addCallAdapterFactory(AgeraCallAdapterFactory.create())
        .addConverterFactory(GsonConverterFactory.create())
        .build();
    final Service service = retrofit.create(Service.class);

    repository1 = Ageras.goToNetworkExecutorWithInitialValue(INITIAL_VALUE)
        .attemptGetFrom(service.android())
        .orSkip()
        .thenTransform(gankToTitleArray)
        .compile();

    repository2 = Ageras.goToNetworkExecutorWithInitialValue(INITIAL_VALUE)
        .attemptGetFrom(service.android(2))
        .orSkip()
        .attemptTransform(response -> {
            Result<Gank> result;
            if (response.isSuccessful()) {
                result = Result.success(response.body());
            } else {
                result = Result.failure(new HttpException(response));
            }
            return result;
        })
        .orEnd(input -> new String[] { "..." })
        .thenTransform(gankToTitleArray)
        .compile();

    repository1.addUpdatable(this);
    repository2.addUpdatable(new Updatable() {
        @Override public void update() {
            for (String s : repository2.get()) {
                textView.append("* " + s + "\n");
            }
            repository2.removeUpdatable(this);
        }
    });
}
 
开发者ID:drakeet,项目名称:retrofit-agera-call-adapter,代码行数:47,代码来源:MainActivity.java


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