예제 #1
0
  private void requestPosts() {
    if (!isAdded() || mIsFetchingPosts) {

      return;
    }

    if (!NetworkUtils.isNetworkAvailable(getActivity())) {
      updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
      return;
    }

    mIsFetchingPosts = true;

    NoteUpdateService.startServiceForNote(getActivity());
  }
예제 #2
0
  @Override
  public void onPostLoaded(int postCount) {
    if (!isAdded()) {
      return;
    }

    if (postCount == 0 && !mIsFetchingPosts) {
      if (NetworkUtils.isNetworkAvailable(getActivity())) {
        updateEmptyView(EmptyViewMessageType.NO_CONTENT);
      } else {
        updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
      }
    } else if (postCount > 0) {
      mEmptyView.setVisibility(View.GONE);
    }
  }