简单的二级购物车

来源:互联网 发布:linux使用gdb 编辑:程序博客网 时间:2024/05/22 00:47

1.权限 依赖

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
 compile 'com.squareup.okhttp3:okhttp:3.9.1'    compile 'com.jakewharton:butterknife:8.8.1'    annotationProcessor'com.jakewharton:butterknife-compiler:8.8.1'    compile 'com.github.bumptech.glide:glide:3.7.0'     compile 'com.google.code.gson:gson:2.8.1'

2.布局(5个)

2.1–activity_main.xml(自定义空件一定要在自己的包下)

<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.mylasst.MainActivity"    >    <com.example.mylasst.ZdY.CarTitleView        android:id="@+id/ctv_title"        android:layout_width="match_parent"        android:layout_height="40dp"/>    <ExpandableListView        android:id="@+id/pt_lv"        android:layout_below="@id/ctv_title"        android:descendantFocusability = "blocksDescendants"        android:divider="@null"        android:scrollbars="none"        android:layout_width="match_parent"        android:layout_height="wrap_content">    </ExpandableListView>    <LinearLayout        android:visibility="gone"        android:orientation="vertical"        android:id="@+id/ll_toBuy"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <ImageView            android:src="@mipmap/ic_launcher"            android:layout_width="match_parent"            android:layout_height="wrap_content" />        <Button            android:layout_gravity="center"            android:id="@+id/btn_toBuy"            android:text="去逛逛"            android:layout_width="wrap_content"            android:layout_height="wrap_content" />    </LinearLayout>    <LinearLayout        android:id="@+id/lll_one"        android:orientation="horizontal"        android:visibility="visible"        android:background="#FFFFFF"        android:layout_alignParentBottom="true"        android:layout_width="match_parent"        android:layout_height="50dp">        <CheckBox            android:layout_gravity="center"            android:id="@+id/cb_all"            android:text="全选"            android:textSize="16dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="wrap_content" />        <TextView            android:id="@+id/tv_rental"            android:layout_marginLeft="20dp"            android:gravity="center_vertical"            android:text="合计:¥0"            android:textSize="20dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="match_parent" />        <TextView            android:id="@+id/tv_num"            android:layout_marginLeft="10dp"            android:gravity="center_vertical"            android:text="数量:0"            android:textSize="20dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="match_parent" />        <Button            android:id="@+id/btn_goto"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_gravity="right"            android:gravity="center"            android:layout_height="match_parent"            android:background="#cc0000"            android:text="去结算"            android:textColor="#FFFF"            android:textSize="20dp" />    </LinearLayout>    <LinearLayout        android:id="@+id/l_two"        android:orientation="horizontal"        android:visibility="gone"        android:background="#FFFFFF"        android:layout_alignParentBottom="true"        android:layout_width="match_parent"        android:layout_height="50dp">        <CheckBox            android:layout_gravity="center"            android:id="@+id/cb_alldel"            android:text="全选"            android:textSize="16dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="wrap_content" />        <TextView            android:layout_marginLeft="20dp"            android:gravity="center_vertical"            android:text="分享"            android:textSize="20dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="match_parent" />        <TextView            android:layout_marginLeft="10dp"            android:gravity="center_vertical"            android:text="移出关注"            android:textSize="20dp"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="match_parent" />        <Button            android:id="@+id/btn_delete_all"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_gravity="right"            android:gravity="center"            android:layout_height="match_parent"            android:text="删除"            android:textColor="#FFFF"            android:textSize="20dp" />    </LinearLayout></RelativeLayout>

2.2–car_shop_fragment.xml

