@Override
  public void onViewCreated(Activity activity, View headerView) {
    super.onViewCreated(activity, headerView);

    // Create animations for use later
    mHeaderInAnimation = AnimationUtils.loadAnimation(activity, R.anim.fade_in);
    mHeaderOutAnimation = AnimationUtils.loadAnimation(activity, R.anim.fade_out);

    if (mHeaderOutAnimation != null || mHeaderInAnimation != null) {
      final AnimationCallback callback = new AnimationCallback();
      if (mHeaderOutAnimation != null) {
        mHeaderOutAnimation.setAnimationListener(callback);
      }
    }
  }
  @Override
  public void onRefreshMinimized() {
    // Super handles ICS+ anyway...
    if (Build.VERSION.SDK_INT >= super.getMinimumApiLevel()) {
      super.onRefreshMinimized();
      return;
    }

    // Here we fade out most of the header, leaving just the progress bar
    View contentLayout = getHeaderView().findViewById(R.id.ptr_content);
    if (contentLayout != null) {
      contentLayout.startAnimation(
          AnimationUtils.loadAnimation(contentLayout.getContext(), R.anim.fade_out));
      contentLayout.setVisibility(View.INVISIBLE);
    }
  }