use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener in project Palm300Heroes by nicolite.
the class TYAreaListFragment method doBusiness.
@Override
protected void doBusiness() {
lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
lRecyclerViewAdapter = new LRecyclerViewAdapter(new TYAreaAdapter(context, dataList));
lRecyclerView.setAdapter(lRecyclerViewAdapter);
lRecyclerView.setLoadMoreEnabled(false);
if (url.equals(Constants.JUMPW_COSPLAY_RUL)) {
View headView = LayoutInflater.from(context).inflate(R.layout.tyarea_cos_headview, rootView, false);
bgaBanner = headView.findViewById(R.id.banner_guide_content);
bgaBanner.setAdapter(new BGABanner.Adapter() {
@Override
public void fillBannerItem(BGABanner banner, View itemView, Object model, int position) {
if (itemView instanceof ImageView) {
Glide.with(context).load((String) model).placeholder(R.drawable.img_loading).error(R.drawable.img_error).skipMemoryCache(true).centerCrop().dontAnimate().into((ImageView) itemView);
}
}
});
bgaBanner.setDelegate(new BGABanner.Delegate() {
@Override
public void onBannerItemClick(BGABanner banner, View itemView, Object model, int position) {
if (itemView instanceof ImageView) {
NewsBanner newsBanner = bannerList.get(position);
Bundle bundle = new Bundle();
bundle.putInt("type", WebViewActivity.TYPE_TY_COS);
bundle.putString("url", newsBanner.getUrl());
bundle.putString("title", newsBanner.getTitle());
startActivity(WebViewActivity.class, bundle);
}
}
});
lRecyclerViewAdapter.addHeaderView(headView);
}
tyAreaPresenter = new TYAreaPresenter(this, this);
lRecyclerView.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
if (url.equals(Constants.JUMPW_COSPLAY_RUL)) {
bannerViewList.clear();
model.clear();
tips.clear();
tyAreaPresenter.showCosBanner();
}
tyAreaPresenter.showTYAreaList(url);
}
});
lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {
@Override
public void reload() {
if (url.equals(Constants.JUMPW_COSPLAY_RUL)) {
bannerViewList.clear();
model.clear();
tips.clear();
tyAreaPresenter.showCosBanner();
}
tyAreaPresenter.showTYAreaList(url);
}
});
if (url.equals(Constants.JUMPW_COSPLAY_RUL) && isFirstVisible && ListUtils.isEmpty(dataList)) {
lRecyclerView.forceToRefresh();
}
}
Aggregations