动画+购物车+加到购物车

布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="view.MainActivity">

   <ImageView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:src="@mipmap/ic_launcher_round"
       android:id="@+id/img"
       android:layout_centerHorizontal="true"
       />

</RelativeLayout>
activity_xiangqing
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.yuekao_demo.view.Xiangqing">

    <ImageView
        android:id="@+id/img"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/title"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/price"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/youhuiprice"
        android:background="#FF00"
        />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/cart"
            android:layout_weight="1"
            android:text="购物车"
            />
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/btn_add"
            android:layout_weight="1"
            android:text="加入购物车"
            />
    </LinearLayout>

</LinearLayout>
activity_shoping
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.yuekao_demo.view.ShopingCart">
    <ExpandableListView android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" android:id="@+id/exlv"/>

    <RelativeLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/rl" android:background="#ffffff">
    <CheckBox android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/checkbox" android:layout_centerVertical="true"/>
    <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/qx" android:layout_centerVertical="true" android:text="全选" android:layout_toRightOf="@id/checkbox"/>

    <LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@id/qx">
    <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/price" android:text="总价:"/>
    <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/num" android:text="0件商品"/>
</LinearLayout>
    <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/jiesuan" android:background="#ff0000" android:text="去结算" android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>
chidren
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <CheckBox
        android:id="@+id/z_che"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginTop="11dp" />


    -

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:layout_toRightOf="@id/z_che"
        android:orientation="vertical">

        <TextView
            android:id="@+id/z_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="三只松鼠大礼包"
            android:textStyle="bold" />


        -

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/z_img"
                android:layout_width="140dp"
                android:layout_height="140dp"
                android:src="@mipmap/ic_launcher" />

            <TextView
                android:id="@+id/z_price"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toEndOf="@+id/z_img"
                android:layout_toRightOf="@+id/z_img"
                android:text="价钱"
                android:textColor="#ff0000" />

            <TextView
                android:id="@+id/z_shuxing"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/z_price"
                android:layout_toEndOf="@+id/z_img"
                android:layout_toRightOf="@+id/z_img"
                android:text="价钱" />


            -

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/z_shuxing"
                android:layout_marginTop="10dp"
                android:layout_toRightOf="@id/z_img"
                android:orientation="horizontal">

                <ImageView
                    android:id="@+id/iv_jian"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/shopcart_minus_red" />

                <TextView
                    android:id="@+id/tv_num"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="1" />

                <ImageView
                    android:id="@+id/iv_add"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_marginLeft="5dp"
                    android:src="@drawable/shopcart_add_red" />

                <ImageView
                    android:id="@+id/del"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="right"
                    android:layout_weight="1"
                    android:src="@drawable/rublish" />

            </LinearLayout>

        </RelativeLayout>

    </LinearLayout>

</RelativeLayout>


group
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <CheckBox
        android:id="@+id/che"
        android:layout_width="25dp"
        android:layout_height="25dp" />

    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_marginLeft="20dp"
        android:src="@drawable/dianpu" />

    <TextView
        android:id="@+id/g_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:text="------------" />
</LinearLayout>

activity_dingdan
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Dingdan">

    <TextView
        android:id="@+id/Allprice"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        />

    <Button
        android:id="@+id/xiadan"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:background="#ff0000"
        android:text="立即下单" />

</RelativeLayout>
activity_my_order订单页面
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.yuekao_demo.view.MyOrder">

</android.support.constraint.ConstraintLayout>

获取网络权限
<activity android:name="view.Xiangqing" />
<activity android:name="view.ShopingCart" />
<activity android:name="view.Dingdan" />
<activity android:name="view.MyOrder"></activity>

View

MainActivity

动画
public class MainActivity extends AppCompatActivity {
    private ImageView img;
    private AnimationSet animationSet;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        img = (ImageView) findViewById(R.id.img);
        initAnimates();//初始化动画
        /**
         * 动画的监听事件
         */
        animationSet.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                /**
                 * 结束监听的事件
                 */
                Intent intent = new Intent(MainActivity.this, Xiangqing.class);
                startActivity(intent);
                finish();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }

    //初始化动画
    private void initAnimates() {
        //创建属性动画对象
        animationSet = new AnimationSet(true);
       
        RotateAnimation rotateAnimation = new RotateAnimation(0, 360,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        rotateAnimation.setDuration(3000);
//        rotateAnimation.setFillAfter(true);
        animationSet.addAnimation(rotateAnimation);
      
        TranslateAnimation translateAnimation =
                new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0f,
                        Animation.RELATIVE_TO_SELF, 0f,
                        Animation.RELATIVE_TO_SELF, 0f,
                        Animation.RELATIVE_TO_SELF, 3f);
        translateAnimation.setDuration(3000);
//        translateAnimation.setFillAfter(true);
        animationSet.addAnimation(translateAnimation);

        //创建一个AnimationSet对象,参数为Boolean型,
        //true表示使用Animationinterpolatorfalse则是使用自己的
        //创建一个AlphaAnimation对象,参数从完全的透明度,到完全的不透明
        AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
        //设置动画执行的时间
        alphaAnimation.setDuration(3000);
//        alphaAnimation.setFillAfter(true);
        animationSet.addAnimation(alphaAnimation);

        
        ScaleAnimation scaleAnimation = new ScaleAnimation(
                2, 1f, 2, 1f,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(3000);
//        scaleAnimation.setFillAfter(true);
        animationSet.addAnimation(scaleAnimation);
        //使动画静止
        animationSet.setFillAfter(true);
        img.startAnimation(animationSet);
    }

}

