原生登录+详情页+购物车+订单

依赖

  compile 'io.reactivex.rxjava2:rxjava:2.1.7'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    compile 'com.facebook.fresco:fresco:0.12.0'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.jakewharton:butterknife:8.8.1'
    compile 'com.jcodecraeer:xrecyclerview:1.3.2'
    compile 'org.greenrobot:eventbus:3.1.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

权限

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

style

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <declare-styleable name="AddDeleteViewStyle">
        <attr name="left_text" format="string"/>
        <attr name="right_text" format="string"/>
        <attr name="middle_text" format="string"/>
    </declare-styleable>
</resources>





 
ApiService

package com.example.yuekaolication.JieKo;

import com.example.yuekaolication.Bean.AddBean;
import com.example.yuekaolication.Bean.CartsBean;
import com.example.yuekaolication.Bean.DeleteBean;
import com.example.yuekaolication.Bean.DinganBean;
import com.example.yuekaolication.Bean.LoginBean;
import com.example.yuekaolication.Bean.ProductsBean;
import com.example.yuekaolication.Bean.RegistBean;
import com.example.yuekaolication.Bean.ShowsBean;

import java.util.Map;

import io.reactivex.Flowable;
import retrofit2.http.GET;
import retrofit2.http.QueryMap;

/**
 * Created by lenovo on 2018/1/17.
 */

public interface ApiService {
    //http://120.27.23.105/user/reg?mobile=15522222223&password=123456
    @GET("user/reg")
    Flowable<RegistBean> getRegist(@QueryMap Map<String, String> map);

    //http://120.27.23.105/user/login?mobile=15522222223&password=123456
    @GET("user/login")
    Flowable<LoginBean> getLogin(@QueryMap Map<String, String> map);

    //https://www.zhaoapi.cn/product/getProducts?pscid=39&page=1
    @GET("product/getProducts")
    Flowable<ProductsBean> getProduct(@QueryMap Map<String, String> map);

    //https://www.zhaoapi.cn/product/getProductDetail?pid=45&source=android
    @GET("product/getProductDetail")
    Flowable<ShowsBean> getShows(@QueryMap Map<String, String> map);

    //http://120.27.23.105/product/addCart?uid=101&pid=45&source=android
    @GET("product/addCart")
    Flowable<AddBean> getAdd(@QueryMap Map<String, String> map);
    // http://120.27.23.105/product/getCarts?uid=75&source=android
    @GET("product/getCarts")
    Flowable<CartsBean> getCarts(@QueryMap Map<String, String> map);
    //http://120.27.23.105/product/deleteCart?uid=101&pid=45&source=android
    @GET("product/deleteCart")
    Flowable<DeleteBean> getDelete(@QueryMap Map<String, String> map);

    //http://120.27.23.105/product/getOrders?uid=71
    @GET("product/getOrders")
    Flowable<DinganBean> getDingdan(@QueryMap Map<String, String> map);
}


dinganBean

package com.example.yuekaolication.Bean;

import java.util.List;

/**
 * Created by lenovo on 2018/1/17.
 */

public class DinganBean {

    /**
     * msg : 请求成功
     * code : 0
     * data : [{"createtime":"2017-10-19T20:28:43","orderid":20,"price":100,"status":2,"title":"订单标题测试3","uid":71},{"createtime":"2017-10-19T20:44:40","orderid":31,"price":11800,"status":0,"title":"订单标题测试14","uid":71},{"createtime":"2017-10-19T20:44:51","orderid":32,"price":11800,"status":2,"title":"订单标题测试15","uid":71},{"createtime":"2017-10-20T08:02:07","orderid":43,"price":11800,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-10-20T08:02:16","orderid":44,"price":11800,"status":2,"title":"订单标题测试","uid":71},{"createtime":"2017-10-22T15:14:39","orderid":890,"price":11800,"status":2,"title":"","uid":71},{"createtime":"2017-11-09T09:17:20","orderid":1446,"price":99.99,"status":1,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1447,"price":567,"status":2,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1448,"price":256.99,"status":2,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1449,"price":399,"status":2,"title":"订单标题测试","uid":71}]
     * page : 1
     */

    private String msg;
    private String code;
    private String page;
    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 String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

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

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

    public static class DataBean {
        /**
         * createtime : 2017-10-19T20:28:43
         * orderid : 20
         * price : 100.0
         * status : 2
         * title : 订单标题测试3
         * uid : 71
         */

        private String createtime;
        private int orderid;
        private double price;
        private int status;
        private String title;
        private int uid;

        public String getCreatetime() {
            return createtime;
        }

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

        public int getOrderid() {
            return orderid;
        }

        public void setOrderid(int orderid) {
            this.orderid = orderid;
        }

        public double getPrice() {
            return price;
        }

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

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public String getTitle() {
            return title;
        }

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

        public int getUid() {
            return uid;
        }

        public void setUid(int uid) {
            this.uid = uid;
        }
    }
}




AddBean
package com.example.yuekaolication.Bean;
/**
 * Created by lenovo on 2018/1/17.
 *
public class AddBean {
    /**
     * 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;
    }
}

CartsBean

package com.example.yuekaolication.Bean;

import java.util.List;

/**
 * Created by lenovo on 2018/1/17.
 */

public class CartsBean {
    /**
     * msg : 请求成功
     * code : 0
     * data : [{"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"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","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":1,"pid":4,"price":999,"pscid":1,"selected":0,"sellerid":20,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家20","sellerid":"20"},{"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":1,"pid":5,"price":88.99,"pscid":1,"selected":0,"sellerid":21,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家21","sellerid":"21"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-03T23:53:28","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":1,"pid":6,"price":7.99,"pscid":1,"selected":0,"sellerid":22,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家22","sellerid":"22"}]
     */

    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 {
        /**
         * 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 boolean checked;
        private boolean edtor;
        private String sellerName;
        private String sellerid;
        private List<ListBean> list;

        public boolean isChecked() {
            return checked;
        }

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

        public boolean isEdtor() {
            return edtor;
        }

        public void setEdtor(boolean edtor) {
            this.edtor = edtor;
        }

        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 {
            /**
             * 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
             */

            private boolean checked;
            private boolean edtor;
            private double bargainPrice;
            private String createtime;
            private String detailUrl;
            private String images;
            private int num;
            private int pid;
            private double price;
            private int pscid;
            private int selected;
            private int sellerid;
            private String subhead;
            private String title;

            public boolean isChecked() {
                return checked;
            }

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

            public boolean isEdtor() {
                return edtor;
            }

            public void setEdtor(boolean edtor) {
                this.edtor = edtor;
            }

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

            public void setPrice(double 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;
            }
        }
    }


}

