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


Java HttpClient类代码示例

本文整理汇总了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);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:27,代码来源:EverydayModel.java

示例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);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:23,代码来源:GankOtherModel.java

示例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);
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:24,代码来源:EverydayModel.java

示例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;
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:23,代码来源:OneRepository.java

示例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);
                }
            }
        }
    });
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:25,代码来源:OneRepository.java

示例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);
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:29,代码来源:BookDetailActivity.java

示例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);
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:38,代码来源:OneFragment.java

示例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);

}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:35,代码来源:OneMovieDetailActivity.java

示例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);
                    }
                });

    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:37,代码来源:MovieDetailActivity.java

示例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);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:50,代码来源:DoubanTopActivity.java


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