购物车 + 顶部吸附

 

GitHub地址:https://github.com/BnerFang/Week_0112

 

第三方的顶部吸附依赖

implementation 'com.gavin.com.library:stickyDecoration:1.4.11'

 MVP层框架就不贴代码了,根据自己封装的实现逻辑就行

自定义加减器 

布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/jian_car"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_centerVertical="true"
        android:src="@drawable/jian" />

    <TextView
        android:id="@+id/edit_shop_car"
        android:layout_width="50dp"
        android:layout_height="30dp"
        android:layout_toRightOf="@id/jian_car"
        android:layout_centerVertical="true"
        android:background="#f9dede"
        android:gravity="center"
        android:text="1"
        android:textSize="14sp" />

    <ImageView
        android:id="@+id/add_car"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/edit_shop_car"
        android:src="@drawable/add" />

</RelativeLayout>

 自定义加减器自定义view

 

public class CustomerView extends RelativeLayout implements View.OnClickListener{

    private TextView editCar;

    public CustomerView(Context context) {
        super(context);
        init(context);
    }

    public CustomerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public CustomerView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private Context context;

    private void init(Context context) {
        this.context = context;
        //获取展示视图
        View view = View.inflate(context, R.layout.add_sub_view, null);
        //获取资源ID
        ImageView addIamge = (ImageView) view.findViewById(R.id.add_car);
        ImageView jianIamge = (ImageView) view.findViewById(R.id.jian_car);
        editCar = (TextView) view.findViewById(R.id.edit_shop_car);
        //加号、减号的点击事件
        addIamge.setOnClickListener(this);
        jianIamge.setOnClickListener(this);
        addView(view);
        //数量的改变监听
        editCar.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                //TODO:改变数量
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }

    private int num;

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.add_car:
                //改变数量,设置数量,改变对象内容,回调,局部刷新
                num++;
                editCar.setText(num + "");
                list.get(position).setNum(num);
                listener.callBack();
                mMyShopAdapter.notifyItemChanged(position);
                break;
            case R.id.jian_car:
                if (num > 1) {
                    num--;
                } else {
                    toast("亲,不能再少了哦!!!");
                }
                editCar.setText(num + "");
                list.get(position).setNum(num);
                listener.callBack();
                mMyShopAdapter.notifyItemChanged(position);
                break;
            default:
                break;
        }
    }

    private void toast(String msg) {
        Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
    }

    //传递的数据
    private List<CartBean.DataBean.ListBean> list = new ArrayList<>();
    private int position;
    private MyShopChilenAdapter mMyShopAdapter;

    public void setData(MyShopChilenAdapter mMyShopAdapter, List<CartBean.DataBean.ListBean> list, int i) {
        this.list = list;
        this.mMyShopAdapter = mMyShopAdapter;
        position = i;
        num = list.get(i).getNum();
        editCar.setText(num + "");
    }


    private CallBackListener listener;

    public void setOnCallBack(CallBackListener listener) {
        this.listener = listener;
    }

    public interface CallBackListener {
        void callBack();
    }
}

 main_activity  布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true">

    <RelativeLayout
        android:id="@+id/layout_top"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorB">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_centerHorizontal="true"
            android:text="购物车"
            android:textColor="@color/colorW"
            android:textSize="24sp" />

        <TextView
            android:id="@+id/main_bj"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="20dp"
            android:gravity="center"
            android:text="编辑"
            android:textColor="@color/colorW" />

    </RelativeLayout>

    <!--中间的显示-->
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/layout_buttom"
        android:layout_below="@+id/layout_top" />

    <!--下面的全选-->
    <RelativeLayout
        android:id="@+id/layout_buttom"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="#ffffff"
        android:paddingLeft="10dp">

        <RelativeLayout
            android:id="@+id/layout_all"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true">

            <CheckBox
                android:id="@+id/iv_cricle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true" />

            <TextView
                android:id="@+id/txt_all"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="5dp"
                android:layout_toRightOf="@+id/iv_cricle"
                android:text="全选/全不选"
                android:textSize="12sp" />
        </RelativeLayout>

        <TextView
            android:id="@+id/all_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:layout_toLeftOf="@+id/sum_price"
            android:layout_toRightOf="@+id/layout_all"
            android:text="合计:0.00"
            android:textColor="@color/colorR"
            android:textSize="16sp" />

        <RelativeLayout
            android:id="@+id/sum_price"
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:background="@color/colorR">

            <TextView
                android:id="@+id/sum_price_txt"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="去结算(0)"
                android:textColor="@color/colorW" />
        </RelativeLayout>
    </RelativeLayout>

