use of com.ramotion.foldingcell.animations.HeightAnimation in project folding-cell-android by Ramotion.
the class FoldingCell method startExpandHeightAnimation.
/**
* Prepare and start height expand animation for FoldingCellLayout
*
* @param partAnimationDuration one part animate duration
* @param viewHeights heights of animation parts
*/
protected void startExpandHeightAnimation(ArrayList<Integer> viewHeights, int partAnimationDuration) {
if (viewHeights == null || viewHeights.isEmpty())
throw new IllegalArgumentException("ViewHeights array must have at least 2 elements");
ArrayList<Animation> heightAnimations = new ArrayList<>();
int fromHeight = viewHeights.get(0);
int delay = 0;
int animationDuration = partAnimationDuration - delay;
for (int i = 1; i < viewHeights.size(); i++) {
int toHeight = fromHeight + viewHeights.get(i);
HeightAnimation heightAnimation = new HeightAnimation(this, fromHeight, toHeight, animationDuration).withInterpolator(new DecelerateInterpolator());
heightAnimation.setStartOffset(delay);
heightAnimations.add(heightAnimation);
fromHeight = toHeight;
}
createAnimationChain(heightAnimations, this);
this.startAnimation(heightAnimations.get(0));
}
Aggregations