public void onViewPagerPageChanged() {
    scrollDown(lastYOffset);

    View visibleView = getTheVisibileView(scrollViewList);
    if (!canScroll(visibleView)) {
      followScrollToolbarLayout(0);
      onMaterialScrolled(visibleView, 0);
    }
  }
  /**
   * Called when a scroller(RecyclerView/ListView,ScrollView,WebView) scrolled by the user
   *
   * @param source the scroller
   * @param yOffset the scroller current yOffset
   */
  public boolean onMaterialScrolled(Object source, float yOffset) {

    if (initialDistance == -1 || initialDistance == 0) {
      initialDistance = mHeader.mPagerSlidingTabStrip.getTop() - mHeader.toolbar.getBottom();
    }

    // only if yOffset changed
    if (yOffset == lastYOffset) return false;

    float scrollTop = -yOffset;

    {
      // parallax scroll of the Background ImageView (the KenBurnsView)
      if (mHeader.headerBackground != null) {

        if (this.settings.parallaxHeaderFactor != 0)
          ViewHelper.setTranslationY(
              mHeader.headerBackground, scrollTop / this.settings.parallaxHeaderFactor);

        if (ViewHelper.getY(mHeader.headerBackground) >= 0)
          ViewHelper.setY(mHeader.headerBackground, 0);
      }
    }

    if (ENABLE_LOG) Log.d("yOffset", "" + yOffset);

    // dispatch the new offset to all registered scrollables
    dispatchScrollOffset(source, minMax(0, yOffset, scrollMaxDp));

    float percent = yOffset / scrollMax;

    if (ENABLE_LOG) Log.d("percent1", "" + percent);

    if (percent != 0) {
      // distance between pager & toolbar
      float newDistance =
          ViewHelper.getY(mHeader.mPagerSlidingTabStrip) - mHeader.toolbar.getBottom();

      percent = 1 - newDistance / initialDistance;

      if (ENABLE_LOG) Log.d("percent2", "" + percent);
    }

    if (Float.isNaN(percent)) // fix for orientation change
    return false;

    // fix quick scroll
    if (percent == 0 && headerAnimator != null) {
      cancelHeaderAnimator();
      ViewHelper.setTranslationY(mHeader.toolbarLayout, 0);
    }

    percent = minMax(0, percent, 1);
    {
      if (!settings.toolbarTransparent) {
        // change color of toolbar & viewpager indicator &  statusBaground
        setColorPercent(percent);
      } else {
        if (justToolbarAnimated) {
          if (toolbarJoinsTabs()) setColorPercent(1);
          else if (lastPercent != percent) {
            animateColorPercent(0, 200);
          }
        }
      }

      lastPercent = percent; // save the percent

      if (mHeader.mPagerSlidingTabStrip != null) { // move the viewpager indicator
        // float newY = ViewHelper.getY(mHeader.mPagerSlidingTabStrip) + scrollTop;

        if (ENABLE_LOG) Log.d(TAG, "" + scrollTop);

        // mHeader.mPagerSlidingTabStrip.setTranslationY(mHeader.getToolbar().getBottom()-mHeader.mPagerSlidingTabStrip.getY());
        if (scrollTop <= 0) {
          ViewHelper.setTranslationY(mHeader.mPagerSlidingTabStrip, scrollTop);
          ViewHelper.setTranslationY(mHeader.toolbarLayoutBackground, scrollTop);

          // when
          if (ViewHelper.getY(mHeader.mPagerSlidingTabStrip) < mHeader.getToolbar().getBottom()) {
            float ty = mHeader.getToolbar().getBottom() - mHeader.mPagerSlidingTabStrip.getTop();
            ViewHelper.setTranslationY(mHeader.mPagerSlidingTabStrip, ty);
            ViewHelper.setTranslationY(mHeader.toolbarLayoutBackground, ty);
          }
        }
      }

      if (mHeader.mLogo != null) { // move the header logo to toolbar

        if (this.settings.hideLogoWithFade) {
          ViewHelper.setAlpha(mHeader.mLogo, 1 - percent);
          ViewHelper.setTranslationY(
              mHeader.mLogo, (mHeader.finalTitleY - mHeader.originalTitleY) * percent);
        } else {
          ViewHelper.setTranslationY(
              mHeader.mLogo, (mHeader.finalTitleY - mHeader.originalTitleY) * percent);
          ViewHelper.setTranslationX(
              mHeader.mLogo, (mHeader.finalTitleX - mHeader.originalTitleX) * percent);

          float scale = (1 - percent) * (1 - mHeader.finalScale) + mHeader.finalScale;
          setScale(scale, mHeader.mLogo);
        }
      }

      if (this.settings.hideToolbarAndTitle && mHeader.toolbarLayout != null) {
        boolean scrollUp = lastYOffset < yOffset;

        if (scrollUp) {
          scrollUp(yOffset);
        } else {
          scrollDown(yOffset);
        }
      }
    }

    if (headerAnimator != null && percent < 1) {
      cancelHeaderAnimator();
    }

    lastYOffset = yOffset;

    return true;
  }