Search in sources :

Example 1 with FlipAnimation

use of yalantis.com.sidemenu.animation.FlipAnimation in project Side-Menu.Android by Yalantis.

the class ViewAnimator method animateView.

private void animateView(int position) {
    final View view = viewList.get(position);
    view.setVisibility(View.VISIBLE);
    FlipAnimation rotation = new FlipAnimation(90, 0, 0.0f, view.getHeight() / 2.0f);
    rotation.setDuration(ANIMATION_DURATION);
    rotation.setFillAfter(true);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.clearAnimation();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    view.startAnimation(rotation);
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) FlipAnimation(yalantis.com.sidemenu.animation.FlipAnimation) FlipAnimation(yalantis.com.sidemenu.animation.FlipAnimation) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView) View(android.view.View)

Example 2 with FlipAnimation

use of yalantis.com.sidemenu.animation.FlipAnimation in project Side-Menu.Android by Yalantis.

the class ViewAnimator method animateHideView.

private void animateHideView(final int position) {
    final View view = viewList.get(position);
    FlipAnimation rotation = new FlipAnimation(0, 90, 0.0f, view.getHeight() / 2.0f);
    rotation.setDuration(ANIMATION_DURATION);
    rotation.setFillAfter(true);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.clearAnimation();
            view.setVisibility(View.INVISIBLE);
            if (position == viewList.size() - 1) {
                animatorListener.enableHomeButton();
                drawerLayout.closeDrawers();
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    view.startAnimation(rotation);
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) FlipAnimation(yalantis.com.sidemenu.animation.FlipAnimation) FlipAnimation(yalantis.com.sidemenu.animation.FlipAnimation) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

View (android.view.View)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 Animation (android.view.animation.Animation)2 ImageView (android.widget.ImageView)2 FlipAnimation (yalantis.com.sidemenu.animation.FlipAnimation)2