summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewGroup.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-04-04 11:33:56 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-04 11:33:56 -0700
commitb38af997f683634de436922d45854c1e2d76415a (patch)
tree1142c7780e53a0ae02ed79fdfcd4086d96b68fdb /core/java/android/view/ViewGroup.java
parent5677e78863cc00bbe5ef0fa66f3e1da287b18f97 (diff)
parent98f69881ce28fef261da45c7fbd7ee79e9b8d637 (diff)
am 98f69881: am 77d94957: Merge "Adding small animation features" into jb-mr2-dev
* commit '98f69881ce28fef261da45c7fbd7ee79e9b8d637': Adding small animation features
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
-rw-r--r--core/java/android/view/ViewGroup.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 7b75033f986b..c1c6bfd276ce 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -416,10 +416,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;
@@ -2574,7 +2580,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;
@@ -4553,7 +4559,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;
}
}
@@ -5273,9 +5279,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);
@@ -5284,6 +5290,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