本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
// }
// });
}
示例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(), "加载中...");
}
});
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
});
}
示例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();
}
}
示例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);
}
});
}
示例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();
}
示例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;
}
示例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);
}
});
}