Search in sources :

Example 1 with TransitionListener

use of android.transition.Transition.TransitionListener in project packages_apps_Contacts by AOKP.

the class ExpandingEntryCardView method expand.

private void expand() {
    ChangeBounds boundsTransition = new ChangeBounds();
    boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
    Fade fadeIn = new Fade(Fade.IN);
    fadeIn.setDuration(DURATION_EXPAND_ANIMATION_FADE_IN);
    fadeIn.setStartDelay(DELAY_EXPAND_ANIMATION_FADE_IN);
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(boundsTransition);
    transitionSet.addTransition(fadeIn);
    transitionSet.excludeTarget(R.id.text, /* exclude = */
    true);
    final ViewGroup transitionViewContainer = mAnimationViewGroup == null ? this : mAnimationViewGroup;
    transitionSet.addListener(new TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
            mListener.onExpand();
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            mListener.onExpandDone();
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
    mIsExpanded = true;
    // In order to insert new entries, we may need to inflate them for the first time
    inflateAllEntries(LayoutInflater.from(getContext()));
    insertEntriesIntoViewGroup();
    updateExpandCollapseButton(getCollapseButtonText(), DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
}
Also used : TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) ViewGroup(android.view.ViewGroup) Transition(android.transition.Transition) TransitionListener(android.transition.Transition.TransitionListener) Fade(android.transition.Fade)

Example 2 with TransitionListener

use of android.transition.Transition.TransitionListener in project Conductor by bluelinelabs.

the class ArcFadeMoveChangeHandler method getSharedElementTransition.

@Nullable
@Override
public Transition getSharedElementTransition(@NonNull ViewGroup container, @Nullable final View from, @Nullable View to, boolean isPush) {
    Transition transition = new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform());
    transition.setPathMotion(new ArcMotion());
    // The framework doesn't totally fade out the "from" shared element, so we'll hide it manually once it's safe.
    transition.addListener(new TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
            if (from != null) {
                for (String name : sharedElementNames) {
                    View namedView = TransitionUtils.findNamedView(from, name);
                    if (namedView != null) {
                        namedView.setVisibility(View.INVISIBLE);
                    }
                }
            }
        }

        @Override
        public void onTransitionEnd(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    return transition;
}
Also used : ChangeTransform(android.transition.ChangeTransform) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) TransitionListener(android.transition.Transition.TransitionListener) View(android.view.View) ArcMotion(android.transition.ArcMotion) ChangeClipBounds(android.transition.ChangeClipBounds) Nullable(android.support.annotation.Nullable)

Example 3 with TransitionListener

use of android.transition.Transition.TransitionListener in project Conductor by bluelinelabs.

the class TransitionChangeHandler method performChange.

@Override
public void performChange(@NonNull final ViewGroup container, @Nullable final View from, @Nullable final View to, final boolean isPush, @NonNull final ControllerChangeCompletedListener changeListener) {
    if (canceled) {
        changeListener.onChangeCompleted();
        return;
    }
    if (needsImmediateCompletion) {
        executePropertyChanges(container, from, to, null, isPush);
        changeListener.onChangeCompleted();
        return;
    }
    final Transition transition = getTransition(container, from, to, isPush);
    transition.addListener(new TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            changeListener.onChangeCompleted();
        }

        @Override
        public void onTransitionCancel(Transition transition) {
            changeListener.onChangeCompleted();
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    prepareForTransition(container, from, to, transition, isPush, new OnTransitionPreparedListener() {

        @Override
        public void onPrepared() {
            if (!canceled) {
                TransitionManager.beginDelayedTransition(container, transition);
                executePropertyChanges(container, from, to, transition, isPush);
            }
        }
    });
}
Also used : Transition(android.transition.Transition) TransitionListener(android.transition.Transition.TransitionListener)

Aggregations

Transition (android.transition.Transition)3 TransitionListener (android.transition.Transition.TransitionListener)3 ChangeBounds (android.transition.ChangeBounds)2 TransitionSet (android.transition.TransitionSet)2 Nullable (android.support.annotation.Nullable)1 ArcMotion (android.transition.ArcMotion)1 ChangeClipBounds (android.transition.ChangeClipBounds)1 ChangeTransform (android.transition.ChangeTransform)1 Fade (android.transition.Fade)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1