當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。