DeleteBean
package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class DeleteBean {
    /**
     * 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;
    }
}

LoginBean
package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class LoginBean {
    /**
     * msg : 登录成功
     * code : 0
     * data : {"age":null,"appkey":"0f45da6575b04a28","appsecret":"7FFA77FFCDC9BA5743CB08BE984C1E30","createtime":"2017-12-21T13:39:39","email":null,"fans":null,"follow":null,"gender":null,"icon":null,"latitude":null,"longitude":null,"mobile":"15522222223","money":null,"nickname":null,"password":"8F669074CAF5513351A2DE5CC22AC04C","praiseNum":null,"token":"FD92C716E4502CF9A062F073FCF44193","uid":5128,"userId":null,"username":"15522222223"}
     */

    private String msg;
    private String code;
    private 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 DataBean getData() {
        return data;
    }

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

    public static class DataBean {
        /**
         * age : null
         * appkey : 0f45da6575b04a28
         * appsecret : 7FFA77FFCDC9BA5743CB08BE984C1E30
         * createtime : 2017-12-21T13:39:39
         * email : null
         * fans : null
         * follow : null
         * gender : null
         * icon : null
         * latitude : null
         * longitude : null
         * mobile : 15522222223
         * money : null
         * nickname : null
         * password : 8F669074CAF5513351A2DE5CC22AC04C
         * praiseNum : null
         * token : FD92C716E4502CF9A062F073FCF44193
         * uid : 5128
         * userId : null
         * username : 15522222223
         */

        private Object age;
        private String appkey;
        private String appsecret;
        private String createtime;
        private Object email;
        private Object fans;
        private Object follow;
        private Object gender;
        private Object icon;
        private Object latitude;
        private Object longitude;
        private String mobile;
        private Object money;
        private Object nickname;
        private String password;
        private Object praiseNum;
        private String token;
        private int uid;
        private Object userId;
        private String username;

        public Object getAge() {
            return age;
        }

        public void setAge(Object age) {
            this.age = age;
        }

        public String getAppkey() {
            return appkey;
        }

        public void setAppkey(String appkey) {
            this.appkey = appkey;
        }

        public String getAppsecret() {
            return appsecret;
        }

        public void setAppsecret(String appsecret) {
            this.appsecret = appsecret;
        }

        public String getCreatetime() {
            return createtime;
        }

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

        public Object getEmail() {
            return email;
        }

        public void setEmail(Object email) {
            this.email = email;
        }

        public Object getFans() {
            return fans;
        }

        public void setFans(Object fans) {
            this.fans = fans;
        }

        public Object getFollow() {
            return follow;
        }

        public void setFollow(Object follow) {
            this.follow = follow;
        }

        public Object getGender() {
            return gender;
        }

        public void setGender(Object gender) {
            this.gender = gender;
        }

        public Object getIcon() {
            return icon;
        }

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

        public Object getLatitude() {
            return latitude;
        }

        public void setLatitude(Object latitude) {
            this.latitude = latitude;
        }

        public Object getLongitude() {
            return longitude;
        }

        public void setLongitude(Object longitude) {
            this.longitude = longitude;
        }

        public String getMobile() {
            return mobile;
        }

        public void setMobile(String mobile) {
            this.mobile = mobile;
        }

        public Object getMoney() {
            return money;
        }

        public void setMoney(Object money) {
            this.money = money;
        }

        public Object getNickname() {
            return nickname;
        }

        public void setNickname(Object nickname) {
            this.nickname = nickname;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public Object getPraiseNum() {
            return praiseNum;
        }

        public void setPraiseNum(Object praiseNum) {
            this.praiseNum = praiseNum;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public int getUid() {
            return uid;
        }

        public void setUid(int uid) {
            this.uid = uid;
        }

        public Object getUserId() {
            return userId;
        }

        public void setUserId(Object userId) {
            this.userId = userId;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }
    }
}

MessageEvent
package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class MessageEvent {
    private boolean checked;

    public boolean isChecked() {
        return checked;
    }

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

PriceAndCountEvent
package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class PriceAndCountEvent {
    private int price;
    private int count;

    public int getPrice() {
        return price;
    }

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

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}
ProductsBean
package com.example.yuekaolication.Bean;

import java.util.List;

/**
 * Created by lenovo on 2018/1/17.
 */

public class ProductsBean {
    /**
     * msg : 请求成功
     * code : 0
     * data : [{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"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","itemtype":0,"pid":46,"price":234,"pscid":39,"salenum":868,"sellerid":2,"subhead":"【iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"},{"bargainPrice":1599,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/1993026402.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5863/302/8961270302/97126/41feade1/5981c81cNc1b1fbef.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7003/250/1488538438/195825/53bf31ba/5981c57eN51e95176.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5665/100/8954482513/43454/418611a9/5981c57eNd5fc97ba.jpg!q70.jpg","itemtype":2,"pid":47,"price":111,"pscid":39,"salenum":757,"sellerid":3,"subhead":"碳黑色 32GB 全网通 官方标配 1件","title":"锤子 坚果Pro 特别版 巧克力色 酒红色 全网通 移动联通电信4G手机 双卡双待 碳黑色 32GB 全网通"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":48,"price":222,"pscid":39,"salenum":656,"sellerid":4,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","itemtype":0,"pid":49,"price":333,"pscid":39,"salenum":123,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":2,"pid":50,"price":444,"pscid":39,"salenum":54,"sellerid":6,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":51,"price":555,"pscid":39,"salenum":424,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":52,"price":666,"pscid":39,"salenum":212,"sellerid":8,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":2999,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2385655.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t2068/298/2448145915/157953/7be197df/56d51a42Nd86f1c8e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2437/128/1687178395/117431/bcc190c1/56d3fcbaNb2963d21.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2467/222/2263160610/95597/927b8a2f/56d3eafeNdecebeb6.jpg!q70.jpg","itemtype":2,"pid":53,"price":777,"pscid":39,"salenum":0,"sellerid":9,"subhead":"Super AMOLED三星双曲面2K 屏,支持无线充电!","title":"三星 Galaxy S7 edge(G9350)4GB+32GB 铂光金 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":54,"price":888,"pscid":39,"salenum":7575,"sellerid":10,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}]
     * page : 1
     */

    private String msg;
    private String code;
    private String page;
    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 String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

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

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

    public static class DataBean {
        /**
         * bargainPrice : 99
         * createtime : 2017-10-14T21:38:26
         * detailUrl : https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends
         * images : https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg
         * itemtype : 1
         * pid : 45
         * price : 2999
         * pscid : 39
         * salenum : 4666
         * sellerid : 1
         * subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!
         * title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机
         */

        private double bargainPrice;
        private String createtime;
        private String detailUrl;
        private String images;
        private int itemtype;
        private int pid;
        private double 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 double getPrice() {
            return price;
        }

        public void setPrice(double 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;
        }
    }
}
RegistBean
package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class RegistBean {
    /**
     * 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;
    }
}
ShowsBean

package com.example.yuekaolication.Bean;

/**
 * Created by lenovo on 2018/1/17.
 */

public class ShowsBean {
    /**
     * msg :
     * seller : {"description":"我是商家1","icon":"http://120.27.23.105/images/icon.png","name":"商家1","productNums":999,"score":4.9,"sellerid":1}
     * code : 0
     * data : {"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"}
     */

    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 : 我是商家1
         * icon : http://120.27.23.105/images/icon.png
         * name : 商家1
         * productNums : 999
         * score : 4.9
         * sellerid : 1
         */

        private String description;
        private String icon;
        private String name;
        private int productNums;
        private double 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 double getScore() {
            return score;
        }

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

        public int getSellerid() {
            return sellerid;
        }

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

    public static class DataBean {
        /**
         * bargainPrice : 99
         * createtime : 2017-10-14T21:38:26
         * detailUrl : https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends
         * images : https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg
         * itemtype : 1
         * pid : 45
         * price : 2999
         * pscid : 39
         * salenum : 4666
         * sellerid : 1
         * subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!
         * title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机
         */

        private double bargainPrice;
        private String createtime;
        private String detailUrl;
        private String images;
        private int itemtype;
        private int pid;
        private double 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 double getPrice() {
            return price;
        }

        public void setPrice(double 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;
        }
    }
}

CartModel
package com.example.yuekaolication.Model;

import com.example.yuekaolication.Bean.AddBean;
import com.example.yuekaolication.Bean.CartsBean;
import com.example.yuekaolication.Bean.DeleteBean;
import com.example.yuekaolication.Bean.DinganBean;
import com.example.yuekaolication.Bean.LoginBean;
import com.example.yuekaolication.Bean.ProductsBean;
import com.example.yuekaolication.Bean.RegistBean;
import com.example.yuekaolication.Bean.ShowsBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Utils.RetrofitUtils;

import java.util.Map;

import io.reactivex.Flowable;

/**
 * Created by lenovo on 2018/1/17.
 */

public class CartModel  implements IModel {
    private CartPresenter presenter;

    public CartModel(CartPresenter presenter) {
        this.presenter = presenter;
    }

    @Override
    public void getRegistData(Map<String, String> map) {
        Flowable<RegistBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getRegist(map);
        presenter.getRegistNews(flowable);
    }

    @Override
    public void getloginData(Map<String, String> map) {
        Flowable<LoginBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getLogin(map);
        presenter.getLoginNews(flowable);

    }

    @Override
    public void getProductData(Map<String, String> map) {
        Flowable<ProductsBean> flowable = RetrofitUtils.getInstance("https://www.zhaoapi.cn/").getApiService().getProduct(map);
        presenter.getProductNews(flowable);
    }

    @Override
    public void getShowsData(Map<String, String> map) {
        Flowable<ShowsBean> flowable = RetrofitUtils.getInstance("https://www.zhaoapi.cn/").getApiService().getShows(map);
        presenter.getShowsNews(flowable);
    }

    @Override
    public void getAddData(Map<String, String> map) {
        Flowable<AddBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getAdd(map);
        presenter.getAddNews(flowable);
    }

    @Override
    public void getCartsData(Map<String, String> map) {
        Flowable<CartsBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getCarts(map);
        presenter.getCartsNews(flowable);
    }

    @Override
    public void getDeleteData(Map<String, String> map) {
        Flowable<DeleteBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getDelete(map);
        presenter.getDeleteNews(flowable);
    }

    @Override
    public void getDingdanData(Map<String, String> map) {
        Flowable<DinganBean> flowable = RetrofitUtils.getInstance("http://120.27.23.105/").getApiService().getDingdan(map);
        presenter.getDingdanNews(flowable);
    }

}
IModel
package com.example.yuekaolication.Model;

import java.util.Map;

/**
 * Created by lenovo on 2018/1/17.
 */

public interface IModel {
    void getRegistData(Map<String, String> map);
    void getloginData(Map<String, String> map);
    void getProductData(Map<String, String> map);
    void getShowsData(Map<String, String> map);
    void getAddData(Map<String, String> map);
    void getCartsData(Map<String, String> map);
    void getDeleteData(Map<String, String> map);
    void getDingdanData(Map<String, String> map);
}
AddDeleteView
package com.example.yuekaolication.Presenter;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.yuekaolication.R;

import io.reactivex.annotations.Nullable;

/**
 * Created by lenovo on 2018/1/17.
 */

public class AddDeleteView extends LinearLayout {
    private OnAddDelClickListener listener;
    private TextView et_number;

    public void setOnAddDelClickListener(OnAddDelClickListener listener) {
        if (listener != null) {
            this.listener = listener;
        }
    }


    public interface OnAddDelClickListener {
        void onAddClick(View v);

        void onDelClick(View v);
    }

    public AddDeleteView(Context context) {
        this(context, null);
    }

    public AddDeleteView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);

    }

    public AddDeleteView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context, attrs, defStyleAttr);
    }

    private void initView(Context context, AttributeSet attrs, int defStyleAttr) {
        View.inflate(context, R.layout.layout_add_delete, this);
        Button but_add = findViewById(R.id.but_add);
        Button but_delete = findViewById(R.id.but_delete);
        et_number = findViewById(R.id.et_number);

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AddDeleteViewStyle);
        String left_text = typedArray.getString(R.styleable.AddDeleteViewStyle_left_text);
        String middle_text = typedArray.getString(R.styleable.AddDeleteViewStyle_middle_text);
        String right_text = typedArray.getString(R.styleable.AddDeleteViewStyle_right_text);

        et_number.setText(middle_text);
        //释放资源
        typedArray.recycle();

        but_add.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onAddClick(view);
            }
        });
        but_delete.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onDelClick(view);
            }
        });
    }

    /**
     * 对外提供设置EditText值的方法
     */
    public void setNumber(int number) {
        if (number > 0) {
            et_number.setText(number + "");
        }
    }

    /**
     * 得到控件原来的值
     */
    public int getNumber() {
        int number = 0;
        try {
            String numberStr = et_number.getText().toString().trim();
            number = Integer.valueOf(numberStr);
        } catch (Exception e) {
            number = 0;
        }
        return number;
    }
}

