@Override
  public void onUIPositionChange(
      PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {

    final int mOffsetToRefresh = frame.getOffsetToRefresh();
    final int currentPos = ptrIndicator.getCurrentPosY();
    final int lastPos = ptrIndicator.getLastPosY();

    if (currentPos < mOffsetToRefresh && lastPos >= mOffsetToRefresh) {
      if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
        crossRotateLineFromBottomUnderTouch(frame);
        if (mRotateView != null) {
          mRotateView.clearAnimation();
          mRotateView.startAnimation(mReverseFlipAnimation);
        }
      }
    } else if (currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh) {
      if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
        crossRotateLineFromTopUnderTouch(frame);
        if (mRotateView != null) {
          mRotateView.clearAnimation();
          mRotateView.startAnimation(mFlipAnimation);
        }
      }
    }
  }
  public void setPtrFrameLayout(PtrFrameLayout layout) {

    final PtrUIHandlerHook mPtrUIHandlerHook =
        new PtrUIHandlerHook() {
          @Override
          public void run() {
            startAnimation(mScaleAnimation);
          }
        };

    mScaleAnimation.setDuration(200);
    mScaleAnimation.setAnimationListener(
        new Animation.AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            mPtrUIHandlerHook.resume();
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}
        });

    mPtrFrameLayout = layout;
    mPtrFrameLayout.setRefreshCompleteHook(mPtrUIHandlerHook);
  }
 private void crossRotateLineFromBottomUnderTouch(PtrFrameLayout frame) {
   mTitleTextView.setVisibility(VISIBLE);
   if (frame.isPullToRefresh()) {
     mTitleTextView.setText(getResources().getString(R.string.cube_ptr_pull_down_to_refresh));
   } else {
     mTitleTextView.setText(getResources().getString(R.string.cube_ptr_pull_down));
   }
 }
  @Override
  public void onUIRefreshPrepare(PtrFrameLayout frame) {

    mShouldShowLastUpdate = true;
    tryUpdateLastUpdateTime();
    mLastUpdateTimeUpdater.start();

    mProgressBar.setVisibility(INVISIBLE);

    mRotateView.setVisibility(VISIBLE);
    mTitleTextView.setVisibility(VISIBLE);
    if (frame.isPullToRefresh()) {
      mTitleTextView.setText(getResources().getString(R.string.cube_ptr_pull_down_to_refresh));
    } else {
      mTitleTextView.setText(getResources().getString(R.string.cube_ptr_pull_down));
    }
  }
 private void crossRotateLineFromTopUnderTouch(PtrFrameLayout frame) {
   if (!frame.isPullToRefresh()) {
     mTitleTextView.setVisibility(VISIBLE);
     mTitleTextView.setText(R.string.cube_ptr_release_to_refresh);
   }
 }