<LinearLayout    android:background="#F0F2F5"    android:orientation="vertical"    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent">    <LinearLayout        android:background="#F7FBF7"        android:layout_width="match_parent"        android:layout_height="200dp">        <CheckBox            android:id="@+id/rb_commodity"            android:layout_gravity="center"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="wrap_content" />        <LinearLayout            android:layout_marginLeft="10dp"            android:orientation="horizontal"            android:layout_width="0dp"            android:layout_weight="9"            android:layout_height="300dp">            <ImageView                android:gravity="center"                android:id="@+id/iv_commodityImg"                android:layout_width="80dp"                android:layout_height="80dp" />            <LinearLayout                android:orientation="vertical"                android:layout_width="match_parent"                android:layout_height="match_parent">                <TextView                    android:id="@+id/tv_commodityName"                    android:gravity="center"                    android:layout_width="match_parent"                    android:layout_weight="1"                    android:layout_height="0dp" />                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="0dp"                    android:layout_weight="1">                    <TextView                        android:textSize="20dp"                        android:id="@+id/tv_commodityPrice"                        android:layout_width="0dp"                        android:layout_weight="1"                        android:layout_marginTop="20dp"                        android:layout_height="wrap_content"                        android:text="ooooooo" />                    <LinearLayout                        android:id="@+id/ll_num"                        android:layout_width="0dp"                        android:layout_weight="1"                        android:gravity="right"                        android:layout_height="match_parent"                        >                        <Button                            android:id="@+id/btn_delete"                            android:layout_width="0dp"                            android:layout_weight="1"                            android:layout_height="wrap_content"/>                        <EditText                            android:id="@+id/et_num"                            android:gravity="center"                            android:layout_width="0dp"                            android:layout_weight="2"                            android:layout_height="wrap_content" />                        <Button                            android:id="@+id/btn_add"                            android:layout_width="0dp"                            android:layout_weight="1"                            android:layout_height="wrap_content" />                    </LinearLayout>                </LinearLayout>            </LinearLayout>        </LinearLayout>    </LinearLayout></LinearLayout>

2.3–car_shop_one_fragment.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent">    <LinearLayout        android:layout_marginTop="20dp"        android:background="#F8F8F8"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <CheckBox            android:id="@+id/rb_shop"            android:layout_width="0dp"            android:layout_weight="1"            android:layout_height="wrap_content" />        <TextView            android:id="@+id/tv_shopName"            android:layout_marginLeft="10dp"            android:textSize="20dp"            android:layout_width="0dp"            android:layout_weight="9"            android:layout_height="wrap_content">        </TextView>    </LinearLayout></LinearLayout>

2.4–car_title_fragment.xml

<LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent">    <LinearLayout        android:orientation="horizontal"        android:background="#FFFFFF"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <LinearLayout            android:orientation="horizontal"            android:layout_width="0dp"            android:layout_weight="7"            android:layout_height="wrap_content">            <TextView                android:text="购物车"                android:layout_marginTop="12dp"                android:textSize="24dp"                android:gravity="right"                android:layout_width="0dp"                android:layout_weight="9"                android:layout_height="wrap_content" />            <ImageView                android:layout_marginRight="10dp"                android:id="@+id/title_address"                android:src="@mipmap/ic_launcher"                android:layout_width="0dp"                android:layout_weight="1"                android:layout_height="wrap_content" />        </LinearLayout>        <LinearLayout            android:layout_width="0dp"            android:layout_height="match_parent"            android:layout_weight="3"            android:orientation="horizontal">            <TextView                android:layout_marginLeft="50dp"                android:id="@+id/tv_compile"                android:layout_width="wrap_content"                android:layout_height="match_parent"                android:layout_marginTop="15dp"                android:gravity="right"                android:text="编辑"                android:textSize="18dp" />            <ImageView                android:id="@+id/iv_message"                android:layout_marginLeft="5dp"                android:layout_width="20dp"                android:layout_height="match_parent"                android:gravity="right"                android:src="@mipmap/ic_launcher" />        </LinearLayout>    </LinearLayout></LinearLayout>

2.5–layot_shopping_car_bottom.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:orientation="horizontal">    <CheckBox        android:id="@+id/chooseAll"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textSize="25sp"        android:padding="10dp"        android:text="全选"/>    <TextView        android:id="@+id/totalPrice"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textSize="25sp"        android:layout_weight="1"        android:padding="10dp"        android:gravity="center"        android:text="合计:0.00 ¥"/>    <TextView        android:id="@+id/btnAmount"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="结算 : (0)"        android:gravity="center"        android:background="@android:color/holo_orange_light"        android:textColor="@android:color/black"        android:textSize="25sp"        android:padding="10dp"/></LinearLayout>

3.Utils 包下的类
3.1— CallBack(接口)

public interface CallBack {    void  OnSuccess(Object o);    void OnFailed(Exception e);}

3.2– HttpUtils

