private void quoteReply() {
    String message = editTextFastReply.getText().toString();
    if (TextUtils.isEmpty(message)) {
      Toast.makeText(getActivity(), "不能为空", Toast.LENGTH_SHORT).show();
      return;
    }
    mQuoteReply.setMessage(message);

    ChhApi api = new ChhApi();
    api.quotrReply(mQuoteReply, new ReplyApiCallBack());
  }
Example #2
0
  /**
   * 解析引用回复的准备数据
   *
   * @param responseBody
   * @return
   */
  public static PrepareQuoteReply parsePrepareQuoteReply(String responseBody) {
    PrepareQuoteReply quoteReply = new PrepareQuoteReply();
    try {

      Document document = Jsoup.parse(responseBody);
      document.setBaseUri(Constants.BASE_URL);

      Element postform = document.getElementById("postform");
      String url = postform.absUrl("action");

      String formhash =
          postform.getElementsByAttributeValue("name", "formhash").first().attr("value");
      String posttime =
          postform.getElementsByAttributeValue("name", "posttime").first().attr("value");
      String noticeauthor =
          postform.getElementsByAttributeValue("name", "noticeauthor").first().attr("value");
      String noticetrimstr =
          postform.getElementsByAttributeValue("name", "noticetrimstr").first().attr("value");
      String noticeauthormsg =
          postform.getElementsByAttributeValue("name", "noticeauthormsg").first().attr("value");
      String reppid = postform.getElementsByAttributeValue("name", "reppid").first().attr("value");
      String reppost =
          postform.getElementsByAttributeValue("name", "reppost").first().attr("value");
      String quoteBody = postform.getElementsByTag("blockquote").first().toString();

      quoteReply.setNoticeauthor(noticeauthor);
      quoteReply.setNoticeauthormsg(noticeauthormsg);
      quoteReply.setNoticetrimstr(noticetrimstr);
      quoteReply.setPosttime(posttime);
      quoteReply.setQuoteBody(quoteBody);
      quoteReply.setReppid(reppid);
      quoteReply.setUrl(url);
      quoteReply.setFormhash(formhash);
      quoteReply.setReppost(reppost);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return quoteReply;
  }
 public void setPrepareQuoteReply(PrepareQuoteReply quoteReply) {
   this.mQuoteReply = quoteReply;
   setHint(quoteReply.getQuoteBody());
 }