BasePresenter
package com.example.yuekaolication.Presenter;

import java.util.Map;

/**
 * Created by lenovo on 2018/1/17.
 */

public interface BasePresenter {
    void getRegistData(Map<String, String> map);
    void getloginData(Map<String, String> map);
    void getProductData(Map<String, String> map);
    void getShowsData(Map<String, String> map);
    void getAddData(Map<String, String> map);
    void getCartsData(Map<String, String> map);
    void getDeleteData(Map<String, String> map);
    void getDingdanData(Map<String, String> map);

}
CartPresenter
package com.example.yuekaolication.Presenter;

import android.util.Log;

import com.example.yuekaolication.Bean.AddBean;
import com.example.yuekaolication.Bean.CartsBean;
import com.example.yuekaolication.Bean.DeleteBean;
import com.example.yuekaolication.Bean.DinganBean;
import com.example.yuekaolication.Bean.LoginBean;
import com.example.yuekaolication.Bean.ProductsBean;
import com.example.yuekaolication.Bean.RegistBean;
import com.example.yuekaolication.Bean.ShowsBean;
import com.example.yuekaolication.Model.CartModel;

import java.util.Map;

import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subscribers.DisposableSubscriber;

/**
 * Created by lenovo on 2018/1/17.
 */

public class CartPresenter implements BasePresenter{
    private IView iv;
    private DisposableSubscriber subscriber;
    private DisposableSubscriber subscriber1;
    private DisposableSubscriber subscriber2;
    private DisposableSubscriber subscriber3;
    private DisposableSubscriber subscriber4;
    private DisposableSubscriber subscriber5;
    private DisposableSubscriber subscriber6;
    private DisposableSubscriber subscriber7;

    public void attachView(IView iv) {
        this.iv = iv;
    }

    public void dattachView() {
        if (iv != null) {
            iv = null;
        }
        if (subscriber!=null){
            if (subscriber.isDisposed()){
                subscriber.dispose();
            }
        }
        if (subscriber1!=null){
            if (subscriber1.isDisposed()){
                subscriber1.dispose();
            }
        }
        if (subscriber2!=null){
            if (subscriber2.isDisposed()){
                subscriber2.dispose();
            }
        }
        if (subscriber3!=null){
            if (subscriber3.isDisposed()){
                subscriber3.dispose();
            }
        }
        if (subscriber4!=null){
            if (subscriber4.isDisposed()){
                subscriber4.dispose();
            }
        }
        if (subscriber5!=null){
            if (subscriber5.isDisposed()){
                subscriber5.dispose();
            }
        }
        if (subscriber6!=null){
            if (subscriber6.isDisposed()){
                subscriber6.dispose();
            }
        }
        if (subscriber7!=null){
            if (subscriber7.isDisposed()){
                subscriber7.dispose();
            }
        }
    }

