Search in sources :

Example 11 with ViewPropertyAnimatorListener

use of android.support.v4.view.ViewPropertyAnimatorListener in project Timber by naman14.

the class FabAnimationUtils method scaleIn.

public static void scaleIn(final View fab, long duration, final ScaleCallback callback) {
    fab.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewCompat.animate(fab).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setDuration(duration).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).withLayer().setListener(new ViewPropertyAnimatorListener() {

            public void onAnimationStart(View view) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationCancel(View view) {
            }

            public void onAnimationEnd(View view) {
                view.setVisibility(View.VISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }
        }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out);
        anim.setDuration(duration);
        anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
        anim.setAnimationListener(new Animation.AnimationListener() {

            public void onAnimationStart(Animation animation) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationEnd(Animation animation) {
                fab.setVisibility(View.VISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            //
            }
        });
        fab.startAnimation(anim);
    }
}
Also used : ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) Animation(android.view.animation.Animation) View(android.view.View)

Example 12 with ViewPropertyAnimatorListener

use of android.support.v4.view.ViewPropertyAnimatorListener in project Timber by naman14.

the class FabAnimationUtils method scaleOut.

public static void scaleOut(final View fab, long duration, final ScaleCallback callback) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewCompat.animate(fab).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(duration).withLayer().setListener(new ViewPropertyAnimatorListener() {

            public void onAnimationStart(View view) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationCancel(View view) {
            }

            public void onAnimationEnd(View view) {
                view.setVisibility(View.INVISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }
        }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out);
        anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
        anim.setDuration(duration);
        anim.setAnimationListener(new Animation.AnimationListener() {

            public void onAnimationStart(Animation animation) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationEnd(Animation animation) {
                fab.setVisibility(View.INVISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            //
            }
        });
        fab.startAnimation(anim);
    }
}
Also used : ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) Animation(android.view.animation.Animation) View(android.view.View)

Example 13 with ViewPropertyAnimatorListener

use of android.support.v4.view.ViewPropertyAnimatorListener in project welcome-android by stephentuso.

the class WelcomeViewWrapper method hideWithAnimation.

protected void hideWithAnimation() {
    ViewPropertyAnimatorListener listener = new ViewPropertyAnimatorListener() {

        @Override
        public void onAnimationStart(View view) {
        //Nothing needed here
        }

        @Override
        public void onAnimationEnd(View view) {
            setAlpha(0f);
            WelcomeViewWrapper.this.view.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationCancel(View view) {
            setAlpha(0f);
            WelcomeViewWrapper.this.view.setVisibility(View.INVISIBLE);
        }
    };
    ViewCompat.animate(view).alpha(0f).setListener(listener).start();
}
Also used : ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) View(android.view.View)

Example 14 with ViewPropertyAnimatorListener

use of android.support.v4.view.ViewPropertyAnimatorListener in project welcome-android by stephentuso.

the class WelcomeViewWrapper method showWithAnimation.

protected void showWithAnimation() {
    ViewPropertyAnimatorListener listener = new ViewPropertyAnimatorListener() {

        @Override
        public void onAnimationStart(View view) {
            WelcomeViewWrapper.this.view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(View view) {
            setAlpha(1f);
        }

        @Override
        public void onAnimationCancel(View view) {
            setAlpha(1f);
        }
    };
    ViewCompat.animate(view).alpha(1f).setListener(listener).start();
}
Also used : ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) View(android.view.View)

Aggregations

ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)14 View (android.view.View)14 RecyclerView (android.support.v7.widget.RecyclerView)5 BindView (butterknife.BindView)4 ViewPropertyAnimatorCompat (android.support.v4.view.ViewPropertyAnimatorCompat)3 Animation (android.view.animation.Animation)3 TextView (android.widget.TextView)3 FloatingActionButton (android.support.design.widget.FloatingActionButton)1