Search in sources :

Example 1 with BannerViewAdapter

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());
        }
    });
}
Also used : HomeBannerInfos(com.seven.seven.home.model.HomeBannerInfos) HomeToWebViewInfo(com.seven.seven.home.model.HomeToWebViewInfo) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) BannerViewAdapter(com.seven.seven.home.adapter.BannerViewAdapter) MainActivity(com.seven.seven.ui.MainActivity) Activity(android.app.Activity) Intent(android.content.Intent) ErrorLayoutView(com.seven.seven.common.view.ErrorLayoutView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 2 with BannerViewAdapter

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);
}
Also used : BannerViewAdapter(com.seven.seven.home.adapter.BannerViewAdapter)

Aggregations

BannerViewAdapter (com.seven.seven.home.adapter.BannerViewAdapter)2 Activity (android.app.Activity)1 Intent (android.content.Intent)1 ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 ErrorLayoutView (com.seven.seven.common.view.ErrorLayoutView)1 HomeBannerInfos (com.seven.seven.home.model.HomeBannerInfos)1 HomeToWebViewInfo (com.seven.seven.home.model.HomeToWebViewInfo)1 MainActivity (com.seven.seven.ui.MainActivity)1