    @Override
    public void getRegistData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getRegistData(map);

    }

    @Override
    public void getloginData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getloginData(map);
    }

    @Override
    public void getProductData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getProductData(map);
    }

    @Override
    public void getShowsData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getShowsData(map);
    }

    @Override
    public void getAddData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getAddData(map);
    }

    @Override
    public void getCartsData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getCartsData(map);
    }

    @Override
    public void getDeleteData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getDeleteData(map);
    }

    @Override
    public void getDingdanData(Map<String, String> map) {
        CartModel model = new CartModel(this);
        model.getDingdanData(map);
    }
    public void getDingdanNews(Flowable<DinganBean> flowable){
        subscriber7 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<DinganBean>() {
                    @Override
                    public void onNext(DinganBean dinganBean) {
                        if (dinganBean != null) {
                            iv.onSuccess(dinganBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
    public void getDeleteNews(Flowable<DeleteBean> flowable) {
        subscriber6 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<DeleteBean>() {
                    @Override
                    public void onNext(DeleteBean deleteBean) {
                        if (deleteBean != null) {
                            iv.onSuccess(deleteBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getCartsNews(Flowable<CartsBean> flowable) {
        subscriber5 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<CartsBean>() {
                    @Override
                    public void onNext(CartsBean cartsBean) {
                        if (cartsBean != null) {
                            iv.onSuccess(cartsBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getRegistNews(Flowable<RegistBean> flowable) {
        subscriber = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<RegistBean>() {
                    @Override
                    public void onNext(RegistBean registBean) {
                        if (registBean != null) {
                            iv.onSuccess(registBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getLoginNews(Flowable<LoginBean> flowable) {
        subscriber1 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<LoginBean>() {
                    @Override
                    public void onNext(LoginBean loginBean) {
                        if (loginBean != null) {
                            iv.onSuccess(loginBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getProductNews(Flowable<ProductsBean> flowable) {
        subscriber2 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<ProductsBean>() {
                    @Override
                    public void onNext(ProductsBean productsBean) {
                        if (productsBean != null) {
                            iv.onSuccess(productsBean);
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getShowsNews(Flowable<ShowsBean> flowable) {
        subscriber3 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<ShowsBean>() {
                    @Override
                    public void onNext(ShowsBean showsBean) {
                        if (showsBean != null) {
                            iv.onSuccess(showsBean);
                            Log.i("fff", "onSuccess: "+showsBean.getMsg());
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                        Log.i("fff", "onSuccess: "+t.getMessage());
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
    public void getAddNews(Flowable<AddBean> flowable) {
        subscriber4 = flowable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeWith(new DisposableSubscriber<AddBean>() {
                    @Override
                    public void onNext(AddBean addBean) {
                        if (addBean != null) {
                            iv.onSuccess(addBean);

                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        iv.onFailed((Exception) t);
                        Log.i("fff", "onSuccess: " + t.getMessage());
                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }

}
IView

package com.example.yuekaolication.Presenter;

/**
 * Created by lenovo on 2018/1/17.
 */

public interface IView {
    void onSuccess(Object o);
    void onFailed(Exception e);
}
MyApplication
package com.example.yuekaolication.Utils;

import android.app.Application;

import com.facebook.drawee.backends.pipeline.Fresco;

/**
 * Created by lenovo on 2018/1/17.
 */

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Fresco.initialize(this);
    }
}
RetrofitUtils
package com.example.yuekaolication.Utils;

import com.example.yuekaolication.JieKo.ApiService;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by lenovo on 2018/1/17.
 */

public class RetrofitUtils { private static volatile RetrofitUtils instance;
    private final ApiService apiService;

    private RetrofitUtils(String baseUrl){
        OkHttpClient client = new OkHttpClient();
        Retrofit retrofit = new Retrofit.Builder()
                .client(client)
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl(baseUrl)
                .build();
        apiService = retrofit.create(ApiService.class);

    }
    public static RetrofitUtils getInstance(String baseUrl){
        if (instance==null){
            synchronized (RetrofitUtils.class){
                if (null == instance){
                    instance = new RetrofitUtils(baseUrl);
                }
            }
        }
        return instance;
    }
    public ApiService getApiService(){
        return apiService;
    }
}

DingdanAdapter
package com.example.yuekaolication.Adapter;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuekaolication.Bean.DinganBean;
import com.example.yuekaolication.R;

import java.util.List;

/**
 * Created by lenovo on 2018/1/17.
 */

public class DingdanAdapter  extends RecyclerView.Adapter<DingdanAdapter.ViewHolder> {
    private Context context;
    private List<DinganBean.DataBean> list;
    private View v;

    public DingdanAdapter(Context context, List<DinganBean.DataBean> list) {
        this.context = context;
        this.list = list;
    }
    private OnItemClickListener mOnItemClickListener;

    public interface OnItemClickListener{
        void onClick(int position);
        void onLongClick(int position);
    }
    public void setOnItemClickListener(OnItemClickListener onItemClickListener ){
        this. mOnItemClickListener=onItemClickListener;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        v = View.inflate(context, R.layout.item_main, null);
        ViewHolder holder = new ViewHolder(v);
        return holder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        holder.title.setText(list.get(position).getTitle());
        holder.price.setText("价格: "+list.get(position).getPrice());
        holder.time.setText("创建时间: "+list.get(position).getCreatetime());
        final DinganBean.DataBean dataBean = list.get(position);
        int status = list.get(position).getStatus();
        if(status==2){
            holder.wen.setText("已取消");
            holder.wen.setTextColor(Color.BLACK);
        }else if(status == 1){
            holder.wen.setText("已支付");
            holder.wen.setTextColor(Color.BLACK);
        }else{
            holder.wen.setTextColor(Color.RED);
            holder.wen.setText("待支付");
            holder.btn.setText("取消支付");
        }
        final DialogInterface.OnClickListener click1 = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
                //  Toast.makeText(context,"否",Toast.LENGTH_LONG).show();;
            }
        };
        final DialogInterface.OnClickListener click2 = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
                Toast.makeText(context,"订单已取消",Toast.LENGTH_LONG).show();
                // xiuCartPersenter.getNews();
                dataBean.setStatus(0);
                notifyDataSetChanged();
            }
        };
        holder.btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(context,"查看订单",Toast.LENGTH_LONG).show();
                new AlertDialog.Builder(context).setTitle("提示").setMessage("确定取消订单吗?")
                        .setPositiveButton("否", click1)
                        .setNegativeButton("是", click2).show();
            }
        });


    }

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

    public class ViewHolder extends RecyclerView.ViewHolder {
        private final TextView title;
        private final TextView price;
        private final TextView time;
        private final TextView wen;
        private final Button btn;
        public ViewHolder(View itemView) {
            super(itemView);
            title = v.findViewById(R.id.tv_title);
            price = v.findViewById(R.id.tv_price);
            time = v.findViewById(R.id.tv_time);
            wen = v.findViewById(R.id.tv_wen);
            btn= v.findViewById(R.id.btn);
        }
    }
}
ShopCartExListAdapter

package com.example.yuekaolication.Adapter;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuekaolication.Bean.CartsBean;
import com.example.yuekaolication.Bean.MessageEvent;
import com.example.yuekaolication.Bean.PriceAndCountEvent;
import com.example.yuekaolication.Presenter.AddDeleteView;
import com.example.yuekaolication.R;
import com.facebook.drawee.view.SimpleDraweeView;

import org.greenrobot.eventbus.EventBus;

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

/**
 * Created by lenovo on 2018/1/17.
 */

public class ShopCartExListAdapter extends BaseExpandableListAdapter {
    private Context context;
    private List<CartsBean.DataBean> list = new ArrayList<>();
    private boolean isShow = true;
    private boolean flag = true;
    private int totalCount=0;

    public ShopCartExListAdapter(Context context, List<CartsBean.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getGroupCount() {
        return list.size();
    }

    @Override
    public int getChildrenCount(int i) {
        return list.get(i).getList().size();
    }

    @Override
    public Object getGroup(int i) {
        return list.get(i);
    }

    @Override
    public Object getChild(int i, int i1) {
        return list.get(i).getList().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 groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        View view;
        final GroupViewHolder holder;
        if (convertView == null) {
            holder = new GroupViewHolder();
            view = View.inflate(context, R.layout.item_shopcart_group, null);
            holder.determine_chekbox = (CheckBox) view.findViewById(R.id.determine_chekbox);
            holder.tv_source_name = (TextView) view.findViewById(R.id.tv_source_name);
            holder.tv_store_edtor = (TextView) view.findViewById(R.id.tv_store_edtor);
            view.setTag(holder);
        } else {
            view = convertView;
            holder = (GroupViewHolder) view.getTag();
        }
        final CartsBean.DataBean dataBean = list.get(groupPosition);

        holder.determine_chekbox.setChecked(dataBean.isChecked());

        holder.tv_source_name.setText(dataBean.getSellerName());
        //一级checkbox
        holder.determine_chekbox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                totalCount++;
                dataBean.setChecked(holder.determine_chekbox.isChecked());
                changeChildCbState(groupPosition, holder.determine_chekbox.isChecked());
                EventBus.getDefault().post(compute());
                changeAllCbState(isAllGroupCbSelected());
                notifyDataSetChanged();
            }
        });
        if (dataBean.isEdtor()) {
            holder.tv_store_edtor.setText("完成");
        } else {
            holder.tv_store_edtor.setText("编辑");
        }
        holder.tv_store_edtor.setOnClickListener(new GroupViewClick(groupPosition, holder.tv_store_edtor, dataBean));
        notifyDataSetChanged();
        return view;
    }

    @Override
    public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        View view;
        final ChildViewHolder holder;
        if (convertView == null) {
            holder = new ChildViewHolder();
            view = View.inflate(context,R.layout.item_shopcart_product, null);
            holder.cbChild = (CheckBox) view.findViewById(R.id.check_box);
            holder.tv_intro = (TextView) view.findViewById(R.id.tv_intro);
            holder.imgIcon = (SimpleDraweeView) view.findViewById(R.id.iv_adapter_list_pic);
            holder.tv_price = (TextView) view.findViewById(R.id.tv_price);
            holder.tv_del = (TextView) view.findViewById(R.id.tv_goods_delete);
//            holder.bt_add = (ImageView) view.findViewById(R.id.bt_add);
//            holder.bt_del = (ImageView) view.findViewById(R.id.bt_reduce);
//            holder.et_num = (EditText) view.findViewById(R.id.et_num);
            holder.tv_num = (TextView) view.findViewById(R.id.tv_buy_num);
            holder.ll_edtor = (LinearLayout) view.findViewById(R.id.ll_edtor);
            holder.rl_no_edtor = (RelativeLayout) view.findViewById(R.id.rl_no_edtor);
            holder.adv = view.findViewById(R.id.adv_main);
            view.setTag(holder);
        } else {
            view = convertView;
            holder = (ChildViewHolder) view.getTag();
        }
        final CartsBean.DataBean.ListBean datasBean = list.get(groupPosition).getList().get(childPosition);



        holder.cbChild.setChecked(datasBean.isChecked());

        holder.tv_intro.setText(datasBean.getTitle());
        holder.tv_price.setText("¥"+datasBean.getPrice() );
        holder.tv_num.setText(datasBean.getNum() + "");
//        holder.et_num.setText(datasBean.getNum() + "");
        holder.adv.setNumber(datasBean.getNum());
        String[] split = datasBean.getImages().split("[|]");
        holder.imgIcon.setImageURI(Uri.parse(split[0]));

        //二级checkbox
        holder.cbChild.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //设置该条目对象里的checked属性值
                datasBean.setChecked(holder.cbChild.isChecked());
                PriceAndCountEvent priceAndCountEvent = compute();
                EventBus.getDefault().post(priceAndCountEvent);
                if (holder.cbChild.isChecked()) {
                    //当前checkbox是选中状态
                    if (isAllChildCbSelected(groupPosition)) {
                        changGroupCbState(groupPosition, true);
                        changeAllCbState(isAllGroupCbSelected());
                    }
                    totalCount++;
                } else {
                    changGroupCbState(groupPosition, false);
                    changeAllCbState(isAllGroupCbSelected());
                }
                notifyDataSetChanged();
            }
        });
        holder.adv.setOnAddDelClickListener(new AddDeleteView.OnAddDelClickListener() {
            @Override
            public void onAddClick(View v) {
                Log.i("zxz", "onAddClick: 执行");
                int origin = holder.adv.getNumber();
                origin++;
//                holder.adv.setNumber(origin);
                int num = datasBean.getNum();
                num++;
                holder.adv.setNumber(num);
                datasBean.setNum(num);
                if (holder.cbChild.isChecked()) {
                    EventBus.getDefault().post(compute());
                }
            }

            @Override
            public void onDelClick(View v) {
                int origin = holder.adv.getNumber();
//                int num = datasBean.getNum();

                origin--;
                if (origin == 0) {
                    Toast.makeText(context,"最小数量为1", Toast.LENGTH_SHORT).show();
                    return ;
                }
                holder.adv.setNumber(origin);
                datasBean.setNum(origin);
                if (holder.cbChild.isChecked()) {

                    EventBus.getDefault().post(compute());
                }

            }
        });
//        //加号
//        holder.bt_add.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                int num = datasBean.getNum();
//                ++num;
//                holder.tv_num.setText(num + "");
//                holder.et_num.setText(num +"");
//                datasBean.setNum(num);
//                if (holder.cbChild.isChecked()) {
//                    PriceAndCountEvent priceAndCountEvent = compute();
//                    EventBus.getDefault().post(priceAndCountEvent);
//                }
//            }
//        });
//        //减号
//        holder.bt_del.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                int num = datasBean.getNum();
//                if (num == 1) {
//                    return;
//                }
//                --num;
//                holder.tv_num.setText(num + "");
//                holder.et_num.setText(num + "");
//                datasBean.setNum(num);
//                if (holder.cbChild.isChecked()) {
//                    PriceAndCountEvent priceAndCountEvent = compute();
//                    EventBus.getDefault().post(priceAndCountEvent);
//                }
//            }
//        });
        //删除
        holder.tv_del.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog alert;
                alert = new AlertDialog.Builder(context).create();
                alert.setTitle("操作提示");
                alert.setMessage("您确定要将这些商品从购物车中移除吗?");
                alert.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                return;
                            }
                        });
                alert.setButton(DialogInterface.BUTTON_POSITIVE, "确定",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                List<CartsBean.DataBean.ListBean> datasBeen = list.get(groupPosition).getList();
                                CartsBean.DataBean.ListBean remove = datasBeen.remove(childPosition);
                                if (datasBeen.size() == 0) {
                                    list.remove(groupPosition);
                                }
                                EventBus.getDefault().post(compute());
                                notifyDataSetChanged();
                            }
                        });
                alert.show();
            }
        });
        //编辑
        //判断是否在编辑状态下(标题中的编辑)
        if (list.get(groupPosition).isEdtor() == true) {
            holder.ll_edtor.setVisibility(View.VISIBLE);
            holder.rl_no_edtor.setVisibility(View.GONE);
        } else {
            holder.ll_edtor.setVisibility(View.GONE);
            holder.rl_no_edtor.setVisibility(View.VISIBLE);
        }

        return view;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    class GroupViewHolder {
        CheckBox determine_chekbox;
        TextView tv_source_name,tv_store_edtor;
    }
    /**
     * 使某个组处于编辑状态
     * <p/>
     * groupPosition组的位置
     */
    class GroupViewClick implements View.OnClickListener {
        private int groupPosition;
        private TextView edtor;
        private CartsBean.DataBean group;

        public GroupViewClick(int groupPosition, TextView edtor, CartsBean.DataBean group) {
            this.groupPosition = groupPosition;
            this.edtor = edtor;
            this.group = group;
        }
        @Override
        public void onClick(View v) {
            int groupId = v.getId();
            if (groupId == edtor.getId()) {
                if (group.isEdtor()) {
                    group.setEdtor(false);
                } else {
                    group.setEdtor(true);

                }
                notifyDataSetChanged();
            }
        }
    }
    /**
     * 监听编辑状态
     */
    public interface GroupEdtorListener {
        void groupEdit(int groupPosition);
    }

    class ChildViewHolder {
        CheckBox cbChild;
        TextView tv_intro;
        SimpleDraweeView imgIcon;
        TextView tv_price;
        TextView tv_del;
        ImageView bt_del,bt_add;
        EditText et_num;
        //        TextView tv_num;
        LinearLayout ll_edtor;
        RelativeLayout rl_no_edtor;
        AddDeleteView adv;
        ImageView iv_del;
        ImageView iv_add;
        TextView tv_num;
    }

    /**
     * 改变全选的状态
     *
     * @param flag
     */
    private void changeAllCbState(boolean flag) {
        MessageEvent messageEvent = new MessageEvent();
        messageEvent.setChecked(flag);
        EventBus.getDefault().post(messageEvent);
    }

    /**
     * 改变一级列表checkbox状态
     *
     * @param groupPosition
     */
    private void changGroupCbState(int groupPosition, boolean flag) {
        CartsBean.DataBean dataBean = list.get(groupPosition);
        dataBean.setChecked(flag);
    }

    /**
     * 改变二级列表checkbox状态
     *
     * @param groupPosition
     * @param flag
     */
    private void changeChildCbState(int groupPosition, boolean flag) {
        List<CartsBean.DataBean.ListBean> datasBeen = list.get(groupPosition).getList();

        for (int i = 0; i < datasBeen.size(); i++) {
            CartsBean.DataBean.ListBean datasBean = datasBeen.get(i);

            datasBean.setChecked(flag);
        }
    }

    /**
     * 判断一级列表是否全部选中
     *
     * @return
     */
    private boolean isAllGroupCbSelected() {
        for (int i = 0; i < list.size(); i++) {
            CartsBean.DataBean dataBean = list.get(i);
            if (!dataBean.isChecked()) {
                return false;
            }
        }
        return true;
    }

    /**
     * 判断二级列表是否全部选中
     *
     * @param groupPosition
     * @return
     */
    private boolean isAllChildCbSelected(int groupPosition) {
        List<CartsBean.DataBean.ListBean> datasBeen = list.get(groupPosition).getList();
        for (int i = 0; i < datasBeen.size(); i++) {
            CartsBean.DataBean.ListBean datasBean = datasBeen.get(i);
            if (!datasBean.isChecked()) {
                return false;
            }
        }
        return true;
    }

    /**
     * 计算列表中,选中的钱和数量
     */
    private PriceAndCountEvent compute() {
        int count = 0;
        int price = 0;
        for (int i = 0; i < list.size(); i++) {
            List<CartsBean.DataBean.ListBean> datasBeen = list.get(i).getList();
            for (int j = 0; j < datasBeen.size(); j++) {
                CartsBean.DataBean.ListBean datasBean = datasBeen.get(j);
                if (datasBean.isChecked()) {
                    price += datasBean.getNum() * datasBean.getPrice();
                    count += datasBean.getNum();
                }
            }
        }
        PriceAndCountEvent priceAndCountEvent = new PriceAndCountEvent();
        priceAndCountEvent.setCount(count);
        priceAndCountEvent.setPrice(price);
        return priceAndCountEvent;
    }

    /**
     * 设置全选、反选
     *
     * @param flag
     */
    public void changeAllListCbState(boolean flag) {
        for (int i = 0; i < list.size(); i++) {
            changGroupCbState(i, flag);
            changeChildCbState(i, flag);
        }
        EventBus.getDefault().post(compute());
        notifyDataSetChanged();
    }
    /**
     * 是否显示可编辑
     *
     * @param flag
     */
    public void isShow(boolean flag) {
        isShow = flag;
        notifyDataSetChanged();
    }
}

ShowAdapter

package com.example.yuekaolication.Adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.yuekaolication.Bean.ProductsBean;
import com.example.yuekaolication.R;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by lenovo on 2018/1/17.
 */

public class ShowAdapter  extends RecyclerView.Adapter<ShowAdapter.ViewHolder> {
        private Context context;
    private List<ProductsBean.DataBean> list;

    public ShowAdapter(Context context, List<ProductsBean.DataBean> list) {
        this.context = context;
        this.list = list;
    }
    private OnItemClickListener mOnItemClickListener;

    public interface OnItemClickListener{
        void onClick(int position);
        void onLongClick(int position);
    }
    public void setOnItemClickListener(OnItemClickListener onItemClickListener ){
        this. mOnItemClickListener=onItemClickListener;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(context, R.layout.show_item, null);
        ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        String[] split = list.get(position).getImages().split("[|]");
        holder.itemImg.setImageURI(split[0]);
        holder.itemPrice.setText("¥"+list.get(position).getPrice());
        holder.itemTitle.setText(list.get(position).getTitle());
        if( mOnItemClickListener!= null){
            holder.itemView.setOnClickListener( new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mOnItemClickListener.onClick(position);
                }
            });
            holder. itemView.setOnLongClickListener( new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    mOnItemClickListener.onLongClick(position);
                    return false;
                }
            });
        }
    }

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

    public class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.item_img)
        SimpleDraweeView itemImg;
        @BindView(R.id.item_price)
        TextView itemPrice;
        @BindView(R.id.item_title)
        TextView itemTitle;
        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}

CartActivity

package com.example.yuekaolication;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuekaolication.Adapter.ShopCartExListAdapter;
import com.example.yuekaolication.Bean.CartsBean;
import com.example.yuekaolication.Bean.MessageEvent;
import com.example.yuekaolication.Bean.PriceAndCountEvent;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class CartActivity extends AppCompatActivity implements IView {
    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.subtitle)
    TextView subtitle;
    @BindView(R.id.top_bar)
    LinearLayout topBar;
    @BindView(R.id.exListView)
    ExpandableListView exListView;
    @BindView(R.id.all_chekbox)
    CheckBox allChekbox;
    @BindView(R.id.tv_total_price)
    TextView tvTotalPrice;
    @BindView(R.id.tv_go_to_pay)
    TextView tvGoToPay;
    @BindView(R.id.ll_info)
    LinearLayout llInfo;
    @BindView(R.id.tv_share)
    TextView tvShare;
    @BindView(R.id.tv_save)
    TextView tvSave;
    @BindView(R.id.tv_delete)
    TextView tvDelete;
    @BindView(R.id.ll_shar)
    LinearLayout llShar;
    @BindView(R.id.ll_cart)
    LinearLayout llCart;

    private int count = 0;
    private List<CartsBean.DataBean> list = new ArrayList<>();
    private ShopCartExListAdapter adapter;
    private boolean flag = false;
    private int totalCount = 0;
    private double totalPrice = 0.00;
    private CartPresenter presenter;
    private String uid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cart);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
        uid = getIntent().getStringExtra("uid");
        getData();
    }


    private void getData() {
        presenter = new CartPresenter();
        presenter.attachView(this);
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("source", "android");
        presenter.getCartsData(map);
        adapter = new ShopCartExListAdapter(this, list);
        exListView.setAdapter(adapter);
    }

    @Override
    public void onSuccess(Object o) {
        if (o !=null) {
            CartsBean cartsBean = (CartsBean) o;
            List<CartsBean.DataBean> dataBean = cartsBean.getData();
            list.addAll(dataBean);
            adapter.notifyDataSetChanged();
            for (int i = 0; i < adapter.getGroupCount(); i++) {
                exListView.expandGroup(i);
            }
        }
    }


    @Override
    public void onFailed(Exception e) {

    }

    public void delete() {

        for (int i = 0; i < list.size(); i++) {
            List<CartsBean.DataBean.ListBean> listbean = list.get(i).getList();
            for (int j = 0; j < listbean.size(); j++) {
                CartsBean.DataBean.ListBean listBean = listbean.get(j);
                if (listBean.isChecked()) {
                    listbean.remove(j);
                    j--;
                    if (listbean.size() == 0) {
                        list.remove(i);
                        i--;
                    }
                }
            }
        }
        adapter.notifyDataSetChanged();
    }

    @OnClick({R.id.all_chekbox, R.id.tv_share, R.id.tv_save, R.id.tv_delete, R.id.subtitle, R.id.tv_go_to_pay,R.id.back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.all_chekbox:
                adapter.changeAllListCbState(allChekbox.isChecked());
                break;
            case R.id.tv_share:
                Toast.makeText(this, "分享成功", Toast.LENGTH_SHORT).show();
                break;
            case R.id.tv_save:
                Toast.makeText(this, "加入成功", Toast.LENGTH_SHORT).show();
                break;
            case R.id.tv_delete:
                AlertDialog dialog;
                if (totalCount == 0) {
                    Toast.makeText(CartActivity.this, "请选择要删除的商品", Toast.LENGTH_SHORT).show();
                    return;
                }
                dialog = new AlertDialog.Builder(CartActivity.this).create();
                dialog.setTitle("操作提示");
                dialog.setMessage("您确定要将这些商品从购物车中移除吗?");
                dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        return;
                    }
                });
                dialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        delete();
                        Toast.makeText(CartActivity.this, "删除成功", Toast.LENGTH_SHORT).show();
                    }
                });
                dialog.show();
                break;
            case R.id.subtitle:
                flag = !flag;
                if (flag) {
                    subtitle.setText("完成");
                    llShar.setVisibility(View.VISIBLE);
                    llInfo.setVisibility(View.GONE);
                } else {
                    subtitle.setText("编辑");
                    llShar.setVisibility(View.GONE);
                    llInfo.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.tv_go_to_pay:
                AlertDialog alert;
                if (totalCount == 0) {
                    Toast.makeText(this, "请选择要支付的商品", Toast.LENGTH_LONG).show();
                    return;
                }
                alert = new AlertDialog.Builder(this).create();
                alert.setTitle("操作提示");
                alert.setMessage("总计:\n" + totalCount + "种商品\n" + totalPrice + "元");
                alert.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                return;
                            }
                        });
                alert.setButton(DialogInterface.BUTTON_POSITIVE, "确定",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Intent intent = new Intent(CartActivity.this, DingdanActivity.class);
                                startActivity(intent);
                            }
                        });
                alert.show();
                break;
            case R.id.back:
                finish();
                break;
        }
    }

    @Subscribe
    public void onMessageEvent(MessageEvent event) {
        allChekbox.setChecked(event.isChecked());
    }

    @Subscribe
    public void onMessageEvent(PriceAndCountEvent event) {
        tvGoToPay.setText("结算(" + event.getCount() + ")");
        tvTotalPrice.setText("¥" + event.getPrice());
        totalCount = event.getCount();
        totalPrice = event.getPrice();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter!=null){
            presenter.dattachView();
        }
    }
}

