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


Java GankIoDataBean類代碼示例

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


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

示例1: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 設置adapter
 */
private void setAdapter(GankIoDataBean mCustomBean) {
    if (mHeaderView == null) {
        mHeaderView = View.inflate(getContext(), R.layout.header_item_gank_custom, null);
        bindingView.xrvCustom.addHeaderView(mHeaderView);
    }
    initHeader(mHeaderView);

    boolean isAll = SPUtils.getString("gank_cala", "全部").equals("全部");
    mAndroidAdapter.clear();
    mAndroidAdapter.setAllType(isAll);
    mAndroidAdapter.addAll(mCustomBean.getResults());
    bindingView.xrvCustom.setLayoutManager(new LinearLayoutManager(getActivity()));
    bindingView.xrvCustom.setAdapter(mAndroidAdapter);
    mAndroidAdapter.notifyDataSetChanged();

    mIsFirst = false;
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:21,代碼來源:CustomFragment.java

示例2: getGankIoData

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的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: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
private void setAdapter(GankIoDataBean gankIoDataBean) {
    mWelfareAdapter.addAll(gankIoDataBean.getResults());
    mWelfareAdapter.notifyDataSetChanged();

    mWelfareAdapter.setOnItemClickListener((resultsBean, position) -> {
        Bundle bundle = new Bundle();
        bundle.putInt("selet", 2);// 2,大圖顯示當前頁數,1,頭像,不顯示頁數
        bundle.putInt("code", position);//第幾張
        bundle.putStringArrayList("imageuri", imgList);
        Intent intent = new Intent(getContext(), ViewBigImageActivity.class);
        intent.putExtras(bundle);
        getContext().startActivity(intent);
    });

    // 顯示成功後就不是第一次了,不再刷新
    isFirst = false;
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:18,代碼來源:WelfareFragment.java

示例4: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 設置adapter
 */
private void setAdapter(GankIoDataBean mCustomBean) {
    if (mHeaderView == null) {
        mHeaderView = View.inflate(getContext(), R.layout.header_item_gank_custom, null);
        bindingView.xrvCustom.addHeaderView(mHeaderView);
    }
    initHeader(mHeaderView);

    boolean isAll = SPUtils.getString(GANK_CALA, "全部").equals("全部");
    mAndroidAdapter.clear();
    mAndroidAdapter.setAllType(isAll);
    mAndroidAdapter.addAll(mCustomBean.getResults());
    bindingView.xrvCustom.setLayoutManager(new LinearLayoutManager(getActivity()));
    bindingView.xrvCustom.setAdapter(mAndroidAdapter);
    mAndroidAdapter.notifyDataSetChanged();

    mIsFirst = false;
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:21,代碼來源:CustomFragment.java

示例5: onBindViewHolder

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
@Override
        public void onBindViewHolder(final GankIoDataBean.ResultBean resultsBean, final int position) {
            /**
             * 注意:DensityUtil.setViewMargin(itemView,true,5,3,5,0);
             * 如果這樣使用,則每個item的左右邊距是不一樣的,
             * 這樣item不能複用,所以下拉刷新成功後顯示會閃一下
             * 換成每個item設置上下左右邊距是一樣的話,係統就會複用,就消除了圖片不能複用 閃跳的情況
             */
            if (position % 2 == 0) {
                DensityUtil.setViewMargin(itemView, false, 12, 6, 12, 0);
            } else {
                DensityUtil.setViewMargin(itemView, false, 6, 12, 12, 0);
            }
            binding.setBean(resultsBean);
            // 仿抖動
            binding.executePendingBindings();
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (listener != null) {
                        listener.onClick(resultsBean, position);
                    }
                }
            });

//            binding.ivWelfare.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    ArrayList<String> imageuri = new ArrayList<String>();
//                    imageuri.add(resultsBean.getUrl());
//                    Bundle bundle = new Bundle();
//                    bundle.putInt("selet", 1);// 2,大圖顯示當前頁數,1,頭像,不顯示頁數
//                    bundle.putInt("code", 0);//第幾張
//                    bundle.putStringArrayList("imageuri", imageuri);
//                    Intent intent = new Intent(v.getContext(), ViewBigImageActivity.class);
//                    intent.putExtras(bundle);
//                    v.getContext().startActivity(intent);
//                }
//            });
        }
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:41,代碼來源:WelfareAdapter.java

