多条目

public class HomeFragment extends Fragment implements IShowView {
private RecyclerView recycle;
private HomeAdapter homeadapter;
// private List list =new ArrayList<>();
private List<Data.ResultBean.RxxpBean.CommodityListBean> rxxplist;
private List<Data.ResultBean.MlssBean.CommodityListBeanXX> mlsslist;
private List<Data.ResultBean.PzshBean.CommodityListBeanX> pzshlist;
// private Data data;
private HomePersenter homePersenter;
private XBanner banner;
ArrayList images;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.home_fragment,container,false);

    recycle = view.findViewById(R.id.recycle);
    banner = view.findViewById(R.id.banner);
    homePersenter = new HomePersenter(this);
    homePersenter.requestShow();
    images = new ArrayList<>();
    images.add("http://172.17.8.100/images/small/banner/cj.png");
    images.add("http://172.17.8.100/images/small/banner/hzp.png");
    images.add("http://172.17.8.100/images/small/banner/lyq.png");
    images.add("http://172.17.8.100/images/small/banner/px.png");
    banner.setData(images,null);
    banner.setmAdapter(new XBanner.XBannerAdapter() {
        @Override
        public void loadBanner(XBanner banner, View view, int position) {
            Glide.with(getActivity()).load(images.get(position)).into((ImageView) view);
        }
    });

    //设置XBanner的页面切换特效,选择一个即可,总的大概就这么多效果啦,欢迎使用
    banner.setPageTransformer(Transformer.Default);//横向移动

    // 设置XBanner页面切换的时间,即动画时长
    banner.setPageChangeDuration(1000);
    return view;
}

@Override
public void success(Data data, Object... args) {

    rxxplist = data.getResult().getRxxp().getCommodityList();
    mlsslist = data.getResult().getMlss().getCommodityList();
    pzshlist = data.getResult().getPzsh().getCommodityList();
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recycle.setLayoutManager(linearLayoutManager);

    homeadapter = new HomeAdapter(getActivity(), data);
    homeadapter.setData(rxxplist,mlsslist,pzshlist);
    homeadapter.notifyDataSetChanged();
    recycle.setAdapter(homeadapter);
}

@Override
public void onResume() {
    super.onResume();
    banner.startAutoPlay();
}

@Override
public void onStop() {
    super.onStop();
    banner.stopAutoPlay();
}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值