public class HttpUtils {    private static volatile HttpUtils instance;    private static Handler handler = new Handler();    private HttpUtils(){    }    public static HttpUtils getInstance() {        if (instance == null) {            synchronized (HttpUtils.class) {                if (instance == null) {                    instance = new HttpUtils();                }            }        }        return instance;    }    //get请求    public void get(String url, Map<String,String> map, final CallBack callBack, final Class c){        //对url和参数做拼接处理        StringBuffer stringBuffer = new StringBuffer();        stringBuffer.append(url);        //判断是否存在?   if中是存在        if(stringBuffer.indexOf("?")!=-1 ){            //判断?是否在最后一位    if中是不在最后一位            if(stringBuffer.indexOf("?")!=stringBuffer.length()-1){                stringBuffer.append("&");            }        }else{            stringBuffer.append("?");        }        for(Map.Entry<String,String> entry:map.entrySet()){            stringBuffer.append(entry.getKey())                    .append("=")                    .append(entry.getValue())                    .append("&");        }        //判断是否存在&   if中是存在        if(stringBuffer.indexOf("&")!=-1){            stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("&"));        }        //1:创建OkHttpClient对象        OkHttpClient okHttpClient = new OkHttpClient.Builder()                .addInterceptor(new com.example.mylasst.Utils.Logger())                .build();        Log.i("okaaa",stringBuffer.toString());        //2:创建Request对象        final Request request = new Request.Builder()                .get()                .url(stringBuffer.toString())                .build();        Log.e("--------地址为:",stringBuffer.toString());        //3:创建Call对象        Call call = okHttpClient.newCall(request);        Log.i("okaaa",stringBuffer.toString());        //4:请求网络        call.enqueue(new Callback() {            //请求失败            @Override            public void onFailure(Call call, final IOException e) {                handler.post(new Runnable() {                    @Override                    public void run() {                        callBack.OnFailed(e);                    }                });            }            //请求成功            @Override            public void onResponse(Call call, Response response) throws IOException {                String result = response.body().string();             final Object o = new Gson().fromJson(result, c);                //当前是在子线程,回到主线程中                handler.post(new Runnable() {                    @Override                    public void run() {                        //回调                        callBack.OnSuccess(o);                    }                });            }        });    }    //post请求    public void post(String url, Map<String,String> map, final CallBack callBack, final Class c){        //1:创建OkHttpClient对象        OkHttpClient okHttpClient = new OkHttpClient.Builder()                .addInterceptor(new com.example.mylasst.Utils.Logger())//添加应用拦截器                .build();        //2:提供post请求需要的body对象        FormBody.Builder builder = new FormBody.Builder();        for(Map.Entry<String,String> entry:map.entrySet()){            builder.add(entry.getKey(),entry.getValue());        }        FormBody body = builder.build();        //3:创建Request对象        final Request request = new Request.Builder()                .post(body)                .url(url)                .build();        //   Log.i("addaaa","--//////\\\\\\\\\\--"+url);        //4:创建Call对象        Call call = okHttpClient.newCall(request);        //5:请求网络        call.enqueue(new Callback() {            //请求失败            @Override            public void onFailure(Call call, final IOException e) {                handler.post(new Runnable() {                    @Override                    public void run() {                        callBack.OnFailed(e);                    }                });            }            //请求成功            @Override            public void onResponse(Call call, Response response) throws IOException {                String result = response.body().string();                //拿到数据解析                final Object o = new Gson().fromJson(result, c);                //当前是在子线程,回到主线程中                handler.post(new Runnable() {                    @Override                    public void run() {                        //回调                        callBack.OnSuccess(o);                    }                });            }        });    }}

3.3– Logger

public class Logger implements Interceptor {    @Override    public Response intercept(Chain chain) throws IOException {        Request original = chain.request();        HttpUrl url=original.url().newBuilder()                .addQueryParameter("source","android")                .build();        //添加请求头        Request request = original.newBuilder()                .url(url)                .build();        return chain.proceed(request);    }}
  1. Bean 类(四个)
    4.1– Car_child_shop_Bean
public class Car_child_shop_Bean {    private int pid;    private String title;    private int num;    private double price;    private String images;    private boolean childCheck;    public Car_child_shop_Bean(int pid, String title, int num, double price, String images, boolean childCheck) {        this.pid = pid;        this.title = title;        this.num = num;        this.price = price;        this.images = images;        this.childCheck = childCheck;    }    public int getPid() {        return pid;    }    public void setPid(int pid) {        this.pid = pid;    }    public String getTitle() {        return title;    }    public void setTitle(String title) {        this.title = title;    }    public int getNum() {        return num;    }    public void setNum(int num) {        this.num = num;    }    public double getPrice() {        return price;    }    public void setPrice(double price) {        this.price = price;    }    public String getImages() {        return images;    }    public void setImages(String images) {        this.images = images;    }    public boolean isChildCheck() {        return childCheck;    }    public void setChildCheck(boolean childCheck) {        this.childCheck = childCheck;    }}

4.2– Car_shop_Bean

public class Car_shop_Bean {    private String name;    private boolean flag;    public Car_shop_Bean(String name, Boolean flag) {        this.name = name;        this.flag = flag;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public Boolean getFlag() {        return flag;    }    public void setFlag(Boolean flag) {        this.flag = flag;    }}

4.3– DelBean

public class DelBean {    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;    }}

4.4– GwcBean

public class GwcBean {    /**     * 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":1,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家17","sellerid":"17"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":2,"price":299,"pscid":1,"selected":0,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家18","sellerid":"18"},{"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":3,"price":198,"pscid":1,"selected":0,"sellerid":19,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家19","sellerid":"19"}]     */    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":1,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}]         * sellerName : 商家17         * sellerid : 17         */        private String sellerName;        private String sellerid;        private List<ListBean> list;        public String getSellerName() {            return sellerName;        }        public void setSellerName(String sellerName) {            this.sellerName = sellerName;        }        public String getSellerid() {            return sellerid;        }        public void setSellerid(String sellerid) {            this.sellerid = sellerid;        }        public List<ListBean> getList() {            return list;        }        public void setList(List<ListBean> list) {            this.list = list;        }        public static class ListBean {            /**             * 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 : 1             * price : 118.0             * pscid : 1             * selected : 0             * sellerid : 17             * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下             * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g             */            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 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;            }        }    }}

5.MvP放一个包
5.1—GwcModel

public class GwcModel {    private Map<String, String> map;    public  void  verGwu(final GwcShowP gwcShowP, Map<String, String> map)    {           this.map = map;           HttpUtils.getInstance().post("http://120.27.23.105/product/getCarts",map, new CallBack() {           @Override          public void OnSuccess(Object o) {               if(o!=null){                   GwcBean gwcBean= (GwcBean) o;                   gwcShowP.ShowSuccessGwcP(gwcBean);               }       }          @Override          public void OnFailed(Exception e) {              gwcShowP.ShowOnFaildGwcP();          }         },GwcBean.class);    }    private Map<String, String> map1;    public  void  verGwudel(final GwcShowP gwcShowP, Map<String, String> map1)    {        this.map1 = map1;        //Log.i("tag",map1.toString());        HttpUtils.getInstance().post("http://120.27.23.105/product/deleteCart",map1, new CallBack() {            @Override            public void OnSuccess(Object o) {                DelBean delBean= (DelBean) o;              gwcShowP.ShowDelSuccessP(delBean);            }            @Override            public void OnFailed(Exception e) {                gwcShowP.ShowDelOnFaildP();            }        },DelBean.class);    }}

5.2– GwcShowP

public interface GwcShowP {    void ShowSuccessGwcP(GwcBean gwcBean);    void ShowOnFaildGwcP();    void ShowDelSuccessP(DelBean delBean);    void ShowDelOnFaildP();}

5.3 –GwcShowPatenter

public class GwcShowPatenter implements  GwcShowP{   private   GwcModel gwcModel;    private GwcShowV gwcShowV;    HashMap<String, String> map ;    public  GwcShowPatenter(GwcShowV gwcShowV, HashMap<String, String> map)    {      //  map.clear();        this.map=map;        this.gwcShowV=gwcShowV;         gwcModel = new GwcModel();  }    public  void  pdModleOne()    {        gwcModel.verGwu(this,map);    }    public  void  pdModleDel()    {        gwcModel.verGwudel(this,map);    }    @Override    public void ShowSuccessGwcP(GwcBean gwcBean) {        gwcShowV.ShowSuccessGwcv(gwcBean);    }    @Override    public void ShowOnFaildGwcP() {    }    @Override    public void ShowDelSuccessP(DelBean delBean) {        gwcShowV.ShowDelSuccess(delBean);    }    @Override    public void ShowDelOnFaildP() {        gwcShowV.ShowDelOnFaild();    }}

5.4– GwcShowV

public interface GwcShowV {   void ShowSuccessGwcv(GwcBean gwcBean);    void ShowOnFaildGwcv();    void ShowDelSuccess(DelBean delBean);    void ShowDelOnFaild();}
原创粉丝点击