Example usage for android.view ViewGroup addOnAttachStateChangeListener

List of usage examples for android.view ViewGroup addOnAttachStateChangeListener

Introduction

In this page you can find the example usage for android.view ViewGroup addOnAttachStateChangeListener.

Prototype

public void addOnAttachStateChangeListener(OnAttachStateChangeListener listener) 

Source Link

Document

Add a listener for attach state changes.

Usage

From source file:android.support.transition.TransitionManager.java

private static void sceneChangeRunTransition(final ViewGroup sceneRoot, final Transition transition) {
    if (transition != null && sceneRoot != null) {
        MultiListener listener = new MultiListener(transition, sceneRoot);
        sceneRoot.addOnAttachStateChangeListener(listener);
        sceneRoot.getViewTreeObserver().addOnPreDrawListener(listener);
    }/*from   w  w  w. j  a  va 2 s.  com*/
}

From source file:android.support.transition.TransitionManagerPort.java

private static void sceneChangeRunTransition(final ViewGroup sceneRoot, final TransitionPort transition) {
    if (transition != null && sceneRoot != null) {
        MultiListener listener = new MultiListener(transition, sceneRoot);
        sceneRoot.addOnAttachStateChangeListener(listener);
        sceneRoot.getViewTreeObserver().addOnPreDrawListener(listener);
    }/*w w  w .j ava2  s . c o  m*/
}

From source file:com.transitionseverywhere.TransitionManager.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
private static void sceneChangeRunTransition(final ViewGroup sceneRoot, final Transition transition) {
    if (transition != null && sceneRoot != null && isTransitionsAllowed()) {
        ViewGroupOverlayUtils.initializeOverlay(sceneRoot);
        MultiListener listener = new MultiListener(transition, sceneRoot);
        sceneRoot.addOnAttachStateChangeListener(listener);
        sceneRoot.getViewTreeObserver().addOnPreDrawListener(listener);
    } else {//from w w  w .  j  a v a2s.  c o m
        sPendingTransitions.remove(sceneRoot);
    }
}