@Override
    public void onAnimationEnd(Animation animation) {
      setHeaderPadding(
          stateAtAnimationStart == State.REFRESHING
              ? 0
              : -measuredHeaderHeight - headerContainer.getTop());
      setSelection(0);

      android.view.ViewGroup.LayoutParams lp = getLayoutParams();
      lp.height = height;
      setLayoutParams(lp);

      if (scrollbarEnabled) {
        setVerticalScrollBarEnabled(true);
      }

      if (bounceBackHeader) {
        bounceBackHeader = false;

        postDelayed(
            new Runnable() {

              @Override
              public void run() {
                resetHeader();
              }
            },
            BOUNCE_ANIMATION_DELAY);
      } else if (stateAtAnimationStart != State.REFRESHING) {
        setState(State.PULL_TO_REFRESH);
      }
    }
    @Override
    public void onAnimationStart(Animation animation) {
      stateAtAnimationStart = state;

      android.view.ViewGroup.LayoutParams lp = getLayoutParams();
      height = lp.height;
      lp.height = getHeight() - translation;
      setLayoutParams(lp);

      if (scrollbarEnabled) {
        setVerticalScrollBarEnabled(false);
      }
    }