protected void updateViews(int scrollY, boolean animated) { // If it's ListView, onScrollChanged is called before ListView is laid out (onGlobalLayout). // This causes weird animation when onRestoreInstanceState occurred, // so we check if it's laid out already. // if (!mReady) { // return; // } // Translate header ViewHelper.setTranslationY(headerViewContent, getHeaderTranslationY(scrollY)); }
@Override public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) { View star = child.findViewById(R.id.star); float d = child.getHeight() / 2 - star.getHeight() / 2; ViewHelper.setTranslationY(star, d * fraction); ViewHelper.setScaleX(star, fraction + 0.6f); ViewHelper.setScaleY(star, fraction + 0.6f); int c = (Integer) evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#4C535B")); child.setBackgroundColor(c); } });
protected void updateViews(int scrollY, boolean animated) { // If it's ListView, onScrollChanged is called before ListView is laid out (onGlobalLayout). // This causes weird animation when onRestoreInstanceState occurred, // so we check if it's laid out already. // if (!mReady) { // return; // } // Translate header ViewHelper.setTranslationY(headerViewContent, getHeaderTranslationY(scrollY)); }
protected void updateViews(int scrollY, boolean animated) { // If it's ListView, onScrollChanged is called before ListView is laid out (onGlobalLayout). // This causes weird animation when onRestoreInstanceState occurred, // so we check if it's laid out already. // if (!mReady) { // return; // } // Translate header ViewHelper.setTranslationY(headerViewContent, getHeaderTranslationY(scrollY)); }
protected void updateViews(int scrollY, boolean animated) { // If it's ListView, onScrollChanged is called before ListView is laid out (onGlobalLayout). // This causes weird animation when onRestoreInstanceState occurred, // so we check if it's laid out already. // if (!mReady) { // return; // } // Translate header ViewHelper.setTranslationY(headerViewContent, getHeaderTranslationY(scrollY)); }
@Override public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) { View star = child.findViewById(R.id.star); float d = child.getHeight() / 2 - star.getHeight() / 2; ViewHelper.setTranslationY(star, d * fraction); ViewHelper.setScaleX(star, fraction + 0.6f); ViewHelper.setScaleY(star, fraction + 0.6f); } });
@Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (toolbarScrollFlags == 0) { return; } ViewHelper.setTranslationY(gradient, verticalOffset); ViewHelper.setAlpha(gradient, 1 - (float) Math.abs(verticalOffset) / (float) appBarLayout.getTotalScrollRange()); switch (progressBarPosition) { case BOTTON_OF_TOOLBAR: ViewHelper.setTranslationY(progressBar, Math.max(verticalOffset, progressBarHeight - appBarLayout.getTotalScrollRange())); break; case TOP_OF_WEBVIEW: ViewHelper.setTranslationY(progressBar, verticalOffset); break; case TOP_OF_TOOLBAR: case BOTTOM_OF_WEBVIEW: default: break; } if (menuLayout.getVisibility() == View.VISIBLE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ViewHelper.setTranslationY(menuLayout, Math.max(verticalOffset, -getResources().getDimension(R.dimen.defaultMenuLayoutMargin))); } }
@Override public void run() { ViewHelper.setRotation(mShapeLoadingView, 180f); ViewHelper.setTranslationY(mShapeLoadingView, 0f); ViewHelper.setScaleX(mIndicationIm, 0.2f); mStopped = false; freeFall(); } };
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, view.getHeight() / 3); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .rotationX(0) .translationY(0) .start(); }
private void slideTo(float translationY, final boolean animated) { ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) -translationY + getScreenHeight(); mInterceptionLayout.requestLayout(); } }
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration * @param startDelay start delay before animation begin */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, view.getHeight() / 3); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .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(); } }
private void slideTo(float translationY, final boolean animated) { ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) -translationY + getScreenHeight(); mInterceptionLayout.requestLayout(); } }
private void slideTo(float translationY, final boolean animated) { ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) -translationY + getScreenHeight(); mInterceptionLayout.requestLayout(); } }
@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(); } } });
private void slideTo(float translationY, final boolean animated) { ViewHelper.setTranslationY(mInterceptionLayout, translationY); if (translationY < 0) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); lp.height = (int) -translationY + getScreenHeight(); mInterceptionLayout.requestLayout(); } }
private void slideTo(float translationY, final boolean animated) { 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 = 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); } }
@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); }
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param fromY initial Y position of view * @param duration aniamtion duration * @param startDelay start delay before animation begin */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, fromY); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .start(); }