本文整理汇总了Java中com.example.jingbin.cloudreader.http.HttpClient类的典型用法代码示例。如果您正苦于以下问题:Java HttpClient类的具体用法?Java HttpClient怎么用?Java HttpClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpClient类属于com.example.jingbin.cloudreader.http包,在下文中一共展示了HttpClient类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showBanncerPage
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
/**
* 轮播图
*/
public void showBanncerPage(final RequestImpl listener) {
Subscription subscription = HttpClient.Builder.getTingServer().getFrontpage()
.observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io())
.subscribe(new Observer<FrontpageBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
listener.loadFailed();
}
@Override
public void onNext(FrontpageBean frontpageBean) {
frontpageBean.getResult().getFocus();
listener.loadSuccess(frontpageBean);
}
});
listener.addSubscription(subscription);
}
示例2: getGankIoData
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
public void getGankIoData(final RequestImpl listener) {
Subscription subscription = HttpClient.Builder.getGankIOServer().getGankIoData(id, page, per_page)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GankIoDataBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
listener.loadFailed();
}
@Override
public void onNext(GankIoDataBean gankIoDataBean) {
listener.loadSuccess(gankIoDataBean);
}
});
listener.addSubscription(subscription);
}
示例3: showBanncerPage
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
/**
* 轮播图
*/
public void showBanncerPage(final RequestImpl listener) {
Subscription subscription = HttpClient.Builder.getTingServer().getFrontpage()
.observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io())
.subscribe(new Observer<FrontpageBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
listener.loadFailed();
}
@Override
public void onNext(FrontpageBean frontpageBean) {
listener.loadSuccess(frontpageBean);
}
});
listener.addSubscription(subscription);
}
示例4: getHotMovie
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
public MutableLiveData<HotMovieBean> getHotMovie() {
final MutableLiveData<HotMovieBean> data = new MutableLiveData<>();
HttpClient.Builder.getDouBanService().getHotMovie().subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<HotMovieBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
data.setValue(null);
}
@Override
public void onNext(HotMovieBean hotMovieBean) {
if (hotMovieBean != null) {
data.setValue(hotMovieBean);
}
}
});
return data;
}
示例5: getMovieTop250
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
public void getMovieTop250(int start, int count, OnMovieLoadListener loadListener) {
HttpClient.Builder.getDouBanService().getMovieTop250(start, count).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<HotMovieBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
if (loadListener != null) {
loadListener.onFailure();
}
}
@Override
public void onNext(HotMovieBean hotMovieBean) {
if (hotMovieBean != null) {
if (loadListener != null) {
loadListener.onSuccess(hotMovieBean);
}
}
}
});
}
示例6: loadBookDetail
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
private void loadBookDetail() {
DebugUtil.error("------http2");
Subscription get = HttpClient.Builder.getDouBanService().getBookDetail(booksBean.getId())
// Subscription get = HttpUtils.getInstance().getDouBanServer().getBookDetail(booksBean.getId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BookDetailBean>() {
@Override
public void onCompleted() {
showContentView();
}
@Override
public void onError(Throwable e) {
showError();
}
@Override
public void onNext(final BookDetailBean bookDetailBean) {
mBookDetailUrl = bookDetailBean.getAlt();
mBookDetailName = bookDetailBean.getTitle();
bindingContentView.setBookDetailBean(bookDetailBean);
bindingContentView.executePendingBindings();
}
});
addSubscription(get);
}
示例7: loadHotMovie
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
private void loadHotMovie() {
Subscription subscription = HttpClient.Builder.getDouBanService().getHotMovie().subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<HotMovieBean>() {
@Override
public void onCompleted() {
showContentView();
}
@Override
public void onError(Throwable e) {
showContentView();
if (oneAdapter != null && oneAdapter.getItemCount() == 0) {
showError();
}
}
@Override
public void onNext(HotMovieBean hotMovieBean) {
if (hotMovieBean != null) {
aCache.remove(Constants.ONE_HOT_MOVIE);
// 保存12个小时
aCache.put(Constants.ONE_HOT_MOVIE, hotMovieBean, 43200);
setAdapter(hotMovieBean);
// 保存请求的日期
SPUtils.putString("one_data", TimeUtil.getData());
// 刷新结束
mIsLoading = false;
}
//构造器中,第一个参数表示列数或者行数,第二个参数表示滑动方向,瀑布流
// bindingContentView.listOne.setLayoutManager(new StaggeredGridLayoutManager(4,StaggeredGridLayoutManager.VERTICAL));
// GridView
// bindingContentView.listOne.setLayoutManager(new GridLayoutManager(getActivity(), 2));
}
});
addSubscription(subscription);
}
示例8: loadMovieDetail
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
private void loadMovieDetail() {
Subscription get = HttpClient.Builder.getDouBanService().getMovieDetail(subjectsBean.getId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<MovieDetailBean>() {
@Override
public void onCompleted() {
showContentView();
}
@Override
public void onError(Throwable e) {
showError();
}
@Override
public void onNext(final MovieDetailBean movieDetailBean) {
// 上映日期
bindingHeaderView.tvOneDay.setText(String.format("上映日期:%s", movieDetailBean.getYear()));
// 制片国家
bindingHeaderView.tvOneCity.setText(String.format("制片国家/地区:%s", StringFormatUtil.formatGenres(movieDetailBean.getCountries())));
bindingHeaderView.setMovieDetailBean(movieDetailBean);
bindingContentView.setBean(movieDetailBean);
bindingContentView.executePendingBindings();
mMoreUrl = movieDetailBean.getAlt();
mMovieName = movieDetailBean.getTitle();
transformData(movieDetailBean);
}
});
addSubscription(get);
}
示例9: loadMovieDetail
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
private void loadMovieDetail() {
// 初始化...
// binding.include.tvOneCity.setText("制片国家/地区:");
// binding.include.tvOneDay.setText("上映日期:");
// binding.tvOneTitle.setText("");
Subscription get = HttpClient.Builder.getDouBanService().getMovieDetail(subjectsBean.getId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<MovieDetailBean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(final MovieDetailBean movieDetailBean) {
// 上映日期
binding.include.tvOneDay.setText("上映日期:" + movieDetailBean.getYear());
// 制片国家
binding.include.tvOneCity.setText("制片国家/地区:" + StringFormatUtil.formatGenres(movieDetailBean.getCountries()));
binding.include.setMovieDetailBean(movieDetailBean);
binding.setMovieDetailBean(movieDetailBean);
mMoreUrl = movieDetailBean.getAlt();
mMovieName = movieDetailBean.getTitle();
transformData(movieDetailBean);
}
});
}
示例10: loadDouBanTop250
import com.example.jingbin.cloudreader.http.HttpClient; //导入依赖的package包/类
private void loadDouBanTop250() {
Subscription get = HttpClient.Builder.getDouBanService().getMovieTop250(mStart, mCount)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<HotMovieBean>() {
@Override
public void onCompleted() {
showContentView();
}
@Override
public void onError(Throwable e) {
bindingView.xrvTop.refreshComplete();
if (mDouBanTopAdapter.getItemCount() == 0) {
showError();
}
}
@Override
public void onNext(HotMovieBean hotMovieBean) {
if (mStart == 0) {
if (hotMovieBean != null && hotMovieBean.getSubjects() != null && hotMovieBean.getSubjects().size() > 0) {
mDouBanTopAdapter.clear();
mDouBanTopAdapter.addAll(hotMovieBean.getSubjects());
//构造器中,第一个参数表示列数或者行数,第二个参数表示滑动方向,瀑布流
bindingView.xrvTop.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
bindingView.xrvTop.setAdapter(mDouBanTopAdapter);
bindingView.xrvTop.setPullRefreshEnabled(false);
bindingView.xrvTop.clearHeader();
bindingView.xrvTop.setLoadingMoreEnabled(true);
mDouBanTopAdapter.notifyDataSetChanged();
} else {
bindingView.xrvTop.setVisibility(View.GONE);
}
} else {
if (hotMovieBean != null && hotMovieBean.getSubjects() != null && hotMovieBean.getSubjects().size() > 0) {
bindingView.xrvTop.refreshComplete();
mDouBanTopAdapter.addAll(hotMovieBean.getSubjects());
mDouBanTopAdapter.notifyDataSetChanged();
} else {
bindingView.xrvTop.noMoreLoading();
}
}
}
});
addSubscription(get);
}