use of com.seven.seven.home.model.HomeBannerInfos in project seven_develop by seven123456.
the class HomeFragment method disposeHomeFragmentData.
@Subscribe(threadMode = ThreadMode.MAIN, priority = 0, sticky = true)
public void disposeHomeFragmentData(HomeEvents homeEvents) {
switch(homeEvents.getWhat()) {
case Constans.HOMEDATA:
HomeNewsInfos homeNewsInfos = (HomeNewsInfos) homeEvents.getData();
newsInfosList = homeNewsInfos.getDatas();
if (newsInfosList != null) {
errorLayoutView.hide();
}
if (!isRefresh) {
homeCommonAdapter.setNewData(newsInfosList);
isRefresh = true;
homeCommonAdapter.setEnableLoadMore(true);
} else {
if (newsInfosList != null) {
homeCommonAdapter.addData(newsInfosList);
} else {
homeCommonAdapter.loadMoreEnd(true);
}
}
PAGE_COUNT = homeNewsInfos.getPageCount();
break;
case Constans.HOMEBANNER:
homeBannerInfos = (List<HomeBannerInfos>) homeEvents.getData();
initRecyclerHeadView(homeBannerInfos);
if (homeBannerInfos != null) {
errorLayoutView.hide();
}
break;
case Constans.HOMEERROR:
showErrorToast((String) homeEvents.getData());
errorLayoutView.showErrorView();
break;
case Constans.HOMEDASUCCESS:
errorLayoutView.hide();
break;
}
// }
swipeRefreshLayout.setRefreshing(false);
}
use of com.seven.seven.home.model.HomeBannerInfos in project seven_develop by seven123456.
the class HomeFragment method initRecyclerHeadView.
private void initRecyclerHeadView(List<HomeBannerInfos> homeBannerInfos) {
bannerViewAdapter = new BannerViewAdapter(R.layout.recycler_item_banner, homeBannerInfos, getContext());
bannerLayout.setAdapter(bannerViewAdapter);
bannerViewAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
HomeBannerInfos homeBannerInfos = (HomeBannerInfos) adapter.getItem(position);
HomeToWebViewInfo homeToWebViewInfo = new HomeToWebViewInfo();
Intent intent = new Intent(getContext(), HomeNewsDetailActivity.class);
homeToWebViewInfo.title = homeBannerInfos.getTitle();
homeToWebViewInfo.imgUrl = homeBannerInfos.getImagePath();
homeToWebViewInfo.h5Url = homeBannerInfos.getUrl();
intent.putExtra("newsInfo", homeToWebViewInfo);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) getContext(), view.findViewById(R.id.iv_banner_image), getResources().getString(R.string.transition_news_img));
ActivityCompat.startActivity(getContext(), intent, options.toBundle());
}
});
}
Aggregations