Search in sources :

Example 76 with ObjectAnimator

use of android.animation.ObjectAnimator in project PhotoNoter by yydcdut.

the class PGEditView method backTopAndCenterWithAnimation.

public void backTopAndCenterWithAnimation() {
    mStepLayout.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 11) {
        float centerHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_center_move_top_height);
        ObjectAnimator centerAnimator = ObjectAnimator.ofFloat(mCenterLayoutParent, "y", -centerHeight, 0f);
        centerAnimator.setDuration(ANIMATION_TIME);
        centerAnimator.start();
        float topHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_top_height);
        ObjectAnimator topAnimator = ObjectAnimator.ofFloat(mFirstTopView, "y", -topHeight, 0f);
        topAnimator.setDuration(ANIMATION_TIME);
        topAnimator.start();
    } else {
        mFirstTopView.setVisibility(View.VISIBLE);
        float topHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_top_height);
        float bottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_bottom_height);
        mCenterLayoutParent.setPadding(mCenterLayoutParent.getPaddingLeft(), Math.round(topHeight), mCenterLayoutParent.getPaddingRight(), Math.round(bottomHeight));
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Example 77 with ObjectAnimator

use of android.animation.ObjectAnimator in project WordPress-Android by wordpress-mobile.

the class AniUtils method getFadeInAnim.

private static ObjectAnimator getFadeInAnim(final View target, Duration duration) {
    ObjectAnimator fadeIn = ObjectAnimator.ofFloat(target, View.ALPHA, 0.0f, 1.0f);
    fadeIn.setDuration(duration.toMillis(target.getContext()));
    fadeIn.setInterpolator(new LinearInterpolator());
    fadeIn.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            target.setVisibility(View.VISIBLE);
        }
    });
    return fadeIn;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 78 with ObjectAnimator

use of android.animation.ObjectAnimator in project WordPress-Android by wordpress-mobile.

the class AniUtils method showFab.

/*
     * in/out animation for floating action button
     */
public static void showFab(final View view, final boolean show) {
    if (view == null)
        return;
    Context context = view.getContext();
    int fabHeight = context.getResources().getDimensionPixelSize(android.support.design.R.dimen.design_fab_size_normal);
    int fabMargin = context.getResources().getDimensionPixelSize(R.dimen.fab_margin);
    int max = (fabHeight + fabMargin) * 2;
    float fromY = (show ? max : 0f);
    float toY = (show ? 0f : max);
    ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, fromY, toY);
    if (show) {
        anim.setInterpolator(new DecelerateInterpolator());
    } else {
        anim.setInterpolator(new AccelerateInterpolator());
    }
    anim.setDuration(show ? Duration.LONG.toMillis(context) : Duration.SHORT.toMillis(context));
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            if (view.getVisibility() != View.VISIBLE) {
                view.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (!show) {
                view.setVisibility(View.GONE);
            }
        }
    });
    anim.start();
}
Also used : Context(android.content.Context) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 79 with ObjectAnimator

use of android.animation.ObjectAnimator in project WordPress-Android by wordpress-mobile.

the class AniUtils method getFadeOutAnim.

private static ObjectAnimator getFadeOutAnim(final View target, Duration duration) {
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(target, View.ALPHA, 1.0f, 0.0f);
    fadeOut.setDuration(duration.toMillis(target.getContext()));
    fadeOut.setInterpolator(new LinearInterpolator());
    fadeOut.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            target.setVisibility(View.GONE);
        }
    });
    return fadeOut;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 80 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class AdapterViewAnimator method getDefaultOutAnimation.

ObjectAnimator getDefaultOutAnimation() {
    ObjectAnimator anim = ObjectAnimator.ofFloat(null, "alpha", 1.0f, 0.0f);
    anim.setDuration(DEFAULT_ANIMATION_DURATION);
    return anim;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)791 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)102 Paint (android.graphics.Paint)68 TextView (android.widget.TextView)49 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)29 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20