分类代码

左边点击。

 leftAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                String id = result.get(position).getId();

                rlvFLPresenter.RequestData(id);
            }
        });

右边第一层数据

 @Override
    public void RData(final String mCartString) {
        //解析数据
        SBean rightBean = new Gson().fromJson(mCartString, SBean.class);
        List<SBean.ResultBean> result = rightBean.getResult();
        Toast.makeText(getActivity(), rightBean.getMessage(), Toast.LENGTH_SHORT);
        //布局管理器
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
        RecyRight.setLayoutManager(linearLayoutManager);
        //设置适配器
        RRftAdapter rRftAdapter = new RRftAdapter(R.layout.right_sb, result);
        RecyRight.setAdapter(rRftAdapter);

    }

右边p层传的id

  @Override
    public void RequestData(String id) {
       //调用model
        ficaModel.FicaCcess( id,new Fication.IModel.OnCallBackLisenter() {
            @Override
            public void onCallBack(String mCartString) {
                LView.RData(mCartString);
            }
        });
        右边第二层的model
        


 public void FicaCcess(String id,final Fication.IModel.OnCallBackLisenter onCallBackLisenter) {
        String s=Cantent.FICATON+"?firstCategoryId="+id;
        OkGo.<String>get(s).execute(new StringCallback() {
            @Override
            public void onSuccess(Response<String> response) {
                String string = response.body().toString();
                onCallBackLisenter.onCallBack(string);
            }
        });

右边的接口

 public static final String FICATWON = "http://172.17.8.100/small/commodity/v1/findCommodityByCategory";
    public static final String FICATON = "http://172.17.8.100/small/commodity/v1/findSecondCategory";//?categoryId=1001004002&page=1&count=5

右边第一层的接口拼接

@Override
    protected void convert(BaseViewHolder helper, SBean.ResultBean item) {
        helper.setText(R.id.RightName2, item.getName());
        bt = helper.getView(R.id.bt);
        //布局管理器
        //解析数据
        /* new Gson().fromJson(, RightBean.class);*/
        String id2 = item.getId();
        String can2 = Cantent.FICATWON + "?categoryId=" + id2 + "&page=1&count=5";
        //
        OkGo.<String>get(can2).execute(new StringCallback() {
            @Override
            public void onSuccess(Response<String> response) {
                String string = response.body().toString();

                Gson gson = new Gson();
                RightBean rightBean = gson.fromJson(string, RightBean.class);

                List<RightBean.ResultBean> result = rightBean.getResult();
                GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false);
                bt.setLayoutManager(gridLayoutManager);
                //设置适配器
                R2ftAdapter rRftAdapter = new R2ftAdapter(R.layout.right_item, result);
                bt.setAdapter(rRftAdapter);
            }
        });

猜你喜欢

转载自blog.csdn.net/qq_42805722/article/details/88092000