private void requestPosts() { if (!isAdded() || mIsFetchingPosts) { return; } if (!NetworkUtils.isNetworkAvailable(getActivity())) { updateEmptyView(EmptyViewMessageType.NETWORK_ERROR); return; } mIsFetchingPosts = true; NoteUpdateService.startServiceForNote(getActivity()); }
@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); } }