@Override public void handleInvisiblePage(View view, float position) { ViewCompat.setPivotX(view, view.getMeasuredWidth()); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, 0); }
@Override public void handleLeftPage(View view, float position) { ViewCompat.setPivotX(view, view.getMeasuredWidth()); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, mMaxRotation * position); }
@Override public void handleInvisiblePage(View view, float position) { ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f); ViewCompat.setPivotY(view, view.getMeasuredHeight()); ViewCompat.setRotation(view, 0); }
@Override public void handleLeftPage(View view, float position) { float rotation = (mMaxRotation * position); ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f); ViewCompat.setPivotY(view, view.getMeasuredHeight()); ViewCompat.setRotation(view, rotation); }
@Override public void handleRightPage(View view, float position) { ViewCompat.setPivotX(view, 0); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, mMaxRotation * position); }
@Override public void handleRightPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 - position); ViewCompat.setScaleY(view, 1 - position); ViewCompat.setAlpha(view, 1 - position); }
@Override public void handleLeftPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 + position); ViewCompat.setScaleY(view, 1 + position); ViewCompat.setAlpha(view, 1 + position); }
@Override public void handleRightPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 + position); ViewCompat.setScaleY(view, 1 + position); if (position > 0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } }
@Override public void handleRightPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 - position); ViewCompat.setScaleY(view, 1 - position); if (position > 0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } }
@Override public void handleLeftPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 + position); ViewCompat.setScaleY(view, 1 + position); if (position < -0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } }
@Override public void handleLeftPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 + position); ViewCompat.setScaleY(view, 1 + position); if (position < -0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } }
private void onItemScrolled(RecyclerView recyclerView, int dx, int dy) { final float ratio = computeRatio(recyclerView); final float footerRatio = Math.max(0, Math.min(FOOTER_RATIO_START, ratio) - FOOTER_RATIO_DIFF) / FOOTER_RATIO_MAX; final float avatarRatio = Math.max(0, Math.min(AVATAR_RATIO_START, ratio) - AVATAR_RATIO_DIFF) / AVATAR_RATIO_MAX; final float answerRatio = Math.max(0, Math.min(ANSWER_RATIO_START, ratio) - ANSWER_RATIO_DIFF) / ANSWER_RATIO_MAX; final float middleRatio = Math.max(0, Math.min(MIDDLE_RATIO_START, ratio) - MIDDLE_RATIO_DIFF) / MIDDLE_RATIO_MAX; ViewCompat.setPivotY(mFooter, 0); ViewCompat.setScaleY(mFooter, footerRatio); ViewCompat.setAlpha(mFooter, footerRatio); ViewCompat.setPivotY(mMiddleAnswer, mMiddleAnswer.getHeight()); ViewCompat.setScaleY(mMiddleAnswer, 1f - answerRatio); ViewCompat.setAlpha(mMiddleAnswer, 0.5f - answerRatio); ViewCompat.setAlpha(mHeaderCaption1, answerRatio); ViewCompat.setAlpha(mHeaderCaption2, 1f - answerRatio); final View mc2 = mMiddleCollapsible.get(1); ViewCompat.setPivotX(mc2, 0); ViewCompat.setPivotY(mc2, mc2.getHeight() / 2); for (final View view: mMiddleCollapsible) { ViewCompat.setScaleX(view, avatarRatio); ViewCompat.setScaleY(view, avatarRatio); ViewCompat.setAlpha(view, avatarRatio); } final ViewGroup.LayoutParams lp = mMiddle.getLayoutParams(); lp.height = m120dp - (int)(m10dp * (1f - middleRatio)); mMiddle.setLayoutParams(lp); }
public static void resetPageTransformer(List<? extends View> views) { if (views == null) { return; } for (View view : views) { view.setVisibility(View.VISIBLE); ViewCompat.setAlpha(view, 1); ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); ViewCompat.setRotationX(view, 0); ViewCompat.setRotationY(view, 0); ViewCompat.setRotation(view, 0); } }
public void open() { ViewGroup.LayoutParams layoutParams = layout3.getLayoutParams(); layoutParams.height = (int) (front.getHeight() * SCALE_OPENED / 4 * SCALE_OPENED); layout3.setLayoutParams(layoutParams); ViewCompat.setPivotY(back, 0); PropertyValuesHolder front1 = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0, -front.getHeight() / 4); PropertyValuesHolder front2 = PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1); frontAnimator = ObjectAnimator.ofPropertyValuesHolder(front, front1, front2); PropertyValuesHolder backX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f); PropertyValuesHolder backY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f); backAnimator = ObjectAnimator.ofPropertyValuesHolder(back, backX, backY); back.setPivotY(0); frontAnimator.start(); backAnimator.start(); front.setCardElevation(ELEVATION_OPENED); }
public DurX pivotY(float percent) { if (view != null) { ViewCompat.setPivotY(view, view.getHeight() * percent); } return this; }
public void handleScale(float scale) { scale = 0.1f + 0.9f * scale; ViewCompat.setScaleX(mPullDownView, scale); ViewCompat.setPivotY(mPullDownView, mPullDownView.getHeight()); ViewCompat.setScaleY(mPullDownView, scale); }
public DurX pivotY(float percent) { if (view != null) { ViewCompat.setPivotY(view, view.getHeight() * percent); } return this; }
public void handleScale(float scale) { scale = 0.1f + 0.9f * scale; ViewCompat.setScaleX(mPullDownView, scale); ViewCompat.setPivotY(mPullDownView, mPullDownView.getHeight()); ViewCompat.setScaleY(mPullDownView, scale); }
@Override protected boolean onScroll(float y) { View view = getPullable().getView(); int heigth = view.getMeasuredHeight(); if (y >= 0) { ViewCompat.setPivotY(view, 0); ViewCompat.setScaleY(view, (heigth + y) / heigth); } else { ViewCompat.setPivotY(view, heigth); ViewCompat.setScaleY(view, (heigth - y) / heigth); } return true; } }