當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestManager類代碼示例

本文整理匯總了Java中com.socks.jiandan.net.RequestManager的典型用法代碼示例。如果您正苦於以下問題:Java RequestManager類的具體用法?Java RequestManager怎麽用?Java RequestManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RequestManager類屬於com.socks.jiandan.net包,在下文中一共展示了RequestManager類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadData

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void loadData() {

        RequestManager.addRequest(new Request4Picture(Picture.getRequestUrl(mType, page),
                new Response.Listener<ArrayList<Picture>>
                        () {
                    @Override
                    public void onResponse(ArrayList<Picture> response) {
                        getCommentCounts(response);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
                mLoadFinisCallBack.loadFinish(null);
            }
        }), mActivity);
    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:18,代碼來源:PictureAdapter.java

示例2: onDestroy

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
@Override
public void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(getActivity()).watch(this);
    RequestManager.cancelAll(this);
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:8,代碼來源:BaseFragment.java

示例3: loadData

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void loadData() {
    RequestManager.addRequest(new Request4Joke(Joke.getRequestUrl(page),
            new Response.Listener<ArrayList<Joke>>
                    () {
                @Override
                public void onResponse(ArrayList<Joke> response) {
                    getCommentCounts(response);
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            mLoadFinisCallBack.loadFinish(null);
        }
    }), mActivity);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:16,代碼來源:JokeAdapter.java

示例4: getCommentCounts

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void getCommentCounts(final ArrayList<Picture> pictures) {

        StringBuilder sb = new StringBuilder();
        for (Picture joke : pictures) {
            sb.append("comment-" + joke.getComment_ID() + ",");
        }

        RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(sb.toString()), new Response
                .Listener<ArrayList<CommentNumber>>() {

            @Override
            public void onResponse(ArrayList<CommentNumber> response) {

                mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
                mLoadFinisCallBack.loadFinish(null);

                for (int i = 0; i < pictures.size(); i++) {
                    pictures.get(i).setComment_counts(response.get(i).getComments() + "");
                }
                if (page == 1) {
                    PictureAdapter.this.pictures.clear();
                    PictureCache.getInstance(mActivity).clearAllCache();
                }
                PictureAdapter.this.pictures.addAll(pictures);
                notifyDataSetChanged();
                //加載完畢後緩存
                PictureCache.getInstance(mActivity).addResultCache(JSONParser.toString
                        (pictures), page);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                ShowToast.Short(ConstantString.LOAD_FAILED);
                mLoadFinisCallBack.loadFinish(null);
                mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
            }
        }
        ), mActivity);
    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:40,代碼來源:PictureAdapter.java

示例5: loadData

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void loadData() {

        RequestManager.addRequest(new Request4Video(Video.getUrlVideos(page),
                new Response.Listener<ArrayList<Video>>() {
                    @Override
                    public void onResponse(ArrayList<Video> response) {
                        getCommentCounts(response);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                mLoadFinisCallBack.loadFinish(null);
            }
        }), mActivity);
    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:16,代碼來源:VideoAdapter.java

示例6: onDestroy

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
@Override
protected void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(this).watch(this);
    RequestManager.cancelAll(this);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:7,代碼來源:BaseActivity.java

示例7: executeRequest

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
public void executeRequest(Request<?> request) {
    RequestManager.addRequest(request, this);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:4,代碼來源:BaseActivity.java

示例8: executeRequest

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
protected void executeRequest(Request request) {
    RequestManager.addRequest(request, this);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:4,代碼來源:BaseFragment.java

示例9: getCommentCounts

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void getCommentCounts(final ArrayList<Joke> jokes) {

        StringBuilder sb = new StringBuilder();
        for (Joke joke : jokes) {
            sb.append("comment-" + joke.getComment_ID() + ",");
        }

        String url = sb.toString();
        if (url.endsWith(",")) {
            url = url.substring(0, url.length() - 1);
        }

        RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(url), new Response
                .Listener<ArrayList<CommentNumber>>() {

            @Override
            public void onResponse(ArrayList<CommentNumber> response) {

                for (int i = 0; i < jokes.size(); i++) {
                    jokes.get(i).setComment_counts(response.get(i).getComments() + "");
                }

                if (page == 1) {
                    mJokes.clear();
                    //首次正常加載之後,清空之前的緩存
                    JokeCache.getInstance(mActivity).clearAllCache();
                }

                mJokes.addAll(jokes);
                notifyDataSetChanged();

                //加載完畢後緩存
                JokeCache.getInstance(mActivity).addResultCache(JSONParser.toString(jokes),
                        page);
                mLoadFinisCallBack.loadFinish(null);
                mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);

            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
                mLoadFinisCallBack.loadFinish(null);
            }
        }
        ), mActivity);

    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:49,代碼來源:JokeAdapter.java

示例10: loadDataByNetworkType

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void loadDataByNetworkType() {

        if (NetWorkUtil.isNetWorkConnected(mActivity)) {
            RequestManager.addRequest(new Request4FreshNews(FreshNews.getUrlFreshNews(page),
                    new Response.Listener<ArrayList<FreshNews>>() {
                        @Override
                        public void onResponse(ArrayList<FreshNews> response) {

                            mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
                            mLoadFinisCallBack.loadFinish(null);

                            if (page == 1) {
                                mFreshNews.clear();
                                FreshNewsCache.getInstance(mActivity).clearAllCache();
                            }

                            mFreshNews.addAll(response);
                            notifyDataSetChanged();

                            FreshNewsCache.getInstance(mActivity).addResultCache(JSONParser.toString(response),
                                    page);
                        }
                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
                    mLoadFinisCallBack.loadFinish(null);
                }
            }), mActivity);
        } else {
            mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
            mLoadFinisCallBack.loadFinish(null);

            if (page == 1) {
                mFreshNews.clear();
                ShowToast.Short(ConstantString.LOAD_NO_NETWORK);
            }

            mFreshNews.addAll(FreshNewsCache.getInstance(mActivity).getCacheByPage(page));
            notifyDataSetChanged();
        }

    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:44,代碼來源:FreshNewsAdapter.java

示例11: getCommentCounts

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
private void getCommentCounts(final ArrayList<Video> videos) {

        StringBuilder sb = new StringBuilder();
        for (Video video : videos) {
            sb.append("comment-" + video.getComment_ID() + ",");
        }

        RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(sb.toString()), new Response
                .Listener<ArrayList<CommentNumber>>() {

            @Override
            public void onResponse(ArrayList<CommentNumber> response) {

                mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
                mLoadFinisCallBack.loadFinish(null);

                for (int i = 0; i < videos.size(); i++) {
                    videos.get(i).setComment_count(response.get(i).getComments() + "");
                }

                if (page == 1) {
                    mVideos.clear();
                    VideoCache.getInstance(mActivity).clearAllCache();
                }

                mVideos.addAll(videos);
                notifyDataSetChanged();
                VideoCache.getInstance(mActivity).addResultCache(JSONParser.toString
                        (videos), page);
                //防止加載不到一頁的情況
                if (mVideos.size() < 10) {
                    loadNextPage();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                mLoadFinisCallBack.loadFinish(null);
                mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, null);
            }
        }
        ), mActivity);

    }
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:45,代碼來源:VideoAdapter.java