详情页面的接口
public interface Iview {
    void onSuccess(Bean.DataBean bean);
    void onFiled(Exception e);

}

public interface AddIv {
        void onSucce(InitBean initBean);
        void onFile(Exception e);
}
详情页面
Xiangqing 
public class Xiangqing extends AppCompatActivity implements Iview, AddIv {
    private ImageView img;
    private TextView title1;
    private TextView price1;
    private TextView youhuiprice;
    private Button cart;
    private ShangpingPre shangpingPre;
    private Button btn_add;
    private AddShoppingPre addShoppingPre;
    private int uid=100;
    private int pid=1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xiangqing);
        img =findViewById(R.id.img);
        title1=findViewById(R.id.title);
        price1=findViewById(R.id.price);
        youhuiprice= findViewById(R.id.youhuiprice);
        btn_add=findViewById(R.id.btn_add);
        cart=findViewById(R.id.cart);
        loadData();
        loadData2();

    }
    private void loadData2() {
        addShoppingPre =new AddShoppingPre(this,this);
        addShoppingPre.get(uid,pid);
    }

    //
    private void loadData() {
        shangpingPre =new ShangpingPre(this);
        shangpingPre.get();
    }

    @Override
    public void onSuccess(Bean.DataBean bean) {
        String images = bean.getImages();
        String[] split = images.split("\\|");
        String title = bean.getTitle();
        String bargainPrice =bean.getBargainPrice()+"";
        String price = bean.getPrice()+"";
        //int pid =bean.getPid();
        Glide.with(this).load(split[0]).into(img);
        title1.setText("商品名"+ title);
        price1.setText("原价:"+price);
        youhuiprice.setText("优惠价"+bargainPrice);

    }

    @Override
    public void onFiled(Exception e) {

    }

    @Override
    public void onSucce(final InitBean initBean) {
        btn_add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadData2();
                Toast.makeText(Xiangqing.this,""+initBean.getMsg(),Toast.LENGTH_SHORT).show();

            }
        });
        cart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Xiangqing.this,ShopingCart.class);
                startActivity(intent);
            }
        });
    }

    @Override
    public void onFile(Exception e) {

    }
}

购物车页面
public class ShopingCart extends AppCompatActivity implements Iv{
    private ExpandableListView exlv;
    private CheckBox checkBox;
    private MyElvadapter adapter;
    private List<ElvDataBean.DataBean> grouplist = new ArrayList<>();
    private List<List<ElvDataBean.DataBean.ListBean>> childlist = new ArrayList<>();
    private TextView price;
    private TextView num;
    private Elvpresenter elvp;
    private Button jiesuan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shoping_cart);
        exlv= (ExpandableListView) findViewById(R.id.exlv);
        checkBox= (CheckBox) findViewById(R.id.checkbox);
        price= (TextView) findViewById(R.id.price);
        num= (TextView) findViewById(R.id.num);
        jiesuan=findViewById(R.id.jiesuan);
        EventBus.getDefault().register(this);
        //全选/全不选
        checkBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //设置全选
                adapter.changeAllListCbState(checkBox.isChecked());
            }
        });
        jiesuan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent =new Intent(ShopingCart.this,Dingdan.class);
                intent.putExtra("key",price.getText().toString()+"");
                startActivity(intent);
            }
        });
        loadData();
    }
    private void loadData() {
        elvp = new Elvpresenter(this);
        elvp.get();
    }


    @Override
    public void Success(ElvDataBean elvDataBean) {
        grouplist.clear();
        List<ElvDataBean.DataBean> data = elvDataBean.getData();
        grouplist.addAll(data);
        childlist.clear();
        for (int i=0;i<data.size();i++){
            ElvDataBean.DataBean dataBean = data.get(i);
            List<ElvDataBean.DataBean.ListBean> list = dataBean.getList();
            childlist.add(list);
        }
        adapter =new MyElvadapter(this,grouplist,childlist);
        exlv.setAdapter(adapter);
        exlv.setGroupIndicator(null);
        // 展开
        for (int i=0;i<grouplist.size();i++){
            exlv.expandGroup(i);
        }
        adapter.notifyDataSetChanged();
    }

    @Override
    public void Failed(Exception e) {

    }
    @Subscribe
    public void onMessageEvent(MessageEvent event) {
        checkBox.setChecked(event.isCheckd());
    }
    @Subscribe
    public void onMessageEven(PriceAndCountEvent event) {
        price.setText("总价:"+event.getPrice());
        num.setText("" + event.getCount() + "件商品");
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        //eventBus销毁
        EventBus.getDefault().unregister(this);
        elvp.onDetchView();
    }


}
购物车页面的接口
public interface Iv {
    void Success(ElvDataBean elvDataBean);
    void Failed(Exception e);
}


