private boolean toolbarIsShown() { return ViewHelper.getTranslationY(mHeaderView) == 0; }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; if (translationY < -mIntersectionHeight) { translationY = -mIntersectionHeight; } else if (getScreenHeight() - mHeaderBarHeight < translationY) { translationY = getScreenHeight() - mHeaderBarHeight; } slideTo(translationY, true); }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; if (translationY < -mIntersectionHeight) { translationY = -mIntersectionHeight; } else if (getScreenHeight() - mHeaderBarHeight < translationY) { translationY = getScreenHeight() - mHeaderBarHeight; } slideTo(translationY, true); }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; if (translationY < -mIntersectionHeight) { translationY = -mIntersectionHeight; } else if (getScreenHeight() - mHeaderBarHeight < translationY) { translationY = getScreenHeight() - mHeaderBarHeight; } slideTo(translationY, true); }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; if (translationY < -mIntersectionHeight) { translationY = -mIntersectionHeight; } else if (getScreenHeight() - mHeaderBarHeight < translationY) { translationY = getScreenHeight() - mHeaderBarHeight; } slideTo(translationY, true); }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; if (translationY < -mIntersectionHeight) { translationY = -mIntersectionHeight; } else if (getScreenHeight() - mHeaderBarHeight < translationY) { translationY = getScreenHeight() - mHeaderBarHeight; } slideTo(translationY, true); }
private boolean toolbarIsShown() { return ViewHelper.getTranslationY(mInterceptionLayout) == 0; }
private boolean toolbarIsShown() { return ViewHelper.getTranslationY(mHeaderView) == 0; }
private boolean toolbarIsHidden() { return ViewHelper.getTranslationY(mInterceptionLayout) == -mToolbarView.getHeight(); }
private boolean toolbarIsHidden() { return ViewHelper.getTranslationY(mHeaderView) == -mToolbarView.getHeight(); }
private boolean toolbarIsHidden() { return ViewHelper.getTranslationY(mHeaderView) == -mHeaderView.getHeight() - mActionBarSize - mStatusSize - tabLayout.getHeight(); }
int translationY = (int) ViewHelper.getTranslationY(mInterceptionLayout); boolean scrollingUp = 0 < diffY; boolean scrollingDown = diffY < 0;
private void animateToolbar(final float toY) { float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout); if (layoutTranslationY != toY) { ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float translationY = (float) animation.getAnimatedValue(); ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) (-translationY + getScreenHeight()); mInterceptionLayout.requestLayout(); } } }); animator.start(); } }
@Override public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -mToolbarView.getHeight(), 0); ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) (-translationY + getScreenHeight()); mInterceptionLayout.requestLayout(); } }
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { if (dragging) { int toolbarHeight = mHeaderView.getHeight() - mActionBarSize - mStatusSize - tabLayout.getHeight(); float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (firstScroll) { if (-toolbarHeight < currentHeaderTranslationY) { mBaseTranslationY = scrollY; } } float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0); ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewHelper.setTranslationY(mHeaderView, headerTranslationY); } toolbar_bac.setImageResource(R.drawable.toolbar_background_black); float a = (float) scrollY / (ViewHelper.getScrollY(mHeaderView)); toolbar_bac.setAlpha(a); }
private void showToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } propagateToolbarState(true); }
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { if (dragging) { int toolbarHeight = mToolbarView.getHeight(); float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (firstScroll) { if (-toolbarHeight < currentHeaderTranslationY) { mBaseTranslationY = scrollY; } } float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0); ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewHelper.setTranslationY(mHeaderView, headerTranslationY); } }
private void hideToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mHeaderView.getHeight() - mActionBarSize - mStatusSize - tabLayout.getHeight(); if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } propagateToolbarState(false); }
private void hideToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } propagateToolbarState(false); }
private void showToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } propagateToolbarState(true); }