@Test public void getTopicWithReplyTest(){ TopicService.getTopicAndReply(this.iResponsibleView, 524071,1, new ResponseListener<Topic>() { @Override public boolean onFailed(String msg) { System.err.println(msg); return true; } @Override public void onComplete(Topic result) { System.out.println(result); } }); }
public static void getTopicAndReply(IResponsibleView responsibleView, int topicId, int page, ResponseListener<Topic> listener){ topicApi.getTopicDetail(topicId, page) .compose(RxUtil.io2main()) .map(s -> { ErrorEnum.ERR_PAGE_NEED_LOGIN.check(s); try { return HtmlUtil.getTopicAndReplies(s); }catch (Exception e){ e.printStackTrace(); ErrorEnum.ERROR_PARSE_HTML.throwThis(); return null; } }) .subscribe(new RxObserver2<>(responsibleView, listener)); }
TopicService extends BaseService<List<Topic>> { public static void getTopicAndReply(IResponsibleView responsibleView, int topicId, int page, ResponseListener<Topic> listener){ topicApi.getTopicDetail(topicId, page) .compose(RxUtil.io2main()) .map(s -> { ErrorEnum.ERR_PAGE_NEED_LOGIN.check(s); try { return HtmlUtil.getTopicAndReplies(s); }catch (Exception e){ e.printStackTrace(); ErrorEnum.ERROR_PARSE_HTML.throwThis(); return null; } }) .subscribe(new RxObserver2<>(responsibleView, listener)); } }
TopicService extends BaseService<List<Topic>> { public static void getTopicAndReply(IResponsibleView responsibleView, int topicId, int page, ResponseListener<Topic> listener){ topicApi.getTopicDetail(topicId, page) .compose(RxUtil.io2main()) .map(s -> { ErrorEnum.ERR_PAGE_NEED_LOGIN.check(s); try { return HtmlUtil.getTopicAndReplies(s); }catch (Exception e){ e.printStackTrace(); ErrorEnum.ERROR_PARSE_HTML.throwThis(); return null; } }) .subscribe(new RxObserver2<>(responsibleView, listener)); } TopicService(IResponsibleView v, ResponseListener<List<Topic>> topicListener); }
TopicService extends BaseService<List<Topic>> { public static void getTopicAndReply(IResponsibleView responsibleView, int topicId, int page, ResponseListener<Topic> listener){ topicApi.getTopicDetail(topicId, page) .compose(RxUtil.io2main()) .map(s -> { ErrorEnum.ERR_PAGE_NEED_LOGIN.check(s); try { return HtmlUtil.getTopicAndReplies(s); }catch (Exception e){ e.printStackTrace(); ErrorEnum.ERROR_PARSE_HTML.throwThis(); return null; } }) .subscribe(new RxObserver2<>(responsibleView, listener)); } TopicService(IResponsibleView v, ResponseListener<List<Topic>> topicListener); void getTopic(Tab type, int page); static void postTopic(IResponsibleView iResponsibleView,
                          String title,
                          String content,
                          String node,
                          ResponseListener<Topic> listener); static void getTopicByNode(IResponsibleView view,
                                      String node,
                                      int page,
                                      ResponseListener<List<Topic>> listener); static void getTopicAndReply(IResponsibleView responsibleView,
                                        int topicId,
                                        int page,
                                        ResponseListener<Topic> listener); static void postReply(IResponsibleView responsibleView,
                                 Topic topic,
                                 String content,
                                 ResponseListener<String> responseListener); static void getReply(IResponsibleView responsibleView,
                                int topicId,
                                int page,
                                ResponseListener<List<Reply>> listener); void getReplyFromApi(Topic topic, int page); }
TopicService extends BaseService<List<Topic>> { public static void getTopicAndReply(IResponsibleView responsibleView, int topicId, int page, ResponseListener<Topic> listener){ topicApi.getTopicDetail(topicId, page) .compose(RxUtil.io2main()) .map(s -> { ErrorEnum.ERR_PAGE_NEED_LOGIN.check(s); try { return HtmlUtil.getTopicAndReplies(s); }catch (Exception e){ e.printStackTrace(); ErrorEnum.ERROR_PARSE_HTML.throwThis(); return null; } }) .subscribe(new RxObserver2<>(responsibleView, listener)); } TopicService(IResponsibleView v, ResponseListener<List<Topic>> topicListener); void getTopic(Tab type, int page); static void postTopic(IResponsibleView iResponsibleView,
                          String title,
                          String content,
                          String node,
                          ResponseListener<Topic> listener); static void getTopicByNode(IResponsibleView view,
                                      String node,
                                      int page,
                                      ResponseListener<List<Topic>> listener); static void getTopicAndReply(IResponsibleView responsibleView,
                                        int topicId,
                                        int page,
                                        ResponseListener<Topic> listener); static void postReply(IResponsibleView responsibleView,
                                 Topic topic,
                                 String content,
                                 ResponseListener<String> responseListener); static void getReply(IResponsibleView responsibleView,
                                int topicId,
                                int page,
                                ResponseListener<List<Reply>> listener); void getReplyFromApi(Topic topic, int page);  }