DingdanActivity
package com.example.yuekaolication;

import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yuekaolication.Adapter.DingdanAdapter;
import com.example.yuekaolication.Bean.DinganBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;
import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DingdanActivity extends AppCompatActivity implements IView {
    private int num = 1;
    @BindView(R.id.img_duo)
    ImageView mImgDuo;
    @BindView(R.id.rv)
    XRecyclerView mRv;
    @BindView(R.id.textview1)
    TextView mTextview1;
    @BindView(R.id.textview2)
    TextView mTextview2;
    @BindView(R.id.textview3)
    TextView mTextview3;
    private DingdanAdapter dingdanAdapter;
    private CartPresenter presenter;
    private HashMap<String, String> map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dingdan);
        ButterKnife.bind(this);

        getData(1);
        LinearLayoutManager manager = new LinearLayoutManager(this);
        mRv.setLayoutManager(manager);
        mRv.setPullRefreshEnabled(true);
        mRv.setLoadingMoreEnabled(true);
        mRv.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
        mRv.setLoadingMoreProgressStyle(ProgressStyle.Pacman);

        mRv.setLoadingListener(new XRecyclerView.LoadingListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {
                    public void run() {
                        num = 1;
                        getData(num);
                        dingdanAdapter.notifyDataSetChanged();
                        mRv.refreshComplete();
                    }

                }, 2000);

            }

            @Override
            public void onLoadMore() {
                new Handler().postDelayed(new Runnable() {
                    public void run() {
                        num++;
                        getData(num);
                        dingdanAdapter.notifyDataSetChanged();
                        mRv.refreshComplete();
                    }
                }, 2000);

            }
        });


    }

    @OnClick({R.id.img_duo, R.id.rv, R.id.textview1, R.id.textview2, R.id.textview3})
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
            case R.id.img_duo:
                break;
            case R.id.rv:
                break;
            case R.id.textview1:
                break;
            case R.id.textview2:
                break;
            case R.id.textview3:
                break;
        }
    }
    public void getData(int count) {
        presenter = new CartPresenter();
        map = new HashMap<>();
        //pscid=39&page=1
        map.put("uid", "71");
        map.put("page", count + "");
        presenter.getDingdanData(map);
        presenter.attachView(this);
    }
    @Override
    public void onSuccess(Object o) {
        if (o != null) {
            DinganBean bean = (DinganBean) o;
            Log.i("zzz", "onSuccess: " + bean.getMsg());
            final List<DinganBean.DataBean> data = bean.getData();
            dingdanAdapter = new DingdanAdapter(this, data);
            mRv.setAdapter(dingdanAdapter);
        }
    }

    @Override
    public void onFailed(Exception e) {

    }
}