</RelativeLayout>

 商家布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <CheckBox
            android:id="@+id/check_shop"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp" />

        <TextView
            android:id="@+id/tv_shop"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/car_circle"
            android:layout_marginLeft="10dp" />
    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_shop"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/seller_name" />
</LinearLayout>

商家适配器

 

public class MyShopAdapter extends RecyclerView.Adapter<MyShopAdapter.MyViewHolder> {

    private List<CartBean.DataBean> mList = new ArrayList<>();
    private Context mContext;

    public MyShopAdapter(Context context) {
        this.mContext = context;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        //适配器的布局--复选框、商家名、RecyclerView(展示商家下的商品)
        View view = View.inflate(mContext, R.layout.shop_seller_car_adapter, null);
        MyViewHolder myViewHoler = new MyViewHolder(view);
        return myViewHoler;
    }

    @Override
    public void onBindViewHolder(@NonNull final MyViewHolder myViewHolder, final int i) {
        //设置商家的名字
        myViewHolder.mSellerName.setText(mList.get(i).getSellerName());
        //展示商品的RecyclerView的适配器
        final MyShopChilenAdapter myShopChilenAdapter = new MyShopChilenAdapter(mContext, mList.get(i).getList());
        //展示商品的RecyclerView的布局格式
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
        myViewHolder.mRecyclerView.setLayoutManager(linearLayoutManager);
        myViewHolder.mRecyclerView.setAdapter(myShopChilenAdapter);
        myViewHolder.mCheck.setChecked(mList.get(i).isChecked());

        //回调商品的接口
        //商品全部选中,商家选中
        myShopChilenAdapter.setListener(new MyShopChilenAdapter.ShopCallBackListener() {
            @Override
            public void callBack() {
               // (运行二,运行一在商品的adapter的商品状态监听)
                //从商品适配里回调回来,回给activity,activity计算价格和数量
                if(mShopCallBackListener != null) {
                    mShopCallBackListener.callBack(mList);
                }
                //*****1.商品集合
                List<CartBean.DataBean.ListBean> listBeans = mList.get(i).getList();
                //*****2.创建一个临时的标志位,用来记录现在点击的状态
                boolean isAllChecked = true;
                //*****3.遍历所有的商品
                for (CartBean.DataBean.ListBean bean : listBeans) {
                    if (!bean.isChecked()) {
                        //只要有一个商品未选中,标志位设置成false,并且跳出循环
                        isAllChecked = false;
                        break;
                    }
                }

                //*****4.刷新商家的状态
                myViewHolder.mCheck.setChecked(isAllChecked);
                //商品的选中状态
                mList.get(i).setChecked(isAllChecked);
            }
        });
        //商家选中,商家下的商品全部选中

        //监听checkBox的点击事件
        //目的是改变旗下所有商品的选中状态
        myViewHolder.mCheck.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //首先改变自己的标志位
                mList.get(i).setChecked(myViewHolder.mCheck.isChecked());
                //调用产品adapter的方法,用来全选和反选
                myShopChilenAdapter.selectOrRemoveAll(myViewHolder.mCheck.isChecked());
            }
        });
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public void setList(List<CartBean.DataBean> list) {
        this.mList = list;
        notifyDataSetChanged();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        RecyclerView mRecyclerView;
        TextView mSellerName;
        CheckBox mCheck;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            mSellerName = (TextView) itemView.findViewById(R.id.tv_shop);
            mCheck = itemView.findViewById(R.id.check_shop);
            mRecyclerView = (RecyclerView) itemView.findViewById(R.id.recycler_shop);
        }
    }

    /**
     * 定义接口,在Activity
     */
    private ShopCallBackListener mShopCallBackListener;

    public void setListener(ShopCallBackListener listener) {
        this.mShopCallBackListener = listener;
    }

    public interface ShopCallBackListener {
        void callBack(List<CartBean.DataBean> list);
    }
}

 