示例6: onBindViewHolder

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
@Override
        public void onBindViewHolder(final GankIoDataBean.ResultBean object, int position) {

            if (isAll && "福利".equals(object.getType())) {
                binding.ivAllWelfare.setVisibility(View.VISIBLE);
                binding.llWelfareOther.setVisibility(View.GONE);
                ImgLoadUtil.displayEspImage(object.getUrl(), binding.ivAllWelfare, 1);
            } else {
                binding.ivAllWelfare.setVisibility(View.GONE);
                binding.llWelfareOther.setVisibility(View.VISIBLE);
            }

            if (isAll) {
                binding.tvContentType.setVisibility(View.VISIBLE);
                binding.tvContentType.setText(" · " + object.getType());
            } else {
                binding.tvContentType.setVisibility(View.GONE);

            }
            binding.setResultsBean(object);
            binding.executePendingBindings();

            // 顯示gif圖片會很耗內存
            if (object.getImages() != null
                    && object.getImages().size() > 0
                    && !TextUtils.isEmpty(object.getImages().get(0))) {
//                binding.ivAndroidPic.setVisibility(View.GONE);
                binding.ivAndroidPic.setVisibility(View.VISIBLE);
                ImgLoadUtil.displayGif(object.getImages().get(0), binding.ivAndroidPic);
            } else {
                binding.ivAndroidPic.setVisibility(View.GONE);
            }

            binding.llAll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    WebViewActivity.loadUrl(v.getContext(), object.getUrl(), "加載中...");
                }
            });
        }
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:41,代碼來源:AndroidAdapter.java

示例7: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
private void setAdapter(GankIoDataBean gankIoDataBean) {
//        mWelfareAdapter = new WelfareAdapter();
        mWelfareAdapter.addAll(gankIoDataBean.getResults());
        //構造器中,第一個參數表示列數或者行數,第二個參數表示滑動方向,瀑布流
        bindingView.xrvWelfare.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
        bindingView.xrvWelfare.setAdapter(mWelfareAdapter);
        mWelfareAdapter.notifyDataSetChanged();


        mWelfareAdapter.setOnItemClickListener(new OnItemClickListener<GankIoDataBean.ResultBean>() {
            @Override
            public void onClick(GankIoDataBean.ResultBean resultsBean, int position) {
                DebugUtil.error("-----" + imgList.toString());
                DebugUtil.error("----imgList.size():  " + imgList.size());
                Bundle bundle = new Bundle();
                bundle.putInt("selet", 2);// 2,大圖顯示當前頁數,1,頭像,不顯示頁數
                bundle.putInt("code", position);//第幾張
                bundle.putStringArrayList("imageuri", imgList);
                Intent intent = new Intent(getContext(), ViewBigImageActivity.class);
                intent.putExtras(bundle);
                getContext().startActivity(intent);
            }
        });

        // 顯示成功後就不是第一次了,不再刷新
        isFirst = false;
    }
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:28,代碼來源:WelfareFragment.java

示例8: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 設置adapter
 */
private void setAdapter(GankIoDataBean mAndroidBean) {
    mAndroidAdapter.clear();
    mAndroidAdapter.addAll(mAndroidBean.getResults());
    bindingView.xrvAndroid.setLayoutManager(new LinearLayoutManager(getActivity()));
    bindingView.xrvAndroid.setAdapter(mAndroidAdapter);
    mAndroidAdapter.notifyDataSetChanged();
    bindingView.xrvAndroid.refreshComplete();

    mIsFirst = false;
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:14,代碼來源:AndroidFragment.java

示例9: handlerFailed

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 處理請求失敗後的情況
 */
private void handlerFailed() {
    GankIoDataBean mAndroidBean = (GankIoDataBean) mACache.getAsObject(Constants.GANK_MEIZI);
    if (mAndroidBean != null
            && mAndroidBean.getResults() != null
            && mAndroidBean.getResults().size() > 0) {
        navigator.showLoadSuccessView();
        navigator.showAdapterView(mAndroidBean);
    } else {
        navigator.showLoadFailedView();
    }
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:15,代碼來源:WelfareViewModel.java

示例10: loadAndroidData

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
public void loadAndroidData() {
    mModel.setData(mType, mPage, HttpUtils.per_page_more);
    mModel.getGankIoData(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            navigator.showLoadSuccessView();
            GankIoDataBean gankIoDataBean = (GankIoDataBean) object;
            if (mPage == 1) {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    navigator.showAdapterView(gankIoDataBean);

                    mACache.remove(Constants.GANK_ANDROID);
                    mACache.put(Constants.GANK_ANDROID, gankIoDataBean);
                } else {
                    handlerFailed();
                }
            } else {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    navigator.refreshAdapter(gankIoDataBean);
                } else {
                    navigator.showListNoMoreLoading();
                }
            }
        }

        @Override
        public void loadFailed() {
            handlerFailed();
            if (mPage > 1) {
                mPage--;
            }
        }

        @Override
        public void addSubscription(Subscription subscription) {
            activity.addSubscription(subscription);
        }
    });
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:40,代碼來源:BigAndroidViewModel.java

示例11: handlerFailed

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 處理請求失敗後的情況
 */