MainActivity
package com.example.yuekaolication;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuekaolication.Bean.LoginBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;
import com.facebook.drawee.view.SimpleDraweeView;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {
    @BindView(R.id.image_user)
    SimpleDraweeView imageUser;
    @BindView(R.id.et_name)
    EditText etName;
    @BindView(R.id.et_psw)
    EditText etPsw;
    @BindView(R.id.lin)
    LinearLayout lin;
    @BindView(R.id.forget_psw)
    TextView forgetPsw;
    @BindView(R.id.tv_regist)
    TextView tvRegist;
    @BindView(R.id.btn_login)
    Button btnLogin;
    private HashMap<String, String> map;
    private CartPresenter presenter;
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tv_regist, R.id.btn_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_regist:
                final Intent intent = new Intent(MainActivity.this, RegistActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_login:
                String name = etName.getText().toString().trim();
                String psw = etPsw.getText().toString().trim();
                String md5 = md5(psw);
                Log.i(TAG, "onViewClicked: "+psw);
                map = new HashMap<>();
                map.put("mobile",name);
                map.put("password",psw);
                presenter = new CartPresenter();
                presenter.getloginData(map);
                presenter.attachView(new IView() {
                    @Override
                    public void onSuccess(Object o) {
                        if (o!=null){
                            LoginBean bean = (LoginBean) o;
                            Toast.makeText(MainActivity.this, bean.getMsg(), Toast.LENGTH_SHORT).show();
                            if(bean.getMsg().equals("登录成功")){
                                Intent intent1 = new Intent(MainActivity.this, ShowActivity.class);
                                intent1.putExtra("uid",bean.getData().getUid()+"");
                                startActivity(intent1);
                            }
                        }
                    }

                    @Override
                    public void onFailed(Exception e) {

                    }
                });
                break;
        }
    }

    public static String md5(String string) {
        byte[] hash;
        try {
            hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("Huh, MD5 should be supported?", e);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Huh, UTF-8 should be supported?", e);
        }

        StringBuilder hex = new StringBuilder(hash.length * 2);
        for (byte b : hash) {
            if ((b & 0xFF) < 0x10) hex.append("0");
            hex.append(Integer.toHexString(b & 0xFF));
        }
        return hex.toString();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter!=null){
            presenter.dattachView();
        }
    }
}
RegistActivity
package com.example.yuekaolication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.yuekaolication.Bean.RegistBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;

