diff options
| author | Chet Haase <chet@google.com> | 2013-04-04 11:30:31 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-04 11:30:31 -0700 |
| commit | 98f69881ce28fef261da45c7fbd7ee79e9b8d637 (patch) | |
| tree | 360895183837aa02dd188f8d4ba6ba5f2dff55ff /core/java/android/view/ViewGroup.java | |
| parent | 2987c218e351c76941f09bddb3eb46a572ca6644 (diff) | |
| parent | 77d94957d793aba16a1352d25d5555bf59fe74e7 (diff) | |
am 77d94957: Merge "Adding small animation features" into jb-mr2-dev
* commit '77d94957d793aba16a1352d25d5555bf59fe74e7':
Adding small animation features
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 725502dbbdb1..f615e1bcf48f 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -406,10 +406,16 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager private View[] mChildren; // Number of valid children in the mChildren array, the rest should be null or not // considered as children + private int mChildrenCount; - private boolean mLayoutSuppressed = false; + // Whether layout calls are currently being suppressed, controlled by calls to + // suppressLayout() + boolean mSuppressLayout = false; - private int mChildrenCount; + // Whether any layout calls have actually been suppressed while mSuppressLayout + // has been true. This tracks whether we need to issue a requestLayout() when + // layout is later re-enabled. + private boolean mLayoutCalledWhileSuppressed = false; private static final int ARRAY_INITIAL_CAPACITY = 12; private static final int ARRAY_CAPACITY_INCREMENT = 12; @@ -2564,7 +2570,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager exitHoverTargets(); // In case view is detached while transition is running - mLayoutSuppressed = false; + mLayoutCalledWhileSuppressed = false; // Tear down our drag tracking mDragNotifiedChildren = null; @@ -4525,7 +4531,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager super.layout(l, t, r, b); } else { // record the fact that we noop'd it; request layout when transition finishes - mLayoutSuppressed = true; + mLayoutCalledWhileSuppressed = true; } } @@ -5201,9 +5207,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override public void endTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) { - if (mLayoutSuppressed && !transition.isChangingLayout()) { + if (mLayoutCalledWhileSuppressed && !transition.isChangingLayout()) { requestLayout(); - mLayoutSuppressed = false; + mLayoutCalledWhileSuppressed = false; } if (transitionType == LayoutTransition.DISAPPEARING && mTransitioningViews != null) { endViewTransition(view); @@ -5212,6 +5218,24 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager }; /** + * Tells this ViewGroup to suppress all layout() calls until layout + * suppression is disabled with a later call to suppressLayout(false). + * When layout suppression is disabled, a requestLayout() call is sent + * if layout() was attempted while layout was being suppressed. + * + * @hide + */ + public void suppressLayout(boolean suppress) { + mSuppressLayout = suppress; + if (!suppress) { + if (mLayoutCalledWhileSuppressed) { + requestLayout(); + mLayoutCalledWhileSuppressed = false; + } + } + } + + /** * {@inheritDoc} */ @Override |
