依赖============================================================================================= implementation 'com.youth.banner:banner:1.4.10' implementation 'com.github.bumptech.glide:glide:4.0.0' implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.1' implementation 'io.reactivex:rxandroid:1.1.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0' implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' implementation 'com.facebook.fresco:fresco:1.5.0' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation'org.greenrobot:greendao:3.0.1' implementation'org.greenrobot:greendao-generator:3.0.0' implementation 'com.android.support:percent:27.1.1'
布局=========================
main_activity==============================
activity_details======================
activity_web=============================================
classify=================
defails===============================
desigan========================================
BannerBean==================================
package com.example.moni1.Modle.bean; import java.util.List; public class BannerBean { /** * msg : * code : 0 * data : [{"aid":1,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad1.png","productId":null,"title":"第十三界瑞丽模特大赛","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":2,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad2.png","productId":null,"title":"文化艺术节","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":3,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad3.png","productId":null,"title":"直播封面标准","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":4,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad4.png","productId":"1","title":"人气谁最高,金主谁最豪气","type":1,"url":""}] */ private String msg; private String code; private Listdata; 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 getData() { return data; } public void setData(List data) { this.data = data; } public static class DataBean { /** * aid : 1 * createtime : 2017-12-26T21:49:44 * icon : https://www.zhaoapi.cn/images/quarter/ad1.png * productId : null * title : 第十三界瑞丽模特大赛 * type : 0 * url : http://m.mv14449315.icoc.bz/index.jsp */ private int aid; private String createtime; private String icon; private Object productId; private String title; private int type; private String url; public int getAid() { return aid; } public void setAid(int aid) { this.aid = aid; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public Object getProductId() { return productId; } public void setProductId(Object productId) { this.productId = productId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } }
ClassifyBean-======================================
package com.example.moni1.Modle.bean; import java.util.List; public class ClassifyBean { /** * msg : * code : 0 * data : [{"cid":1,"createtime":"2017-10-10T19:41:39","icon":"http://120.27.23.105/images/category/shop.png","ishome":1,"name":"京东超市"},{"cid":2,"createtime":"2017-10-10T19:41:39","icon":"http://120.27.23.105/images/category/qqg.png","ishome":1,"name":"全球购"},{"cid":3,"createtime":"2017-10-10T19:45:11","icon":"http://120.27.23.105/images/category/phone.png","ishome":1,"name":"手机数码"},{"cid":5,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/man.png","ishome":1,"name":"男装"},{"cid":6,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/girl.png","ishome":1,"name":"女装"},{"cid":7,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/manshoe.png","ishome":1,"name":"男鞋"},{"cid":8,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/girlshoe.png","ishome":1,"name":"女鞋"},{"cid":9,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/shirt.png","ishome":1,"name":"内衣配饰"},{"cid":10,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/bag.png","ishome":1,"name":"箱包手袋"},{"cid":11,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/beauty.png","ishome":1,"name":"美妆个护"},{"cid":12,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/jewel.png","ishome":1,"name":"钟表珠宝"},{"cid":13,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/luxury.png","ishome":1,"name":"奢侈品"},{"cid":14,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/computer.png","ishome":1,"name":"电脑办公"},{"cid":15,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"家用电器"},{"cid":16,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"食品生鲜"},{"cid":17,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"酒水饮料"},{"cid":18,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"母婴童装"},{"cid":19,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"玩具乐器"},{"cid":20,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":0,"name":"医药保健"}] */ private String msg; private String code; private Listdata; 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 getData() { return data; } public void setData(List data) { this.data = data; } public static class DataBean { /** * cid : 1 * createtime : 2017-10-10T19:41:39 * icon : http://120.27.23.105/images/category/shop.png * ishome : 1 * name : 京东超市 */ private int cid; private String createtime; private String icon; private int ishome; private String name; public int getCid() { return cid; } public void setCid(int cid) { this.cid = cid; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public int getIshome() { return ishome; } public void setIshome(int ishome) { this.ishome = ishome; } public String getName() { return name; } public void setName(String name) { this.name = name; } } }
DesignBean-==========================================
package com.example.moni1.Modle.bean; import java.util.List; public class DesignBean { /** * code : 1 * data : {"display":[{"uid":"100180","ordered":"0","space":"售楼处/家居别墅/样板间","bill":"0","evaluate":"0","nick_name":"刘卫军","avatar":"https://app.tuozhe8.com/uploads/avatar/091286e480d0ace52f3e965c462f0061100180.jpeg","address":"广东","charge":"价格面议","intro":"主张以情感美学创造艺术空间,其美学取向分为人本取向与文本取向两种"},{"uid":"100179","ordered":"1","space":"售楼处/样板间/家居别墅","bill":"0","evaluate":"0","nick_name":"韩松","avatar":"https://app.tuozhe8.com/uploads/avatar/cd0056fe4616508551f2cd38ca2294b3100179.jpeg","address":"广东","charge":"收费面议","intro":"致力于在传统美学智慧中挖掘现代性的可持续价值,冀望以物质空间为载体的全新生活体验的实现,来改变以往生活的习惯和认知,以寻求体悟生命真实的喜悦和智慧。"},{"uid":"100103","ordered":"11","space":"商业空间/酒店/办公空间","bill":"5","evaluate":"0","nick_name":"黄全","avatar":"https://app.tuozhe8.com/uploads/avatar/04e7ded9788efaaa5936f5eb994bb7b5100103.jpeg","address":"上海","charge":"收费面议","intro":"直面市场,设计不止是自我表达"},{"uid":"100181","ordered":"2","space":"售楼处/家居别墅/样板间","bill":"0","evaluate":"0","nick_name":"鬼手帕","avatar":"https://app.tuozhe8.com/uploads/avatar/8350263b013a428ad83118e16c68fb92100181.jpeg","address":"福建","charge":"收费面议","intro":"走个性化设计需要更耐心地与业主磨合"},{"uid":"101012","ordered":"0","space":"","bill":"0","evaluate":"0","nick_name":"得间老李","avatar":"https://app.tuozhe8.com/uploads/avatar/e521e0ac87aa0eac02f108fdb9993c13101012.jpeg","address":"湖北","charge":"收费面议","intro":"武汉得间设计创始人"},{"uid":"100193","ordered":"0","space":"售楼处/家居别墅/样板间","bill":"0","evaluate":"0","nick_name":"周晓安","avatar":"https://app.tuozhe8.com/uploads/avatar/1873cc4e37d2bde47df1ac93f87629cf100193.jpeg","address":"江苏","charge":"收费面议","intro":""},{"uid":"100196","ordered":"0","space":"售楼处/家居别墅/样板间","bill":"0","evaluate":"0","nick_name":"叶永志","avatar":"https://app.tuozhe8.com/uploads/avatar/c55301f590ac438267dd81c726d6d3a8100196.jpeg","address":"浙江","charge":"100 ~ 500元","intro":"今天的荣誉就是明天的起跑线,会一直坚持做好设计。"},{"uid":"101008","ordered":"0","space":"售楼处/家居别墅/样板间","bill":"0","evaluate":"0","nick_name":"之境内建筑廖志强","avatar":"https://app.tuozhe8.com/uploads/avatar/61135da0aa8df4e71d71b139b667a345101008.jpeg","address":"四川","charge":"100 ~ 500元","intro":""},{"uid":"101009","ordered":"0","space":"","bill":"3","evaluate":"0","nick_name":"周传龙","avatar":"https://app.tuozhe8.com/uploads/avatar/cddcbf6117bfe4a3ad57db4c3e8856e9101009.jpeg","address":"山东","charge":"100 ~ 500元","intro":"让设计赞美生活"},{"uid":"101267","ordered":"0","space":"","bill":"0","evaluate":"0","nick_name":"陈熠","avatar":"https://app.tuozhe8.com/uploads/avatar/b780ad70687dabe09f200d21b754d23f101267.jpeg","address":"江苏","charge":"收费面议","intro":""}]} * message : success */ private String code; private DataBean data; private String message; 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 String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public static class DataBean { private Listdisplay; public List getDisplay() { return display; } public void setDisplay(List display) { this.display = display; } public static class DisplayBean { /** * uid : 100180 * ordered : 0 * space : 售楼处/家居别墅/样板间 * bill : 0 * evaluate : 0 * nick_name : 刘卫军 * avatar : https://app.tuozhe8.com/uploads/avatar/091286e480d0ace52f3e965c462f0061100180.jpeg * address : 广东 * charge : 价格面议 * intro : 主张以情感美学创造艺术空间,其美学取向分为人本取向与文本取向两种 */ private String uid; private String ordered; private String space; private String bill; private String evaluate; private String nick_name; private String avatar; private String address; private String charge; private String intro; public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getOrdered() { return ordered; } public void setOrdered(String ordered) { this.ordered = ordered; } public String getSpace() { return space; } public void setSpace(String space) { this.space = space; } public String getBill() { return bill; } public void setBill(String bill) { this.bill = bill; } public String getEvaluate() { return evaluate; } public void setEvaluate(String evaluate) { this.evaluate = evaluate; } public String getNick_name() { return nick_name; } public void setNick_name(String nick_name) { this.nick_name = nick_name; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCharge() { return charge; } public void setCharge(String charge) { this.charge = charge; } public String getIntro() { return intro; } public void setIntro(String intro) { this.intro = intro; } } } }
DetailsBean=============================
package com.example.moni1.Modle.bean; import java.util.List; public class DetailsBean { /** * msg : 请求成功 * code : 0 * data : [{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":1,"price":118,"pscid":1,"salenum":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":2,"price":299,"pscid":1,"salenum":999,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"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","itemtype":0,"pid":3,"price":198,"pscid":1,"salenum":1234,"sellerid":19,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"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","itemtype":2,"pid":4,"price":999,"pscid":1,"salenum":356,"sellerid":20,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":5,"price":88.99,"pscid":1,"salenum":678,"sellerid":21,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"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","itemtype":0,"pid":6,"price":7.99,"pscid":1,"salenum":234,"sellerid":22,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":7,"price":120.01,"pscid":1,"salenum":1266,"sellerid":23,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"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","itemtype":0,"pid":8,"price":324,"pscid":1,"salenum":3000,"sellerid":1,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"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","itemtype":2,"pid":9,"price":78.99,"pscid":1,"salenum":2356,"sellerid":2,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":10,"price":555.55,"pscid":1,"salenum":0,"sellerid":3,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}] * page : 1 */ private String msg; private String code; private String page; private Listdata; 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 getData() { return data; } public void setData(List data) { this.data = data; } public static class DataBean { /** * bargainPrice : 111.99 * createtime : 2017-10-14T21:39:05 * detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg * itemtype : 1 * pid : 1 * price : 118.0 * pscid : 1 * salenum : 0 * sellerid : 17 * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下 * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private 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; } } }
GreenDao======================================
package com.example.moni1.Modle.bean; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Property; @Entity public class GreenDao { @Id private long id; @Property(nameInDb = "name") private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } public long getId() { return this.id; } public void setId(long id) { this.id = id; } @Generated(hash = 596391576) public GreenDao(long id, String name) { this.id = id; this.name = name; } @Generated(hash = 766040118) public GreenDao() { } }
DaoMaster=============================
package com.example.moni1.Modle.http; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.util.Log; import org.greenrobot.greendao.AbstractDaoMaster; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseOpenHelper; import org.greenrobot.greendao.database.StandardDatabase; import org.greenrobot.greendao.identityscope.IdentityScopeType; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { GreenDaoDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { GreenDaoDao.dropTable(db, ifExists); } /** * WARNING: Drops all table on Upgrade! Use only during development. * Convenience method using a {@link DevOpenHelper}. */ public static DaoSession newDevSession(Context context, String name) { Database db = new DevOpenHelper(context, name).getWritableDb(); DaoMaster daoMaster = new DaoMaster(db); return daoMaster.newSession(); } public DaoMaster(SQLiteDatabase db) { this(new StandardDatabase(db)); } public DaoMaster(Database db) { super(db, SCHEMA_VERSION); registerDaoClass(GreenDaoDao.class); } public DaoSession newSession() { return new DaoSession(db, IdentityScopeType.Session, daoConfigMap); } public DaoSession newSession(IdentityScopeType type) { return new DaoSession(db, type, daoConfigMap); } /** * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} - */ public static abstract class OpenHelper extends DatabaseOpenHelper { public OpenHelper(Context context, String name) { super(context, name, SCHEMA_VERSION); } public OpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory, SCHEMA_VERSION); } @Override public void onCreate(Database db) { Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION); createAllTables(db, false); } } /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); } public DevOpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory); } @Override public void onUpgrade(Database db, int oldVersion, int newVersion) { Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables"); dropAllTables(db, true); onCreate(db); } } }
DaoSession====================================
package com.example.moni1.Modle.http; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. import com.example.moni1.Modle.bean.GreenDao; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.identityscope.IdentityScopeType; import org.greenrobot.greendao.internal.DaoConfig; import java.util.Map; /** * {@inheritDoc} * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { private final DaoConfig greenDaoDaoConfig; private final GreenDaoDao greenDaoDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); greenDaoDaoConfig = daoConfigMap.get(GreenDaoDao.class).clone(); greenDaoDaoConfig.initIdentityScope(type); greenDaoDao = new GreenDaoDao(greenDaoDaoConfig, this); registerDao(GreenDao.class, greenDaoDao); } public void clear() { greenDaoDaoConfig.getIdentityScope().clear(); } public GreenDaoDao getGreenDaoDao() { return greenDaoDao; } }
GreenDaoDao=====================================
package com.example.moni1.Modle.http; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import com.example.moni1.Modle.bean.GreenDao; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; import org.greenrobot.greendao.internal.DaoConfig; /** * DAO for table "GREEN_DAO". */ public class GreenDaoDao extends AbstractDao{ public static final String TABLENAME = "GREEN_DAO"; /** * Properties of entity GreenDao.
* Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property Id = new Property(0, long.class, "id", true, "_id"); public final static Property Name = new Property(1, String.class, "name", false, "name"); }; public GreenDaoDao(DaoConfig config) { super(config); } public GreenDaoDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"GREEN_DAO\" (" + // "\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id "\"name\" TEXT);"); // 1: name } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GREEN_DAO\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, GreenDao entity) { stmt.clearBindings(); stmt.bindLong(1, entity.getId()); String name = entity.getName(); if (name != null) { stmt.bindString(2, name); } } @Override protected final void bindValues(SQLiteStatement stmt, GreenDao entity) { stmt.clearBindings(); stmt.bindLong(1, entity.getId()); String name = entity.getName(); if (name != null) { stmt.bindString(2, name); } } @Override public Long readKey(Cursor cursor, int offset) { return cursor.getLong(offset + 0); } @Override public GreenDao readEntity(Cursor cursor, int offset) { GreenDao entity = new GreenDao( // cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1) // name ); return entity; } @Override public void readEntity(Cursor cursor, GreenDao entity, int offset) { entity.setId(cursor.getLong(offset + 0)); entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); } @Override protected final Long updateKeyAfterInsert(GreenDao entity, long rowId) { entity.setId(rowId); return rowId; } @Override public Long getKey(GreenDao entity) { if(entity != null) { return entity.getId(); } else { return null; } } @Override protected final boolean isEntityUpdateable() { return true; } }
BannerLisenter============================
package com.example.moni1.Modle.Imodle; import com.example.moni1.Modle.bean.BannerBean; public interface BannerLisenter { void onBanner(BannerBean bannerBean); }
BaseMoble=====================
package com.example.moni1.Modle.Imodle; public interface BaseMoble { void setBanner(BannerLisenter banner); void setDesigan(DesiganListener desigan); void setClassify(ClassifyLisenter classifyLisenter); void setDetails(int pscid, DetailsListener detailsListener); }
ClassifyLisenter==============================
package com.example.moni1.Modle.Imodle; import com.example.moni1.Modle.bean.ClassifyBean; public interface ClassifyLisenter { void onClassify(ClassifyBean classifyBean); }
DesiganListener=============================
package com.example.moni1.Modle.Imodle; import com.example.moni1.Modle.bean.DesignBean; public interface DesiganListener { void onDesigan(DesignBean designBean); }
DetailsListener===================================
package com.example.moni1.Modle.Imodle; import com.example.moni1.Modle.bean.DetailsBean; public interface DetailsListener { void onDetails(DetailsBean detailsBean); }
Model============================
package com.example.moni1.Modle.Imodle; import android.util.Log; import com.example.moni1.Modle.bean.BannerBean; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.Modle.bean.DesignBean; import com.example.moni1.Modle.bean.DetailsBean; import com.example.moni1.Modle.utils.ReUtil; import com.example.moni1.View.Iview.Api; import com.example.moni1.View.Iview.ApiService; import rx.Observer; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; public class Model implements BaseMoble{ @Override public void setBanner(final BannerLisenter banner) { ReUtil.getin().getUrl(Api.URL).create(ApiService.class).getBanner().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() { @Override public void onCompleted() { Log.i("xxx","1"); } @Override public void onError(Throwable e) { Log.i("xxx","2"); } @Override public void onNext(BannerBean bannerBean) { banner.onBanner(bannerBean); } }); } @Override public void setDesigan(final DesiganListener desigan) { ReUtil.getin().getUrl(Api.URL1).create(ApiService.class).getDesigan().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer () { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(DesignBean designBean) { desigan.onDesigan(designBean); } }); } @Override public void setClassify(final ClassifyLisenter classifyLisenter) { ReUtil.getin().getUrl(Api.URL).create(ApiService.class).getClassify().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer () { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(ClassifyBean classifyBean) { classifyLisenter.onClassify(classifyBean); } }); } @Override public void setDetails(int pscid, final DetailsListener detailsListener) { ReUtil.getin().getUrl(Api.URL).create(ApiService.class).getDetails(pscid).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer () { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(DetailsBean detailsBean) { detailsListener.onDetails(detailsBean); } }); } }
App==================================
package com.example.moni1.Modle.utils; import android.content.Context; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.youth.banner.loader.ImageLoader; public class App extends ImageLoader { @Override public void displayImage(Context context, Object path, ImageView imageView) { Glide.with(context).load(path).into(imageView); } }
MyApp================================
package com.example.moni1.Modle.utils; import android.app.Application; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import com.example.moni1.Modle.http.DaoMaster; import com.example.moni1.Modle.http.DaoSession; import com.facebook.drawee.backends.pipeline.Fresco; public class MyApp extends Application{ public static MyApp myApp; public Context context; public static DaoSession daoSession; @Override public void onCreate() { super.onCreate(); this.context = context; myApp = this; Fresco.initialize(this); setDb(); } public static MyApp getin(){ return myApp; } private void setDb() { DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(this,"user.db",null); SQLiteDatabase writableDatabase = devOpenHelper.getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(writableDatabase); daoSession = daoMaster.newSession(); } public static DaoSession getdaoSession(){ return daoSession; } }
ReUtil==========================
package com.example.moni1.Modle.utils; import android.util.Log; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; public class ReUtil { public static ReUtil reUtil; public static ReUtil getin(){ if(reUtil==null){ synchronized (ReUtil.class){ if(reUtil==null){ reUtil = new ReUtil(); } } } return reUtil; } public OkHttpClient getClient(){ HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { @Override public void log(String message) { Log.i("xxx", "日志信息:" + message); } }); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(interceptor) .connectTimeout(5000, TimeUnit.SECONDS) .writeTimeout(5000, TimeUnit.SECONDS) .readTimeout(5000, TimeUnit.SECONDS) .build(); return client; } public Retrofit getUrl(String URL){ Retrofit retrofit = new Retrofit.Builder().baseUrl(URL).client(getClient()).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).build(); return retrofit; } }
BasePresenter============================
package com.example.moni1.Presenter; public interface BasePresenter { void getBanner(); void getDesigan(); void getClassify(); void onDestroy(); }
DetailsPresenter============================
package com.example.moni1.Presenter; public interface DetailsPresenter { void setDetails(int pscid); }
DetailsPresenters==========================
package com.example.moni1.Presenter; import com.example.moni1.Modle.Imodle.DetailsListener; import com.example.moni1.Modle.Imodle.Model; import com.example.moni1.Modle.bean.DetailsBean; import com.example.moni1.View.Iview.DetailsView; import com.example.moni1.View.activity.DetailsActivity; public class DetailsPresenters implements DetailsPresenter{ Model model; DetailsView detailsView; public DetailsPresenters(DetailsActivity detailsActivity) { model = new Model(); detailsView = detailsActivity; } @Override public void setDetails(int pscid) { model.setDetails(pscid, new DetailsListener() { @Override public void onDetails(DetailsBean detailsBean) { detailsView.setDetailsList(detailsBean); } }); } }
GoodPresenter====================================
package com.example.moni1.Presenter; import com.example.moni1.Modle.Imodle.BannerLisenter; import com.example.moni1.Modle.Imodle.ClassifyLisenter; import com.example.moni1.Modle.Imodle.DesiganListener; import com.example.moni1.Modle.Imodle.Model; import com.example.moni1.Modle.bean.BannerBean; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.Modle.bean.DesignBean; import com.example.moni1.View.Iview.BannerView; import com.example.moni1.View.activity.MainActivity; public class GoodPresenter implements BasePresenter{ Model model; BannerView bannerView; public GoodPresenter(MainActivity mainActivity) { model = new Model(); bannerView = mainActivity; } @Override public void getBanner() { model.setBanner(new BannerLisenter() { @Override public void onBanner(BannerBean bannerBean) { bannerView.getBannerList(bannerBean); } }); } @Override public void getDesigan(){ model.setDesigan(new DesiganListener() { @Override public void onDesigan(DesignBean designBean) { bannerView.getDesiganList(designBean); } }); } @Override public void getClassify() { model.setClassify(new ClassifyLisenter() { @Override public void onClassify(ClassifyBean classifyBean) { bannerView.getClassifyList(classifyBean); } }); } @Override public void onDestroy() { if(bannerView!=null){ bannerView = null; } } }
BaseActivity========================
package com.example.moni1.View.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.example.moni1.Presenter.BasePresenter; public abstract class BaseActivityextends AppCompatActivity { public T presenter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getXml()); presenter = getPresenter(); getId(); } protected abstract int getXml(); protected abstract T getPresenter() ; protected abstract void getId(); }
DetailsActivity=====================
package com.example.moni1.View.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import com.example.moni1.Modle.bean.DetailsBean; import com.example.moni1.Modle.http.DaoSession; import com.example.moni1.Presenter.DetailsPresenters; import com.example.moni1.R; import com.example.moni1.View.Iview.DetailsView; import com.example.moni1.View.adapter.DetailsAdpter; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; public class DetailsActivity extends AppCompatActivity implements DetailsView { @BindView(R.id.DetailsRecy) RecyclerView DetailsRecy; private DetailsAdpter detailsAdpter; private DetailsPresenters detailsPresenters; private int pscid; private DaoSession daoSession; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); ButterKnife.bind(this); pscid = getIntent().getExtras().getInt("pscid"); detailsPresenters = new DetailsPresenters(this); detailsPresenters.setDetails(pscid); detailsAdpter = new DetailsAdpter(this); DetailsRecy.setLayoutManager(new LinearLayoutManager(this)); } @Override public void setDetailsList(DetailsBean detailsBean) { Listdata = detailsBean.getData(); detailsAdpter.addData(detailsBean.getData()); DetailsRecy.setAdapter(detailsAdpter); } }
MainActivity===================================
package com.example.moni1.View.activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.util.Log; import com.example.moni1.Modle.bean.BannerBean; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.Modle.bean.DesignBean; import com.example.moni1.Modle.bean.GreenDao; import com.example.moni1.Modle.http.DaoSession; import com.example.moni1.Modle.utils.App; import com.example.moni1.Modle.utils.MyApp; import com.example.moni1.Presenter.GoodPresenter; import com.example.moni1.R; import com.example.moni1.View.Iview.BannerView; import com.example.moni1.View.adapter.ClassifyAdpter; import com.example.moni1.View.adapter.DesiganAdpter; import com.youth.banner.Banner; import com.youth.banner.listener.OnBannerListener; import java.util.ArrayList; import java.util.List; import butterknife.ButterKnife; public class MainActivity extends BaseActivityimplements BannerView { private RecyclerView recytwo; private DesiganAdpter desiganAdpter; private ClassifyAdpter classifyAdpter; private Banner banner; private RecyclerView recyclerView; private GoodPresenter goodPresenter; private int aid; private String url; private List list = new ArrayList<>(); private DaoSession daoSession; @Override protected int getXml() { return R.layout.activity_main; } @Override protected GoodPresenter getPresenter() { goodPresenter = new GoodPresenter(this); goodPresenter.getBanner(); goodPresenter.getDesigan(); goodPresenter.getClassify(); return goodPresenter; } @Override protected void getId() { banner = findViewById(R.id.banner); recyclerView = findViewById(R.id.recy); recytwo = findViewById(R.id.recytwo); desiganAdpter = new DesiganAdpter(this); classifyAdpter = new ClassifyAdpter(this); daoSession = MyApp.getin().getdaoSession(); classifyAdpter.setOnlisenterId(new ClassifyAdpter.OnlisenterId() { @Override public void setId(int id) { GreenDao greenDao = new GreenDao(id,""); Intent intent = new Intent(MainActivity.this, DetailsActivity.class); intent.putExtra("pscid", id); startActivity(intent); } }); recyclerView.setLayoutManager(new StaggeredGridLayoutManager(1, OrientationHelper.HORIZONTAL)); recytwo.setLayoutManager(new LinearLayoutManager(this)); } @Override public void getBannerList(final BannerBean bannerBean) { final List data = bannerBean.getData(); for (int i = 0; i < data.size(); i++) { list.add(data.get(i).getIcon()); } banner.setImages(list); banner.setImageLoader(new App()); banner.setDelayTime(1000); banner.start(); Log.i("xxx", bannerBean.getCode() + ""); banner.setOnBannerListener(new OnBannerListener() { @Override public void OnBannerClick(int position) { String url = data.get(position).getUrl(); Intent intent = new Intent(MainActivity.this, WebActivity.class); intent.putExtra("url", url); Log.i("zszz", url); startActivity(intent); } }); } @Override public void getDesiganList(DesignBean designBean) { desiganAdpter.addData(designBean.getData().getDisplay()); recyclerView.setAdapter(desiganAdpter); } @Override public void getClassifyList(ClassifyBean classifyBean) { Log.i("zszz", classifyBean.getCode() + ""); List data = classifyBean.getData(); classifyAdpter.addData(classifyBean.getData()); recytwo.setAdapter(classifyAdpter); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: add setContentView(...) invocation ButterKnife.bind(this); } }
WebActivity=============================
package com.example.moni1.View.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.webkit.WebView; import com.example.moni1.R; public class WebActivity extends AppCompatActivity { private WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web); webView = findViewById(R.id.webview); String url = getIntent().getExtras().getString("url"); webView.loadUrl(url); } }
ClassifyAdpter=====================================
package com.example.moni1.View.adapter; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.R; import com.facebook.drawee.view.SimpleDraweeView; import java.util.ArrayList; import java.util.List; public class ClassifyAdpter extends RecyclerView.Adapter{ private List list; public ClassifyAdpter(Context context) { this.context = context; this.list = new ArrayList<>(); } public void addData(List dataBeans){ list.addAll(dataBeans); notifyDataSetChanged(); } private Context context; @NonNull @Override public Holder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { return new Holder(LinearLayout.inflate(context,R.layout.classify,null)); } @Override public void onBindViewHolder(@NonNull Holder holder, final int i) { holder.textView.setText(list.get(i).getName()); String avatar = list.get(i).getIcon(); Uri parse = Uri.parse(avatar); holder.simpleDraweeView.setImageURI(parse); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onlisenterId.setId(list.get(i).getCid()); } }); } @Override public int getItemCount() { return list.size(); } class Holder extends RecyclerView.ViewHolder{ TextView textView; SimpleDraweeView simpleDraweeView; public Holder(@NonNull View itemView) { super(itemView); textView = itemView.findViewById(R.id.textView1); simpleDraweeView = itemView.findViewById(R.id.simp1); } } OnlisenterId onlisenterId; public void setOnlisenterId(OnlisenterId onlisenterId) { this.onlisenterId = onlisenterId; } public interface OnlisenterId{ void setId(int id); } }
DesiganAdpter=====================================
package com.example.moni1.View.adapter; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.example.moni1.Modle.bean.DesignBean; import com.example.moni1.R; import com.facebook.drawee.view.SimpleDraweeView; import java.util.ArrayList; import java.util.List; public class DesiganAdpter extends RecyclerView.Adapter{ private List list; public DesiganAdpter(Context context) { this.context = context; this.list = new ArrayList<>(); } public void addData(List dataBeans){ list.addAll(dataBeans); notifyDataSetChanged(); } private Context context; @NonNull @Override public Holder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { return new Holder(LinearLayout.inflate(context, R.layout.desigan,null)); } @Override public void onBindViewHolder(@NonNull Holder holder, int i) { holder.textView.setText(list.get(i).getNick_name()); String avatar = list.get(i).getAvatar(); Uri parse = Uri.parse(avatar); holder.simpleDraweeView.setImageURI(parse); } @Override public int getItemCount() { return list.size(); } class Holder extends RecyclerView.ViewHolder{ TextView textView; SimpleDraweeView simpleDraweeView; public Holder(@NonNull View itemView) { super(itemView); textView = itemView.findViewById(R.id.textView); simpleDraweeView = itemView.findViewById(R.id.simp); } } }
DetailsAdpter==============================
package com.example.moni1.View.adapter; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.example.moni1.Modle.bean.DetailsBean; import com.example.moni1.R; import com.facebook.drawee.view.SimpleDraweeView; import java.util.ArrayList; import java.util.List; public class DetailsAdpter extends RecyclerView.Adapter{ private List list; public DetailsAdpter(Context context) { this.context = context; this.list = new ArrayList<>(); } public void addData(List dataBeans){ list.addAll(dataBeans); notifyDataSetChanged(); } private Context context; @NonNull @Override public Holder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { return new Holder(LinearLayout.inflate(context,R.layout.defails,null)); } @Override public void onBindViewHolder(@NonNull Holder holder, final int i) { holder.textView.setText(list.get(i).getTitle()); holder.textView1.setText("¥"+list.get(i).getPrice()+""); String avatar = list.get(i).getImages(); String s = avatar.split("\\|")[0]; Uri parse = Uri.parse(s); holder.simpleDraweeView.setImageURI(parse); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onlisenterId.setId(list.get(i).getPid()); } }); } @Override public int getItemCount() { return list.size(); } class Holder extends RecyclerView.ViewHolder{ TextView textView,textView1; SimpleDraweeView simpleDraweeView; public Holder(@NonNull View itemView) { super(itemView); textView = itemView.findViewById(R.id.textView2); textView1 = itemView.findViewById(R.id.textView3); simpleDraweeView = itemView.findViewById(R.id.simp2); } } OnlisenterId onlisenterId; public void setOnlisenterId(OnlisenterId onlisenterId) { this.onlisenterId = onlisenterId; } public interface OnlisenterId{ void setId(int id); } }
Api==============================
package com.example.moni1.View.Iview; public class Api { public static final String URL = "https://www.zhaoapi.cn/"; public static final String URL1 = "https://app.tuozhe8.com/"; }
ApiService=================================
package com.example.moni1.View.Iview; import com.example.moni1.Modle.bean.BannerBean; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.Modle.bean.DesignBean; import com.example.moni1.Modle.bean.DetailsBean; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; import rx.Observable; public interface ApiService { @POST("quarter/getAd") ObservablegetBanner(); @POST("api.php/api/Lists/designer?token=&version=1.7") Observable getDesigan(); @POST("product/getCatagory") Observable getClassify(); @POST("product/getProducts") @FormUrlEncoded Observable getDetails(@Field("pscid") int pscid); }
BannerView============================================
package com.example.moni1.View.Iview; import com.example.moni1.Modle.bean.BannerBean; import com.example.moni1.Modle.bean.ClassifyBean; import com.example.moni1.Modle.bean.DesignBean; public interface BannerView { void getBannerList(BannerBean bannerBean); void getDesiganList(DesignBean designBean); void getClassifyList(ClassifyBean classifyBean); }
DetailsView=======================================
package com.example.moni1.View.Iview; import com.example.moni1.Modle.bean.DetailsBean; public interface DetailsView { void setDetailsList(DetailsBean detailsBean); }