商品布局

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorW">


    <CheckBox
        android:id="@+id/check_product"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="40dp" />

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/iv_product"
        android:layout_width="100dp"
        android:layout_height="80dp"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="10dp"
        android:layout_toRightOf="@+id/check_product"
        android:layout_margin="10dp"/>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/iv_product">

        <TextView
            android:id="@+id/tv_product_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="20dp"
            android:ellipsize="end"
            android:lines="2"
            android:textColor="#666666"
            android:textSize="14sp" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_alignParentBottom="true">

            <TextView
                android:id="@+id/tv_product_price"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:textColor="@color/colorR"
                android:textSize="12sp" />

            <com.bawei.week_0112.customer.CustomerView
                android:id="@+id/custom_product_counter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp" />
        </RelativeLayout>

    </RelativeLayout>

</RelativeLayout>

 商品适配器

public class MyShopChilenAdapter extends RecyclerView.Adapter<MyShopChilenAdapter.MyViewHolder> {

    private Context mContext;
    private List<CartBean.DataBean.ListBean> mList = new ArrayList<>();

    /**
     * 商品的有参构造
     *
     * @param context
     * @param list
     */
    public MyShopChilenAdapter(Context context, List<CartBean.DataBean.ListBean> list) {
        this.mContext = context;
        this.mList = list;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        //              商品的展示视图:复选框、标题、价格、自定义View(加减号、数量)
        View view = View.inflate(mContext, R.layout.shop_car_adapter, null);
        MyViewHolder myViewHolder = new MyViewHolder(view);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, final int i) {
        //商品的图片
        String url = mList.get(i).getImages().split("\\|")[0].replace("https", "http");
        Uri uri = Uri.parse(url);
        myViewHolder.mImage.setImageURI(uri);
        //商品的标题
        myViewHolder.mTitle.setText(mList.get(i).getTitle());
        //商品的价钱
        myViewHolder.mPrice.setText("¥"+mList.get(i).getPrice() + "");
        //商品的复选框
        //根据我记录的状态,改变勾选
        myViewHolder.mCheckBox.setChecked(mList.get(i).isChecked());
        /**
         * ***************商品的复选框状态监听****************
         *
         */
        //商品的跟商家的有所不同,商品添加了选中改变的监听
        myViewHolder.mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                //****1.优先改变自己的状态 (运行一)
                mList.get(i).setChecked(isChecked);
                //回调,目的是告诉activity,有人选中状态被改变
                if (mShopCallBackListener != null) {
                    mShopCallBackListener.callBack();
                }
            }
        });

        //------------------------------------------------------------------
        //设置自定义View里的Edit
        myViewHolder.mCustomShopCarPrice.setData(this, mList, i);
        myViewHolder.mCustomShopCarPrice.setOnCallBack(new CustomerView.CallBackListener() {
            @Override
            public void callBack() {
                if (mShopCallBackListener != null) {
                    mShopCallBackListener.callBack();
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        CustomerView mCustomShopCarPrice;
        TextView mTitle, mPrice;
        SimpleDraweeView mImage;
        CheckBox mCheckBox;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            mImage = (SimpleDraweeView) itemView.findViewById(R.id.iv_product);
            mTitle = (TextView) itemView.findViewById(R.id.tv_product_title);
            mPrice = (TextView) itemView.findViewById(R.id.tv_product_price);
            mCheckBox = (CheckBox) itemView.findViewById(R.id.check_product);
            mCustomShopCarPrice = (CustomerView) itemView.findViewById(R.id.custom_product_counter);
        }
    }

    /**
     * ****************商品里定义个方法:**************************
     * *****************商家的所有商品状态改变**********************
     * 在我们子商品的adapter中,修改子商品的全选和反选
     *
     * @param isSelectAll
     */
    public void selectOrRemoveAll(boolean isSelectAll) {
        //循环商品
        for (CartBean.DataBean.ListBean listBean : mList) {
            listBean.setChecked(isSelectAll);
        }
        //刷新
        notifyDataSetChanged();
    }

    private ShopCallBackListener mShopCallBackListener;

    public void setListener(ShopCallBackListener listener) {
        this.mShopCallBackListener = listener;
    }

    public interface ShopCallBackListener {
        void callBack();
    }
}

 

MainActivity

public class CartFragment extends Fragment implements MyView {

    @BindView(R.id.recyclerview)
    RecyclerView mRecyclerview;
    @BindView(R.id.iv_cricle)
    CheckBox mIvCricle;
    @BindView(R.id.txt_all)
    TextView mTxtAll;
    @BindView(R.id.all_price)
    TextView mAllPrice;
    @BindView(R.id.sum_price_txt)
    TextView mSumPriceTxt;
    @BindView(R.id.layout_top)
    RelativeLayout mLayoutTop;
    @BindView(R.id.layout_all)
    RelativeLayout mLayoutAll;
    @BindView(R.id.sum_price)
    RelativeLayout mSumPrice;
    @BindView(R.id.layout_buttom)
    RelativeLayout mLayoutButtom;
    @BindView(R.id.main_bj)
    TextView mMainBj;
    private Unbinder unbinder;
    private MyPresenter mMyPresenter;
    private MyShopAdapter mMyShopAdapter;
    private List<CartBean.DataBean> mBeanData;
    private View view;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_cart, container, false);
        unbinder = ButterKnife.bind(this, view);
        mMyPresenter = new MyPresenter(this);
        mMyPresenter.onGetDatas(Apis.CART_GET_URL, CartBean.class);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
    }

    private void initView() {
        //RecyclerView的布局格式
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerview.setLayoutManager(linearLayoutManager);
        GroupListener groupListener = new GroupListener() {
            @Override
            public String getGroupName(int position) {
                //获取分组名
                return mBeanData.get(position).getSellerName();
            }
        };
        StickyDecoration decoration = StickyDecoration.Builder
                .init(groupListener)
                //重置span(使用GridLayoutManager时必须调用)
                //.resetSpan(mRecyclerView, (GridLayoutManager) manager)
                .build();

        //设置适配器
        mMyShopAdapter = new MyShopAdapter(getContext());
        mRecyclerview.setAdapter(mMyShopAdapter);
        mRecyclerview.addItemDecoration(decoration);

        /**
         * 选中全部商家,全选/全不选按钮选中
         * 根据选中的商品数量和所有的商品数量比较判断
         */
        //*****1.回调商家适配器里的接口
        mMyShopAdapter.setListener(new MyShopAdapter.ShopCallBackListener() {
            @Override
            public void callBack(List<CartBean.DataBean> list) {
                //在这里重新遍历已经改状态后的数据,
                // 这里不能break跳出,因为还需要计算后面点击商品的价格和数目,所以必须跑完整个循环
                double totalPrice = 0;
                //勾选商品的数量,不是该商品购买的数量
                int num = 0;
                //所有商品总数,和上面的数量做比对,如果两者相等,则说明全选
                int totalNum = 0;
                for (int a = 0; a < list.size(); a++) {
                    //获取商家里商品
                    List<CartBean.DataBean.ListBean> listAll = list.get(a).getList();
                    //*****2.循环商品集合
                    for (int i = 0; i < listAll.size(); i++) {
                        //***3.得到所有商品的总数
                        totalNum = totalNum + listAll.get(i).getNum();
                        //****4.如果有商品选中----取选中的状态
                        if (listAll.get(i).isChecked()) {
                            //选中的商品价格
                            totalPrice = totalPrice + (listAll.get(i).getPrice() * listAll.get(i).getNum());
                            //选中商品的数量
                            num = num + listAll.get(i).getNum();
                        }
                    }
                }
                //****5.如果选中商品的数量<商品的总数量
                if (num < totalNum) {
                    //不是全部选中
                    mIvCricle.setChecked(false);
                } else {
                    //是全部选中
                    mIvCricle.setChecked(true);
                }
                //*****6.将值设置
                mAllPrice.setText("合计:" + totalPrice);
                mSumPriceTxt.setText("去结算(" + num + ")");
            }
        });
    }

    @Override
    public void onMySuccess(Object data) {
        if (data instanceof CartBean) {
            CartBean bean = (CartBean) data;
            if (bean.getCode().equals("0")) {
                mBeanData = bean.getData();
                if (mBeanData != null) {
                    mBeanData.remove(0);
                    mMyShopAdapter.setList(mBeanData);
                    mMyShopAdapter.notifyDataSetChanged();
                }
            }
        }
    }

    @Override
    public void onMyFailed(String error) {
        Toast.makeText(getActivity(), error, Toast.LENGTH_SHORT).show();
    }

    @OnClick({R.id.iv_cricle, R.id.main_bj})
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
            case R.id.iv_cricle:
                checkSeller(mIvCricle.isChecked());
                //刷新商家适配器
                mMyShopAdapter.notifyDataSetChanged();
                break;
            case R.id.main_bj:
                startActivity(new Intent(getActivity(), CustomerActivity.class));
                break;
        }
    }

    /**
     * 全选/全不选复选框选中
     * 1.所有商家的复选框选中
     * 2.所有的商品复选框选中
     * 修改选中状态,获取价格和数量
     */
    private void checkSeller(boolean bool) {
        double totalPrice = 0;
        int num = 0;
        for (int a = 0; a < mBeanData.size(); a++) {
            //****1.遍历商家,改变状态---设置商家状态为全选中
            CartBean.DataBean dataBean = mBeanData.get(a);
            dataBean.setChecked(bool);
            //得到所有的商品
            List<CartBean.DataBean.ListBean> listAll = mBeanData.get(a).getList();
            for (int i = 0; i < listAll.size(); i++) {
                //****2.遍历商品,改变状态---设置商家的商品全部选中
                listAll.get(i).setChecked(bool);
                //计算总价
                totalPrice = totalPrice + (listAll.get(i).getPrice() * listAll.get(i).getNum());
                //计算总数量
                num = num + listAll.get(i).getNum();
            }
        }

        if (bool) {
            mAllPrice.setText("合计:" + totalPrice);
            mSumPriceTxt.setText("去结算(" + num + ")");
        } else {
            mAllPrice.setText("合计:0.00");
            mSumPriceTxt.setText("去结算(0)");
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
        mMyPresenter.onDetached();
    }
}

 