订单页面
public class Dingdan extends AppCompatActivity implements Iva{
    private TextView text;
    private Button xiadan;
    private OrderPresenter orderPresenter;
    private int i=100;
    private String key;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dingdan);
        text=findViewById(R.id.Allprice);
        xiadan=findViewById(R.id.xiadan);
        Intent intent = getIntent();
        key = intent.getStringExtra("key");
        text.setText("实付款¥"+ key);

    }



    @Override
    public void onMake(final OrderBean orderBean) {

        xiadan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               Intent intent = new Intent(Dingdan.this,MyOrder.class);
               startActivity(intent);
            }
        });
    }

    @Override
    public void onFider(Exception e) {

    }
}
订单页面的接口
public interface Iva {
    void onMake(OrderBean orderBean);
    void onFider(Exception e);
}
写订单的
public class MyOrder extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_order);

    }
}


接口
public interface CallBack {
   void onSuccess(Object o);
   void onFailed(Exception e);
}
public interface Iview {
    void onSuccess(Bean.DataBean bean);
    void onFiled(Exception e);

}

utils

public class MessageEvent {
    private boolean checkd;
    public boolean isCheckd(){
        return checkd;
    }
    public void  setCheckd(boolean checkd){
        this.checkd=checkd;
    }
}
public class PriceAndCountEvent {
    private int price;
    private int count;
    public int getPrice() {
        return price;
    }
    public int getCount() {
        return count;
    }
    public void setPrice(int price) {
        this.price = price;
    }
    public void setCount(int count) {
        this.count = count;
    }
}

Presenter

public class AddShoppingPre {
    private Context context;
    private AddIv addiv;

    public AddShoppingPre(Context context, AddIv addiv) {
        this.context = context;
        this.addiv = addiv;
    }

    public void get(int i,int j){
        Map map = new HashMap<String,String>();
        map.put("uid",i+"");
        map.put("pid",j+"");
        OkHttpUtils.getInstance().get("http://120.27.23.105/product/addCart", map, new CallBack() {
            @Override
            public void onSuccess(Object o) {
                InitBean initBean = (InitBean) o;
                addiv.onSucce(initBean);
            }

            @Override
            public void onFailed(Exception e) {

            }
        }, InitBean.class);
    }

}
public class Elvpresenter {
    private Iv ivew;
    public Elvpresenter(Iv ivew) {
        this.ivew = ivew;
    }
    public void get(){
        Map map = new HashMap<String,String>();
        map.put("uid","100");
        OkHttpUtils.getInstance().get("http://120.27.23.105/product/getCarts", map, new CallBack() {
            @Override
            public void onSuccess(Object o) {
                ElvDataBean elvDataBean = (ElvDataBean) o;
                ivew.Success(elvDataBean);
            }
            @Override
            public void onFailed(Exception e) {
                ivew.Failed(e);
            }
        },ElvDataBean.class);
    }
    public void onDetchView(){
        if (ivew!=null){
            ivew=null;
        }
    }
}


public class OrderPresenter {

        private Context context;
        private Iva iv;

        public OrderPresenter(Context context, Iva iv) {
            this.context = context;
            this.iv = iv;
        }

        public void get(String key){
            Map map = new HashMap<String,String>();
            map.put("uid","100");
            map.put("price",key);
            OkHttpUtils.getInstance().get("http://120.27.23.105/product/createOrder", map, new CallBack() {
                @Override
                public void onSuccess(Object o) {
                        OrderBean orderBean = (OrderBean) o;
                        iv.onMake(orderBean);
                }

                @Override
                public void onFailed(Exception e) {

                }
            }, OrderBean.class);
        }
    }