import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class RegistActivity extends AppCompatActivity {

    @BindView(R.id.regist_back)
    ImageView registBack;
    @BindView(R.id.regist_name)
    EditText registName;
    @BindView(R.id.regist_psw)
    EditText registPsw;
    @BindView(R.id.regist_psw1)
    EditText registPsw1;
    @BindView(R.id.regist_email)
    EditText registEmail;
    @BindView(R.id.btn_regist)
    Button btnRegist;
    private HashMap<String, String> map;
    private CartPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_regist);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.regist_back, R.id.btn_regist})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.regist_back:
                finish();
                break;
            case R.id.btn_regist:
                String name = registName.getText().toString().trim();
                String psw = registPsw.getText().toString().trim();
                String psw1 = registPsw1.getText().toString().trim();
                String email = registEmail.getText().toString().trim();
                if (psw.equals(psw1)){
                    if (email!=null){
                        presenter = new CartPresenter();
                        map = new HashMap<>();
                        map.put("mobile",name);
                        map.put("password",psw);
                        presenter.getRegistData(map);
                        presenter.attachView(new IView() {
                            @Override
                            public void onSuccess(Object o) {
                                if (o!=null){
                                    RegistBean bean = (RegistBean) o;
                                    Toast.makeText(RegistActivity.this,bean.getMsg(), Toast.LENGTH_SHORT).show();
                                    if (bean.getMsg().equals("注册成功")){
                                        finish();
                                    }
                                }
                            }

                            @Override
                            public void onFailed(Exception e) {

                            }
                        });
                    }else {
                        Toast.makeText(this, "邮箱不能为空!", Toast.LENGTH_SHORT).show();
                    }
                }else {
                    Toast.makeText(this, "两密码不一致!", Toast.LENGTH_SHORT).show();
                }
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter!=null){
            presenter.dattachView();
        }
    }
}

ShowActivity
package com.example.yuekaolication;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;

import com.example.yuekaolication.Adapter.ShowAdapter;
import com.example.yuekaolication.Bean.ProductsBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;
import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ShowActivity extends AppCompatActivity implements IView {
    private int num = 1;
    @BindView(R.id.xrecyclerView)
    XRecyclerView xRecyclerView;
    private CartPresenter presenter;
    private HashMap<String, String> map;
    private ShowAdapter adapter;
    private String uid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show);
        ButterKnife.bind(this);

        uid = getIntent().getStringExtra("uid");
        getData(num);
        LinearLayoutManager manager = new LinearLayoutManager(this);
        xRecyclerView.setLayoutManager(manager);
        xRecyclerView.setPullRefreshEnabled(true);
        xRecyclerView.setLoadingMoreEnabled(true);
        xRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
        xRecyclerView.setLoadingMoreProgressStyle(ProgressStyle.Pacman);

        xRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {
                    public void run() {
                        num = 1;
                        getData(num);
                        adapter.notifyDataSetChanged();
                        xRecyclerView.refreshComplete();
                    }

                }, 2000);

            }

            @Override
            public void onLoadMore() {
                new Handler().postDelayed(new Runnable() {
                    public void run() {
                        num++;
                        getData(num);
                        adapter.notifyDataSetChanged();
                        xRecyclerView.refreshComplete();
                    }
                }, 2000);

            }
        });


    }

    public void getData(int count) {
        presenter = new CartPresenter();
        map = new HashMap<>();
        //pscid=39&page=1
        map.put("pscid", "39");
        map.put("page", count + "");
        presenter.getProductData(map);
        presenter.attachView(this);
    }

    @Override
    public void onSuccess(Object o) {
        if (o != null) {
                    ProductsBean bean = (ProductsBean) o;
                    Log.i("zzz", "onSuccess: " + bean.getMsg());
                    final List<ProductsBean.DataBean> data = bean.getData();
                    adapter = new ShowAdapter(this, data);
                    xRecyclerView.setAdapter(adapter);
                    adapter.setOnItemClickListener(new ShowAdapter.OnItemClickListener() {
                        @Override
                        public void onClick(int position) {
                            Intent intent = new Intent(ShowActivity.this, ShowsActivity.class);
                            intent.putExtra("pid",data.get(position).getPid()+"");
                            intent.putExtra("uid",uid);
                            startActivity(intent);
                        }

                @Override
                public void onLongClick(int position) {

                }
            });
        }
    }

    @Override
    public void onFailed(Exception e) {

    }
}

ShowsActivity

package com.example.yuekaolication;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuekaolication.Bean.AddBean;
import com.example.yuekaolication.Bean.ShowsBean;
import com.example.yuekaolication.Presenter.CartPresenter;
import com.example.yuekaolication.Presenter.IView;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ShowsActivity extends AppCompatActivity {
    @BindView(R.id.regist_back)
    ImageView registBack;
    @BindView(R.id.shows_img)
    SimpleDraweeView showsImg;
    @BindView(R.id.shows_title)
    TextView showsTitle;
    @BindView(R.id.shows_price)
    TextView showsPrice;
    @BindView(R.id.cart)
    Button cart;
    @BindView(R.id.add_cart)
    Button addCart;
    private CartPresenter presenter;
    private HashMap<String, String> map;
    private String pid;
    private CartPresenter presenter1;
    private String uid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shows);
        ButterKnife.bind(this);
        pid = getIntent().getStringExtra("pid");
        uid = getIntent().getStringExtra("uid");
        Log.i("fff", "onCreate: "+ pid);
        presenter = new CartPresenter();
        map = new HashMap<>();
        map.put("pid", pid);
        map.put("source", "android");
        presenter.getShowsData(map);
        presenter.attachView(new IView() {
            @Override
            public void onSuccess(Object o) {
                if (o != null) {
                    ShowsBean bean = (ShowsBean) o;
                    Log.i("fff", "onSuccess: "+bean.getMsg());
                    String[] split = bean.getData().getImages().split("[|]");
                    showsImg.setImageURI(split[0]);
                    showsTitle.setText(bean.getData().getTitle());
                    showsPrice.setText("¥"+bean.getData().getPrice());
                }
            }

            @Override
            public void onFailed(Exception e) {

            }
        });

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter != null) {
            presenter.dattachView();
        }
    }

    @OnClick({R.id.regist_back, R.id.cart, R.id.add_cart})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.regist_back:
                finish();
                break;
            case R.id.cart:
                Intent intent = new Intent(ShowsActivity.this, CartActivity.class);
                intent.putExtra("uid",uid);
                startActivity(intent);
                break;
            case R.id.add_cart:
                HashMap<String, String> map = new HashMap<>();
                map.put("uid",uid);
                map.put("pid",pid);
                map.put("source","android");
                presenter.getAddData(map);
                presenter.attachView(new IView() {
                    @Override
                    public void onSuccess(Object o) {
                        if (o!=null){
                            AddBean bean = (AddBean) o;
                            Toast.makeText(ShowsActivity.this, bean.getMsg(), Toast.LENGTH_SHORT).show();
                        }
                    }

                    @Override
                    public void onFailed(Exception e) {

                    }
                });
                break;
        }
    }
}

activity_cart

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.yuekaolication.CartActivity"
    android:orientation="vertical">
    <LinearLayout
        android:id="@+id/top_bar"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:orientation="vertical" >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:orientation="vertical" >

            <ImageView
                android:id="@+id/back"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_alignParentLeft="true"
                android:layout_gravity="center_vertical"
                android:layout_marginTop="10dp"
                android:src="@mipmap/fanhui1" />
            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:minHeight="48dp"
                android:text="购物车"
                android:textColor="#1a1a1a"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp"
                android:gravity="center"
                android:minHeight="48dp"
                android:text="编辑"
                android:textColor="#1a1a1a"
                android:textSize="14sp"
                android:visibility="visible" />
        </RelativeLayout>
    </LinearLayout>
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        <LinearLayout
            android:id="@+id/ll_cart"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"

            >
            <ExpandableListView
                android:id="@+id/exListView"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:childIndicator="@null"
                android:groupIndicator="@null" >
            </ExpandableListView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <CheckBox
                    android:id="@+id/all_chekbox"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_gravity="center_vertical"
                    android:layout_marginRight="4dp"
                    android:gravity="center"
                    android:focusable="false"
                    android:layout_marginLeft="10dp"
                    android:text="全选"
                    />
                <LinearLayout
                    android:id="@+id/ll_info"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="4"
                    >
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:layout_marginRight="20dp"
                        android:layout_weight="1"
                        >
                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:gravity="right"
                            >
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="5dp"
                                android:text="合计:"
                                android:textSize="18sp"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_price"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="¥0.00"
                                android:textColor="#000"
                                android:textSize="16sp"
                                android:textStyle="bold" />
                        </LinearLayout>
                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="不含运费"
                            android:gravity="right"
                            android:textColor="#000"
                            android:textSize="16sp"
                            android:textStyle="bold" />
                    </LinearLayout>
                    <TextView
                        android:id="@+id/tv_go_to_pay"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="3"
                        android:background="#f00"
                        android:clickable="true"
                        android:gravity="center"
                        android:text="结算(0)"
                        android:textColor="#FAFAFA"

                        />
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/ll_shar"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="4"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    >
                    <TextView
                        android:id="@+id/tv_share"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:layout_weight="1"
                        android:layout_marginLeft="5dp"
                        android:text="分享宝贝"
                        android:background="#ef930a"
                        android:textColor="#fff"
                        android:textSize="16sp"
                        android:layout_marginRight="5dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tv_save"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:text="移到收藏夹"
                        android:background="#ef930a"
                        android:textColor="#fff"
                        android:layout_marginRight="5dp"
                        android:textSize="16sp"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/tv_delete"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:background="#f00"
                        android:clickable="true"
                        android:gravity="center"
                        android:text="删除"
                        android:textColor="#FAFAFA"
                        />
                </LinearLayout>

            </LinearLayout>
        </LinearLayout>
    </FrameLayout>