实体类

 

public class CartBean {

    private String msg;
    private String code;
    private List<DataBean> data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {

        private String sellerName;
        private String sellerid;
        private List<ListBean> list;
        private boolean isChecked = false;

        public boolean isChecked() {
            return isChecked;
        }

        public void setChecked(boolean checked) {
            isChecked = checked;
        }

        public String getSellerName() {
            return sellerName;
        }

        public void setSellerName(String sellerName) {
            this.sellerName = sellerName;
        }

        public String getSellerid() {
            return sellerid;
        }

        public void setSellerid(String sellerid) {
            this.sellerid = sellerid;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public class ListBean {

            private String createtime;
            private String detailUrl;
            private String images;
            private String subhead;
            private String title;
            private double bargainPrice;
            private double price;
            private int num;
            private int pid;
            private int pscid;
            private int selected;
            private int sellerid;
            private boolean isChecked = false;

            public boolean isChecked() {
                return isChecked;
            }

            public void setChecked(boolean checked) {
                isChecked = checked;
            }

            public String getCreatetime() {
                return createtime;
            }

            public void setCreatetime(String createtime) {
                this.createtime = createtime;
            }

            public String getDetailUrl() {
                return detailUrl;
            }

            public void setDetailUrl(String detailUrl) {
                this.detailUrl = detailUrl;
            }

            public String getImages() {
                return images;
            }

            public void setImages(String images) {
                this.images = images;
            }

            public String getSubhead() {
                return subhead;
            }

            public void setSubhead(String subhead) {
                this.subhead = subhead;
            }

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }

            public double getBargainPrice() {
                return bargainPrice;
            }

            public void setBargainPrice(double bargainPrice) {
                this.bargainPrice = bargainPrice;
            }

            public double getPrice() {
                return price;
            }

            public void setPrice(double price) {
                this.price = price;
            }

            public int getNum() {
                return num;
            }

            public void setNum(int num) {
                this.num = num;
            }

            public int getPid() {
                return pid;
            }

            public void setPid(int pid) {
                this.pid = pid;
            }

            public int getPscid() {
                return pscid;
            }

            public void setPscid(int pscid) {
                this.pscid = pscid;
            }

            public int getSelected() {
                return selected;
            }

            public void setSelected(int selected) {
                this.selected = selected;
            }

            public int getSellerid() {
                return sellerid;
            }

            public void setSellerid(int sellerid) {
                this.sellerid = sellerid;
            }
        }
    }
}
  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值