From 7970894a9c446a6c8260d28b5b5ec922cc3e7010 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Thu, 25 Feb 2016 16:57:08 -0500 Subject: [PATCH] Revert "Fix exit transition and dismiss callback for popup exit transition" This reverts most of commit 21d361806c9e2dce5bae5b30f44be5ad87f32c22, which broke too many expectations in both apps and framework widgets. We need to find a safer way to handle the exit transition callback. Bug: 27359366 Bug: 27353218 Change-Id: I769ac7a25cb900c50e857839ca0563fbc5a3cb16 --- core/java/android/widget/PopupWindow.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 4c81d1ac316b0..54b3932dfeb23 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -1632,7 +1632,6 @@ public class PopupWindow { final PopupDecorView decorView = mDecorView; final View contentView = mContentView; - final OnDismissListener dismissListener = mOnDismissListener; final ViewGroup contentHolder; final ViewParent contentParent = contentView.getParent(); @@ -1676,16 +1675,19 @@ public class PopupWindow { new TransitionListenerAdapter() { @Override public void onTransitionEnd(Transition transition) { - dismissImmediate(decorView, contentHolder, - contentView, dismissListener); + dismissImmediate(decorView, contentHolder, contentView); } }); } else { - dismissImmediate(decorView, contentHolder, contentView, dismissListener); + dismissImmediate(decorView, contentHolder, contentView); } // Clears the anchor view. unregisterForViewTreeChanges(); + + if (mOnDismissListener != null) { + mOnDismissListener.onDismiss(); + } } /** @@ -1727,8 +1729,7 @@ public class PopupWindow { * Removes the popup from the window manager and tears down the supporting * view hierarchy, if necessary. */ - private void dismissImmediate(View decorView, ViewGroup contentHolder, - View contentView, OnDismissListener listener) { + private void dismissImmediate(View decorView, ViewGroup contentHolder, View contentView) { // If this method gets called and the decor view doesn't have a parent, // then it was either never added or was already removed. That should // never happen, but it's worth checking to avoid potential crashes. @@ -1745,10 +1746,6 @@ public class PopupWindow { mDecorView = null; mBackgroundView = null; mIsTransitioningToDismiss = false; - - if (mOnDismissListener != null) { - mOnDismissListener.onDismiss(); - } } /**