购物车model的使用

package com.baway.test;


import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.ExpandableListView;
import android.widget.TextView;


import com.bwie.mycartutils.bean.ChildBean;
import com.bwie.mycartutils.bean.GroupBean;
import com.bwie.mycartutils.utils.CartUtils;


import java.util.ArrayList;
import java.util.List;


public class MainActivity extends AppCompatActivity {
    private ExpandableListView expandableListView;
    private CheckBox checkBox;
    private TextView sum,jiesuan;
    private List<GroupBean> groupList;
    private List<List<ChildBean>> cList;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //获取控件
        expandableListView = (ExpandableListView) findViewById(R.id.elv);
        checkBox = (CheckBox) findViewById(R.id.allcheck);
        sum = (TextView) findViewById(R.id.sum);
        jiesuan = (TextView) findViewById(R.id.jiesuan);
        //初始化数据
        groupList = new ArrayList<>();
        cList = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            groupList.add(new GroupBean("商家"+i,false));
            List<ChildBean> clist = new ArrayList<>();
            for (int j = 0; j < 4; j++) {
                clist.add(new ChildBean("商品1","20","http://img3.imgtn.bdimg.com/it/u=2337557546,3853217561&fm=27&gp=0.jpg",false,1));
            }
            cList.add(clist);
        }
        CartUtils.setCartData(this,groupList,cList,expandableListView,checkBox,jiesuan,sum);
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值