From 7a46dde1ae56a85fcb5cdac91173424b6355bf3c Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Wed, 17 Jul 2013 10:22:53 -0700 Subject: [PATCH] Changed name of recent hasLayout() method to isLaidOut() This new method on view reflects whether the view has been laid out at least once since it was attached. hasLayout() seems too vague for that meaning; every View that has a parent has a layout (since we use container, parent, and layout interchangeably). The new version of the method is closer to the actual meaning. Change-Id: I519745739b6a6317faeb077aa61f994025cf81f3 --- api/current.txt | 2 +- core/java/android/view/View.java | 12 ++++++------ .../android/view/transition/TransitionManager.java | 2 +- core/java/android/widget/HorizontalScrollView.java | 2 +- core/java/android/widget/ScrollView.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/current.txt b/api/current.txt index 907334881cf24..c67e1466c362b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -26768,7 +26768,6 @@ package android.view { method public float getY(); method public boolean hasFocus(); method public boolean hasFocusable(); - method public boolean hasLayout(); method public boolean hasOnClickListeners(); method public boolean hasOverlappingRendering(); method public boolean hasTransientState(); @@ -26798,6 +26797,7 @@ package android.view { method public boolean isInEditMode(); method public boolean isInLayout(); method public boolean isInTouchMode(); + method public boolean isLaidOut(); method public boolean isLayoutDirectionResolved(); method public boolean isLayoutRequested(); method public boolean isLongClickable(); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f8aef88bc026c..95a2469dee7c9 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2198,7 +2198,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Flag indicating that the view has been through at least one layout since it * was last attached to a window. */ - static final int PFLAG3_HAS_LAYOUT = 0x4; + static final int PFLAG3_IS_LAID_OUT = 0x4; /** * Flag indicating that a call to measure() was skipped and should be done @@ -6160,8 +6160,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Returns true if this view has been through at least one layout since it * was last attached to or detached from a window. */ - public boolean hasLayout() { - return (mPrivateFlags3 & PFLAG3_HAS_LAYOUT) == PFLAG3_HAS_LAYOUT; + public boolean isLaidOut() { + return (mPrivateFlags3 & PFLAG3_IS_LAID_OUT) == PFLAG3_IS_LAID_OUT; } /** @@ -11813,7 +11813,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } - mPrivateFlags3 &= ~PFLAG3_HAS_LAYOUT; + mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; jumpDrawablesToCurrentState(); @@ -12112,7 +12112,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ protected void onDetachedFromWindow() { mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; - mPrivateFlags3 &= ~PFLAG3_HAS_LAYOUT; + mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; removeUnsetPressCallback(); removeLongPressCallback(); @@ -14439,7 +14439,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } mPrivateFlags &= ~PFLAG_FORCE_LAYOUT; - mPrivateFlags3 |= PFLAG3_HAS_LAYOUT; + mPrivateFlags3 |= PFLAG3_IS_LAID_OUT; } /** diff --git a/core/java/android/view/transition/TransitionManager.java b/core/java/android/view/transition/TransitionManager.java index 7a3d9e2d15a87..7836268b067b0 100644 --- a/core/java/android/view/transition/TransitionManager.java +++ b/core/java/android/view/transition/TransitionManager.java @@ -320,7 +320,7 @@ public class TransitionManager { * value of null causes the TransitionManager to use the default transition. */ public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) { - if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.hasLayout()) { + if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.isLaidOut()) { if (Transition.DBG) { Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " + sceneRoot + ", " + transition); diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index d114b7660d228..dab0962f96940 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -1480,7 +1480,7 @@ public class HorizontalScrollView extends FrameLayout { } mChildToScrollTo = null; - if (!hasLayout()) { + if (!isLaidOut()) { final int scrollRange = Math.max(0, childWidth - (r - l - mPaddingLeft - mPaddingRight)); if (mSavedState != null) { diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 3d361f11d7b18..6680393845463 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -1473,7 +1473,7 @@ public class ScrollView extends FrameLayout { } mChildToScrollTo = null; - if (!hasLayout()) { + if (!isLaidOut()) { if (mSavedState != null) { mScrollY = mSavedState.scrollPosition; mSavedState = null;