Search in sources :

Example 1 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project UltimateRecyclerView by cymcsg.

the class parent method rotationExpandIcon.

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void rotationExpandIcon(float from, float to) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to);
        valueAnimator.setDuration(150);
        valueAnimator.setInterpolator(new LinearOutSlowInInterpolator());
        valueAnimator.addUpdateListener(this);
        valueAnimator.start();
    }
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) ValueAnimator(android.animation.ValueAnimator) TargetApi(android.annotation.TargetApi)

Example 2 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project animate by hitherejoe.

the class ForegroundFrame method resizeViewProperty.

private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.setStartDelay(DELAY_COLOR_CHANGE + durationOffset);
    animator.start();
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) ObjectAnimator(android.animation.ObjectAnimator)

Example 3 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project PreLollipopTransition by takahirom.

the class SubFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_sub, container, false);
    final ExitFragmentTransition exitFragmentTransition = FragmentTransition.with(this).interpolator(new LinearOutSlowInInterpolator()).to(v.findViewById(R.id.sub_imageView)).start(savedInstanceState);
    exitFragmentTransition.exitListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            Log.d("TAG", "onAnimationStart: ");
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d("TAG", "onAnimationEnd: ");
        }
    }).interpolator(new FastOutSlowInInterpolator());
    exitFragmentTransition.startExitListening();
    return v;
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) View(android.view.View) ExitFragmentTransition(com.kogitune.activity_transition.fragment.ExitFragmentTransition) Nullable(android.support.annotation.Nullable)

Example 4 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class ProfileLayout method animateEnter.

private void animateEnter() {
    ObjectAnimator animator = ObjectAnimator.ofInt(this, OFFSET, getHeight(), 0);
    animator.setDuration(mShortAnimationTime);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mListener != null) {
                mListener.onEnterAnimationEnd();
            }
        }
    });
    animator.start();
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 5 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project AndroidChromium by JackyAndroid.

the class FocusAnimator method startAnimator.

private void startAnimator(final Runnable callback) {
    // Don't animate anything if the number of children changed.
    if (mInitialNumberOfChildren != mLayout.getChildCount()) {
        finishAnimation(callback);
        return;
    }
    // Don't animate if children are already all in the correct places.
    boolean isAnimationNecessary = false;
    ArrayList<Integer> finalChildTops = calculateChildTops();
    for (int i = 0; i < finalChildTops.size() && !isAnimationNecessary; i++) {
        isAnimationNecessary |= finalChildTops.get(i).compareTo(mInitialTops.get(i)) != 0;
    }
    if (!isAnimationNecessary) {
        finishAnimation(callback);
        return;
    }
    // Animate each child moving and changing size to match their final locations.
    ArrayList<Animator> animators = new ArrayList<Animator>();
    ValueAnimator childAnimator = ValueAnimator.ofFloat(0f, 1f);
    animators.add(childAnimator);
    for (int i = 0; i < mLayout.getChildCount(); i++) {
        // The child is already where it should be.
        if (mInitialTops.get(i).compareTo(finalChildTops.get(i)) == 0 && mInitialTops.get(i + 1).compareTo(finalChildTops.get(i + 1)) == 0) {
            continue;
        }
        final View child = mLayout.getChildAt(i);
        final int translationDifference = mInitialTops.get(i) - finalChildTops.get(i);
        final int oldHeight = mInitialTops.get(i + 1) - mInitialTops.get(i);
        final int newHeight = finalChildTops.get(i + 1) - finalChildTops.get(i);
        // Translate the child to its new place while changing where its bottom is drawn to
        // animate the child changing height without causing another layout.
        childAnimator.addUpdateListener(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float progress = (Float) animation.getAnimatedValue();
                child.setTranslationY(translationDifference * (1f - progress));
                if (oldHeight != newHeight) {
                    float animatedHeight = oldHeight * (1f - progress) + newHeight * progress;
                    child.setBottom(child.getTop() + (int) animatedHeight);
                }
            }
        });
        // Explicitly place the child in its final position in the end.
        childAnimator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animator) {
                child.setTranslationY(0);
                child.setBottom(child.getTop() + newHeight);
            }
        });
    }
    // Animate the height of the container itself changing.
    int oldContainerHeight = mInitialTops.get(mInitialTops.size() - 1);
    int newContainerHeight = finalChildTops.get(finalChildTops.size() - 1);
    ValueAnimator layoutAnimator = ValueAnimator.ofInt(oldContainerHeight, newContainerHeight);
    layoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mLayout.setBottom(((Integer) animation.getAnimatedValue()));
            requestChildFocus();
        }
    });
    animators.add(layoutAnimator);
    // Set up and kick off the animation.
    AnimatorSet animator = new AnimatorSet();
    animator.setDuration(ANIMATION_LENGTH_MS);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.playTogether(animators);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animator) {
            finishAnimation(callback);
            // Request a layout to put everything in the right final place.
            mLayout.requestLayout();
        }
    });
    animator.start();
}
Also used : ArrayList(java.util.ArrayList) AnimatorSet(android.animation.AnimatorSet) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator) View(android.view.View) LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)11 Animator (android.animation.Animator)7 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)6 View (android.view.View)5 ObjectAnimator (android.animation.ObjectAnimator)4 ValueAnimator (android.animation.ValueAnimator)2 TargetApi (android.annotation.TargetApi)2 Nullable (android.support.annotation.Nullable)2 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)2 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)2 AnimatorSet (android.animation.AnimatorSet)1 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)1 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)1 ViewGroup (android.view.ViewGroup)1 ViewTreeObserver (android.view.ViewTreeObserver)1 OvershootInterpolator (android.view.animation.OvershootInterpolator)1 TextView (android.widget.TextView)1 AHBottomNavigation (com.aurelhubert.ahbottomnavigation.AHBottomNavigation)1 AHBottomNavigationAdapter (com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter)1 AHBottomNavigationItem (com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem)1