Fix leak in LayoutTransition

Previously, an OnPreDrawListener was added to clean things up, including
removing the listener, after animations are started.
But if the view is detached before that listener is called, the
listener will remain on that ViewTreeObserver.

This change adds an OnAttachStateChangeListener to perform that cleanup
step when the view is detached, just in case.

Issue #20824645 Leak in LayoutTransition

Change-Id: I264812f8e02dda673789712ba83d208e87cdc5a4
1 file changed