コード例 #1
0
  public void setPlateAndThread(Plate plate, Thread thread) {
    this.mQuoteReply = null;
    this.mPlate = plate;
    this.mThread = thread;
    SmileyPickerUtility.showKeyBoard(editTextFastReply);
    String hint = "回复: " + thread.getTitle();

    setHint(hint);
  }
コード例 #2
0
 void reply() {
   String message = editTextFastReply.getText().toString();
   if (TextUtils.isEmpty(message)) {
     Toast.makeText(getActivity(), "不能为空", Toast.LENGTH_SHORT).show();
     return;
   }
   ChhApi api = new ChhApi();
   api.reply(
       mPlate.getFid(),
       mThread.getTid(),
       ChhApplication.getInstance().getFormHash(),
       message,
       new ReplyApiCallBack());
 }
コード例 #3
0
  /**
   * 解析帖子列表
   *
   * @param Content
   */
  public static ThreadListWrap parseThreadList(String content) {
    ThreadListWrap threadWrap = new ThreadListWrap();
    List<Thread> threads = new ArrayList<Thread>();
    List<Plate> plates = null;

    Document document = Jsoup.parse(content);
    document.setBaseUri(Constants.BASE_URL);
    Elements elementsGroup = document.getElementsByClass("bm_c");
    for (Element bmc : elementsGroup) {
      try {
        Thread thread = new Thread();
        Elements xg1 = bmc.getElementsByClass("xg1");
        String timeAndCount = xg1.first().ownText();
        Elements as = bmc.getElementsByTag("a");
        Element a1 = as.first();
        String url = a1.absUrl("href");
        String title = a1.text();
        String style = a1.attr("style");
        if (!TextUtils.isEmpty(style)) {
          int s = style.indexOf("color");
          if (s != -1) {
            s += 5;
            s = style.indexOf(":", s);
            int e = style.indexOf(";", s);
            String color = style.substring(s + 1, e);
            try {
              thread.setTitleColor(Color.parseColor(color.trim()));
            } catch (Exception e2) {
              e2.printStackTrace();
            }
          }
        }

        Elements imgElements = bmc.getElementsByTag("img");
        if (imgElements != null && imgElements.size() != 0) {
          String src = imgElements.first().absUrl("src");
          thread.setImgSrc(src);
        }

        Element a2 = as.get(1);
        String by = a2.text();

        thread.setBy(by);
        thread.setTitle(title);
        thread.setUrl(url);
        thread.setTimeAndCount(timeAndCount);

        threads.add(thread);
      } catch (Exception e) { // 当有子版块时
        if (plates == null) {
          plates = new ArrayList<Plate>();
        }
        Element child = bmc.child(0);
        Plate plate = new Plate();
        String title = child.ownText();
        String url = child.absUrl("href");
        plate.setTitle(title);
        plate.setUrl(url);
        plate.setSubPlate(true);
        plates.add(plate);

        LogMessage.i(TAG, plate);
      }
    }
    threadWrap.setThreads(threads);
    threadWrap.setPlates(plates);
    return threadWrap;
  }