示例12: loadData

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
public void loadData() {
    RequestManager.addRequest(new Request4CommentList(Commentator.getUrlCommentList(thread_key), new Response
            .Listener<ArrayList<Commentator>>() {
        @Override
        public void onResponse(ArrayList<Commentator> response) {

            if (response.size() == 0) {
                mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_NONE, null);
            } else {
                commentators.clear();

                ArrayList<Commentator> hotCommentator = new ArrayList<>();
                ArrayList<Commentator> normalComment = new ArrayList<>();

                //添加熱門評論
                for (Commentator commentator : response) {
                    if (commentator.getTag().equals(Commentator.TAG_HOT)) {
                        hotCommentator.add(commentator);
                    } else {
                        normalComment.add(commentator);
                    }
                }

                //添加熱門評論標簽
                if (hotCommentator.size() != 0) {
                    Collections.sort(hotCommentator);
                    Commentator hotCommentFlag = new Commentator();
                    hotCommentFlag.setType(Commentator.TYPE_HOT);
                    hotCommentator.add(0, hotCommentFlag);
                    commentators.addAll(hotCommentator);
                }

                //添加最新評論及標簽
                if (normalComment.size() != 0) {
                    Commentator newCommentFlag = new Commentator();
                    newCommentFlag.setType(Commentator.TYPE_NEW);
                    commentators.add(newCommentFlag);
                    Collections.sort(normalComment);
                    commentators.addAll(normalComment);
                }

                notifyDataSetChanged();
                mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
        }
    }, new LoadFinishCallBack() {
        @Override
        public void loadFinish(Object obj) {
            thread_id = (String) obj;
        }
    }), mActivity);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:58,代碼來源:CommentAdapter.java

示例13: executeRequest

import com.socks.jiandan.net.RequestManager; //導入依賴的package包/類
protected void executeRequest(Request<?> request) {
	RequestManager.addRequest(request, this);
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:4,代碼來源:TestClass.java


注:本文中的com.socks.jiandan.net.RequestManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。