From 7d6cb913de9b51dba0bae79e527b7d4fe79eb35d Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 2 Dec 2016 17:25:33 -0500 Subject: Modify SwipeDismissLayout to perform its own exit animation Instead of relying on the window animation system, in the special case of a swipe-dismiss, disable any default window exit animation and perform a custom animation. This bypasses some bugs in the window animator codebase and allows us to have a nice "rebound" animation if the user doesn't swipe far/fast enough to trigger a dismiss. Bug: 33041168 Change-Id: Ied45700d35a59950bacef1ba0650eaa5bc60fadb --- core/java/android/view/Window.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/java/android/view/Window.java') diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 1cca0742877f..a36127db559f 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -581,8 +581,10 @@ public abstract class Window { * Called when a window is dismissed. This informs the callback that the * window is gone, and it should finish itself. * @param finishTask True if the task should also be finished. + * @param suppressWindowTransition True if the resulting exit and enter window transition + * animations should be suppressed. */ - void onWindowDismissed(boolean finishTask); + void onWindowDismissed(boolean finishTask, boolean suppressWindowTransition); } /** @hide */ @@ -871,9 +873,10 @@ public abstract class Window { } /** @hide */ - public final void dispatchOnWindowDismissed(boolean finishTask) { + public final void dispatchOnWindowDismissed( + boolean finishTask, boolean suppressWindowTransition) { if (mOnWindowDismissedCallback != null) { - mOnWindowDismissedCallback.onWindowDismissed(finishTask); + mOnWindowDismissedCallback.onWindowDismissed(finishTask, suppressWindowTransition); } } -- cgit v1.2.3