Search in sources :

Example 1 with Animation

use of android.view.animation.Animation in project Meizhi by drakeet.

the class AnimRecyclerViewAdapter method showItemAnim.

public void showItemAnim(final View view, final int position) {
    Context context = view.getContext();
    if (position > mLastPosition) {
        view.setAlpha(0);
        view.postDelayed(() -> {
            Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_in_right);
            animation.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                    view.setAlpha(1);
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
            view.startAnimation(animation);
        }, DELAY * position);
        mLastPosition = position;
    }
}
Also used : Context(android.content.Context) Animation(android.view.animation.Animation)

Example 2 with Animation

use of android.view.animation.Animation in project Meizhi by drakeet.

the class ScrollAwareFABBehavior method animateIn.

// Same animation that FloatingActionButton.Behavior uses to show the FAB when the AppBarLayout enters
private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR).withLayer().setListener(null).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}
Also used : Animation(android.view.animation.Animation)

Example 3 with Animation

use of android.view.animation.Animation in project Meizhi by drakeet.

the class ScrollAwareFABBehavior method animateOut.

// Same animation that FloatingActionButton.Behavior uses to hide the FAB when the AppBarLayout exits
private void animateOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR).withLayer().setListener(new ViewPropertyAnimatorListener() {

            public void onAnimationStart(View view) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationCancel(View view) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
            }

            public void onAnimationEnd(View view) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                view.setVisibility(View.GONE);
            }
        }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_out);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(200L);
        anim.setAnimationListener(new Animation.AnimationListener() {

            public void onAnimationStart(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationEnd(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.GONE);
            }

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

Example 4 with Animation

use of android.view.animation.Animation in project cw-omnibus by commonsguy.

the class ActionBarSherlockCompat method hideProgressBars.

private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    //getLocalFeatures();
    final int features = mFeatures;
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 && spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 && horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
Also used : Animation(android.view.animation.Animation)

Example 5 with Animation

use of android.view.animation.Animation in project AndroidTraining by mixi-inc.

the class AnimationPracticeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.animation_practice);
    View animationView = findViewById(R.id.animation_view);
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.practice);
    animationView.startAnimation(animation);
}
Also used : Animation(android.view.animation.Animation) View(android.view.View)

Aggregations

Animation (android.view.animation.Animation)941 AlphaAnimation (android.view.animation.AlphaAnimation)241 TranslateAnimation (android.view.animation.TranslateAnimation)190 ScaleAnimation (android.view.animation.ScaleAnimation)146 Transformation (android.view.animation.Transformation)114 View (android.view.View)104 AnimationListener (android.view.animation.Animation.AnimationListener)98 AnimationSet (android.view.animation.AnimationSet)94 RotateAnimation (android.view.animation.RotateAnimation)63 ImageView (android.widget.ImageView)48 TextView (android.widget.TextView)47 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)43 Point (android.graphics.Point)40 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)35 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)35 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)35 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)35 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)35 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)35 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)35