Search in sources :

Example 1 with AnimationListenerAdapter

use of android.support.design.widget.AnimationUtils.AnimationListenerAdapter in project material-components-android by material-components.

the class FloatingActionButtonGingerbread method show.

@Override
void show(@Nullable final InternalVisibilityChangedListener listener, final boolean fromUser) {
    if (isOrWillBeShown()) {
        // We either are or will soon be visible, skip the call
        return;
    }
    mAnimState = ANIM_STATE_SHOWING;
    mView.internalSetVisibility(View.VISIBLE, fromUser);
    Animation anim = android.view.animation.AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_fab_in);
    anim.setDuration(SHOW_HIDE_ANIM_DURATION);
    anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
    anim.setAnimationListener(new AnimationListenerAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mAnimState = ANIM_STATE_NONE;
            if (listener != null) {
                listener.onShown();
            }
        }
    });
    mView.startAnimation(anim);
}
Also used : Animation(android.view.animation.Animation) AnimationListenerAdapter(android.support.design.widget.AnimationUtils.AnimationListenerAdapter)

Aggregations

AnimationListenerAdapter (android.support.design.widget.AnimationUtils.AnimationListenerAdapter)1 Animation (android.view.animation.Animation)1