예제 #1
0
  @Override
  public void onTaskFinished(int taskCode, TaskResultCode code, HNFeed result, Object tag) {
    if (taskCode == TASKCODE_LOAD_FEED) {
      if (code.equals(TaskResultCode.Success) && mPostsListAdapter != null) {
        showFeed(result);
      } else if (!code.equals(TaskResultCode.Success))
        Toast.makeText(this, getString(R.string.error_unable_to_retrieve_feed), Toast.LENGTH_SHORT)
            .show();

      mActionbarRefreshProgress.setVisibility(View.GONE);
      mActionbarRefresh.setVisibility(View.VISIBLE);
    } else if (taskCode == TASKCODE_LOAD_MORE_POSTS) {
      if (!code.equals(TaskResultCode.Success))
        Toast.makeText(this, getString(R.string.error_unable_to_load_more), Toast.LENGTH_SHORT)
            .show();

      mFeed.appendLoadMoreFeed(result);
      mPostsListAdapter.notifyDataSetChanged();
    }
  }