use of com.seven.seven.home.adapter.BannerViewAdapter 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());
}
});
}
use of com.seven.seven.home.adapter.BannerViewAdapter in project seven_develop by seven123456.
the class HomeFragment method initHeadView.
/*
* 初始化headview,并且初始化一个空list的banneradapter,加载数据成功以后再初始化banneradapter并且绑定bannerview
* */
private void initHeadView() {
if (headView == null) {
headView = View.inflate(getContext(), R.layout.recycler_head_view, null);
}
bannerLayout = headView.findViewById(R.id.bl_banner);
bannerViewAdapter = new BannerViewAdapter(R.layout.recycler_item_banner, getContext());
bannerLayout.setAdapter(bannerViewAdapter);
}
Aggregations