public class ShangpingPre {

    private Iview iv;

    public ShangpingPre( Iview iv) {
        this.iv = iv;
    }

    public void get(){
        Map map = new HashMap<String,String>();
        map.put("pid","1");
        OkHttpUtils.getInstance().get("https://www.zhaoapi.cn/product/getProductDetail", map, new CallBack() {
            @Override
            public void onSuccess(Object o) {
                Bean bean = (Bean) o;
               Bean.DataBean data = bean.getData();
                iv.onSuccess(data);
            }

            @Override
            public void onFailed(Exception e) {

            }
        }, Bean.class);
    }

}

Model

public class Logger implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request original = chain.request();
        HttpUrl url=original.url().newBuilder()
                .addQueryParameter("source","android")
                .build();
        //添加请求头
        Request request = original.newBuilder()
                .url(url)
                .build();
        return chain.proceed(request);
    }
}
public class MyElvadapter extends BaseExpandableListAdapter {
    private static final String TAG = "ExlvAdapter";
    private Context context;
    private List<ElvDataBean.DataBean> groupList;
    private List<List<ElvDataBean.DataBean.ListBean>> childList;
    private boolean allGroupCbSelect;
    public MyElvadapter(Context context, List<ElvDataBean.DataBean> groupList, List<List<ElvDataBean.DataBean.ListBean>> childList) {
        this.context = context;
        this.groupList = groupList;
        this.childList = childList;
    }