</LinearLayout >
activity_dingdan

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

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="订单列表"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true" />

        <ImageView
            android:id="@+id/img_duo"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/lv_icon"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    </RelativeLayout>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="#000"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textview1"
            android:gravity="center"
            android:text="待支付"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:background="#000"/>
        <TextView
            android:id="@+id/textview2"
            android:gravity="center"
            android:text="已支付"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:background="#000"/>
        <TextView
            android:id="@+id/textview3"
            android:gravity="center"
            android:text="已取消"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </LinearLayout>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="#000"/>
    <com.jcodecraeer.xrecyclerview.XRecyclerView
        android:id="@+id/rv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </com.jcodecraeer.xrecyclerview.XRecyclerView>


</LinearLayout>

activity_main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fresco="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.yuekaolication.MainActivity">

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/image_user"
        fresco:placeholderImage="@mipmap/ic_launcher"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_centerHorizontal="true"
        fresco:roundAsCircle="true"
        />
    <LinearLayout
        android:id="@+id/lin"
        android:layout_below="@+id/image_user"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <EditText
            android:id="@+id/et_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="手机号/会员号/邮箱"
            />
        <EditText
            android:id="@+id/et_psw"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="请输入密码"
            android:password="true"
            />
    </LinearLayout>
    <TextView
        android:id="@+id/forget_psw"
        android:layout_below="@+id/lin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="忘记密码"
        />
    <TextView
        android:id="@+id/tv_regist"
        android:layout_below="@+id/lin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="新用户注册"
        android:layout_alignParentRight="true"
        />
    <Button
        android:id="@+id/btn_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="登录"
        android:textColor="#fff"
        android:layout_below="@+id/forget_psw"
        android:background="#cce68b13"
        />


</RelativeLayout >

activity_regist
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.yuekaolication.RegistActivity"
    android:orientation="vertical">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#cce68b13"
        >
        <ImageView
            android:id="@+id/regist_back"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@mipmap/fanhui1"
            android:layout_centerVertical="true"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新用户注册"
            android:textSize="20sp"
            android:textColor="#fff"
            android:layout_centerInParent="true"
            />
    </RelativeLayout>
    <EditText
        android:id="@+id/regist_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入用户名"
        android:layout_marginTop="10dp"
        />
    <EditText
        android:id="@+id/regist_psw"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入密码"
        android:password="true"
        android:layout_marginTop="10dp"
        />
    <EditText
        android:id="@+id/regist_psw1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="确认输入密码"
        android:password="true"
        android:layout_marginTop="10dp"
        />
    <EditText
        android:id="@+id/regist_email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请填写邮箱"
        android:layout_marginTop="10dp"
        />
    <Button
        android:id="@+id/btn_regist"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#cce68b13"
        android:text="注册"
        android:textColor="#fff"
        android:layout_marginTop="10dp"
        />

</LinearLayout >
activity_show

<?xml version="1.0" encoding="utf-8"?>
<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="com.example.yuekaolication.ShowActivity">
    <com.jcodecraeer.xrecyclerview.XRecyclerView
        android:id="@+id/xrecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"></com.jcodecraeer.xrecyclerview.XRecyclerView>
</RelativeLayout>
activity_shows

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:fresco="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.yuekaolication.ShowsActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#cce68b13"
            >
            <ImageView
                android:id="@+id/regist_back"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:src="@mipmap/fanhui1"
                android:layout_centerVertical="true"
                />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="商品详情"
                android:textSize="20sp"
                android:textColor="#fff"
                android:layout_centerInParent="true"
                />
        </RelativeLayout>
        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/shows_img"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            fresco:placeholderImage="@mipmap/ic_launcher"
            />
        <TextView
            android:id="@+id/shows_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:text="标题"
            />
        <TextView
            android:id="@+id/shows_price"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:text="价格"
            android:layout_marginTop="10dp"
            android:textColor="#ddd67813"
            />


    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        >
        <Button
            android:id="@+id/cart"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="购物车"
            android:background="#e59114"
            />
        <Button
            android:id="@+id/add_cart"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="加入购物车"
            android:background="#cd1b18"
            />

    </LinearLayout>
</RelativeLayout>

item_main
<?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="match_parent"
    android:orientation="vertical">
    <RelativeLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    <RelativeLayout
        android:id="@+id/rl1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/tv_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="dwqeeqwq"
            />

        <TextView
            android:id="@+id/tv_wen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="待支付" />
    </RelativeLayout>


    <TextView
        android:id="@+id/tv_price"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/rl1"
        android:textColor="#F00"
        android:text="dwqeeqwq" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_price">

        <TextView
            android:id="@+id/tv_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:text="wdqdwqd"
            android:layout_centerVertical="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:id="@+id/btn"
            android:text="查看订单" />
    </RelativeLayout>
    </RelativeLayout>
</LinearLayout>

item_shopcart_group
<?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="match_parent"
    android:orientation="vertical">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white" >

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

        <TextView
            android:id="@+id/tv_source_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/determine_chekbox"
            android:background="#ffffffff"
            android:drawablePadding="10dp"
            android:text="第八号当铺"
            android:textColor="#000"
            android:gravity="center"
            android:textSize="18dp" />
        <TextView
            android:id="@+id/tv_store_edtor"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="14dp"
            android:textSize="18dp"
            android:background="@null"
            android:text="编辑"/>
    </RelativeLayout>

</LinearLayout>

item_shopcart_product
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent"
    android:orientation="vertical"  >
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#CCCCCC" />

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

        <CheckBox
            android:id="@+id/check_box"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="4dp"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:gravity="center"
            android:minHeight="64dp"
            android:minWidth="32dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:visibility="visible" />

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/iv_adapter_list_pic"
            android:layout_width="85dp"
            android:layout_height="85dp"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="13dp"
            android:scaleType="centerCrop"
            />

        <RelativeLayout
            android:id="@+id/rl_no_edtor"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="13dp"
            >

            <TextView
                android:id="@+id/tv_intro"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginTop="20dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:text="第八号店铺"
                android:textColor="#000"
                android:singleLine="true"
                />
            <TextView
                android:id="@+id/tv_color_size"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="颜色:黑色;尺码:29"
                android:layout_marginTop="5dp"
                android:textColor="#000"
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_marginBottom="20dp"
                android:layout_alignParentStart="true">

                <TextView
                    android:id="@+id/tv_price"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:singleLine="true"
                    android:text="¥ 308.00"
                    android:textColor="#000"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/tv_discount_price"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="10dp"
                    android:layout_toRightOf="@+id/tv_price"
                    android:text=""
                    />
                <TextView
                    android:id="@+id/tv_buy_num"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="20dp"
                    android:layout_alignParentRight="true"
                    android:text="X 1"
                    android:textColor="#000"
                    />
            </RelativeLayout>
        </RelativeLayout>
        <LinearLayout
            android:id="@+id/ll_edtor"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="13dp"
            android:visibility="gone"
            android:orientation="horizontal">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">
                <RelativeLayout
                    android:id="@+id/ll_change_num"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:layout_marginTop="20dp"
                    android:orientation="horizontal">
                    <com.example.yuekaolication.Presenter.AddDeleteView
                        android:id="@+id/adv_main"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:left_text="-"
                        app:middle_text="3"
                        app:right_text="+"
                        >
                    </com.example.yuekaolication.Presenter.AddDeleteView>

                </RelativeLayout>

                <TextView
                    android:id="@+id/tv_colorsize"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:gravity="center"
                    android:text="颜色:黑色;尺码:29"
                    android:layout_gravity="left"
                    android:textColor="#000"/>
            </LinearLayout>

            <TextView
                android:id="@+id/tv_goods_delete"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:text="删除"
                android:background="#ecb74c"
                android:gravity="center"
                android:layout_gravity="center"
                android:textColor="#fff"/>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

layout_add_delete
<?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="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        >
        <Button
            android:id="@+id/but_delete"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="-"
            />
        <TextView
            android:id="@+id/et_number"
            android:layout_width="40dp"
            android:inputType="number"
            android:layout_height="wrap_content"
            android:gravity="center"

            />
        <Button
            android:id="@+id/but_add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="+"
            />
    </LinearLayout>

</LinearLayout>

show_item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:fresco="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent"
    android:orientation="vertical"  >
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="120dp">
        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/item_img"
            android:layout_width="120dp"
            android:layout_height="120dp"
            fresco:placeholderImage="@mipmap/ic_launcher"
            />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >
            <TextView
                android:id="@+id/item_price"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="价格"
                android:textSize="20sp"
                />
            <TextView
                android:id="@+id/item_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="商品"
                android:textSize="20sp"
                android:layout_marginTop="5dp"
                />

        </LinearLayout>
    </LinearLayout>
</LinearLayout>






猜你喜欢

转载自blog.csdn.net/zh_binfgan/article/details/79092109