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厘米的小果实,不能食用,也就是看看而已。现有一种红花重瓣石榴,花艳而结果,既能赏花又能食果。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>() {
            @Override
            public AnsListBean createFromParcel(Parcel in) {
                return new AnsListBean(in);
            }

            @Override
            public 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() {
        }

        @Override
        public 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);
        }

        @Override
        public 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>() {
                @Override
                public UserBeanX createFromParcel(Parcel in) {
                    return new UserBeanX(in);
                }

                @Override
                public 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() {
            }

            @Override
            public 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);
            }

            @Override
            public 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>() {
                @Override
                public ShareDataBeanX createFromParcel(Parcel in) {
                    return new ShareDataBeanX(in);
                }

                @Override
                public 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() {
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(content);
                dest.writeString(image_url);
                dest.writeString(share_url);
                dest.writeString(title);
            }

            @Override
            public 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
    @Override
    protected 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);
    }

    @Override
    protected 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>() {
                        @Override
                        public 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.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:layout_marginTop="4dp"
    android:background="@color/viewBackground"
    app:cardElevation="1dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground"
        android:foreground="?attr/selectableItemBackground"
        android:orientation="vertical"
        android:padding="16dp">

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

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/tv_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginEnd="22dp"
                    android:layout_marginRight="22dp"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:textStyle="bold"
                    tools:text="你们当地那些混黑社会的人现在都怎么样了?"/>

                <ImageView
                    android: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>

            <ImageView
                android: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>

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

            <TextView
                android:id="@+id/tv_answer_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                tools:text="1226回答"/>

            <TextView
                android: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
    @Override
    protected 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);
    }

    @Override
    protected 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>() {
                        @Override
                        public 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.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:layout_marginTop="4dp"
    android:background="@color/viewBackground"
    app:cardElevation="1dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground"
        android:foreground="?attr/selectableItemBackground"
        android:orientation="vertical"
        android:padding="16dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/tv_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginEnd="22dp"
                android:layout_marginRight="22dp"
                android:ellipsize="end"
                android:maxLines="1"
                android:textStyle="bold"
                tools:text="你们当地那些混黑社会的人现在都怎么样了?"/>

            <ImageView
                android: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>

        <LinearLayout
            android:id="@+id/image_layout"
            android:layout_width="match_parent"
            android:layout_height="72dp"
            android:layout_marginTop="4dp"
            android:orientation="horizontal">

            <ImageView
                android: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"/>

            <ImageView
                android: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"/>

            <ImageView
                android: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>

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

            <TextView
                android:id="@+id/tv_answer_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                tools:text="1226回答"/>

            <TextView
                android: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
    @Override
    protected 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);
    }

    @Override
    protected 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>() {
                        @Override
                        public 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.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:layout_marginTop="4dp"
    android:background="@color/viewBackground"
    app:cardElevation="1dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground"
        android:foreground="?attr/selectableItemBackground"
        android:orientation="vertical"
        android:padding="16dp">

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

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/tv_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginEnd="22dp"
                    android:layout_marginRight="22dp"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:textStyle="bold"
                    tools:text="你们当地那些混黑社会的人现在都怎么样了?"/>

                <ImageView
                    android: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>

            <TextView
                android: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>

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

            <TextView
                android:id="@+id/tv_answer_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                tools:text="1226回答"/>

            <TextView
                android: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();
    }

    @Override
    public void doLoadData(){

        //释放内存
        if(dataList.size()>100){
            dataList.clear();
        }

        RetrofitFactory.getRetrofit().create(IMobileWendaApi.class)
                .getWendaArticle(time)
                .subscribeOn(Schedulers.io())
                .switchMap(new Function<WendaArticleBean, Observable<WendaArticleDataBean>>() {
                    @Override
                    public 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>() {
                    @Override
                    public boolean test(@NonNull WendaArticleDataBean wendaArticleDataBean) throws Exception {
                        return !TextUtils.isEmpty(wendaArticleDataBean.getQuestion());
                    }
                })
                .map(new Function<WendaArticleDataBean, WendaArticleDataBean>() {
                    @Override
                    public 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>() {
                    @Override
                    public 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>>() {
                    @Override
                    public void accept(@NonNull List<WendaArticleDataBean> wendaArticleDataBeen) throws Exception {
                        doSetAdapter(wendaArticleDataBeen);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(@NonNull Throwable throwable) throws Exception {
                        doShowNetError();
                        ErrorAction.print(throwable);
                    }
                });
    }

    @Override
    public void doLoadMoreData() {
        doLoadData();
    }

    @Override
    public void doRefresh() {
        if (dataList.size() != 0) {
            dataList.clear();
            time = TimeUtil.getCurrentTimeStamp();
        }
        view.onShowLoading();
        doLoadData();
    }

    @Override
    public void doShowNetError() {
        view.onHideLoading();
        view.onShowNetError();
    }

    @Override
    public 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();
    }

    @Override
    public void setPresenter(IWendaArticle.Presenter presenter) {
        if (null == presenter) {
            this.presenter = new WendaArticlePresenter(this);
        }
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView(View view) {
        super.initView(view);
        adapter = new MultiTypeAdapter(oldItems);
        Register.registerWendaArticleItem(adapter);
        recyclerView.setAdapter(adapter);
        recyclerView.addOnScrollListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore() {
                if (canLoadMore) {
                    canLoadMore = false;
                    presenter.doLoadMoreData();
                }
            }
        });
    }

    @Override
    public 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;
    }

    @Override
    public void onLoadData() {
        onShowLoading();
        presenter.doLoadData();
    }

    @Override
    public 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){
        // 一个类型对应多个 ItemViewBinder
        adapter.register(WendaArticleDataBean.class)
                .to(new WendaArticleTextViewBinder(),
                        new WendaArticleOneImgViewBinder(),
                        new WendaArticleThreeImgViewBinder())
                .withClassLinker(new ClassLinker<WendaArticleDataBean>() {
                    @NonNull
                    @Override
                    public 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);
    }

    @Override
    public int getOldListSize() {
        return oldList != null ? oldList.size() : 0;
    }

    @Override
    public int getNewListSize() {
        return newList != null ? newList.size() : 0;
    }

    @Override
    public 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;
    }

    @Override
    public 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值