Search in sources :

Example 1 with TransitionEndListener

use of com.bluelinelabs.conductor.demo.util.AnimUtils.TransitionEndListener in project Conductor by bluelinelabs.

the class FabToDialogTransitionChangeHandler method executePropertyChanges.

@Override
public void executePropertyChanges(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, @NonNull Transition transition, boolean isPush) {
    if (isPush) {
        fabParent.removeView(fab);
        container.addView(to);
        /*
             * After the transition is finished we have to add the fab back to the original container.
             * Because otherwise we will be lost when trying to transition back.
             * Set it to invisible because we don't want it to jump back after the transition
             */
        transition.addListener(new AnimUtils.TransitionEndListener() {

            @Override
            public void onTransitionCompleted(Transition transition) {
                fab.setVisibility(View.GONE);
                fabParent.addView(fab);
                fab = null;
                fabParent = null;
            }
        });
    } else {
        dialogBackground.setVisibility(View.INVISIBLE);
        fabParent.addView(fab);
        container.removeView(from);
        transition.addListener(new TransitionEndListener() {

            @Override
            public void onTransitionCompleted(Transition transition) {
                fabParent.removeView(dialogBackground);
                dialogBackground = null;
            }
        });
    }
}
Also used : TransitionEndListener(com.bluelinelabs.conductor.demo.util.AnimUtils.TransitionEndListener) AnimUtils(com.bluelinelabs.conductor.demo.util.AnimUtils) Transition(android.transition.Transition) TransitionEndListener(com.bluelinelabs.conductor.demo.util.AnimUtils.TransitionEndListener)

Aggregations

Transition (android.transition.Transition)1 AnimUtils (com.bluelinelabs.conductor.demo.util.AnimUtils)1 TransitionEndListener (com.bluelinelabs.conductor.demo.util.AnimUtils.TransitionEndListener)1