From f791703f9bc566bee4f4809910d09dd415342078 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 6 Oct 2014 14:50:59 -0700 Subject: Avoid changeBounds animations on Views that are not yet laidout bug:17683930 This means that GONE views with empty bounds don't trigger ChangeBounds animations the first time they're shown. Change-Id: I6503c5b0a790d3d31f7566fab27a0b12c5f61f26 --- core/java/android/transition/ChangeBounds.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'core/java/android/transition') diff --git a/core/java/android/transition/ChangeBounds.java b/core/java/android/transition/ChangeBounds.java index eb17429..0a44ba2 100644 --- a/core/java/android/transition/ChangeBounds.java +++ b/core/java/android/transition/ChangeBounds.java @@ -117,13 +117,16 @@ public class ChangeBounds extends Transition { private void captureValues(TransitionValues values) { View view = values.view; - values.values.put(PROPNAME_BOUNDS, new Rect(view.getLeft(), view.getTop(), - view.getRight(), view.getBottom())); - values.values.put(PROPNAME_PARENT, values.view.getParent()); - if (mReparent) { - values.view.getLocationInWindow(tempLocation); - values.values.put(PROPNAME_WINDOW_X, tempLocation[0]); - values.values.put(PROPNAME_WINDOW_Y, tempLocation[1]); + + if (view.isLaidOut()) { + values.values.put(PROPNAME_BOUNDS, new Rect(view.getLeft(), view.getTop(), + view.getRight(), view.getBottom())); + values.values.put(PROPNAME_PARENT, values.view.getParent()); + if (mReparent) { + values.view.getLocationInWindow(tempLocation); + values.values.put(PROPNAME_WINDOW_X, tempLocation[0]); + values.values.put(PROPNAME_WINDOW_Y, tempLocation[1]); + } } } -- cgit v1.1