本文整理汇总了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();
}
示例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();
}
示例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);
}
});
}