1.bean类
public class User {
/**
* data : {"curPage":1,"datas":[{"apkLink":"","author":" Ruheng","chapterId":390,"chapterName":"Git","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7632,"link":"https://juejin.im/post/599e14875188251240632702","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113919000,"superChapterId":390,"superChapterName":"项目管理","tags":[],"title":"一篇文章,教你学会Git","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"SupKing_a520","chapterId":171,"chapterName":"binder","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7631,"link":"https://www.jianshu.com/p/c1daf5653a47","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113884000,"superChapterId":171,"superChapterName":"framework","tags":[],"title":"Android:从源码角度来赏析Binder机制的优美","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":" Roll圈圈","chapterId":355,"chapterName":"他人收集","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7630,"link":"https://www.jianshu.com/p/2d1a3ba27e76","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113860000,"superChapterId":349,"superChapterName":"开放API","tags":[],"title":"开放通用Api,总有你喜欢的","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"辰之猫","chapterId":60,"chapterName":"Android Studio相关","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7629,"link":"https://www.jianshu.com/p/e54db232df62","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113821000,"superChapterId":60,"superChapterName":"开发环境","tags":[],"title":"让你明明白白的使用RecyclerView——SnapHelper详解","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7633,"link":"https://mp.weixin.qq.com/s/cLhf-SSS3I5SkPEFd5Cxbw","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"不到100行代码实现左右对齐TextView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7634,"link":"https://mp.weixin.qq.com/s/i1GfYke-9419uYsZgCMiJg","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"对 Kotlin 与 Java 编程语言的思考","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"郭霖","chapterId":409,"chapterName":"郭霖","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7635,"link":"https://mp.weixin.qq.com/s/cBISvWo8TnvlJ3oSKJ544g","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/409/1"}],"title":"30张图带你彻底理解红黑树","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"辰之猫","chapterId":100,"chapterName":"RecyclerView","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7627,"link":"https://www.jianshu.com/p/d1ab5f6be73f","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544111204000,"superChapterId":179,"superChapterName":"5.+高新技术","tags":[],"title":"Android组件化——SXRecyclerView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"NightFarmer","chapterId":375,"chapterName":"Flutter","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7626,"link":"https://www.jianshu.com/p/26b32dc2087e","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544110868000,"superChapterId":375,"superChapterName":"跨平台","tags":[],"title":"Android工程内嵌Flutter,跨平台的渐进式解决方案","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"mandypig","chapterId":99,"chapterName":"具体案例","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7590,"link":"https://www.jianshu.com/p/7241ed34346a","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544110372000,"superChapterId":94,"superChapterName":"自定义控件","tags":[],"title":"不到100行代码实现左右对齐TextView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"gityuan","chapterId":78,"chapterName":"性能优化","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7622,"link":"http://gityuan.com/2016/01/02/memory-analysis-command/","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544093713000,"superChapterId":79,"superChapterName":"热门专题","tags":[],"title":"Android内存分析命令","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"看书的小蜗牛","chapterId":86,"chapterName":"图片处理","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7621,"link":"https://www.jianshu.com/p/d5714e8987f3","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544092914000,"superChapterId":87,"superChapterName":"图片加载","tags":[],"title":"Android Bitmap变迁与原理解析(4.x-8.x)","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7623,"link":"https://mp.weixin.qq.com/s/Vt__FGCcWftanYW5ndyXmA","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544025600000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"RecyclerView库中被我们忽略的部分","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7624,"link":"https://mp.weixin.qq.com/s/99eQ1_9wzYYByNTIrzOVfA","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544025600000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"Android 设备唯一标识(多种实现方案)","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"Jamin_正宗红罐辣酱","chapterId":252,"chapterName":"奇怪的Bug","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7617,"link":"https://www.jianshu.com/p/18950c9b0ec9","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1544005813000,"superChapterId":135,"superChapterName":"项目必备","tags":[],"title":"从Daemons到finalize timed out after 10 seconds","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"Jamin_正宗红罐辣酱","chapterId":252,"chapterName":"奇怪的Bug","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7616,"link":"https://www.jianshu.com/p/84e7a99e8467","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1544005797000,"superChapterId":135,"superChapterName":"项目必备","tags":[],"title":"Android Crash的防护与追踪","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7618,"link":"https://mp.weixin.qq.com/s/WP8kUvcyHETlkDIdvGktdA","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"Android高斯模糊你所不知道的坑","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7619,"link":"https://mp.weixin.qq.com/s/dq_wBsp1sUYA2M_oW9hv4Q","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"OPPO Android 开发技术面总结","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"郭霖","chapterId":409,"chapterName":"郭霖","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7620,"link":"https://mp.weixin.qq.com/s/kcbEto2ljhhCSNknIWtbzA","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/409/1"}],"title":"Android Monitor工具详解大全","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"zqljintu","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"网上有各种各样的免费API,在众里寻找后,最后发现何不将这些API集合在一个App中呢,鉴于个人能力有限,就选取了部分的API来创作。 感谢知乎日报的Api,提供了App中的日报板块。 感谢豆瓣的Api,提供了App中的电影板块。 感谢WanAndroid的Api,提供了开发板块。 感谢Gank.io的Api,提供了娱乐版块","envelopePic":"http://wanandroid.com/blogimgs/271a4c3f-8066-4038-b4e6-9e5756463403.png","fresh":false,"id":7612,"link":"http://www.wanandroid.com/blog/show/2445","niceDate":"2018-12-04","origin":"","projectLink":"https://github.com/zqljintu/Assembly-number","publishTime":1543928671000,"superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"集结号//Assembly-number——集合了多项内容的客户端","type":0,"userId":-1,"visible":1,"zan":0}],"offset":0,"over":false,"pageCount":289,"size":20,"total":5779}
* errorCode : 0
* errorMsg :
*/
private DataBean data;
private int errorCode;
private String errorMsg;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public int getErrorCode() {
return errorCode;
}
public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public static class DataBean {
/**
* curPage : 1
* datas : [{"apkLink":"","author":" Ruheng","chapterId":390,"chapterName":"Git","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7632,"link":"https://juejin.im/post/599e14875188251240632702","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113919000,"superChapterId":390,"superChapterName":"项目管理","tags":[],"title":"一篇文章,教你学会Git","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"SupKing_a520","chapterId":171,"chapterName":"binder","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7631,"link":"https://www.jianshu.com/p/c1daf5653a47","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113884000,"superChapterId":171,"superChapterName":"framework","tags":[],"title":"Android:从源码角度来赏析Binder机制的优美","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":" Roll圈圈","chapterId":355,"chapterName":"他人收集","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7630,"link":"https://www.jianshu.com/p/2d1a3ba27e76","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113860000,"superChapterId":349,"superChapterName":"开放API","tags":[],"title":"开放通用Api,总有你喜欢的","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"辰之猫","chapterId":60,"chapterName":"Android Studio相关","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7629,"link":"https://www.jianshu.com/p/e54db232df62","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544113821000,"superChapterId":60,"superChapterName":"开发环境","tags":[],"title":"让你明明白白的使用RecyclerView——SnapHelper详解","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7633,"link":"https://mp.weixin.qq.com/s/cLhf-SSS3I5SkPEFd5Cxbw","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"不到100行代码实现左右对齐TextView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7634,"link":"https://mp.weixin.qq.com/s/i1GfYke-9419uYsZgCMiJg","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"对 Kotlin 与 Java 编程语言的思考","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"郭霖","chapterId":409,"chapterName":"郭霖","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7635,"link":"https://mp.weixin.qq.com/s/cBISvWo8TnvlJ3oSKJ544g","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544112000000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/409/1"}],"title":"30张图带你彻底理解红黑树","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"辰之猫","chapterId":100,"chapterName":"RecyclerView","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7627,"link":"https://www.jianshu.com/p/d1ab5f6be73f","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544111204000,"superChapterId":179,"superChapterName":"5.+高新技术","tags":[],"title":"Android组件化——SXRecyclerView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"NightFarmer","chapterId":375,"chapterName":"Flutter","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7626,"link":"https://www.jianshu.com/p/26b32dc2087e","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544110868000,"superChapterId":375,"superChapterName":"跨平台","tags":[],"title":"Android工程内嵌Flutter,跨平台的渐进式解决方案","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"mandypig","chapterId":99,"chapterName":"具体案例","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7590,"link":"https://www.jianshu.com/p/7241ed34346a","niceDate":"2天前","origin":"","projectLink":"","publishTime":1544110372000,"superChapterId":94,"superChapterName":"自定义控件","tags":[],"title":"不到100行代码实现左右对齐TextView","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"gityuan","chapterId":78,"chapterName":"性能优化","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7622,"link":"http://gityuan.com/2016/01/02/memory-analysis-command/","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544093713000,"superChapterId":79,"superChapterName":"热门专题","tags":[],"title":"Android内存分析命令","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"看书的小蜗牛","chapterId":86,"chapterName":"图片处理","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7621,"link":"https://www.jianshu.com/p/d5714e8987f3","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544092914000,"superChapterId":87,"superChapterName":"图片加载","tags":[],"title":"Android Bitmap变迁与原理解析(4.x-8.x)","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7623,"link":"https://mp.weixin.qq.com/s/Vt__FGCcWftanYW5ndyXmA","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544025600000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"RecyclerView库中被我们忽略的部分","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7624,"link":"https://mp.weixin.qq.com/s/99eQ1_9wzYYByNTIrzOVfA","niceDate":"2018-12-06","origin":"","projectLink":"","publishTime":1544025600000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"Android 设备唯一标识(多种实现方案)","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"Jamin_正宗红罐辣酱","chapterId":252,"chapterName":"奇怪的Bug","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7617,"link":"https://www.jianshu.com/p/18950c9b0ec9","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1544005813000,"superChapterId":135,"superChapterName":"项目必备","tags":[],"title":"从Daemons到finalize timed out after 10 seconds","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"Jamin_正宗红罐辣酱","chapterId":252,"chapterName":"奇怪的Bug","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7616,"link":"https://www.jianshu.com/p/84e7a99e8467","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1544005797000,"superChapterId":135,"superChapterName":"项目必备","tags":[],"title":"Android Crash的防护与追踪","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"鸿洋","chapterId":408,"chapterName":"鸿洋","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7618,"link":"https://mp.weixin.qq.com/s/WP8kUvcyHETlkDIdvGktdA","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/408/1"}],"title":"Android高斯模糊你所不知道的坑","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"code小生","chapterId":414,"chapterName":"code小生","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7619,"link":"https://mp.weixin.qq.com/s/dq_wBsp1sUYA2M_oW9hv4Q","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/414/1"}],"title":"OPPO Android 开发技术面总结","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"郭霖","chapterId":409,"chapterName":"郭霖","collect":false,"courseId":13,"desc":"","envelopePic":"","fresh":false,"id":7620,"link":"https://mp.weixin.qq.com/s/kcbEto2ljhhCSNknIWtbzA","niceDate":"2018-12-05","origin":"","projectLink":"","publishTime":1543939200000,"superChapterId":408,"superChapterName":"公众号","tags":[{"name":"公众号","url":"/wxarticle/list/409/1"}],"title":"Android Monitor工具详解大全","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","author":"zqljintu","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"网上有各种各样的免费API,在众里寻找后,最后发现何不将这些API集合在一个App中呢,鉴于个人能力有限,就选取了部分的API来创作。 感谢知乎日报的Api,提供了App中的日报板块。 感谢豆瓣的Api,提供了App中的电影板块。 感谢WanAndroid的Api,提供了开发板块。 感谢Gank.io的Api,提供了娱乐版块","envelopePic":"http://wanandroid.com/blogimgs/271a4c3f-8066-4038-b4e6-9e5756463403.png","fresh":false,"id":7612,"link":"http://www.wanandroid.com/blog/show/2445","niceDate":"2018-12-04","origin":"","projectLink":"https://github.com/zqljintu/Assembly-number","publishTime":1543928671000,"superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"集结号//Assembly-number——集合了多项内容的客户端","type":0,"userId":-1,"visible":1,"zan":0}]
* offset : 0
* over : false
* pageCount : 289
* size : 20
* total : 5779
*/
private int curPage;
private int offset;
private boolean over;
private int pageCount;
private int size;
private int total;
private List<DatasBean> datas;
public int getCurPage() {
return curPage;
}
public void setCurPage(int curPage) {
this.curPage = curPage;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public boolean isOver() {
return over;
}
public void setOver(boolean over) {
this.over = over;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<DatasBean> getDatas() {
return datas;
}
public void setDatas(List<DatasBean> datas) {
this.datas = datas;
}
public static class DatasBean {
/**
* apkLink :
* author : Ruheng
* chapterId : 390
* chapterName : Git
* collect : false
* courseId : 13
* desc :
* envelopePic :
* fresh : false
* id : 7632
* link : https://juejin.im/post/599e14875188251240632702
* niceDate : 2天前
* origin :
* projectLink :
* publishTime : 1544113919000
* superChapterId : 390
* superChapterName : 项目管理
* tags : []
* title : 一篇文章,教你学会Git
* type : 0
* userId : -1
* visible : 1
* zan : 0
*/
private String apkLink;
private String author;
private int chapterId;
private String chapterName;
private boolean collect;
private int courseId;
private String desc;
private String envelopePic;
private boolean fresh;
private int id;
private String link;
private String niceDate;
private String origin;
private String projectLink;
private long publishTime;
private int superChapterId;
private String superChapterName;
private String title;
private int type;
private int userId;
private int visible;
private int zan;
private List<?> tags;
public String getApkLink() {
return apkLink;
}
public void setApkLink(String apkLink) {
this.apkLink = apkLink;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getChapterId() {
return chapterId;
}
public void setChapterId(int chapterId) {
this.chapterId = chapterId;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public boolean isCollect() {
return collect;
}
public void setCollect(boolean collect) {
this.collect = collect;
}
public int getCourseId() {
return courseId;
}
public void setCourseId(int courseId) {
this.courseId = courseId;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getEnvelopePic() {
return envelopePic;
}
public void setEnvelopePic(String envelopePic) {
this.envelopePic = envelopePic;
}
public boolean isFresh() {
return fresh;
}
public void setFresh(boolean fresh) {
this.fresh = fresh;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getNiceDate() {
return niceDate;
}
public void setNiceDate(String niceDate) {
this.niceDate = niceDate;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public String getProjectLink() {
return projectLink;
}
public void setProjectLink(String projectLink) {
this.projectLink = projectLink;
}
public long getPublishTime() {
return publishTime;
}
public void setPublishTime(long publishTime) {
this.publishTime = publishTime;
}
public int getSuperChapterId() {
return superChapterId;
}
public void setSuperChapterId(int superChapterId) {
this.superChapterId = superChapterId;
}
public String getSuperChapterName() {
return superChapterName;
}
public void setSuperChapterName(String superChapterName) {
this.superChapterName = superChapterName;
}
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 int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getVisible() {
return visible;
}
public void setVisible(int visible) {
this.visible = visible;
}
public int getZan() {
return zan;
}
public void setZan(int zan) {
this.zan = zan;
}
public List<?> getTags() {
return tags;
}
public void setTags(List<?> tags) {
this.tags = tags;
}
}
}
}
2.callback返回
public interface CallBack {
void onSuccess(String result);
void onFailer(Call<String> call,Throwable t);
}
3.封装网络请求工具类
public class HttpManager {
public void getMethod(String url, final CallBack callBack){
Retrofit retrofit = new Retrofit.Builder().baseUrl("http://www.wanandroid.com/")
.addConverterFactory(ScalarsConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
ProjectApi projectApi = retrofit.create(ProjectApi.class);
Call<String> call = projectApi.getMethod(url);
call.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
String body = response.body();
callBack.onSuccess(body);
}
@Override
public void onFailure(Call<String> call, Throwable t) {
callBack.onFailer(call,t);
}
});
}
}
4.view层
public interface OneView {
void onSuccess(String result);
void onFailer(Call<String> call, Throwable t);
}
5.p层
public class OnePresenter {
private OneView mOneView;
private HttpManager mHttpManager;
public OnePresenter(OneView oneView) {
mOneView = oneView;
mHttpManager = new HttpManager();
}
public void urlUtil(String url, Map<String,String> map){
mHttpManager.getMethod(url, new CallBack() {
@Override
public void onSuccess(String result) {
mOneView.onSuccess(result);
}
@Override
public void onFailer(Call call, Throwable t) {
mOneView.onFailer(call, t);
}
});
}
}
6.网址
public interface UrlUtil {
//http://www.wanandroid.com/article/list/0/json
public String PATH1 = "http://www.wanandroid.com/";
public String PATH2 = "article/list/0/json";
}
7.projectapi
public interface ProjectApi {
@GET
Call<String> getMethod(@Url String url);
}
8.activity
public class MainActivity extends AppCompatActivity implements OneView {
@BindView(R.id.recycle)
RecyclerView recycle;
private Unbinder mBind;
private OnePresenter mOnePresenter;
private List<User.DataBean.DatasBean> mDatas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBind = ButterKnife.bind(this);
mOnePresenter = new OnePresenter(this);
Map<String,String> map = new HashMap<>();
mOnePresenter.urlUtil(UrlUtil.PATH2,map);
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
@Override
public void onSuccess(String result) {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
recycle.setLayoutManager(linearLayoutManager);
Gson gson = new Gson();
User user = gson.fromJson(result, User.class);
mDatas = user.getData().getDatas();
RecycleAdapter adapter = new RecycleAdapter(getApplicationContext(),mDatas);
recycle.setAdapter(adapter);
}
@Override
public void onFailer(Call call, Throwable t) {
}
}
9.adapter
public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.MyViewHolder> {
private Context mContext;
private List<User.DataBean.DatasBean> mDatas;
public RecycleAdapter(Context context, List<User.DataBean.DatasBean> datas) {
mContext = context;
mDatas = datas;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item, viewGroup, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
User.DataBean.DatasBean bean = mDatas.get(i);
myViewHolder.text.setText(bean.getTitle());
}
@Override
public int getItemCount() {
return mDatas.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView text;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
text = itemView.findViewById(R.id.textView);
}
}
}
10 权限
implementation 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.facebook.fresco:animated-gif:0.14.1'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'com.youth.banner:banner:1.4.9'
implementation 'com.android.support:recyclerview-v7:28.0.0'