示例#1
0
  @Override
  public void onPostExecute(Boolean success) {
    if (isInsertingEntireThread()) {
      insertCommentsUI();
      if (isFoundJumpTargetComment())
        mActivity.getListView().setSelection(mJumpToCommentFoundIndex);
    } else if (!mDeferredReplacementList.isEmpty()) {
      replaceCommentsAtPositionUI(mDeferredReplacementList, mPositionOffset);
    }

    // have to wait till onPostExecute to do this, to ensure they've been inserted by UI thread
    processDeferredComments();

    if (Common.shouldLoadThumbnails(mActivity, mSettings)) showOPThumbnail();

    if (mContentLength == -1)
      mActivity
          .getWindow()
          .setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_INDETERMINATE_OFF);
    else mActivity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);

    if (success) {
      // We should clear any replies the user was composing.
      mActivity.setShouldClearReply(true);

      // Set title in android titlebar
      if (mThreadTitle != null) mActivity.setTitle(mThreadTitle + " : " + mSubreddit);
    } else {
      if (!isCancelled()) {
        Common.showErrorToast(
            "Error downloading comments. Please try again.", Toast.LENGTH_LONG, mActivity);
        mActivity.resetUI(null);
      }
    }

    synchronized (mCurrentDownloadCommentsTaskLock) {
      mCurrentDownloadCommentsTask = null;
    }
  }