private void handlerFailed() {
    GankIoDataBean mAndroidBean = (GankIoDataBean) mACache.getAsObject(Constants.GANK_ANDROID);
    if (mAndroidBean != null
            && mAndroidBean.getResults() != null
            && mAndroidBean.getResults().size() > 0) {
        navigator.showLoadSuccessView();
        navigator.showAdapterView(mAndroidBean);
    } else {
        navigator.showLoadFailedView();
    }
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:15,代碼來源:BigAndroidViewModel.java

示例12: loadCustomData

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
public void loadCustomData() {
    mModel.setData(mType, mPage, HttpUtils.per_page_more);
    mModel.getGankIoData(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            navigator.showLoadSuccessView();
            GankIoDataBean gankIoDataBean = (GankIoDataBean) object;
            if (mPage == 1) {
                if (gankIoDataBean != null
                        && gankIoDataBean.getResults() != null
                        && gankIoDataBean.getResults().size() > 0) {
                    navigator.showAdapterView(gankIoDataBean);
                }
            } else {
                if (gankIoDataBean != null
                        && gankIoDataBean.getResults() != null
                        && gankIoDataBean.getResults().size() > 0) {
                    navigator.refreshAdapter(gankIoDataBean);
                } else {
                    navigator.showListNoMoreLoading();
                }
            }
        }

        @Override
        public void loadFailed() {
            navigator.showLoadFailedView();
            if (mPage > 1) {
                mPage--;
            }
        }

        @Override
        public void addSubscription(Subscription subscription) {
            activity.addSubscription(subscription);
        }
    });
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:39,代碼來源:CustomViewModel.java

示例13: onBindViewHolder

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
@Override
public void onBindViewHolder(final GankIoDataBean.ResultBean object, int position) {

    if (isAll && "福利".equals(object.getType())) {
        binding.ivAllWelfare.setVisibility(View.VISIBLE);
        binding.llWelfareOther.setVisibility(View.GONE);
        ImgLoadUtil.displayEspImage(object.getUrl(), binding.ivAllWelfare, 1);
    } else {
        binding.ivAllWelfare.setVisibility(View.GONE);
        binding.llWelfareOther.setVisibility(View.VISIBLE);
    }

    if (isAll) {
        binding.tvContentType.setVisibility(View.VISIBLE);
        binding.tvContentType.setText(" · " + object.getType());
    } else {
        binding.tvContentType.setVisibility(View.GONE);

    }

    // 顯示gif圖片會很耗內存
    if (object.getImages() != null
            && object.getImages().size() > 0
            && !TextUtils.isEmpty(object.getImages().get(0))) {
        binding.ivAndroidPic.setVisibility(View.VISIBLE);
        ImgLoadUtil.displayGif(object.getImages().get(0), binding.ivAndroidPic);
    } else {
        binding.ivAndroidPic.setVisibility(View.GONE);
    }

    binding.setResultsBean(object);
    binding.setCommand(AndroidAdapter.this);
    binding.executePendingBindings();
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:35,代碼來源:AndroidAdapter.java

示例14: setAdapter

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
/**
 * 設置adapter
 */
private void setAdapter(GankIoDataBean mAndroidBean) {
    mAndroidAdapter.clear();
    mAndroidAdapter.addAll(mAndroidBean.getResults());
    mAndroidAdapter.notifyDataSetChanged();
    bindingView.xrvAndroid.refreshComplete();

    mIsFirst = false;
}
 
開發者ID:youlookwhat,項目名稱:CloudReader,代碼行數:12,代碼來源:AndroidFragment.java

示例15: loadWelfareData

import com.example.jingbin.cloudreader.bean.GankIoDataBean; //導入依賴的package包/類
private void loadWelfareData() {
    mModel.setData("福利", mPage, HttpUtils.per_page_more);
    mModel.getGankIoData(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            showContentView();
            GankIoDataBean gankIoDataBean = (GankIoDataBean) object;
            if (mPage == 1) {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    imgList.clear();
                    for (int i = 0; i < gankIoDataBean.getResults().size(); i++) {
                        imgList.add(gankIoDataBean.getResults().get(i).getUrl());
                    }

                    setAdapter(gankIoDataBean);
                    aCache.remove(Constants.GANK_MEIZI);
                    aCache.put(Constants.GANK_MEIZI, gankIoDataBean, 30000);

                }
            } else {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    bindingView.xrvWelfare.refreshComplete();
                    mWelfareAdapter.addAll(gankIoDataBean.getResults());
                    mWelfareAdapter.notifyDataSetChanged();

                    for (int i = 0; i < gankIoDataBean.getResults().size(); i++) {
                        imgList.add(gankIoDataBean.getResults().get(i).getUrl());
                    }

                } else {
                    bindingView.xrvWelfare.noMoreLoading();
                }
            }
        }

        @Override
        public void loadFailed() {
            bindingView.xrvWelfare.refreshComplete();
            if (mWelfareAdapter.getItemCount() == 0) {
                showError();
            }
            if (mPage > 1) {
                mPage--;
            }
        }

        @Override
        public void addSubscription(Subscription subscription) {
            WelfareFragment.this.addSubscription(subscription);
        }
    });
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:53,代碼來源:WelfareFragment.java


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