    @Override
    public int getGroupCount() {
        return groupList.size();
    }
    @Override
    public int getChildrenCount(int i) {
        return childList.get(i).size();
    }
    @Override
    public Object getGroup(int i) {
        return groupList.get(i);
    }
    @Override
    public Object getChild(int i, int i1) {
        return childList.get(i).get(i1);
    }
    @Override
    public long getGroupId(int i) {
        return i;
    }
    @Override
    public long getChildId(int i, int i1) {
        return i1;
    }
    @Override
    public boolean hasStableIds() {
        return false;
    }
    //一级列表布局
    @Override
    public View getGroupView(final int i, boolean b, View view, ViewGroup viewGroup) {
        final ElvDataBean.DataBean dataBean = groupList.get(i);
        final ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            view = View.inflate(context, R.layout.group, null);
            holder.textView = (TextView) view.findViewById(R.id.g_title);
            holder.che = (CheckBox) view.findViewById(R.id.che);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.textView.setText(dataBean.getSellerName());
        //设置一级列表checkBox的状态
        holder.che.setChecked(dataBean.isChecked());
        //一级列表checkBox的点击事件
        holder.che.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //判断一级列表复选框的状态  设置为truefalse
                dataBean.setChecked(holder.che.isChecked());
                //改变二级checkbod的状态
                changeChildCbState(i, holder.che.isChecked());
                //算钱
                EventBus.getDefault().post(computer());
                //改变全选状态   isAllGroupCbSelect判断一级是否全部选中
                changeAllCbState(isAllGroupCbSelect());
                //必刷新
                notifyDataSetChanged();
            }
        });
        return view;
    }

    //二级列表布局
    @Override
    public View getChildView(final int i, final int i1, boolean b, View view, ViewGroup viewGroup) {
        final ElvDataBean.DataBean.ListBean listBean = childList.get(i).get(i1);
        final ViewHolder2 holder2;
        if (view == null) {
            holder2 = new ViewHolder2();
            view = View.inflate(context, R.layout.chidren, null);
            holder2.z_title = (TextView) view.findViewById(R.id.z_title);
            holder2.z_che = (CheckBox) view.findViewById(R.id.z_che);
            holder2.img = (ImageView) view.findViewById(R.id.z_img);
            holder2.price = view.findViewById(R.id.z_price);
            holder2.xiangqing = view.findViewById(R.id.z_shuxing);
            holder2.jian = view.findViewById(R.id.iv_jian);
            holder2.jia = view.findViewById(R.id.iv_add);
            holder2.del = view.findViewById(R.id.del);
            holder2.num = view.findViewById(R.id.tv_num);
            view.setTag(holder2);
        } else {
            holder2 = (ViewHolder2) view.getTag();
        }
        holder2.num.setText(listBean.getNum() + "");
        holder2.z_title.setText(listBean.getTitle());
        holder2.price.setText("¥" + listBean.getPrice());
        holder2.xiangqing.setText(listBean.getSubhead());
        //设置二级列表checkbox的属性
        holder2.z_che.setChecked(listBean.isChecked());
        String images = listBean.getImages();
        String[] split = images.split("\\|");
        Glide.with(context).load(split[0]).into(holder2.img);
        //二级列表的点击事件
        holder2.z_che.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //设置该条目中的checkbox属性值
                listBean.setChecked(holder2.z_che.isChecked());
                //计算价钱
                PriceAndCountEvent priceAndCountEvent = computer();
                EventBus.getDefault().post(priceAndCountEvent);
                //判断当前checkbox是选中的状态
                if (holder2.z_che.isChecked()) {
                    //如果全部选中(isAllChildCbSelected)
                    if (isAllChildCbSelected(i)) {
                        //改变一级列表的状态
                        changeGroupCbState(i, true);
                        //改变全选的状态
                        changeAllCbState(isAllGroupCbSelect());
                    }
                } else {
                    //如果没有全部选中,一级列表的checkboxfalse不为选中
                    changeGroupCbState(i, false);
                    changeAllCbState(isAllGroupCbSelect());
                }
                notifyDataSetChanged();
            }
        });
        //加号
        holder2.jia.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int num = listBean.getNum();
                //numint类型所以要加空字符串
                holder2.num.setText(++num + "");
                listBean.setNum(num);
                //如果二级列表的checkbox为选中,计算价钱
                if (holder2.z_che.isChecked()) {
                    PriceAndCountEvent priceAndCountEvent = computer();
                    EventBus.getDefault().post(priceAndCountEvent);
                }
            }
        });
        //减号
        holder2.jian.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int num = listBean.getNum();
                if (num == 1) {
                    return;
                }
                holder2.num.setText(--num + "");
                listBean.setNum(num);
                if (holder2.z_che.isChecked()) {
                    PriceAndCountEvent priceAndCountEvent = computer();
                    EventBus.getDefault().post(priceAndCountEvent);
                }
            }
        });
        //删除
        holder2.del.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                List<ElvDataBean.DataBean.ListBean> listBeen = childList.get(i);
                ElvDataBean.DataBean.ListBean remove = listBeen.remove(i1);
                if (listBeen.size() == 0) {
                    //先移除二级列表的集合,再移除一级列表的集合
                    childList.remove(i);
                    groupList.remove(i);
                }
                //算钱
                EventBus.getDefault().post(computer());
                notifyDataSetChanged();
            }
        });
        return view;
    }
    @Override
    public boolean isChildSelectable(int i, int i1) {
        return true;
    }
    class ViewHolder {
        TextView textView;
        CheckBox che;
    }
    class ViewHolder2 {
        ImageView img;
        TextView z_title;
        CheckBox z_che;
        TextView price;
        TextView xiangqing;
        ImageView jia;
        ImageView jian;
        ImageView del;
        TextView num;
    }
    //改变二级列表的checkbox的状态   如果一级选中,控制二级也选中
    private void changeChildCbState(int i, boolean flag) {
        List<ElvDataBean.DataBean.ListBean> listBeen = childList.get(i);
        for (int j = 0; j < listBeen.size(); j++) {
            ElvDataBean.DataBean.ListBean listBean = listBeen.get(j);
            listBean.setChecked(flag);
        }
        Log.i(TAG, "changeChildCbState: ");
    }
    //判断一级列表是否全部选中
    public boolean isAllGroupCbSelect() {
        for (int i = 0; i < groupList.size(); i++) {
            ElvDataBean.DataBean dataBean = groupList.get(i);
            if (!dataBean.isChecked()) {
                return false;
            }
        }
        return true;
    }
    //改变全选的状态
    private void changeAllCbState(boolean flag) {
        MessageEvent messageEvent = new MessageEvent();
        messageEvent.setCheckd(flag);
        EventBus.getDefault().post(messageEvent);
    }
    //改变一级列表的checkbox的状态
    private void changeGroupCbState(int i, boolean flag) {
        ElvDataBean.DataBean dataBean = groupList.get(i);
        dataBean.setChecked(flag);
    }
    //判断二级列表是否全部选中
    private boolean isAllChildCbSelected(int i) {
        List<ElvDataBean.DataBean.ListBean> listBeen = childList.get(i);
        for (int j = 0; j < listBeen.size(); j++) {
            ElvDataBean.DataBean.ListBean listBean = listBeen.get(j);
            if (!listBean.isChecked()) {
                return false;
            }
        }
        return true;
    }
    //设置全选,反选
    public void changeAllListCbState(boolean flag) {
        for (int i = 0; i < groupList.size(); i++) {
            changeGroupCbState(i, flag);
            changeChildCbState(i, flag);
        }
        //算钱
        EventBus.getDefault().post(computer());
        //
        notifyDataSetChanged();
    }
    //计算列表的价钱
    private PriceAndCountEvent computer() {
        int count = 0;
        int price = 0;
        for (int i = 0; i < childList.size(); i++) {
            List<ElvDataBean.DataBean.ListBean> listBeen = childList.get(i);
            for (int j = 0; j < listBeen.size(); j++) {
                ElvDataBean.DataBean.ListBean listBean = listBeen.get(j);
                if (listBean.isChecked()) {
                    price += listBean.getNum() * listBean.getPrice();
                    count += listBean.getNum();
                }
            }
        }
        PriceAndCountEvent priceAndCountEvent = new PriceAndCountEvent();
        priceAndCountEvent.setCount(count);
        priceAndCountEvent.setPrice(price);
        return priceAndCountEvent;
    }
}
public class OkHttpUtils {
    private static volatile OkHttpUtils instance;

