Example #1
0
  @Override
  public SimpleListBean loadInBackground() {

    int count = 0;
    boolean getOk = false;
    do {
      fetchSimpleList(mType);

      synchronized (mLocker) {
        try {
          mLocker.wait();
        } catch (InterruptedException e) {
        }
      }

      if (mRsp != null) {
        if (!LoginHelper.checkLoggedin(mCtx, mRsp)) {
          int status = new LoginHelper(mCtx, null).login();
          if (status > Constants.STATUS_FAIL) {
            break;
          }
        } else {
          getOk = true;
        }
      }
      count++;
    } while (!getOk && count < 3);

    if (!getOk) {
      return null;
    }

    Document doc = Jsoup.parse(mRsp);
    return HiParser.parseSimpleList(mCtx, mType, doc);
  }
Example #2
0
  @Override
  public ThreadListBean loadInBackground() {
    if (mForumId == 0) {
      return null;
    }

    boolean getOk = false;
    do {
      count++;
      fetchForumList();

      synchronized (mLocker) {
        try {
          mLocker.wait();
        } catch (InterruptedException ignored) {
        }
      }

      if (mRsp != null) {
        if (!LoginHelper.checkLoggedin(mCtx, mRsp)) {
          int status = new LoginHelper(mCtx, mHandler).login();
          if (status > Constants.STATUS_FAIL) {
            break;
          }
        } else {
          getOk = true;
        }
      }
    } while (!getOk && count <= MAX_TIMES);

    if (!getOk) {
      return null;
    }

    Document doc = Jsoup.parse(mRsp);
    return HiParserThreadList.parse(mCtx, mHandler, doc);
  }