public void updateViewsPositions(float percentX, float percentY) { if (shuffle != null) { final ShuffleSettings shuffleSettings = shuffle.getShuffleSettings(); float percent = shuffleSettings.isVertical() ? percentY : percentX; int numberOfCards = shuffleSettings.getNumberOfDisplayedCards(); for (int i = 1; i < numberOfCards; ++i) { DraggableView view = shuffle.getDraggableView(i); float myScale = shuffleSettings.getScaleForPosition(i); float nextScale = shuffleSettings.getScaleForPosition(i - 1); float percentAbs = myScale + (nextScale - myScale) * Math.abs(percent); ViewCompat.setScaleX(view, percentAbs); ViewCompat.setScaleY(view, percentAbs); float myTranslationY = shuffleSettings.getTranslationYForPosition(i); if (shuffleSettings.isStackFromTop()) { myTranslationY *= -1; } float nextTranslationY = shuffleSettings.getTranslationYForPosition(i - 1); if (shuffleSettings.isStackFromTop()) { nextTranslationY *= -1; } float translationY = myTranslationY - Math.abs(percent) * (myTranslationY - nextTranslationY); ViewCompat.setTranslationY(view, translationY); float myTranslationX = shuffleSettings.getTranslationXForPosition(i); float nextTranslationX = shuffleSettings.getTranslationXForPosition(i - 1); float translationX = myTranslationX - Math.abs(percent) * (myTranslationX - nextTranslationX); ViewCompat.setTranslationX(view, translationX); } } }
public boolean animateViewStackFrom(@NonNull Listener listener, Direction direction) { if (shuffle != null) { if (shuffle.getShuffleSettings().isVertical()) { switch (direction) { case TOP:
void updateDraggableView(CardDraggableView draggableView) { draggableView.setVertical(shuffleSettings.isVertical()); draggableView.setRotationEnabled(shuffleSettings.isRotationEnabled()); draggableView.setRotationValue(shuffleSettings.getRotation()); draggableView.setInlineMove(shuffleSettings.isInlineMove()); draggableView.setMinVelocity(shuffleSettings.getMinVelocity()); draggableView.setOverlayColors(shuffleSettings.getColorLeft(), shuffleSettings.getColorRight()); draggableView.setOverlayLayouts(shuffleSettings.getLayoutLeftResId(), shuffleSettings.getLayoutRightResId()); draggableView.setViewAnimator(viewAnimator); }