    private static Handler handler = new Handler();

    private OkHttpUtils(){

    }
    public static OkHttpUtils getInstance() {
        if (instance == null) {
            synchronized (OkHttpUtils.class) {
                if (instance == null) {
                    instance = new OkHttpUtils();
                }
            }
        }
        return instance;
    }

    public void get(String url, Map<String,String> map, final CallBack callBack, final Class c) {
        //url和参数做拼接处理
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(url);
        //判断是否存在?   if中是存在
        if (stringBuffer.indexOf("?") != -1) {
            //判断?是否在最后一位    if中是不在最后一位
            if (stringBuffer.indexOf("?") != stringBuffer.length() - 1) {
                stringBuffer.append("&");
            }
        } else {
            stringBuffer.append("?");
        }
        for (Map.Entry<String, String> entry : map.entrySet()) {
            stringBuffer.append(entry.getKey())
                    .append("=")
                    .append(entry.getValue())
                    .append("&");
        }
        //判断是否存在&   if中是存在
        if (stringBuffer.indexOf("&") != -1) {
            stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("&"));
        }
        Log.i("TAG",stringBuffer.toString());
        OkHttpClient okHttpClient = new OkHttpClient
                .Builder()
                .addInterceptor(new Logger())
                .build();
        Request request = new Request.Builder().get().url(stringBuffer.toString()).build();
        Call call = okHttpClient.newCall(request);
        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, final IOException e) {
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        callBack.onFailed(e);
                    }
                });
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                String result = response.body().string();
                Log.i("TAG",result);
                //拿到数据开始解析
                final Object o = new Gson().fromJson(result, c);
                //当前是在子线程,回到主线程中
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        //回调
                        callBack.onSuccess(o);
                    }
                });
            }
        });
    }
    //post请求
    public void post(String url, Map<String,String> map, final CallBack callBack, final Class c){
        //1:创建OkHttpClient对象
        OkHttpClient okHttpClient = new OkHttpClient();
        //2:提供post请求需要的body对象
        FormBody.Builder builder = new FormBody.Builder();
        for(Map.Entry<String,String> entry:map.entrySet()){
            builder.add(entry.getKey(),entry.getValue());
        }
        FormBody body = builder.build();
        //3:创建Request对象
        final Request request = new Request.Builder()
                .post(body)
                .url(url)
                .build();
        //4:创建Call对象
        Call call = okHttpClient.newCall(request);
        //5:请求网络
        call.enqueue(new Callback() {
            //请求失败
            @Override
            public void onFailure(Call call, final IOException e) {
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        callBack.onFailed(e);
                    }
                });
            }
            //请求成功
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                String result = response.body().string();
                //拿到数据解析
                final Object o = new Gson().fromJson(result, c);
                //当前是在子线程,回到主线程中
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        //回调
                        callBack.onSuccess(o);
                    }
                });
            }
        });
    }
}

public class ListBean {
    private String img;
    private String title;
    private String price;

    public ListBean(String img, String title, String price) {
        this.img = img;
        this.title = title;
        this.price = price;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getTitle() {
        return title;
    }

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

    public String getPrice() {
        return price;
    }

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

}
public class OrderBean {
    /**
     * msg : 订单创建成功
     * code : 0
     */

