TouTiao开源项目 分析笔记9 实现一个问答主页面
生活随笔
收集整理的這篇文章主要介紹了
TouTiao开源项目 分析笔记9 实现一个问答主页面
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.根據API返回創建幾個基礎的Bean
1.1.WendaArticleDataBean類
API返回的數據如下:
/*** cell_type : 36* extra : {"wenda_video":[],"show_answer":false,"video_large_card":false,"label_style":{"color_type":0,"name":""},"show_video":false,"video_source_name":"","wenda_image":{"three_image_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664","url_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"},{"url":"http:\/\/pb9.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"}],"uri":"list\/300x196\/18a2000bcefb11e51664","height":576,"width":768,"type":1},{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/e580008f01daabc4b83","url_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/e580008f01daabc4b83"},{"url":"http:\/\/pb9.pstatp.com\/list\/300x196\/e580008f01daabc4b83"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/e580008f01daabc4b83"}],"uri":"list\/300x196\/e580008f01daabc4b83","height":295,"width":440,"type":1},{"url":"http:\/\/p9.pstatp.com\/list\/300x196\/12320005f73e2f519d5c","url_list":[{"url":"http:\/\/p9.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"},{"url":"http:\/\/pb1.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"}],"uri":"list\/300x196\/12320005f73e2f519d5c","height":768,"width":431,"type":1}],"small_image_list":[],"large_image_list":[],"medium_image_list":[]},"schema":"sslocal:\/\/wenda_list?qid=6333792867344974082&gd_ext_json=%7B%22qid%22%3A%226333792867344974082%22%2C%22ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22click_answer_hot%22%7D&video_auto_play=0&api_param=%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22native_wenda_home%22%2C%22enter_ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22answer_hot%22%7D"}* question : {"status":1,"op_status":0,"qid":6333792867344974082,"nice_ans_count":336,"uname":"","create_time":1474701070,"normal_ans_count":1227,"item_id":0,"user_id":5547793806,"title":"\u4f60\u4eec\u5f53\u5730\u90a3\u4e9b\u6df7\u9ed1\u793e\u4f1a\u7684\u4eba\u73b0\u5728\u90fd\u600e\u4e48\u6837\u4e86\uff1f","content":{"text":"\u6211\u77e5\u9053\u7684\u90fd\u51fa\u53bb\u6253\u5de5\u4e86\uff0c\u6709\u4e9b\u751a\u81f3\u8e72\u8fc7\u51e0\u5e74\u7262\uff0c\u603b\u4e4b\u5c31\u662f\u6ca1\u4ee5\u524d\u90a3\u4e48\u56a3\u5f20\u5f97\u610f\uff0c\u4f60\u4eec\u77e5\u9053\u7684\u5462\uff1f","pic_uri_list":[],"thumb_image_list":[],"large_image_list":[]},"group_id":null}* behot_time : 1495245397* cursor : 0* filter_words : [{"is_selected":false,"id":"8:0","show_dislike":true,"name":"重復、舊聞"},{"is_selected":false,"id":"9:1","show_dislike":true,"name":"內容質量差"},{"is_selected":false,"id":"3:306457840","show_dislike":true,"name":"黑社會"},{"is_selected":false,"id":"6:47778225","show_dislike":true,"name":"打黑除惡"}]* answer : {"status":1,"qid":6333792867344974082,"abstract":"\u8fd9\u4e2a\u4eba\u7269\u662f\u6211\u540c\u5b66\u7684\u8205\u8205\uff0c\u9053\u4e0a\u90fd\u53eb\u4ed6\u8363\u54e5\uff0c\u4e1c\u5317\u9ed1\u9053\u7684\uff0c\u66fe\u7ecf\u548c\u9ed1\u8001\u5927\u5218\u52c7\u6df7\u7684\uff0c\u73b0\u5728\u5feb60\u5de6\u53f3\u4e86\uff0c\u4e09\u756a\u4e94\u6b21\u8fdb\u5bab\uff0c\u7d2f\u8ba1\u5728\u76d1\u72f1\u5446\u4e86\u5c0f30\u5e74\uff0c2013\u5e74\u51fa\u6765\u4e00\u6b21\uff0c\u56e0\u4e3a\u624b\u4e0b\u4e00\u4e2a\u5c0f\u5f1f\u62ff\u67aa\u5931\u624b\u628a\u5bf9\u65b9\u6253\u6b7b\u4e86\uff0c\u5f53\u65f6\u8fd9\u5c0f\u5f1f\u5f00\u9762\u5305\u8f66\u53bb\u7684\uff0c\u628a\u4eba\u6253\u6b7b\u540e\u6ca1\u6765\u5f97\u53ca\u5f00\u8f66\u8d70\uff0c\u8363\u54e5\u77e5\u9053\u540e\u5927\u9a82\u4ed6\u4e00\u987f\uff0c\u544a\u8bc9\u4ed6\uff0c\u8f66\u4e0d\u80fd\u8981\u4e86\uff0c\u5c0f\u5f1f\u5fc3\u75bc\u8f66\uff0c\u4e8b\u53d1\u540e\u5341\u5929\uff0c\u770b\u6ca1\u5565\u4e8b\uff0c\u5c0f\u5f1f\u6df1\u591c\u53bb\u53d6\u8f66\uff0c\u88ab\u8b66\u5bdf\u5f53\u573a\u62ff\u4e0b\uff0c\u5c0f\u5f1f\u88ab\u6293\uff0c\u67aa\u662f\u8363\u54e5\u7684\uff0c\u6240\u4ee5\u8363\u54e5\u4e5f\u8fdb\u53bb\u4e86\uff0c\u8363\u54e5\u5224\u4e86\u4e0d\u5c11\u5e74\uff0c\u6700\u540e\u51cf\u52117\u5e74\u51fa\u6765\u4e86\uff0c\u9053\u4e0a\u670b\u53cb\u63a5\u98ce\u8bbe\u5bb4\u5f88\u8bb2\u7a76\uff0c\u6bcf\u4e2a\u4eba\u515c\u91cc\u90fd\u6709\u67aa\uff0c\u51fa\u6765\u4e00\u4e2a\u6708\u540e\u53c8\u56e0\u4e3a\u8d29\u6bd2\u8fdb\u53bb\u4e86\uff0c\u4e03\u514b\u6bd2\u54c1\uff0c\u542c\u8bf4\u8d85\u8fc7\u4e03\u514b\u7f6a\u8fc7\u5c31\u5927\u4e86\u3002\u8363\u54e5\u8bf4\uff0c\u4ed6\u8fd9\u7ea7\u522b\u7684\u72af\u4eba\u5728\u7262\u91cc\u6bd4\u5916\u9762\u81ea\u5728\uff0c\u5728\u7262\u91cc\u4e00\u6837\u6709\u5927\u7b14\u751f\u610f\u505a\uff0c\u4e00\u5e74\u4e5f\u80fd20\u6765\u4e07\uff0c\u73b0\u5728\u5f88\u591a\u5f53\u5e74\u8fd8\u4e0d\u9519\u7684\u5927\u54e5\u90fd\u5728\u7262\u91cc\u505a\u751f\u610f\uff0c\u51fa\u6765\u4e86\u4e5f\u60f3\u529e\u6cd5\u518d\u8fdb\u53bb\u3002","uname":"\u67cf\u94ed\u4e00","create_time":1474761961,"ansid":6334054392425087233,"user_id":6029773522,"bury_count":809,"display_status":2,"digg_count":2100,"can_comment":1}* id : 6334054392425087000*/?
所以構造了一個WendaArticleDataBean類
public class WendaArticleDataBean {/*** cell_type : 36* extra : {"wenda_video":[],"show_answer":false,"video_large_card":false,"label_style":{"color_type":0,"name":""},"show_video":false,"video_source_name":"","wenda_image":{"three_image_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664","url_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"},{"url":"http:\/\/pb9.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/18a2000bcefb11e51664"}],"uri":"list\/300x196\/18a2000bcefb11e51664","height":576,"width":768,"type":1},{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/e580008f01daabc4b83","url_list":[{"url":"http:\/\/p3.pstatp.com\/list\/300x196\/e580008f01daabc4b83"},{"url":"http:\/\/pb9.pstatp.com\/list\/300x196\/e580008f01daabc4b83"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/e580008f01daabc4b83"}],"uri":"list\/300x196\/e580008f01daabc4b83","height":295,"width":440,"type":1},{"url":"http:\/\/p9.pstatp.com\/list\/300x196\/12320005f73e2f519d5c","url_list":[{"url":"http:\/\/p9.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"},{"url":"http:\/\/pb1.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"},{"url":"http:\/\/pb3.pstatp.com\/list\/300x196\/12320005f73e2f519d5c"}],"uri":"list\/300x196\/12320005f73e2f519d5c","height":768,"width":431,"type":1}],"small_image_list":[],"large_image_list":[],"medium_image_list":[]},"schema":"sslocal:\/\/wenda_list?qid=6333792867344974082&gd_ext_json=%7B%22qid%22%3A%226333792867344974082%22%2C%22ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22click_answer_hot%22%7D&video_auto_play=0&api_param=%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22native_wenda_home%22%2C%22enter_ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22answer_hot%22%7D"}* question : {"status":1,"op_status":0,"qid":6333792867344974082,"nice_ans_count":336,"uname":"","create_time":1474701070,"normal_ans_count":1227,"item_id":0,"user_id":5547793806,"title":"\u4f60\u4eec\u5f53\u5730\u90a3\u4e9b\u6df7\u9ed1\u793e\u4f1a\u7684\u4eba\u73b0\u5728\u90fd\u600e\u4e48\u6837\u4e86\uff1f","content":{"text":"\u6211\u77e5\u9053\u7684\u90fd\u51fa\u53bb\u6253\u5de5\u4e86\uff0c\u6709\u4e9b\u751a\u81f3\u8e72\u8fc7\u51e0\u5e74\u7262\uff0c\u603b\u4e4b\u5c31\u662f\u6ca1\u4ee5\u524d\u90a3\u4e48\u56a3\u5f20\u5f97\u610f\uff0c\u4f60\u4eec\u77e5\u9053\u7684\u5462\uff1f","pic_uri_list":[],"thumb_image_list":[],"large_image_list":[]},"group_id":null}* behot_time : 1495245397* cursor : 0* filter_words : [{"is_selected":false,"id":"8:0","show_dislike":true,"name":"重復、舊聞"},{"is_selected":false,"id":"9:1","show_dislike":true,"name":"內容質量差"},{"is_selected":false,"id":"3:306457840","show_dislike":true,"name":"黑社會"},{"is_selected":false,"id":"6:47778225","show_dislike":true,"name":"打黑除惡"}]* answer : {"status":1,"qid":6333792867344974082,"abstract":"\u8fd9\u4e2a\u4eba\u7269\u662f\u6211\u540c\u5b66\u7684\u8205\u8205\uff0c\u9053\u4e0a\u90fd\u53eb\u4ed6\u8363\u54e5\uff0c\u4e1c\u5317\u9ed1\u9053\u7684\uff0c\u66fe\u7ecf\u548c\u9ed1\u8001\u5927\u5218\u52c7\u6df7\u7684\uff0c\u73b0\u5728\u5feb60\u5de6\u53f3\u4e86\uff0c\u4e09\u756a\u4e94\u6b21\u8fdb\u5bab\uff0c\u7d2f\u8ba1\u5728\u76d1\u72f1\u5446\u4e86\u5c0f30\u5e74\uff0c2013\u5e74\u51fa\u6765\u4e00\u6b21\uff0c\u56e0\u4e3a\u624b\u4e0b\u4e00\u4e2a\u5c0f\u5f1f\u62ff\u67aa\u5931\u624b\u628a\u5bf9\u65b9\u6253\u6b7b\u4e86\uff0c\u5f53\u65f6\u8fd9\u5c0f\u5f1f\u5f00\u9762\u5305\u8f66\u53bb\u7684\uff0c\u628a\u4eba\u6253\u6b7b\u540e\u6ca1\u6765\u5f97\u53ca\u5f00\u8f66\u8d70\uff0c\u8363\u54e5\u77e5\u9053\u540e\u5927\u9a82\u4ed6\u4e00\u987f\uff0c\u544a\u8bc9\u4ed6\uff0c\u8f66\u4e0d\u80fd\u8981\u4e86\uff0c\u5c0f\u5f1f\u5fc3\u75bc\u8f66\uff0c\u4e8b\u53d1\u540e\u5341\u5929\uff0c\u770b\u6ca1\u5565\u4e8b\uff0c\u5c0f\u5f1f\u6df1\u591c\u53bb\u53d6\u8f66\uff0c\u88ab\u8b66\u5bdf\u5f53\u573a\u62ff\u4e0b\uff0c\u5c0f\u5f1f\u88ab\u6293\uff0c\u67aa\u662f\u8363\u54e5\u7684\uff0c\u6240\u4ee5\u8363\u54e5\u4e5f\u8fdb\u53bb\u4e86\uff0c\u8363\u54e5\u5224\u4e86\u4e0d\u5c11\u5e74\uff0c\u6700\u540e\u51cf\u52117\u5e74\u51fa\u6765\u4e86\uff0c\u9053\u4e0a\u670b\u53cb\u63a5\u98ce\u8bbe\u5bb4\u5f88\u8bb2\u7a76\uff0c\u6bcf\u4e2a\u4eba\u515c\u91cc\u90fd\u6709\u67aa\uff0c\u51fa\u6765\u4e00\u4e2a\u6708\u540e\u53c8\u56e0\u4e3a\u8d29\u6bd2\u8fdb\u53bb\u4e86\uff0c\u4e03\u514b\u6bd2\u54c1\uff0c\u542c\u8bf4\u8d85\u8fc7\u4e03\u514b\u7f6a\u8fc7\u5c31\u5927\u4e86\u3002\u8363\u54e5\u8bf4\uff0c\u4ed6\u8fd9\u7ea7\u522b\u7684\u72af\u4eba\u5728\u7262\u91cc\u6bd4\u5916\u9762\u81ea\u5728\uff0c\u5728\u7262\u91cc\u4e00\u6837\u6709\u5927\u7b14\u751f\u610f\u505a\uff0c\u4e00\u5e74\u4e5f\u80fd20\u6765\u4e07\uff0c\u73b0\u5728\u5f88\u591a\u5f53\u5e74\u8fd8\u4e0d\u9519\u7684\u5927\u54e5\u90fd\u5728\u7262\u91cc\u505a\u751f\u610f\uff0c\u51fa\u6765\u4e86\u4e5f\u60f3\u529e\u6cd5\u518d\u8fdb\u53bb\u3002","uname":"\u67cf\u94ed\u4e00","create_time":1474761961,"ansid":6334054392425087233,"user_id":6029773522,"bury_count":809,"display_status":2,"digg_count":2100,"can_comment":1}* id : 6334054392425087000*/private int cell_type;private String extra;private String question;private String behot_time;private int cursor;private String answer;private long id;private ExtraBean extraBean;private QuestionBean questionBean;private AnswerBean answerBean;public AnswerBean getAnswerBean() {return answerBean;}public void setAnswerBean(AnswerBean answerBean) {this.answerBean = answerBean;}public ExtraBean getExtraBean() {return extraBean;}public void setExtraBean(ExtraBean extraBean) {this.extraBean = extraBean;}public QuestionBean getQuestionBean() {return questionBean;}public void setQuestionBean(QuestionBean questionBean) {this.questionBean = questionBean;}public int getCell_type() {return cell_type;}public void setCell_type(int cell_type) {this.cell_type = cell_type;}public String getExtra() {return extra;}public void setExtra(String extra) {this.extra = extra;}public String getQuestion() {return question;}public void setQuestion(String question) {this.question = question;}public String getBehot_time() {return behot_time;}public void setBehot_time(String behot_time) {this.behot_time = behot_time;}public int getCursor() {return cursor;}public void setCursor(int cursor) {this.cursor = cursor;}public String getAnswer() {return answer;}public void setAnswer(String answer) {this.answer = answer;}public long getId() {return id;}public void setId(long id) {this.id = id;}public static class ExtraBean {/*** wenda_video : []* show_answer : false* video_large_card : false* label_style : {"color_type":0,"name":""}* show_video : false* video_source_name :* wenda_image : {"three_image_list":[{"url":"http://p3.pstatp.com/list/300x196/18a2000bcefb11e51664","url_list":[{"url":"http://p3.pstatp.com/list/300x196/18a2000bcefb11e51664"},{"url":"http://pb9.pstatp.com/list/300x196/18a2000bcefb11e51664"},{"url":"http://pb3.pstatp.com/list/300x196/18a2000bcefb11e51664"}],"uri":"list/300x196/18a2000bcefb11e51664","height":576,"width":768,"type":1},{"url":"http://p3.pstatp.com/list/300x196/e580008f01daabc4b83","url_list":[{"url":"http://p3.pstatp.com/list/300x196/e580008f01daabc4b83"},{"url":"http://pb9.pstatp.com/list/300x196/e580008f01daabc4b83"},{"url":"http://pb3.pstatp.com/list/300x196/e580008f01daabc4b83"}],"uri":"list/300x196/e580008f01daabc4b83","height":295,"width":440,"type":1},{"url":"http://p9.pstatp.com/list/300x196/12320005f73e2f519d5c","url_list":[{"url":"http://p9.pstatp.com/list/300x196/12320005f73e2f519d5c"},{"url":"http://pb1.pstatp.com/list/300x196/12320005f73e2f519d5c"},{"url":"http://pb3.pstatp.com/list/300x196/12320005f73e2f519d5c"}],"uri":"list/300x196/12320005f73e2f519d5c","height":768,"width":431,"type":1}],"small_image_list":[],"large_image_list":[],"medium_image_list":[]}* schema : sslocal://wenda_list?qid=6333792867344974082&gd_ext_json=%7B%22qid%22%3A%226333792867344974082%22%2C%22ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22click_answer_hot%22%7D&video_auto_play=0&api_param=%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22native_wenda_home%22%2C%22enter_ansid%22%3A%226334054392425087233%22%2C%22enter_from%22%3A%22answer_hot%22%7D*/private boolean show_answer;private boolean video_large_card;private LabelStyleBean label_style;private boolean show_video;private String video_source_name;private WendaImageBean wenda_image;private String schema;private List<?> wenda_video;public boolean isShow_answer() {return show_answer;}public void setShow_answer(boolean show_answer) {this.show_answer = show_answer;}public boolean isVideo_large_card() {return video_large_card;}public void setVideo_large_card(boolean video_large_card) {this.video_large_card = video_large_card;}public LabelStyleBean getLabel_style() {return label_style;}public void setLabel_style(LabelStyleBean label_style) {this.label_style = label_style;}public boolean isShow_video() {return show_video;}public void setShow_video(boolean show_video) {this.show_video = show_video;}public String getVideo_source_name() {return video_source_name;}public void setVideo_source_name(String video_source_name) {this.video_source_name = video_source_name;}public WendaImageBean getWenda_image() {return wenda_image;}public void setWenda_image(WendaImageBean wenda_image) {this.wenda_image = wenda_image;}public String getSchema() {return schema;}public void setSchema(String schema) {this.schema = schema;}public List<?> getWenda_video() {return wenda_video;}public void setWenda_video(List<?> wenda_video) {this.wenda_video = wenda_video;}public static class LabelStyleBean {/*** color_type : 0* name :*/private int color_type;private String name;public int getColor_type() {return color_type;}public void setColor_type(int color_type) {this.color_type = color_type;}public String getName() {return name;}public void setName(String name) {this.name = name;}}public static class WendaImageBean {private List<ThreeImageListBean> three_image_list;private List<?> small_image_list;private List<LargeImageList> large_image_list;private List<?> medium_image_list;public List<ThreeImageListBean> getThree_image_list() {return three_image_list;}public void setThree_image_list(List<ThreeImageListBean> three_image_list) {this.three_image_list = three_image_list;}public List<?> getSmall_image_list() {return small_image_list;}public void setSmall_image_list(List<?> small_image_list) {this.small_image_list = small_image_list;}public List<LargeImageList> getLarge_image_list() {return large_image_list;}public void setLarge_image_list(List<LargeImageList> large_image_list) {this.large_image_list = large_image_list;}public List<?> getMedium_image_list() {return medium_image_list;}public void setMedium_image_list(List<?> medium_image_list) {this.medium_image_list = medium_image_list;}public static class ThreeImageListBean {/*** url : http://p3.pstatp.com/list/300x196/18a2000bcefb11e51664* url_list : [{"url":"http://p3.pstatp.com/list/300x196/18a2000bcefb11e51664"},{"url":"http://pb9.pstatp.com/list/300x196/18a2000bcefb11e51664"},{"url":"http://pb3.pstatp.com/list/300x196/18a2000bcefb11e51664"}]* uri : list/300x196/18a2000bcefb11e51664* height : 576* width : 768* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBean> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBean> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBean> url_list) {this.url_list = url_list;}public static class UrlListBean {/*** url : http://p3.pstatp.com/list/300x196/18a2000bcefb11e51664*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}public static class LargeImageList {private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}}public static class QuestionBean {/*** status : 1* op_status : 0* qid : 6333792867344974000* nice_ans_count : 336* uname :* create_time : 1474701070* normal_ans_count : 1227* item_id : 0* user_id : 5547793806* title : 你們當地那些混黑社會的人現在都怎么樣了?* content : {"text":"我知道的都出去打工了,有些甚至蹲過幾年牢,總之就是沒以前那么囂張得意,你們知道的呢?","pic_uri_list":[],"thumb_image_list":[],"large_image_list":[]}* group_id : null*/private int status;private int op_status;private long qid;private int nice_ans_count;private String uname;private int create_time;private int normal_ans_count;private int item_id;private long user_id;private String title;private ContentBean content;private Object group_id;public int getStatus() {return status;}public void setStatus(int status) {this.status = status;}public int getOp_status() {return op_status;}public void setOp_status(int op_status) {this.op_status = op_status;}public long getQid() {return qid;}public void setQid(long qid) {this.qid = qid;}public int getNice_ans_count() {return nice_ans_count;}public void setNice_ans_count(int nice_ans_count) {this.nice_ans_count = nice_ans_count;}public String getUname() {return uname;}public void setUname(String uname) {this.uname = uname;}public int getCreate_time() {return create_time;}public void setCreate_time(int create_time) {this.create_time = create_time;}public int getNormal_ans_count() {return normal_ans_count;}public void setNormal_ans_count(int normal_ans_count) {this.normal_ans_count = normal_ans_count;}public int getItem_id() {return item_id;}public void setItem_id(int item_id) {this.item_id = item_id;}public long getUser_id() {return user_id;}public void setUser_id(long user_id) {this.user_id = user_id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public ContentBean getContent() {return content;}public void setContent(ContentBean content) {this.content = content;}public Object getGroup_id() {return group_id;}public void setGroup_id(Object group_id) {this.group_id = group_id;}public static class ContentBean {/*** text : 我知道的都出去打工了,有些甚至蹲過幾年牢,總之就是沒以前那么囂張得意,你們知道的呢?* pic_uri_list : []* thumb_image_list : []* large_image_list : []*/private String text;private List<?> pic_uri_list;private List<?> thumb_image_list;private List<?> large_image_list;public String getText() {return text;}public void setText(String text) {this.text = text;}public List<?> getPic_uri_list() {return pic_uri_list;}public void setPic_uri_list(List<?> pic_uri_list) {this.pic_uri_list = pic_uri_list;}public List<?> getThumb_image_list() {return thumb_image_list;}public void setThumb_image_list(List<?> thumb_image_list) {this.thumb_image_list = thumb_image_list;}public List<?> getLarge_image_list() {return large_image_list;}public void setLarge_image_list(List<?> large_image_list) {this.large_image_list = large_image_list;}}}public static class AnswerBean {/*** status : 1* qid : 6355230839860625000* abstract : 很多人喜歡在院子里種樹,但有些樹適合在院子里種,有些樹不適合。那么,院子里中出的風水有什么禁忌呢?哪些樹可以種,哪些不可以呢?下面和大家一起看看。院子里種樹的風水有什么禁忌種樹也有風水講究你知道院子里不能種什么樹嗎院子中央不宜放植栽院子中心不宜種樹,樹種樹風水院子里種樹風水知識植物有陰陽屬性。喜陽的植物,如植(置)于陰濕的環境,則體弱,無花,無果或死亡。如:白蘭、玫瑰、茉莉、梅花、牡丹、芍藥、杜鵑、菊花等。這類植物,須得一千八百個勒克斯光照度,才能正常發能。而文竹,龜背竹、萬年青、綠蘿、蓬萊松、巴西鐵等,在一百個勒克斯光照度條件下,亦能正常生長。此類植物可長期置于室內或陰暗處。屬于陰性植物。院子里種樹風水注意事項風水樹知識根據古代風水理論,中式風格的別墅院子前院可以栽種桂亦主桃花、多生女兒,此時可在向上施以遮形、通氣之法。艮方有山而形惡者相同 。植物作為一種活物,其本身存在的風水能量就要比一些擺件或者裝飾之類的死物更強,因此,在進行庭院綠化的過程中必須要關注下各種不同植物的風水問題。庭院綠化過程中要注意植物的風水禁忌在這里我們要為各位介紹的就是關于植物的風水禁忌問題,在庭院綠化的過程中,一定要盡可能的避免觸犯這些風水禁忌。1、任何植物不可與門相對,因為大門乃是住宅的納氣口,所以庭院大門和住宅大門必須相通,中間不可以有任何阻礙,如果中間出現了什么植物擋住了從大門進入的氣場,必然會對住宅的氣場環境帶來一定不利影響,所以這一點大家必須重視。2、庭院中心位置不可有植物,因為在風水學中認為中心的位置乃是風水氣運最強的地方,所以最好將自己的住宅放在庭院的中心,這樣對于住宅的氣運才會有所幫助。如果在中心位置有植物,特別是大樹,將會嚴重破壞住宅的風水氣場,所以最好是在庭院中心處建造一個水池、噴泉之類與水有關的事物,這樣可以旺盛財運。3、帶有尖刺的植物不宜種植,在庭院綠化的過程中種植的植物一定要謹慎選擇,由于風水學中比較忌諱帶有尖刺的事物,所以植物如果有尖刺,最好也不要種在庭院里,那樣對于住宅的風水氣場會帶來不利影響。此外,如果植物的相貌丑惡,最好也不要種。這些就是庭院綠化過程中,大家必須注意的與植物相關的風水禁忌問題。一個家宅中,除了大廳、臥室,庭院是每個人的必經之處,所以庭院的風水布局也是住宅最重要的部分之一,合理的布置庭院,不僅能讓庭院看起來美觀大方,還能形成良好的氣場。我們可以通過庭院綠化來做好庭院布局。有關庭院布局,大家可以看看下面的講解。庭院綠化時需要注意的一些風水布局問題不宜種植易斜的樹:庭院綠化最重要的是綠化植物的選擇,選擇綠化植物的時候盡量選擇樹干筆直、生命力旺盛的植物,這樣會旺子孫,一定不要選擇難成活、遇風雨容易傾斜的植物,這樣的植物不利于房屋氣場的通行,影響家人的身體健康。庭院不要鋪很多碎石:泥土是很多植物的最佳種植方式,但是近年來,有人不斷追求新潮,喜歡用碎石來種植植物,以增加庭院的韻味,但是庭院綠化很忌諱道路鋪碎石。另外,庭院道路上鋪碎石,不方便人行走,走的時候容易發生磕磕絆絆,尤其是家中有老人的,老人摔跤嚴重時會有生命危險。設計假山、噴泉,風水更佳:所謂風水布局,有風來,七亨通;有水到,水到渠成。庭院綠化的時候,房主可考慮修建一些假山或噴泉,利用綠化、水體造型,不僅能讓庭院更美觀,水氣加濕空氣濕度,讓家人身體健康。庭院綠化的布置,與家人的運勢息息相關,這里提醒大家,在開工前一定要先充分了解庭院綠化風水的有關知識,否則破壞原有的風水就不好了。家里不能種石榴樹,這要看你石榴的大小了,石榴本來有多子多福的寓意,土栽盆栽都有。既美化了環境,又可以吃到美味的果實,一舉兩得。但是如果種植位置不對,或者樹形大小不合適,如此情況是不建議在家種植的。但是如果說不能在家種植,似乎有些武斷了!看看哪些情況下不適合在家種:風水禁忌院子或客廳中央不宜放。首先在院子中間種植石榴樹,樹形較大,容易擋光,不利于采光。另外,如果是落葉樹經常掉葉,難于清掃,也有礙美觀和衛生。另外,認為家中不能種植石榴樹的人,大多是因為“石榴裙下死”這個故事的傳說,容易對家庭造成不和諧。大家都生活在現代社會,所謂的這些故事傳說,并不能得到驗證,沒有說服力。如果你對植物家居風水深信不疑,那還是不要在家種石榴!養護環境的差異許多人在家種石榴盆栽,但只開花不結果,不是什么風水問題,是家里的環境有關,還有品種,以及種植方法不恰當的影響。1.品種石榴品種很多,主要分二大類,即花石榴和果石榴(果石榴多單瓣花),如果選擇的僅供賞花的花石榴,就可能只開花不結果,即使結果,也只能結直徑僅2—3厘米的小果實,不能食用,也就是看看而已?,F有一種紅花重瓣石榴,花艷而結果,既能賞花又能食果。2.環境要求種植石榴的土壤要求疏松、肥沃、排水良好;光照應充足,生長期要求全日照,并且光照越充足,花越多越鮮艷,光照不足時,可能只長葉不開花;適宜生長溫度15-20℃。而家庭種最大的問題就是光照,除非是庭院,無遮擋陽光充足,否則很難達到石榴開花結果的要求。3.日常管理澆水、施肥、適度剪枝、病蟲害防治也很重要,充分注意才能花好果豐。家里是可以種石榴的,在風水上還是有一定好處的:石榴花的風水價值石榴花花朵表面光滑,顏色鮮紅艷麗,象征著富貴,成熟的美麗。如果石榴花擺放位置不同那么它所代表的風水也不同首先因為石榴花的果實鮮美肥碩,而且色彩鮮艷光亮,所以表示了喜慶,如果把石榴花放在客廳、陽臺、院子里,則會讓家庭多子多孫,多福壽。其次石榴花的果子香甜口口,常被人們代表為繁榮、昌盛、團圓、和睦,是人們喜愛的一種吉祥之果,在民間人們會把石榴花的果實切開,會出來豐滿飽實的果粒,則用來表示多多生子,以及農家豐收滿滿。最后石榴也會作為一種中秋佳節贈送的禮品,象征吉祥,又因為石榴花帶一個榴字,可以諧音為留,所以也表示了留下之意,“送榴傳誼”就延伸出來了。石榴花的價值當你把石榴花擺在家里的陽臺上或者臥室里時,不僅可以帶來吉祥美好的祝福,也會祝福你多子多孫多福壽,而且石榴花的價值也不少呢石榴花擺在室內美化空間,等石榴花的果實成熟以后,也可以食用,藥用。石榴花的果實可以炒菜,作為一道美味的小菜入口,甜潤爽口。石榴花的果實也可以入藥,治療腹瀉、殺早、止咳等。所以石榴花不僅風水好,它的價值也不容易小覷,不妨你試試,絕對讓你贊不絕口,會想一直種植石榴花呢!石榴呢,在書上一般記載為落葉灌木或小喬木。石榴樹樹冠叢狀自然圓頭形。樹干呈灰褐色,上面有丑丑的瘤狀突起,樹根是黃褐色。石榴樹高可達4-5米以上,但是也有分矮生石榴,長成的石榴樹只有1米左右。石榴的葉子是針狀枝,葉呈長倒卵形或長橢圓形。石榴花是朱紅色的,花期是5、6月份。石榴是一個圓圓的小紅果,到9月10月的時候就會像一個個紅彤彤的小燈籠一樣,掛在樹上。石榴作為一種常見的水果,也是常見的觀賞植物。可謂全身是寶,果皮、根、花皆可入藥。石榴晶瑩剔透,如紅寶石般的果粒,是很多女性都會喜歡的。但是很多人不喜歡石榴外表黑紅,有些丑丑的果皮,千萬不要小看了石榴的果皮哦,其果皮中含有蘋果酸、鞣質、生物堿等成分。所以說,石榴可是實力和內在兼具的水果。* uname : 用戶58700537490* create_time : 1490869217* ansid : 6403234528361447000* user_id : 58700537490* bury_count : 39* display_status : 2* digg_count : 998* can_comment : 1*/private int status;private long qid;@SerializedName("abstract")private String abstractX;private String uname;private int create_time;private long ansid;private long user_id;private int bury_count;private int display_status;private int digg_count;private int can_comment;public int getStatus() {return status;}public void setStatus(int status) {this.status = status;}public long getQid() {return qid;}public void setQid(long qid) {this.qid = qid;}public String getAbstractX() {return abstractX;}public void setAbstractX(String abstractX) {this.abstractX = abstractX;}public String getUname() {return uname;}public void setUname(String uname) {this.uname = uname;}public int getCreate_time() {return create_time;}public void setCreate_time(int create_time) {this.create_time = create_time;}public long getAnsid() {return ansid;}public void setAnsid(long ansid) {this.ansid = ansid;}public long getUser_id() {return user_id;}public void setUser_id(long user_id) {this.user_id = user_id;}public int getBury_count() {return bury_count;}public void setBury_count(int bury_count) {this.bury_count = bury_count;}public int getDisplay_status() {return display_status;}public void setDisplay_status(int display_status) {this.display_status = display_status;}public int getDigg_count() {return digg_count;}public void setDigg_count(int digg_count) {this.digg_count = digg_count;}public int getCan_comment() {return can_comment;}public void setCan_comment(int can_comment) {this.can_comment = can_comment;}}} View Code?
?
1.2.WendaArticleBean類
API返回的數據如下:
/*** add_first_page : 1* has_more_to_refresh : true* login_status : 0* total_number : 10* extra :* has_more : true* message : success* api_param : {"origin_from":"","enter_from":""}* tips : {"display_info":"今日頭條推薦引擎有10條更新","open_url":"","type":"app","display_duration":2,"app_name":"今日頭條"}*/由此構造了一個WendaArticleBean類
package com.jasonjan.headnews.bean.wenda;import java.util.List;public class WendaArticleBean {/*** add_first_page : 1* has_more_to_refresh : true* login_status : 0* total_number : 10* extra :* has_more : true* message : success* api_param : {"origin_from":"","enter_from":""}* tips : {"display_info":"今日頭條推薦引擎有10條更新","open_url":"","type":"app","display_duration":2,"app_name":"今日頭條"}*/private int add_first_page;private boolean has_more_to_refresh;private int login_status;private int total_number;private String extra;private boolean has_more;private String message;private String api_param;private TipsBean tips;private List<DataBean> data;public int getAdd_first_page() {return add_first_page;}public void setAdd_first_page(int add_first_page) {this.add_first_page = add_first_page;}public boolean isHas_more_to_refresh() {return has_more_to_refresh;}public void setHas_more_to_refresh(boolean has_more_to_refresh) {this.has_more_to_refresh = has_more_to_refresh;}public int getLogin_status() {return login_status;}public void setLogin_status(int login_status) {this.login_status = login_status;}public int getTotal_number() {return total_number;}public void setTotal_number(int total_number) {this.total_number = total_number;}public String getExtra() {return extra;}public void setExtra(String extra) {this.extra = extra;}public boolean isHas_more() {return has_more;}public void setHas_more(boolean has_more) {this.has_more = has_more;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}public String getApi_param() {return api_param;}public void setApi_param(String api_param) {this.api_param = api_param;}public TipsBean getTips() {return tips;}public void setTips(TipsBean tips) {this.tips = tips;}public List<DataBean> getData() {return data;}public void setData(List<DataBean> data) {this.data = data;}public static class TipsBean {/*** display_info : 今日頭條推薦引擎有10條更新* open_url :* type : app* display_duration : 2* app_name : 今日頭條*/private String display_info;private String open_url;private String type;private int display_duration;private String app_name;public String getDisplay_info() {return display_info;}public void setDisplay_info(String display_info) {this.display_info = display_info;}public String getOpen_url() {return open_url;}public void setOpen_url(String open_url) {this.open_url = open_url;}public String getType() {return type;}public void setType(String type) {this.type = type;}public int getDisplay_duration() {return display_duration;}public void setDisplay_duration(int display_duration) {this.display_duration = display_duration;}public String getApp_name() {return app_name;}public void setApp_name(String app_name) {this.app_name = app_name;}}public static class DataBean {/*** content : {"cell_height":120,"data_url":"https:\/\/ic.snssdk.com\/wenda\/v1\/channel\/announcement\/","template_url":"http:\/\/ic.snssdk.com\/wenda\/v1\/native\/widget\/?api_param=%7B%22wd_version%22%3A5%7D","data_flag":true,"id":"50052410574","template_md5":"bc58854942d0559324kjl435298234fs","cell_type":25,"is_deleted":false,"behot_time":1495245397,"cursor":1,"refresh_interval":60,"data_callback":"window.refresh"}* code :*/private String content;private String code;public String getContent() {return content;}public void setContent(String content) {this.content = content;}public String getCode() {return code;}public void setCode(String code) {this.code = code;}} } View Code?
?
1.3.WendaContentBean類
API返回的數據如下:
/*** show_format : {"show_module":1,"font_size":"18","answer_full_context_color":0}* err_tips :* err_no : 0* offset : 10* candidate_invite_user : []* module_list : [{"day_icon_url":"http://p3.pstatp.com/origin/1bf50001abbc1c7f8dba","text":"更多問答","icon_type":2,"night_icon_url":"http://p3.pstatp.com/origin/1bf40001abebc0717135","schema":"sslocal://feed?category=question_and_answer&concern_id=6260258266329123329&type=4&name=%E9%97%AE%E7%AD%94&api_param=%7B%22source%22%3A%22question_brow%22%2C%22origin_from%22%3Anull%2C%22enter_from%22%3Anull%7D"}]* has_more : true* channel_data : {"open_url":"sslocal://webview?url=https%3A%2F%2Fic.snssdk.com%2Fwenda%2Fv1%2Fwaphome%2Fbrow%2F%3Frecommend_from%3Drecommend_question_brow&title=%E5%A4%B4%E6%9D%A1%E9%97%AE%E7%AD%94","text":"關注問答頻道,聊天更有談資!","pos":3,"button_text":"進入","recommend_image":{"url":"https://p.pstatp.com/origin/159f000460df3e3f850c","url_list":[{"url":"http://p3.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb9.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb3.pstatp.com/list/r90/13530005a010f7ce835d"}],"uri":"list/r90/13530005a010f7ce835d","height":90,"width":90,"type":1},"type":1}* question : {"concern_tag_list":[{"concern_id":"6213182495320443393","name":"火車","schema":"sslocal://concern?tab_sname=wenda&api_param=%7B%22wenda_api_param%22%3A%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22click_headline%22%2C%22parent_enter_from%22%3A%22click_headline%22%2C%22enter_from%22%3A%22question%22%7D%7D&cid=6213182495320443393"}],"can_delete":false,"post_answer_url":"sslocal://wenda_post?qid=6420544946419269889&gd_ext_json=%7B%22enter_type%22%3A%22question_and_answer%22%2C%22ansid%22%3A6422088403512197378%7D&qTitle=%E5%8D%B0%E5%BA%A6%E6%9C%80%E5%BF%AB%E7%9A%84%E5%88%97%E8%BD%A6%E6%97%B6%E9%80%9F160%EF%BC%8C%E5%BD%93%E5%9C%B0%E4%BA%BA%E9%97%AE%E2%80%9C%E4%B8%AD%E5%9B%BD%E7%81%AB%E8%BD%A6%E6%9C%89%E8%BF%99%E4%B9%88%E5%BF%AB%E5%90%97%E2%80%9D%EF%BC%8C%E6%80%8E%E4%B9%88%E5%9B%9E%E7%AD%94%EF%BC%9F","is_follow":false,"nice_ans_count":73,"create_time":1494899612,"normal_ans_count":851,"user":{"user_intro":"","uname":"yuejiao19926","avatar_url":"http://p0.pstatp.com/origin/3795/3033762272","user_id":"6796383301","is_verify":0},"share_data":{"content":"非常推薦!","image_url":"http://p0.pstatp.com/medium/6399/2275149767","share_url":"https://wenda.toutiao.com/m/wapshare/question/brow/?qid=6420544946419269889&","title":"頭條問答-印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?(924個回答)"},"can_edit":false,"show_delete":false,"title":"印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?","follow_count":497,"content":{"text":"\n","thumb_image_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}],"large_image_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/large/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}]},"show_edit":false,"qid":"6420544946419269889","fold_reason":{"open_url":"sslocal://detail?groupid=6293724675596402946","title":"為什么折疊?"}}* module_count : 1* question_type : 0* api_param : {"origin_from": null, "enter_from": null}* question_header_content_fold_max_count : 1*/由此構造出WendaContentBean類
package com.jasonjan.headnews.bean.wenda;import android.os.Parcel; import android.os.Parcelable;import java.util.List;public class WendaContentBean {/*** show_format : {"show_module":1,"font_size":"18","answer_full_context_color":0}* err_tips :* err_no : 0* offset : 10* candidate_invite_user : []* module_list : [{"day_icon_url":"http://p3.pstatp.com/origin/1bf50001abbc1c7f8dba","text":"更多問答","icon_type":2,"night_icon_url":"http://p3.pstatp.com/origin/1bf40001abebc0717135","schema":"sslocal://feed?category=question_and_answer&concern_id=6260258266329123329&type=4&name=%E9%97%AE%E7%AD%94&api_param=%7B%22source%22%3A%22question_brow%22%2C%22origin_from%22%3Anull%2C%22enter_from%22%3Anull%7D"}]* has_more : true* channel_data : {"open_url":"sslocal://webview?url=https%3A%2F%2Fic.snssdk.com%2Fwenda%2Fv1%2Fwaphome%2Fbrow%2F%3Frecommend_from%3Drecommend_question_brow&title=%E5%A4%B4%E6%9D%A1%E9%97%AE%E7%AD%94","text":"關注問答頻道,聊天更有談資!","pos":3,"button_text":"進入","recommend_image":{"url":"https://p.pstatp.com/origin/159f000460df3e3f850c","url_list":[{"url":"http://p3.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb9.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb3.pstatp.com/list/r90/13530005a010f7ce835d"}],"uri":"list/r90/13530005a010f7ce835d","height":90,"width":90,"type":1},"type":1}* question : {"concern_tag_list":[{"concern_id":"6213182495320443393","name":"火車","schema":"sslocal://concern?tab_sname=wenda&api_param=%7B%22wenda_api_param%22%3A%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22click_headline%22%2C%22parent_enter_from%22%3A%22click_headline%22%2C%22enter_from%22%3A%22question%22%7D%7D&cid=6213182495320443393"}],"can_delete":false,"post_answer_url":"sslocal://wenda_post?qid=6420544946419269889&gd_ext_json=%7B%22enter_type%22%3A%22question_and_answer%22%2C%22ansid%22%3A6422088403512197378%7D&qTitle=%E5%8D%B0%E5%BA%A6%E6%9C%80%E5%BF%AB%E7%9A%84%E5%88%97%E8%BD%A6%E6%97%B6%E9%80%9F160%EF%BC%8C%E5%BD%93%E5%9C%B0%E4%BA%BA%E9%97%AE%E2%80%9C%E4%B8%AD%E5%9B%BD%E7%81%AB%E8%BD%A6%E6%9C%89%E8%BF%99%E4%B9%88%E5%BF%AB%E5%90%97%E2%80%9D%EF%BC%8C%E6%80%8E%E4%B9%88%E5%9B%9E%E7%AD%94%EF%BC%9F","is_follow":false,"nice_ans_count":73,"create_time":1494899612,"normal_ans_count":851,"user":{"user_intro":"","uname":"yuejiao19926","avatar_url":"http://p0.pstatp.com/origin/3795/3033762272","user_id":"6796383301","is_verify":0},"share_data":{"content":"非常推薦!","image_url":"http://p0.pstatp.com/medium/6399/2275149767","share_url":"https://wenda.toutiao.com/m/wapshare/question/brow/?qid=6420544946419269889&","title":"頭條問答-印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?(924個回答)"},"can_edit":false,"show_delete":false,"title":"印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?","follow_count":497,"content":{"text":"\n","thumb_image_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}],"large_image_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/large/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}]},"show_edit":false,"qid":"6420544946419269889","fold_reason":{"open_url":"sslocal://detail?groupid=6293724675596402946","title":"為什么折疊?"}}* module_count : 1* question_type : 0* api_param : {"origin_from": null, "enter_from": null}* question_header_content_fold_max_count : 1*/private ShowFormatBean show_format;private String err_tips;private int err_no;private int offset;private boolean has_more;private ChannelDataBean channel_data;private QuestionBean question;private int module_count;private int question_type;private String api_param;private int question_header_content_fold_max_count;private List<?> candidate_invite_user;private List<ModuleListBean> module_list;private List<AnsListBean> ans_list;public ShowFormatBean getShow_format() {return show_format;}public void setShow_format(ShowFormatBean show_format) {this.show_format = show_format;}public String getErr_tips() {return err_tips;}public void setErr_tips(String err_tips) {this.err_tips = err_tips;}public int getErr_no() {return err_no;}public void setErr_no(int err_no) {this.err_no = err_no;}public int getOffset() {return offset;}public void setOffset(int offset) {this.offset = offset;}public boolean isHas_more() {return has_more;}public void setHas_more(boolean has_more) {this.has_more = has_more;}public ChannelDataBean getChannel_data() {return channel_data;}public void setChannel_data(ChannelDataBean channel_data) {this.channel_data = channel_data;}public QuestionBean getQuestion() {return question;}public void setQuestion(QuestionBean question) {this.question = question;}public int getModule_count() {return module_count;}public void setModule_count(int module_count) {this.module_count = module_count;}public int getQuestion_type() {return question_type;}public void setQuestion_type(int question_type) {this.question_type = question_type;}public String getApi_param() {return api_param;}public void setApi_param(String api_param) {this.api_param = api_param;}public int getQuestion_header_content_fold_max_count() {return question_header_content_fold_max_count;}public void setQuestion_header_content_fold_max_count(int question_header_content_fold_max_count) {this.question_header_content_fold_max_count = question_header_content_fold_max_count;}public List<?> getCandidate_invite_user() {return candidate_invite_user;}public void setCandidate_invite_user(List<?> candidate_invite_user) {this.candidate_invite_user = candidate_invite_user;}public List<ModuleListBean> getModule_list() {return module_list;}public void setModule_list(List<ModuleListBean> module_list) {this.module_list = module_list;}public List<AnsListBean> getAns_list() {return ans_list;}public void setAns_list(List<AnsListBean> ans_list) {this.ans_list = ans_list;}public static class ShowFormatBean {/*** show_module : 1* font_size : 18* answer_full_context_color : 0*/private int show_module;private String font_size;private int answer_full_context_color;public int getShow_module() {return show_module;}public void setShow_module(int show_module) {this.show_module = show_module;}public String getFont_size() {return font_size;}public void setFont_size(String font_size) {this.font_size = font_size;}public int getAnswer_full_context_color() {return answer_full_context_color;}public void setAnswer_full_context_color(int answer_full_context_color) {this.answer_full_context_color = answer_full_context_color;}}public static class ChannelDataBean {/*** open_url : sslocal://webview?url=https%3A%2F%2Fic.snssdk.com%2Fwenda%2Fv1%2Fwaphome%2Fbrow%2F%3Frecommend_from%3Drecommend_question_brow&title=%E5%A4%B4%E6%9D%A1%E9%97%AE%E7%AD%94* text : 關注問答頻道,聊天更有談資!* pos : 3* button_text : 進入* recommend_image : {"url":"https://p.pstatp.com/origin/159f000460df3e3f850c","url_list":[{"url":"http://p3.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb9.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb3.pstatp.com/list/r90/13530005a010f7ce835d"}],"uri":"list/r90/13530005a010f7ce835d","height":90,"width":90,"type":1}* type : 1*/private String open_url;private String text;private int pos;private String button_text;private RecommendImageBean recommend_image;private int type;public String getOpen_url() {return open_url;}public void setOpen_url(String open_url) {this.open_url = open_url;}public String getText() {return text;}public void setText(String text) {this.text = text;}public int getPos() {return pos;}public void setPos(int pos) {this.pos = pos;}public String getButton_text() {return button_text;}public void setButton_text(String button_text) {this.button_text = button_text;}public RecommendImageBean getRecommend_image() {return recommend_image;}public void setRecommend_image(RecommendImageBean recommend_image) {this.recommend_image = recommend_image;}public int getType() {return type;}public void setType(int type) {this.type = type;}public static class RecommendImageBean {/*** url : https://p.pstatp.com/origin/159f000460df3e3f850c* url_list : [{"url":"http://p3.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb9.pstatp.com/list/r90/13530005a010f7ce835d"},{"url":"http://pb3.pstatp.com/list/r90/13530005a010f7ce835d"}]* uri : list/r90/13530005a010f7ce835d* height : 90* width : 90* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBean> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBean> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBean> url_list) {this.url_list = url_list;}public static class UrlListBean {/*** url : http://p3.pstatp.com/list/r90/13530005a010f7ce835d*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}}public static class QuestionBean {/*** concern_tag_list : [{"concern_id":"6213182495320443393","name":"火車","schema":"sslocal://concern?tab_sname=wenda&api_param=%7B%22wenda_api_param%22%3A%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22click_headline%22%2C%22parent_enter_from%22%3A%22click_headline%22%2C%22enter_from%22%3A%22question%22%7D%7D&cid=6213182495320443393"}]* can_delete : false* post_answer_url : sslocal://wenda_post?qid=6420544946419269889&gd_ext_json=%7B%22enter_type%22%3A%22question_and_answer%22%2C%22ansid%22%3A6422088403512197378%7D&qTitle=%E5%8D%B0%E5%BA%A6%E6%9C%80%E5%BF%AB%E7%9A%84%E5%88%97%E8%BD%A6%E6%97%B6%E9%80%9F160%EF%BC%8C%E5%BD%93%E5%9C%B0%E4%BA%BA%E9%97%AE%E2%80%9C%E4%B8%AD%E5%9B%BD%E7%81%AB%E8%BD%A6%E6%9C%89%E8%BF%99%E4%B9%88%E5%BF%AB%E5%90%97%E2%80%9D%EF%BC%8C%E6%80%8E%E4%B9%88%E5%9B%9E%E7%AD%94%EF%BC%9F* is_follow : false* nice_ans_count : 73* create_time : 1494899612* normal_ans_count : 851* user : {"user_intro":"","uname":"yuejiao19926","avatar_url":"http://p0.pstatp.com/origin/3795/3033762272","user_id":"6796383301","is_verify":0}* share_data : {"content":"非常推薦!","image_url":"http://p0.pstatp.com/medium/6399/2275149767","share_url":"https://wenda.toutiao.com/m/wapshare/question/brow/?qid=6420544946419269889&","title":"頭條問答-印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?(924個回答)"}* can_edit : false* show_delete : false* title : 印度最快的列車時速160,當地人問“中國火車有這么快嗎”,怎么回答?* follow_count : 497* content : {"text":"\n","thumb_image_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}],"large_image_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/large/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}]}* show_edit : false* qid : 6420544946419269889* fold_reason : {"open_url":"sslocal://detail?groupid=6293724675596402946","title":"為什么折疊?"}*/private boolean can_delete;private String post_answer_url;private boolean is_follow;private int nice_ans_count;private int create_time;private int normal_ans_count;private UserBean user;private ShareDataBean share_data;private boolean can_edit;private boolean show_delete;private String title;private int follow_count;private ContentBean content;private boolean show_edit;private String qid;private FoldReasonBean fold_reason;private List<ConcernTagListBean> concern_tag_list;public boolean isCan_delete() {return can_delete;}public void setCan_delete(boolean can_delete) {this.can_delete = can_delete;}public String getPost_answer_url() {return post_answer_url;}public void setPost_answer_url(String post_answer_url) {this.post_answer_url = post_answer_url;}public boolean isIs_follow() {return is_follow;}public void setIs_follow(boolean is_follow) {this.is_follow = is_follow;}public int getNice_ans_count() {return nice_ans_count;}public void setNice_ans_count(int nice_ans_count) {this.nice_ans_count = nice_ans_count;}public int getCreate_time() {return create_time;}public void setCreate_time(int create_time) {this.create_time = create_time;}public int getNormal_ans_count() {return normal_ans_count;}public void setNormal_ans_count(int normal_ans_count) {this.normal_ans_count = normal_ans_count;}public UserBean getUser() {return user;}public void setUser(UserBean user) {this.user = user;}public ShareDataBean getShare_data() {return share_data;}public void setShare_data(ShareDataBean share_data) {this.share_data = share_data;}public boolean isCan_edit() {return can_edit;}public void setCan_edit(boolean can_edit) {this.can_edit = can_edit;}public boolean isShow_delete() {return show_delete;}public void setShow_delete(boolean show_delete) {this.show_delete = show_delete;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public int getFollow_count() {return follow_count;}public void setFollow_count(int follow_count) {this.follow_count = follow_count;}public ContentBean getContent() {return content;}public void setContent(ContentBean content) {this.content = content;}public boolean isShow_edit() {return show_edit;}public void setShow_edit(boolean show_edit) {this.show_edit = show_edit;}public String getQid() {return qid;}public void setQid(String qid) {this.qid = qid;}public FoldReasonBean getFold_reason() {return fold_reason;}public void setFold_reason(FoldReasonBean fold_reason) {this.fold_reason = fold_reason;}public List<ConcernTagListBean> getConcern_tag_list() {return concern_tag_list;}public void setConcern_tag_list(List<ConcernTagListBean> concern_tag_list) {this.concern_tag_list = concern_tag_list;}public static class UserBean {/*** user_intro :* uname : yuejiao19926* avatar_url : http://p0.pstatp.com/origin/3795/3033762272* user_id : 6796383301* is_verify : 0*/private String user_intro;private String uname;private String avatar_url;private String user_id;private int is_verify;public String getUser_intro() {return user_intro;}public void setUser_intro(String user_intro) {this.user_intro = user_intro;}public String getUname() {return uname;}public void setUname(String uname) {this.uname = uname;}public String getAvatar_url() {return avatar_url;}public void setAvatar_url(String avatar_url) {this.avatar_url = avatar_url;}public String getUser_id() {return user_id;}public void setUser_id(String user_id) {this.user_id = user_id;}public int getIs_verify() {return is_verify;}public void setIs_verify(int is_verify) {this.is_verify = is_verify;}}public static class ShareDataBean {/*** content : 非常推薦!* image_url : http://p0.pstatp.com/medium/6399/2275149767* share_url : https://wenda.toutiao.com/m/wapshare/question/brow/?qid=6420544946419269889&* title : 頭條問答-印度最快的列車時速160,當地人問“中國火車有這么快嗎”,怎么回答?(924個回答)*/private String content;private String image_url;private String share_url;private String title;public String getContent() {return content;}public void setContent(String content) {this.content = content;}public String getImage_url() {return image_url;}public void setImage_url(String image_url) {this.image_url = image_url;}public String getShare_url() {return share_url;}public void setShare_url(String share_url) {this.share_url = share_url;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}}public static class ContentBean {/*** text :* <p>* thumb_image_list : [{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}]* large_image_list : [{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8","url_list":[{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/large/1dcd000e3ba14e6e61f8"}],"uri":"1dcd000e3ba14e6e61f8","height":379,"width":640,"type":1}]*/private String text;private List<ThumbImageListBean> thumb_image_list;private List<LargeImageListBean> large_image_list;public String getText() {return text;}public void setText(String text) {this.text = text;}public List<ThumbImageListBean> getThumb_image_list() {return thumb_image_list;}public void setThumb_image_list(List<ThumbImageListBean> thumb_image_list) {this.thumb_image_list = thumb_image_list;}public List<LargeImageListBean> getLarge_image_list() {return large_image_list;}public void setLarge_image_list(List<LargeImageListBean> large_image_list) {this.large_image_list = large_image_list;}public static class ThumbImageListBean {/*** url : http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8* url_list : [{"url":"http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/list/r640/1dcd000e3ba14e6e61f8"}]* uri : 1dcd000e3ba14e6e61f8* height : 379* width : 640* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBeanX> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBeanX> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBeanX> url_list) {this.url_list = url_list;}public static class UrlListBeanX {/*** url : http://p9.pstatp.com/list/r640/1dcd000e3ba14e6e61f8*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}public static class LargeImageListBean {/*** url : http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8* url_list : [{"url":"http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb1.pstatp.com/large/1dcd000e3ba14e6e61f8"},{"url":"http://pb3.pstatp.com/large/1dcd000e3ba14e6e61f8"}]* uri : 1dcd000e3ba14e6e61f8* height : 379* width : 640* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBeanXX> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBeanXX> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBeanXX> url_list) {this.url_list = url_list;}public static class UrlListBeanXX {/*** url : http://p9.pstatp.com/large/1dcd000e3ba14e6e61f8*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}}public static class FoldReasonBean {/*** open_url : sslocal://detail?groupid=6293724675596402946* title : 為什么折疊?*/private String open_url;private String title;public String getOpen_url() {return open_url;}public void setOpen_url(String open_url) {this.open_url = open_url;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}}public static class ConcernTagListBean {/*** concern_id : 6213182495320443393* name : 火車* schema : sslocal://concern?tab_sname=wenda&api_param=%7B%22wenda_api_param%22%3A%7B%22scope%22%3A%22toutiao_wenda%22%2C%22origin_from%22%3A%22click_headline%22%2C%22parent_enter_from%22%3A%22click_headline%22%2C%22enter_from%22%3A%22question%22%7D%7D&cid=6213182495320443393*/private String concern_id;private String name;private String schema;public String getConcern_id() {return concern_id;}public void setConcern_id(String concern_id) {this.concern_id = concern_id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSchema() {return schema;}public void setSchema(String schema) {this.schema = schema;}}}public static class ModuleListBean {/*** day_icon_url : http://p3.pstatp.com/origin/1bf50001abbc1c7f8dba* text : 更多問答* icon_type : 2* night_icon_url : http://p3.pstatp.com/origin/1bf40001abebc0717135* schema : sslocal://feed?category=question_and_answer&concern_id=6260258266329123329&type=4&name=%E9%97%AE%E7%AD%94&api_param=%7B%22source%22%3A%22question_brow%22%2C%22origin_from%22%3Anull%2C%22enter_from%22%3Anull%7D*/private String day_icon_url;private String text;private int icon_type;private String night_icon_url;private String schema;public String getDay_icon_url() {return day_icon_url;}public void setDay_icon_url(String day_icon_url) {this.day_icon_url = day_icon_url;}public String getText() {return text;}public void setText(String text) {this.text = text;}public int getIcon_type() {return icon_type;}public void setIcon_type(int icon_type) {this.icon_type = icon_type;}public String getNight_icon_url() {return night_icon_url;}public void setNight_icon_url(String night_icon_url) {this.night_icon_url = night_icon_url;}public String getSchema() {return schema;}public void setSchema(String schema) {this.schema = schema;}}public static class AnsListBean implements Parcelable {public static final Creator<AnsListBean> CREATOR = new Creator<AnsListBean>() {@Overridepublic AnsListBean createFromParcel(Parcel in) {return new AnsListBean(in);}@Overridepublic AnsListBean[] newArray(int size) {return new AnsListBean[size];}};/*** content_abstract : {"text":"我去過印度,覺得印度人有時也太可愛了,在他們眼里,印度幾乎就是唯一的,他們接受新事物的能力似乎非常的有限。但真心是想不到,印度居然還是IT大國。去過印度的人通常都會從導游那里知道:從新德里出發到阿格拉的泰姬陵之間的一趟列車,時速最高的時候達到了160公里/每小時,被印度人稱為當地最快的火車。因為印度人非常的熱情,看到中國游客就會用蹩腳的漢語跟中國人搭訕,甚至會問:\u201c中國有沒有這樣快的火車呀?\u201d,這讓人尷尬不已,不知道如何回答是好。我在想如下回答,如何?----對不起,中國沒有時速160的火車,只有時速360的動車。----我們中國的火車坐的人少,拉輕,印度的火車超載了,跑不快,所以中國的火車要快一點。----你們印度人是坐在車外面的,所以感覺很快,我們的高鐵是坐里面的,所以感覺不到快。","thumb_image_list":[{"url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f","url_list":[{"url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"}],"uri":"list/r498/216d000c29349bc2648f","height":350,"width":498,"type":1}],"large_image_list":[{"url":"http://p1.pstatp.com/large/216d000c29349bc2648f","url_list":[{"url":"http://p1.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"}],"uri":"large/216d000c29349bc2648f","height":350,"width":498,"type":1}],"video_list":[]}* create_time : 1494936653* user : {"uname":"媒體人楊壯波的落腳地","avatar_url":"http://p9.pstatp.com/thumb/1787/4062932054","user_id":"3747947486","is_verify":0,"create_time":1419220894,"user_intro":"","user_auth_info":"","schema":"sslocal://profile?uid=3747947486&refer=wenda"}* share_data : {"content":"我去過印度,覺得印度人有時也太可愛了,在他們眼里,印度幾乎就是唯一的,他們接受新事物的能力似乎非常的有限。但真心是想不到,印度居然還是IT大國。去過印度的人通常都會從導游那里知道:從新德里出發到阿格拉的泰姬陵之間的一趟列車,時速最高的時候達到了160公里/每小時,被印度人稱為當地最快的火車。因為印度人非常的熱情,看到中國游客就會用蹩腳的漢語跟中國人搭訕,甚至會問:\u201c中國有沒有這樣快的火車呀?\u201d,這讓人尷尬不已,不知道如何回答是好。我在想如下回答,如何?----對不起,中國沒有時速160的火車,只有時速360的動車。----我們中國的火車坐的人少,拉輕,印度的火車超載了,跑不快,所以中國的火車要快一點。----你們印度人是坐在車外面的,所以感覺很快,我們的高鐵是坐里面的,所以感覺不到快。","image_url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f","share_url":"https://wenda.toutiao.com/m/wapshare/answer/brow/?ansid=6420704033253622018&","title":"頭條問答-印度最快的列車時速160,當地人問\u201c中國火車有這么快嗎\u201d,怎么回答?"}* ans_url : https://ic.snssdk.com/wenda/v1/wapanswer/content/?ansid=6420704033253622018* ansid : 6420704033253622018* is_show_bury : true* is_buryed : false* bury_count : 34* title :* digg_count : 566* is_digg : false* schema : sslocal://wenda_detail?gd_ext_json=%7B%22ansid%22%3A6420704033253622018%7D&ansid=6420704033253622018&api_param=%7B%22in_offset%22%3A0%2C%22has_more%22%3Atrue%2C%22next_offset%22%3A10%2C%22answer_list%22%3A%5B6420704033253622018%2C6420545734315081985%2C6420999813550047490%2C6420564644980588801%2C6420722026490626306%2C6420724394624041217%2C6420874208393298177%2C6420766146428928258%2C6420914953204531457%2C6422088403512197378%5D%2C%22answer_type%22%3A%22nice_answer%22%7D*/private ContentAbstractBean content_abstract;private int create_time;private UserBeanX user;private ShareDataBeanX share_data;private String ans_url;private String ansid;private String qid;private boolean is_show_bury;private boolean is_buryed;private int bury_count;private String title;private int digg_count;private boolean is_digg;private String schema;public AnsListBean(Parcel in) {create_time = in.readInt();user = in.readParcelable(UserBeanX.class.getClassLoader());share_data = in.readParcelable(ShareDataBeanX.class.getClassLoader());ans_url = in.readString();ansid = in.readString();qid = in.readString();is_show_bury = in.readByte() != 0;is_buryed = in.readByte() != 0;bury_count = in.readInt();title = in.readString();digg_count = in.readInt();is_digg = in.readByte() != 0;schema = in.readString();}public AnsListBean() {}@Overridepublic void writeToParcel(Parcel dest, int flags) {dest.writeInt(create_time);dest.writeParcelable(user, flags);dest.writeParcelable(share_data, flags);dest.writeString(ans_url);dest.writeString(ansid);dest.writeString(qid);dest.writeByte((byte) (is_show_bury ? 1 : 0));dest.writeByte((byte) (is_buryed ? 1 : 0));dest.writeInt(bury_count);dest.writeString(title);dest.writeInt(digg_count);dest.writeByte((byte) (is_digg ? 1 : 0));dest.writeString(schema);}@Overridepublic int describeContents() {return 0;}public ContentAbstractBean getContent_abstract() {return content_abstract;}public void setContent_abstract(ContentAbstractBean content_abstract) {this.content_abstract = content_abstract;}public String getQid() {return qid;}public void setQid(String qid) {this.qid = qid;}public int getCreate_time() {return create_time;}public void setCreate_time(int create_time) {this.create_time = create_time;}public UserBeanX getUser() {return user;}public void setUser(UserBeanX user) {this.user = user;}public ShareDataBeanX getShare_data() {return share_data;}public void setShare_data(ShareDataBeanX share_data) {this.share_data = share_data;}public String getAns_url() {return ans_url;}public void setAns_url(String ans_url) {this.ans_url = ans_url;}public String getAnsid() {return ansid;}public void setAnsid(String ansid) {this.ansid = ansid;}public boolean isIs_show_bury() {return is_show_bury;}public void setIs_show_bury(boolean is_show_bury) {this.is_show_bury = is_show_bury;}public boolean isIs_buryed() {return is_buryed;}public void setIs_buryed(boolean is_buryed) {this.is_buryed = is_buryed;}public int getBury_count() {return bury_count;}public void setBury_count(int bury_count) {this.bury_count = bury_count;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public int getDigg_count() {return digg_count;}public void setDigg_count(int digg_count) {this.digg_count = digg_count;}public boolean isIs_digg() {return is_digg;}public void setIs_digg(boolean is_digg) {this.is_digg = is_digg;}public String getSchema() {return schema;}public void setSchema(String schema) {this.schema = schema;}public static class ContentAbstractBean {/*** text : 我去過印度,覺得印度人有時也太可愛了,在他們眼里,印度幾乎就是唯一的,他們接受新事物的能力似乎非常的有限。但真心是想不到,印度居然還是IT大國。去過印度的人通常都會從導游那里知道:從新德里出發到阿格拉的泰姬陵之間的一趟列車,時速最高的時候達到了160公里/每小時,被印度人稱為當地最快的火車。因為印度人非常的熱情,看到中國游客就會用蹩腳的漢語跟中國人搭訕,甚至會問:“中國有沒有這樣快的火車呀?”,這讓人尷尬不已,不知道如何回答是好。我在想如下回答,如何?----對不起,中國沒有時速160的火車,只有時速360的動車。----我們中國的火車坐的人少,拉輕,印度的火車超載了,跑不快,所以中國的火車要快一點。----你們印度人是坐在車外面的,所以感覺很快,我們的高鐵是坐里面的,所以感覺不到快。* thumb_image_list : [{"url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f","url_list":[{"url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"}],"uri":"list/r498/216d000c29349bc2648f","height":350,"width":498,"type":1}]* large_image_list : [{"url":"http://p1.pstatp.com/large/216d000c29349bc2648f","url_list":[{"url":"http://p1.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"}],"uri":"large/216d000c29349bc2648f","height":350,"width":498,"type":1}]* video_list : []*/private String text;private List<ThumbImageListBeanX> thumb_image_list;private List<LargeImageListBeanX> large_image_list;private List<?> video_list;public String getText() {return text;}public void setText(String text) {this.text = text;}public List<ThumbImageListBeanX> getThumb_image_list() {return thumb_image_list;}public void setThumb_image_list(List<ThumbImageListBeanX> thumb_image_list) {this.thumb_image_list = thumb_image_list;}public List<LargeImageListBeanX> getLarge_image_list() {return large_image_list;}public void setLarge_image_list(List<LargeImageListBeanX> large_image_list) {this.large_image_list = large_image_list;}public List<?> getVideo_list() {return video_list;}public void setVideo_list(List<?> video_list) {this.video_list = video_list;}public static class ThumbImageListBeanX {/*** url : http://p1.pstatp.com/list/r498/216d000c29349bc2648f* url_list : [{"url":"http://p1.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/list/r498/216d000c29349bc2648f"}]* uri : list/r498/216d000c29349bc2648f* height : 350* width : 498* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBeanXXX> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBeanXXX> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBeanXXX> url_list) {this.url_list = url_list;}public static class UrlListBeanXXX {/*** url : http://p1.pstatp.com/list/r498/216d000c29349bc2648f*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}public static class LargeImageListBeanX {/*** url : http://p1.pstatp.com/large/216d000c29349bc2648f* url_list : [{"url":"http://p1.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"},{"url":"http://pb3.pstatp.com/large/216d000c29349bc2648f"}]* uri : large/216d000c29349bc2648f* height : 350* width : 498* type : 1*/private String url;private String uri;private int height;private int width;private int type;private List<UrlListBeanXXXX> url_list;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getUri() {return uri;}public void setUri(String uri) {this.uri = uri;}public int getHeight() {return height;}public void setHeight(int height) {this.height = height;}public int getWidth() {return width;}public void setWidth(int width) {this.width = width;}public int getType() {return type;}public void setType(int type) {this.type = type;}public List<UrlListBeanXXXX> getUrl_list() {return url_list;}public void setUrl_list(List<UrlListBeanXXXX> url_list) {this.url_list = url_list;}public static class UrlListBeanXXXX {/*** url : http://p1.pstatp.com/large/216d000c29349bc2648f*/private String url;public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}}}}public static class UserBeanX implements Parcelable {public static final Creator<UserBeanX> CREATOR = new Creator<UserBeanX>() {@Overridepublic UserBeanX createFromParcel(Parcel in) {return new UserBeanX(in);}@Overridepublic UserBeanX[] newArray(int size) {return new UserBeanX[size];}};/*** uname : 媒體人楊壯波的落腳地* avatar_url : http://p9.pstatp.com/thumb/1787/4062932054* user_id : 3747947486* is_verify : 0* create_time : 1419220894* user_intro :* user_auth_info :* schema : sslocal://profile?uid=3747947486&refer=wenda*/private String uname;private String avatar_url;private String user_id;private int is_verify;private int create_time;private String user_intro;private String user_auth_info;private String schema;public UserBeanX(Parcel in) {uname = in.readString();avatar_url = in.readString();user_id = in.readString();is_verify = in.readInt();create_time = in.readInt();user_intro = in.readString();user_auth_info = in.readString();schema = in.readString();}public UserBeanX() {}@Overridepublic void writeToParcel(Parcel dest, int flags) {dest.writeString(uname);dest.writeString(avatar_url);dest.writeString(user_id);dest.writeInt(is_verify);dest.writeInt(create_time);dest.writeString(user_intro);dest.writeString(user_auth_info);dest.writeString(schema);}@Overridepublic int describeContents() {return 0;}public String getUname() {return uname;}public void setUname(String uname) {this.uname = uname;}public String getAvatar_url() {return avatar_url;}public void setAvatar_url(String avatar_url) {this.avatar_url = avatar_url;}public String getUser_id() {return user_id;}public void setUser_id(String user_id) {this.user_id = user_id;}public int getIs_verify() {return is_verify;}public void setIs_verify(int is_verify) {this.is_verify = is_verify;}public int getCreate_time() {return create_time;}public void setCreate_time(int create_time) {this.create_time = create_time;}public String getUser_intro() {return user_intro;}public void setUser_intro(String user_intro) {this.user_intro = user_intro;}public String getUser_auth_info() {return user_auth_info;}public void setUser_auth_info(String user_auth_info) {this.user_auth_info = user_auth_info;}public String getSchema() {return schema;}public void setSchema(String schema) {this.schema = schema;}}public static class ShareDataBeanX implements Parcelable {public static final Creator<ShareDataBeanX> CREATOR = new Creator<ShareDataBeanX>() {@Overridepublic ShareDataBeanX createFromParcel(Parcel in) {return new ShareDataBeanX(in);}@Overridepublic ShareDataBeanX[] newArray(int size) {return new ShareDataBeanX[size];}};/*** content : 我去過印度,覺得印度人有時也太可愛了,在他們眼里,印度幾乎就是唯一的,他們接受新事物的能力似乎非常的有限。但真心是想不到,印度居然還是IT大國。去過印度的人通常都會從導游那里知道:從新德里出發到阿格拉的泰姬陵之間的一趟列車,時速最高的時候達到了160公里/每小時,被印度人稱為當地最快的火車。因為印度人非常的熱情,看到中國游客就會用蹩腳的漢語跟中國人搭訕,甚至會問:“中國有沒有這樣快的火車呀?”,這讓人尷尬不已,不知道如何回答是好。我在想如下回答,如何?----對不起,中國沒有時速160的火車,只有時速360的動車。----我們中國的火車坐的人少,拉輕,印度的火車超載了,跑不快,所以中國的火車要快一點。----你們印度人是坐在車外面的,所以感覺很快,我們的高鐵是坐里面的,所以感覺不到快。* image_url : http://p1.pstatp.com/list/r498/216d000c29349bc2648f* share_url : https://wenda.toutiao.com/m/wapshare/answer/brow/?ansid=6420704033253622018&* title : 頭條問答-印度最快的列車時速160,當地人問“中國火車有這么快嗎”,怎么回答?*/private String content;private String image_url;private String share_url;private String title;public ShareDataBeanX(Parcel in) {content = in.readString();image_url = in.readString();share_url = in.readString();title = in.readString();}public ShareDataBeanX() {}@Overridepublic void writeToParcel(Parcel dest, int flags) {dest.writeString(content);dest.writeString(image_url);dest.writeString(share_url);dest.writeString(title);}@Overridepublic int describeContents() {return 0;}public String getContent() {return content;}public void setContent(String content) {this.content = content;}public String getImage_url() {return image_url;}public void setImage_url(String image_url) {this.image_url = image_url;}public String getShare_url() {return share_url;}public void setShare_url(String share_url) {this.share_url = share_url;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}}} } View Code?
2.構造問答主列表的三個Binder
2.1.只有一張大圖的問答列表
package com.jasonjan.headnews.binder.wenda;import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;import com.jakewharton.rxbinding2.view.RxView; import com.jasonjan.headnews.R; import com.jasonjan.headnews.bean.wenda.WendaArticleDataBean; import com.jasonjan.headnews.main.ErrorAction; import com.jasonjan.headnews.util.ImageLoader; import com.jasonjan.headnews.util.SettingUtil; import com.jasonjan.headnews.util.TimeUtil;import java.util.concurrent.TimeUnit;import io.reactivex.functions.Consumer; import me.drakeet.multitype.ItemViewBinder;/*** Created by JasonJan on 2017/12/11.*/public class WendaArticleOneImgViewBinder extends ItemViewBinder<WendaArticleDataBean,WendaArticleOneImgViewBinder.ViewHolder> {@NonNull@Overrideprotected WendaArticleOneImgViewBinder.ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {View view = inflater.inflate(R.layout.item_wenda_article_one_img, parent, false);return new ViewHolder(view);}@Overrideprotected void onBindViewHolder(@NonNull final ViewHolder holder, @NonNull final WendaArticleDataBean item) {final Context context = holder.itemView.getContext();try {String url = item.getExtraBean().getWenda_image().getLarge_image_list().get(0).getUrl();ImageLoader.loadCenterCrop(context, url, holder.iv_image_big, R.color.viewBackground);final String tv_title = item.getQuestionBean().getTitle();String tv_answer_count = item.getQuestionBean().getNormal_ans_count() + item.getQuestionBean().getNice_ans_count() + "回答";String tv_datetime = item.getQuestionBean().getCreate_time() + "";if (!TextUtils.isEmpty(tv_datetime)) {tv_datetime = TimeUtil.getTimeStampAgo(tv_datetime);}holder.tv_title.setText(tv_title);holder.tv_title.setTextSize(SettingUtil.getInstance().getTextSize());holder.tv_answer_count.setText(tv_answer_count);holder.tv_time.setText(tv_datetime);RxView.clicks(holder.itemView).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {@Overridepublic void accept(@io.reactivex.annotations.NonNull Object o) throws Exception {//WendaContentActivity.launch(item.getQuestionBean().getQid() + ""); }});} catch (Exception e) {ErrorAction.print(e);}}public class ViewHolder extends RecyclerView.ViewHolder {private TextView tv_title;private ImageView iv_image_big;private TextView tv_answer_count;private TextView tv_time;public ViewHolder(View itemView) {super(itemView);this.tv_title = itemView.findViewById(R.id.tv_title);this.iv_image_big = itemView.findViewById(R.id.iv_image_big);this.tv_answer_count = itemView.findViewById(R.id.tv_answer_count);this.tv_time = itemView.findViewById(R.id.tv_time);}} } View Code?
?
2.2.只有一張大圖的item布局效果
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardViewxmlns: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="wrap_content"android:layout_marginBottom="4dp"android:layout_marginTop="4dp"android:background="@color/viewBackground"app:cardElevation="1dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:background="?attr/selectableItemBackground"android:foreground="?attr/selectableItemBackground"android:orientation="vertical"android:padding="16dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:id="@+id/tv_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginEnd="22dp"android:layout_marginRight="22dp"android:ellipsize="end"android:maxLines="1"android:textStyle="bold"tools:text="你們當地那些混黑社會的人現在都怎么樣了?"/><ImageViewandroid:id="@+id/iv_dots"android:layout_width="22dp"android:layout_height="22dp"android:layout_alignParentEnd="true"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:padding="4dp"android:scaleType="center"android:visibility="gone"app:srcCompat="@drawable/ic_dots_horizontal_grey500_24dp"tools:ignore="ContentDescription"/></RelativeLayout><ImageViewandroid:id="@+id/iv_image_big"android:layout_width="match_parent"android:layout_height="138dp"android:layout_marginTop="4dp"android:scaleType="centerCrop"android:src="@color/viewBackground"tools:ignore="ContentDescription"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="4dp"android:orientation="horizontal"><TextViewandroid:id="@+id/tv_answer_count"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ellipsize="end"android:maxLines="1"tools:text="1226回答"/><TextViewandroid:id="@+id/tv_time"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ellipsize="end"android:gravity="end"android:maxLines="1"tools:text="1小時前"/></LinearLayout></LinearLayout> </android.support.v7.widget.CardView>?
?
2.3.有三張圖的問答主列表Binder
package com.jasonjan.headnews.binder.wenda;import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;import com.jakewharton.rxbinding2.view.RxView; import com.jasonjan.headnews.R; import com.jasonjan.headnews.bean.wenda.WendaArticleDataBean; import com.jasonjan.headnews.main.ErrorAction; import com.jasonjan.headnews.util.ImageLoader; import com.jasonjan.headnews.util.SettingUtil; import com.jasonjan.headnews.util.TimeUtil;import java.util.concurrent.TimeUnit;import io.reactivex.functions.Consumer; import me.drakeet.multitype.ItemViewBinder;/*** Created by JasonJan on 2017/12/11.*/public class WendaArticleThreeImgViewBinder extends ItemViewBinder<WendaArticleDataBean,WendaArticleThreeImgViewBinder.ViewHolder> {@NonNull@Overrideprotected WendaArticleThreeImgViewBinder.ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {View view = inflater.inflate(R.layout.item_wenda_article_three_img, parent, false);return new ViewHolder(view);}@Overrideprotected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull final WendaArticleDataBean item) {Context context = holder.itemView.getContext();try {int size = item.getExtraBean().getWenda_image().getThree_image_list().size();String[] ivs = new String[size];for (int i = 0; i < size; i++) {ivs[i] = item.getExtraBean().getWenda_image().getThree_image_list().get(i).getUrl();}switch (ivs.length) {case 1:ImageLoader.loadCenterCrop(context, ivs[0], holder.iv_0, R.color.viewBackground);break;case 2:ImageLoader.loadCenterCrop(context, ivs[0], holder.iv_0, R.color.viewBackground);ImageLoader.loadCenterCrop(context, ivs[1], holder.iv_1, R.color.viewBackground);break;case 3:ImageLoader.loadCenterCrop(context, ivs[0], holder.iv_0, R.color.viewBackground);ImageLoader.loadCenterCrop(context, ivs[1], holder.iv_1, R.color.viewBackground);ImageLoader.loadCenterCrop(context, ivs[2], holder.iv_2, R.color.viewBackground);break;}String tv_title = item.getQuestionBean().getTitle();String tv_answer_count = item.getQuestionBean().getNormal_ans_count() + item.getQuestionBean().getNice_ans_count() + "回答";String tv_datetime = item.getQuestionBean().getCreate_time() + "";if (!TextUtils.isEmpty(tv_datetime)) {tv_datetime = TimeUtil.getTimeStampAgo(tv_datetime);}holder.tv_title.setText(tv_title);holder.tv_title.setTextSize(SettingUtil.getInstance().getTextSize());holder.tv_answer_count.setText(tv_answer_count);holder.tv_time.setText(tv_datetime);RxView.clicks(holder.itemView).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {@Overridepublic void accept(@io.reactivex.annotations.NonNull Object o) throws Exception {//WendaContentActivity.launch(item.getQuestionBean().getQid() + ""); }});} catch (Exception e) {ErrorAction.print(e);}}public class ViewHolder extends RecyclerView.ViewHolder {private TextView tv_title;private ImageView iv_0;private ImageView iv_1;private ImageView iv_2;private TextView tv_answer_count;private TextView tv_time;public ViewHolder(View itemView) {super(itemView);this.tv_title = itemView.findViewById(R.id.tv_title);this.iv_0 = itemView.findViewById(R.id.iv_0);this.iv_1 = itemView.findViewById(R.id.iv_1);this.iv_2 = itemView.findViewById(R.id.iv_2);this.tv_answer_count = itemView.findViewById(R.id.tv_answer_count);this.tv_time = itemView.findViewById(R.id.tv_time);}} } View Code?
?
2.4.有三張圖的問答主列表item布局
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardViewxmlns: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="wrap_content"android:layout_marginBottom="4dp"android:layout_marginTop="4dp"android:background="@color/viewBackground"app:cardElevation="1dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:background="?attr/selectableItemBackground"android:foreground="?attr/selectableItemBackground"android:orientation="vertical"android:padding="16dp"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:id="@+id/tv_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginEnd="22dp"android:layout_marginRight="22dp"android:ellipsize="end"android:maxLines="1"android:textStyle="bold"tools:text="你們當地那些混黑社會的人現在都怎么樣了?"/><ImageViewandroid:id="@+id/iv_dots"android:layout_width="22dp"android:layout_height="22dp"android:layout_alignParentEnd="true"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:padding="4dp"android:scaleType="center"android:visibility="gone"app:srcCompat="@drawable/ic_dots_horizontal_grey500_24dp"tools:ignore="ContentDescription"/></RelativeLayout><LinearLayoutandroid:id="@+id/image_layout"android:layout_width="match_parent"android:layout_height="72dp"android:layout_marginTop="4dp"android:orientation="horizontal"><ImageViewandroid:id="@+id/iv_0"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_marginEnd="4dp"android:layout_marginRight="4dp"android:layout_weight="1"android:scaleType="centerCrop"android:src="@color/viewBackground"tools:ignore="ContentDescription"/><ImageViewandroid:id="@+id/iv_1"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_marginEnd="4dp"android:layout_marginRight="4dp"android:layout_weight="1"android:scaleType="centerCrop"android:src="@color/viewBackground"tools:ignore="ContentDescription"/><ImageViewandroid:id="@+id/iv_2"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1"android:scaleType="centerCrop"android:src="@color/viewBackground"tools:ignore="ContentDescription"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="4dp"android:orientation="horizontal"><TextViewandroid:id="@+id/tv_answer_count"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ellipsize="end"android:maxLines="1"tools:text="1226回答"/><TextViewandroid:id="@+id/tv_time"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ellipsize="end"android:gravity="end"android:maxLines="1"tools:text="1小時前"/></LinearLayout></LinearLayout> </android.support.v7.widget.CardView>?
?
2.5.只有文字的問答主列表Binder
package com.jasonjan.headnews.binder.wenda;import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView;import com.jakewharton.rxbinding2.view.RxView; import com.jasonjan.headnews.R; import com.jasonjan.headnews.bean.wenda.WendaArticleDataBean; import com.jasonjan.headnews.main.ErrorAction; import com.jasonjan.headnews.util.SettingUtil; import com.jasonjan.headnews.util.TimeUtil;import java.util.concurrent.TimeUnit;import io.reactivex.functions.Consumer; import me.drakeet.multitype.ItemViewBinder;/*** Created by JasonJan on 2017/12/11.*/public class WendaArticleTextViewBinder extends ItemViewBinder<WendaArticleDataBean,WendaArticleTextViewBinder.ViewHolder> {@NonNull@Overrideprotected WendaArticleTextViewBinder.ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {View view = inflater.inflate(R.layout.item_wenda_article_text, parent, false);return new ViewHolder(view);}@Overrideprotected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull final WendaArticleDataBean item) {try {String tv_title = item.getQuestionBean().getTitle();String tv_answer_count = item.getQuestionBean().getNormal_ans_count() + item.getQuestionBean().getNice_ans_count() + "回答";String tv_datetime = item.getQuestionBean().getCreate_time() + "";if (!TextUtils.isEmpty(tv_datetime)) {tv_datetime = TimeUtil.getTimeStampAgo(tv_datetime);}String tv_content = item.getAnswerBean().getAbstractX();holder.tv_title.setText(tv_title);holder.tv_title.setTextSize(SettingUtil.getInstance().getTextSize());holder.tv_answer_count.setText(tv_answer_count);holder.tv_time.setText(tv_datetime);holder.tv_content.setText(tv_content);RxView.clicks(holder.itemView).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {@Overridepublic void accept(@io.reactivex.annotations.NonNull Object o) throws Exception {//WendaContentActivity.launch(item.getQuestionBean().getQid() + ""); }});} catch (Exception e) {ErrorAction.print(e);}}public class ViewHolder extends RecyclerView.ViewHolder {private TextView tv_title;private TextView tv_content;private TextView tv_answer_count;private TextView tv_time;public ViewHolder(View itemView) {super(itemView);this.tv_title = itemView.findViewById(R.id.tv_title);this.tv_content = itemView.findViewById(R.id.tv_content);this.tv_answer_count = itemView.findViewById(R.id.tv_answer_count);this.tv_time = itemView.findViewById(R.id.tv_time);}} } View Code?
?
2.6.只有文字的問答item布局
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardViewxmlns: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="wrap_content"android:layout_marginBottom="4dp"android:layout_marginTop="4dp"android:background="@color/viewBackground"app:cardElevation="1dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:background="?attr/selectableItemBackground"android:foreground="?attr/selectableItemBackground"android:orientation="vertical"android:padding="16dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:id="@+id/tv_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginEnd="22dp"android:layout_marginRight="22dp"android:ellipsize="end"android:maxLines="1"android:textStyle="bold"tools:text="你們當地那些混黑社會的人現在都怎么樣了?"/><ImageViewandroid:id="@+id/iv_dots"android:layout_width="22dp"android:layout_height="22dp"android:layout_alignParentEnd="true"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:padding="4dp"android:scaleType="center"android:visibility="gone"app:srcCompat="@drawable/ic_dots_horizontal_grey500_24dp"tools:ignore="ContentDescription"/></RelativeLayout><TextViewandroid:id="@+id/tv_content"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="4dp"android:ellipsize="end"android:maxLines="3"tools:text="美國總統當選人特朗普日前暗示,可能拿美國的“一中政策”當談判籌碼,與中國大陸就諸如人民幣匯率及南海等爭議討價還價。"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="4dp"android:orientation="horizontal"><TextViewandroid:id="@+id/tv_answer_count"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ellipsize="end"android:maxLines="1"tools:text="1226回答"/><TextViewandroid:id="@+id/tv_time"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ellipsize="end"android:gravity="end"android:maxLines="1"tools:text="1小時前"/></LinearLayout></LinearLayout> </android.support.v7.widget.CardView>?
?
2.7.真實效果圖
?
3.API接口
3.1.接口非常簡單。
public interface IMobileWendaApi {/*** 獲取頭條問答標題等信息* http://is.snssdk.com/wenda/v1/native/feedbrow/?category=question_and_answer&wd_version=5&count=20&max_behot_time=1495245397?iid=10344168417&device_id=36394312781** @param maxBehotTime 時間軸*/@GET("http://is.snssdk.com/wenda/v1/native/feedbrow/?iid=10344168417&device_id=36394312781&category=question_and_answer&wd_version=5&count=20&aid=13")Observable<WendaArticleBean> getWendaArticle(@Query("max_behot_time") String maxBehotTime); }?
?
4.問答主頁面片段
4.1.問答重要接口
public interface IWendaArticle {interface View extends IBaseListView<Presenter>{void onLoadData();void onRefresh();}interface Presenter extends IBasePresenter{void doLoadData();void doLoadMoreData();void doSetAdapter(List<WendaArticleDataBean> list);} }?
?
4.2.問答頁面主頁處理器
public class WendaArticlePresenter implements IWendaArticle.Presenter {private static final String TAG = "WendaArticlePresenter";private IWendaArticle.View view;private String time;private Gson gson = new Gson();private List<WendaArticleDataBean> dataList = new ArrayList<>();WendaArticlePresenter(IWendaArticle.View view) {this.view = view;this.time = TimeUtil.getCurrentTimeStamp();}@Overridepublic void doLoadData(){//釋放內存if(dataList.size()>100){dataList.clear();}RetrofitFactory.getRetrofit().create(IMobileWendaApi.class).getWendaArticle(time).subscribeOn(Schedulers.io()).switchMap(new Function<WendaArticleBean, Observable<WendaArticleDataBean>>() {@Overridepublic Observable<WendaArticleDataBean> apply(@NonNull WendaArticleBean wendaArticleBean) throws Exception {List<WendaArticleDataBean> list = new ArrayList<>();for (WendaArticleBean.DataBean bean : wendaArticleBean.getData()) {WendaArticleDataBean contentBean = gson.fromJson(bean.getContent(), WendaArticleDataBean.class);list.add(contentBean);}return Observable.fromIterable(list);}}).filter(new Predicate<WendaArticleDataBean>() {@Overridepublic boolean test(@NonNull WendaArticleDataBean wendaArticleDataBean) throws Exception {return !TextUtils.isEmpty(wendaArticleDataBean.getQuestion());}}).map(new Function<WendaArticleDataBean, WendaArticleDataBean>() {@Overridepublic WendaArticleDataBean apply(@NonNull WendaArticleDataBean bean) throws Exception {WendaArticleDataBean.ExtraBean extraBean = gson.fromJson(bean.getExtra(), WendaArticleDataBean.ExtraBean.class);WendaArticleDataBean.QuestionBean questionBean = gson.fromJson(bean.getQuestion(), WendaArticleDataBean.QuestionBean.class);WendaArticleDataBean.AnswerBean answerBean = gson.fromJson(bean.getAnswer(), WendaArticleDataBean.AnswerBean.class);bean.setExtraBean(extraBean);bean.setQuestionBean(questionBean);bean.setAnswerBean(answerBean);time = bean.getBehot_time();return bean;}}).filter(new Predicate<WendaArticleDataBean>() {@Overridepublic boolean test(@NonNull WendaArticleDataBean wendaArticleDataBean) throws Exception {for (WendaArticleDataBean bean : dataList) {if (bean.getQuestionBean().getTitle().equals(wendaArticleDataBean.getQuestionBean().getTitle())) {return false;}}return true;}}).toList().compose(view.<List<WendaArticleDataBean>>bindToLife()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<List<WendaArticleDataBean>>() {@Overridepublic void accept(@NonNull List<WendaArticleDataBean> wendaArticleDataBeen) throws Exception {doSetAdapter(wendaArticleDataBeen);}}, new Consumer<Throwable>() {@Overridepublic void accept(@NonNull Throwable throwable) throws Exception {doShowNetError();ErrorAction.print(throwable);}});}@Overridepublic void doLoadMoreData() {doLoadData();}@Overridepublic void doRefresh() {if (dataList.size() != 0) {dataList.clear();time = TimeUtil.getCurrentTimeStamp();}view.onShowLoading();doLoadData();}@Overridepublic void doShowNetError() {view.onHideLoading();view.onShowNetError();}@Overridepublic void doSetAdapter(List<WendaArticleDataBean> list) {dataList.addAll(list);view.onSetAdapter(dataList);view.onHideLoading();}}?
?
4.3.問答主頁面視圖
public class WendaArticleView extends BaseListFragment<IWendaArticle.Presenter> implements IWendaArticle.View {public static WendaArticleView newInstance() {return new WendaArticleView();}@Overridepublic void setPresenter(IWendaArticle.Presenter presenter) {if (null == presenter) {this.presenter = new WendaArticlePresenter(this);}}@Overrideprotected void initData() {}@Overrideprotected void initView(View view) {super.initView(view);adapter = new MultiTypeAdapter(oldItems);Register.registerWendaArticleItem(adapter);recyclerView.setAdapter(adapter);recyclerView.addOnScrollListener(new OnLoadMoreListener() {@Overridepublic void onLoadMore() {if (canLoadMore) {canLoadMore = false;presenter.doLoadMoreData();}}});}@Overridepublic void onSetAdapter(List<?> list) {Items newItems = new Items(list);newItems.add(new LoadingBean());DiffCallback.notifyDataSetChanged(oldItems, newItems, DiffCallback.WENDA_ARTICLE, adapter);oldItems.clear();oldItems.addAll(newItems);canLoadMore = true;}@Overridepublic void onLoadData() {onShowLoading();presenter.doLoadData();}@Overridepublic void fetchData() {super.fetchData();onLoadData();} }?
?
4.4.自定義注冊器注冊三種類型(問答主頁面有三種類型:一張圖+三張圖+純文字)
public class Register {public static void registerJokeContentItem(@NonNull MultiTypeAdapter adapter) {adapter.register(JokeContentBean.DataBean.GroupBean.class, new JokeContentViewBinder());adapter.register(LoadingBean.class, new LoadingViewBinder());adapter.register(LoadingEndBean.class, new LoadingEndViewBinder());}public static void registerWendaArticleItem(@NonNull MultiTypeAdapter adapter){// 一個類型對應多個 ItemViewBinderadapter.register(WendaArticleDataBean.class).to(new WendaArticleTextViewBinder(),new WendaArticleOneImgViewBinder(),new WendaArticleThreeImgViewBinder()).withClassLinker(new ClassLinker<WendaArticleDataBean>() {@NonNull@Overridepublic Class<? extends ItemViewBinder<WendaArticleDataBean, ?>> index(@NonNull WendaArticleDataBean item) {if (null != item.getExtraBean().getWenda_image() &&null != item.getExtraBean().getWenda_image().getThree_image_list() &&item.getExtraBean().getWenda_image().getThree_image_list().size() > 0) {return WendaArticleThreeImgViewBinder.class;}if (null != item.getExtraBean().getWenda_image() &&null != item.getExtraBean().getWenda_image().getLarge_image_list() &&item.getExtraBean().getWenda_image().getLarge_image_list().size() > 0) {return WendaArticleOneImgViewBinder.class;}return WendaArticleTextViewBinder.class;}});adapter.register(LoadingBean.class, new LoadingViewBinder());adapter.register(LoadingEndBean.class, new LoadingEndViewBinder());} }?
?
4.5.修改DiffCallback,判斷新老數據是否一樣。
public class DiffCallback extends DiffUtil.Callback {public static final int JOKE = 1;public static final int PHOTO = 2;public static final int NEWS_COMMENT = 5;public static final int JOKE_COMMENT = 6;public static final int MUlTI_NEWS = 7;public static final int WENDA_ARTICLE = 8;public static final int WENDA_CONTENT = 9;public static final int SEARCH = 10;public static final int MUlTI_MEDIA = 11;public static final int MEDIA_WENDA = 12;private List oldList, newList;private int type;public DiffCallback(List oldList, List newList, int type) {this.oldList = oldList;this.newList = newList;this.type = type;}public static void notifyDataSetChanged(List oldList, List newList, int type, RecyclerView.Adapter adapter) {DiffCallback diffCallback = new DiffCallback(oldList, newList, type);DiffUtil.DiffResult result = DiffUtil.calculateDiff(diffCallback, true);result.dispatchUpdatesTo(adapter);}@Overridepublic int getOldListSize() {return oldList != null ? oldList.size() : 0;}@Overridepublic int getNewListSize() {return newList != null ? newList.size() : 0;}@Overridepublic boolean areItemsTheSame(int oldItemPosition,int newItemPosition){try{switch(type){case JOKE:return ((JokeContentBean.DataBean.GroupBean) oldList.get(oldItemPosition)).getContent().equals(((JokeContentBean.DataBean.GroupBean) newList.get(newItemPosition)).getContent());case WENDA_ARTICLE:return ((WendaArticleDataBean) oldList.get(oldItemPosition)).getQuestionBean().getTitle().equals(((WendaArticleDataBean) newList.get(newItemPosition)).getQuestionBean().getTitle());}}catch(Exception e){}return false;}@Overridepublic boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {try {switch (type) {case JOKE:return ((JokeContentBean.DataBean.GroupBean) oldList.get(oldItemPosition)).getShare_url().equals(((JokeContentBean.DataBean.GroupBean) newList.get(newItemPosition)).getShare_url());case WENDA_ARTICLE:return ((WendaArticleDataBean) oldList.get(oldItemPosition)).getQuestionBean().getContent().equals(((WendaArticleDataBean) newList.get(newItemPosition)).getQuestionBean().getContent());}} catch (Exception e) {}return false;} }?
轉載于:https://www.cnblogs.com/Jason-Jan/p/8023309.html
總結
以上是生活随笔為你收集整理的TouTiao开源项目 分析笔记9 实现一个问答主页面的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 当final作用于变量、参数、方法和类时
- 下一篇: Fork/Join框架