    private String msg;
    private String code;

    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 class InitBean {
    private String msg;
    private int code;

    public InitBean(String msg, int code) {
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

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

    public int getCode() {
        return code;
    }

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

    @Override
    public String toString() {
        return "InitBean{" +
                "msg='" + msg + '\'' +
                ", code=" + code +
                '}';
    }
}
public class ElvDataBean {
    /**
     * msg : 请求成功
     * code : 0
     * data : [{"list":[{"bargainPrice":22.9,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg","num":2,"pid":24,"price":288,"pscid":2,"selected":0,"sellerid":1,"subhead":"三只松鼠零食特惠,专区满9950,满199100,火速抢购》","title":"三只松鼠 坚果炒货 零食奶油味 碧根果225g/"}],"sellerName":"商家1","sellerid":"1"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/5025518.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8830/106/1760940277/195595/5cf9412f/59bf2ef5N5ab7dc16.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5428/70/1520969931/274676/b644dd0d/591128e7Nd2f70da0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5566/365/1519564203/36911/620c750c/591128eaN54ac3363.jpg!q70.jpg","num":1,"pid":58,"price":6399,"pscid":40,"selected":0,"sellerid":2,"subhead":"升级4G大显存!Nvme协议Pcie SSD,速度快人一步】GTX1050Ti就选拯救者!专业游戏键盘&新模具全新设计!","title":"联想(Lenovo)拯救者R720 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 1T+128G SSD GTX1050Ti 4G IPS )"},{"bargainPrice":6666,"createtime":"2017-10-10T16:01:31","detailUrl":"https://item.m.jd.com/product/5089273.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8284/363/1326459580/71585/6d3e8013/59b857f2N6ca75622.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9346/182/1406837243/282106/68af5b54/59b8480aNe8af7f5c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8434/54/1359766007/56140/579509d9/59b85801Nfea207db.jpg!q70.jpg","num":1,"pid":46,"price":234,"pscid":39,"selected":0,"sellerid":2,"subhead":"iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"}],"sellerName":"商家2","sellerid":"2"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":87,"pid":10,"price":555.55,"pscid":1,"selected":0,"sellerid":3,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家3","sellerid":"3"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":1,"pid":61,"price":14999,"pscid":40,"selected":0,"sellerid":5,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP213英寸Bar i5/8G/256G"}],"sellerName":"商家5","sellerid":"5"},{"list":[{"bargainPrice":159,"createtime":"2017-10-14T21:49:15","detailUrl":"https://item.m.jd.com/product/5061723.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8716/197/1271594444/173291/2f40bb4f/59b743bcN8509428e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8347/264/1286771527/92188/5cf5ec04/59b7420fN65378e9e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7363/165/3000956253/190883/179a372/59b743bfNd0c79d93.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7399/112/2935531768/183594/b77c7d4a/59b7441aNc3d40133.jpg!q70.jpg","num":1,"pid":100,"price":2200,"pscid":112,"selected":0,"sellerid":11,"subhead":"针织针织闪闪闪亮你的眼","title":"维迩旎 2017秋冬新款长袖针织连衣裙韩版气质中长款名媛包臀A字裙 zx179709 黑色 XL"}],"sellerName":"商家11","sellerid":"11"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":1,"pid":69,"price":16999,"pscid":40,"selected":0,"sellerid":13,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP213英寸Bar i5/8G/256G"}],"sellerName":"商家13","sellerid":"13"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":2,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家17","sellerid":"17"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":3,"pid":2,"price":299,"pscid":1,"selected":0,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家18","sellerid":"18"}]
     */

    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 {
        public boolean isChecked() {
            return checked;
        }

        public void setChecked(boolean checked) {
            this.checked = checked;
        }

        /**
         * list : [{"bargainPrice":22.9,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg","num":2,"pid":24,"price":288,"pscid":2,"selected":0,"sellerid":1,"subhead":"三只松鼠零食特惠,专区满9950,满199100,火速抢购》","title":"三只松鼠 坚果炒货 零食奶油味 碧根果225g/"}]
         * sellerName : 商家1
         * sellerid : 1
         */
        private boolean checked;
        private String sellerName;
        private String sellerid;
        private List<ListBean> list;

        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 static class ListBean {
            public boolean isChecked() {
                return checked;
            }

            public void setChecked(boolean checked) {
                this.checked = checked;
            }

            /**
             * bargainPrice : 22.9
             * createtime : 2017-10-14T21:48:08
             * detailUrl : https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends
             * images : https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg
             * num : 2
             * pid : 24
             * price : 288
             * pscid : 2
             * selected : 0
             * sellerid : 1
             * subhead : 三只松鼠零食特惠,专区满9950,满199100,火速抢购》
             * title : 三只松鼠 坚果炒货 零食奶油味 碧根果225g/             */
            private boolean checked;
            private double bargainPrice;
            private String createtime;
            private String detailUrl;
            private String images;
            private int num;
            private int pid;
            private float price;
            private int pscid;
            private int selected;
            private int sellerid;
            private String subhead;
            private String title;

            public double getBargainPrice() {
                return bargainPrice;
            }

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

            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 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 float getPrice() {
                return price;
            }

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

            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;
            }

            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 class Bean {

    /**
     * msg :
     * seller : {"description":"我是商家17","icon":"http://120.27.23.105/images/icon.png","name":"商家17","productNums":999,"score":5,"sellerid":17}
     * code : 0
     * data : {"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":1,"price":118,"pscid":1,"salenum":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}
     */

    private String msg;
    private SellerBean seller;
    private String code;
    private DataBean data;

    public String getMsg() {
        return msg;
    }

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

    public SellerBean getSeller() {
        return seller;
    }

    public void setSeller(SellerBean seller) {
        this.seller = seller;
    }

    public String getCode() {
        return code;
    }

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

    public DataBean getData() {
        return data;
    }

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

    public static class SellerBean {
        /**
         * description : 我是商家17
         * icon : http://120.27.23.105/images/icon.png
         * name : 商家17
         * productNums : 999
         * score : 5
         * sellerid : 17
         */

        private String description;
        private String icon;
        private String name;
        private int productNums;
        private int score;
        private int sellerid;

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getProductNums() {
            return productNums;
        }

        public void setProductNums(int productNums) {
            this.productNums = productNums;
        }

        public int getScore() {
            return score;
        }

        public void setScore(int score) {
            this.score = score;
        }

        public int getSellerid() {
            return sellerid;
        }

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

    public static class DataBean {
        /**
         * bargainPrice : 111.99
         * createtime : 2017-10-14T21:39:05
         * detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends
         * images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg
         * itemtype : 1
         * pid : 1
         * price : 118
         * pscid : 1
         * salenum : 0
         * sellerid : 17
         * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下
         * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g
         */

        private double bargainPrice;
        private String createtime;
        private String detailUrl;
        private String images;
        private int itemtype;
        private int pid;
        private int price;
        private int pscid;
        private int salenum;
        private int sellerid;
        private String subhead;
        private String title;

        public double getBargainPrice() {
            return bargainPrice;
        }

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

        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 int getItemtype() {
            return itemtype;
        }

        public void setItemtype(int itemtype) {
            this.itemtype = itemtype;
        }

        public int getPid() {
            return pid;
        }

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

        public int getPrice() {
            return price;
        }

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

        public int getPscid() {
            return pscid;
        }

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

        public int getSalenum() {
            return salenum;
        }

        public void setSalenum(int salenum) {
            this.salenum = salenum;
        }

        public int getSellerid() {
            return sellerid;
        }

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

        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;
        }
    }
}
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'org.greenrobot:eventbus:3.1.1'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.android.support:design:26.0.0-alpha1'

js加入购物车抛物线动画购物车效果特效,亲测可用, 当您在电商购物网站浏览中意的商品时,您可以点击页面中的“加入购物车”按钮即可将商品加入的购物车中。本文介绍借助一款基于jQuery的动画插件,点击加入购物车按钮时,实现商品将飞入到右侧的购物车中的效果。 HTML 首先载入jQuery库文件和jquery.fly.min.js插件。 复制代码 代码如下: 接着,将商品信息html结构布置好,本例中,我们用四个商品并排布置,每个商品box中包括有商品图片、价格、名称以及加入购物车按钮等信息。 复制代码 代码如下: ¥3499.00 LG 49LF5400-CA 49寸IPS硬屏富贵招财铜钱设计 加入购物车 ¥3799.00 Hisense/海信 LED50T1A 海信电视官方旗舰店 加入购物车 ¥¥3999.00 Skyworth/创维 50E8EUS 8核4Kj极清酷开系统智能液晶电视 加入购物车 ¥6969.00 乐视TV Letv X60S 4核1080P高清3D安卓智能超级电视 加入购物车 然后,我们还需要在页面的右侧加上购物车以及提示信息。 复制代码 代码如下: 购物车 已成功加入购物车! CSS 我们使用CSS先将商品排列美化,然后设置右侧购物车样式,具体请看代码: 复制代码 代码如下: .box{float:left; width:198px; height:320px; margin-left:5px; border:1px solid #e0e0e0; text-align:center} .box p{line-height:20px; padding:4px 4px 10px 4px; text-align:left} .box:hover{border:1px solid #f90} .box h4{line-height:32px; font-size:14px; color:#f30;font-weight:500} .box h4 span{font-size:20px} .u-flyer{display: block;width: 50px;height: 50px;border-radius: 50px;position: fixed;z-index: 9999;} .m-sidebar{position: fixed;top: 0;right: 0;background: #000;z-index: 2000;width: 35px;height: 100%;font-size: 12px;color: #fff;} .cart{color: #fff;t
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值