Loading api/current.txt +10 −0 Original line number Diff line number Diff line Loading @@ -36263,6 +36263,7 @@ package android.view { method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(); method public void createContextMenu(android.view.ContextMenu); method public void destroyDrawingCache(); method public final boolean didLayoutParamsChange(); method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets); method public void dispatchConfigurationChanged(android.content.res.Configuration); method public void dispatchDisplayHint(int); Loading Loading @@ -36488,6 +36489,7 @@ package android.view { method public boolean isOpaque(); method protected boolean isPaddingOffsetRequired(); method public boolean isPaddingRelative(); method public final boolean isPartialLayoutRequested(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); Loading Loading @@ -37097,6 +37099,7 @@ package android.view { method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>); method protected boolean drawChild(android.graphics.Canvas, android.view.View, long); method public void endViewTransition(android.view.View); method public int findDependentLayoutAxes(android.view.View, int); method public android.view.View focusSearch(android.view.View, int); method public void focusableViewAvailable(android.view.View); method public boolean gatherTransparentRegion(android.graphics.Region); Loading Loading @@ -37163,6 +37166,8 @@ package android.view { method public void requestChildFocus(android.view.View, android.view.View); method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); method public void requestDisallowInterceptTouchEvent(boolean); method public void requestLayoutForChild(android.view.View); method public void requestPartialLayoutForChild(android.view.View); method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public void requestTransparentRegion(android.view.View); method public void scheduleLayoutAnimation(); Loading Loading @@ -37277,6 +37282,7 @@ package android.view { method public abstract void childHasTransientStateChanged(android.view.View, boolean); method public abstract void clearChildFocus(android.view.View); method public abstract void createContextMenu(android.view.ContextMenu); method public abstract int findDependentLayoutAxes(android.view.View, int); method public abstract android.view.View focusSearch(android.view.View, int); method public abstract void focusableViewAvailable(android.view.View); method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); Loading Loading @@ -37306,12 +37312,16 @@ package android.view { method public abstract void requestDisallowInterceptTouchEvent(boolean); method public abstract void requestFitSystemWindows(); method public abstract void requestLayout(); method public abstract void requestLayoutForChild(android.view.View); method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public abstract void requestTransparentRegion(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View, float, float); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int); field public static final int FLAG_LAYOUT_AXIS_ANY = 3; // 0x3 field public static final int FLAG_LAYOUT_AXIS_HORIZONTAL = 1; // 0x1 field public static final int FLAG_LAYOUT_AXIS_VERTICAL = 2; // 0x2 } public class ViewPropertyAnimator { api/system-current.txt +10 −0 Original line number Diff line number Diff line Loading @@ -38586,6 +38586,7 @@ package android.view { method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(); method public void createContextMenu(android.view.ContextMenu); method public void destroyDrawingCache(); method public final boolean didLayoutParamsChange(); method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets); method public void dispatchConfigurationChanged(android.content.res.Configuration); method public void dispatchDisplayHint(int); Loading Loading @@ -38811,6 +38812,7 @@ package android.view { method public boolean isOpaque(); method protected boolean isPaddingOffsetRequired(); method public boolean isPaddingRelative(); method public final boolean isPartialLayoutRequested(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); Loading Loading @@ -39420,6 +39422,7 @@ package android.view { method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>); method protected boolean drawChild(android.graphics.Canvas, android.view.View, long); method public void endViewTransition(android.view.View); method public int findDependentLayoutAxes(android.view.View, int); method public android.view.View focusSearch(android.view.View, int); method public void focusableViewAvailable(android.view.View); method public boolean gatherTransparentRegion(android.graphics.Region); Loading Loading @@ -39486,6 +39489,8 @@ package android.view { method public void requestChildFocus(android.view.View, android.view.View); method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); method public void requestDisallowInterceptTouchEvent(boolean); method public void requestLayoutForChild(android.view.View); method public void requestPartialLayoutForChild(android.view.View); method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public void requestTransparentRegion(android.view.View); method public void scheduleLayoutAnimation(); Loading Loading @@ -39600,6 +39605,7 @@ package android.view { method public abstract void childHasTransientStateChanged(android.view.View, boolean); method public abstract void clearChildFocus(android.view.View); method public abstract void createContextMenu(android.view.ContextMenu); method public abstract int findDependentLayoutAxes(android.view.View, int); method public abstract android.view.View focusSearch(android.view.View, int); method public abstract void focusableViewAvailable(android.view.View); method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); Loading Loading @@ -39629,12 +39635,16 @@ package android.view { method public abstract void requestDisallowInterceptTouchEvent(boolean); method public abstract void requestFitSystemWindows(); method public abstract void requestLayout(); method public abstract void requestLayoutForChild(android.view.View); method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public abstract void requestTransparentRegion(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View, float, float); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int); field public static final int FLAG_LAYOUT_AXIS_ANY = 3; // 0x3 field public static final int FLAG_LAYOUT_AXIS_HORIZONTAL = 1; // 0x1 field public static final int FLAG_LAYOUT_AXIS_VERTICAL = 2; // 0x2 } public class ViewPropertyAnimator { core/java/android/view/View.java +77 −5 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import android.view.AccessibilityIterators.TextSegmentIterator; import android.view.AccessibilityIterators.CharacterTextSegmentIterator; import android.view.AccessibilityIterators.WordTextSegmentIterator; import android.view.AccessibilityIterators.ParagraphTextSegmentIterator; import android.view.ViewGroup.LayoutParams; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEventSource; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -2416,6 +2417,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG3_SCROLL_INDICATOR_END * 1 PFLAG3_ASSIST_BLOCKED * 1111111 PFLAG3_POINTER_ICON_MASK * 1 PFLAG3_PARTIAL_LAYOUT_REQUESTED * 1 PFLAG3_LAYOUT_PARAMS_CHANGED * |-------|-------|-------|-------| */ Loading Loading @@ -2504,6 +2507,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static final int PFLAG3_SCROLL_INDICATOR_END = 0x2000; /* End of masks for mPrivateFlags3 */ static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED; Loading Loading @@ -2641,6 +2645,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static final int PFLAG3_POINTER_ICON_VALUE_START = 3 << PFLAG3_POINTER_ICON_LSHIFT; /** * Flag indicating that this view has requested a partial layout and * is added to the AttachInfo's list of views that need a partial layout * request handled on the next traversal. */ static final int PFLAG3_PARTIAL_LAYOUT_REQUESTED = 0x800000; /** * Flag indicating that this view's LayoutParams have been explicitly changed * since the last layout pass. */ static final int PFLAG3_LAYOUT_PARAMS_CHANGED = 0x1000000; /** * Always allow a user to over-scroll this view, provided it is a * view that can scroll. Loading Loading @@ -12622,10 +12639,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * ViewGroup.LayoutParams, and these correspond to the different subclasses * of ViewGroup that are responsible for arranging their children. * * This method may return null if this View is not attached to a parent * <p>This method may return null if this View is not attached to a parent * ViewGroup or {@link #setLayoutParams(android.view.ViewGroup.LayoutParams)} * was not invoked successfully. When a View is attached to a parent * ViewGroup, this method must not return null. * ViewGroup, this method must not return null.</p> * * <p>Callers that modify the returned LayoutParams object should call * {@link #setLayoutParams(LayoutParams)} to explicitly inform the view that * LayoutParams have changed.</p> * * @return The LayoutParams associated with this view, or null if no * parameters have been set yet Loading @@ -12642,6 +12663,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * correspond to the different subclasses of ViewGroup that are responsible * for arranging their children. * * <p>If the View's existing LayoutParams object as obtained by {@link #getLayoutParams()} is * modified, you should call this method to inform the view that it has changed.</p> * * @param params The layout parameters for this view, cannot be null */ public void setLayoutParams(ViewGroup.LayoutParams params) { Loading @@ -12649,6 +12673,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, throw new NullPointerException("Layout parameters cannot be null"); } mLayoutParams = params; mPrivateFlags3 |= PFLAG3_LAYOUT_PARAMS_CHANGED; resolveLayoutParams(); if (mParent instanceof ViewGroup) { ((ViewGroup) mParent).onSetLayoutParams(this, params); Loading Loading @@ -14324,7 +14349,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mParent.requestTransparentRegion(this); } mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; if ((mPrivateFlags & PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { initialAwakenScrollBars(); mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } mPrivateFlags3 &= ~(PFLAG3_IS_LAID_OUT | PFLAG3_PARTIAL_LAYOUT_REQUESTED); jumpDrawablesToCurrentState(); Loading Loading @@ -14662,8 +14692,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ @CallSuper protected void onDetachedFromWindowInternal() { if (mAttachInfo != null && isPartialLayoutRequested()) { mAttachInfo.mPartialLayoutViews.remove(this); } mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; mPrivateFlags3 &= ~(PFLAG3_IS_LAID_OUT | PFLAG3_PARTIAL_LAYOUT_REQUESTED | PFLAG3_LAYOUT_PARAMS_CHANGED); removeUnsetPressCallback(); removeLongPressCallback(); Loading Loading @@ -16849,6 +16884,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return (mPrivateFlags & PFLAG_FORCE_LAYOUT) == PFLAG_FORCE_LAYOUT; } /** * Indicates whether or not this view has requested a partial layout that * may not affect its size or position within its parent. This state will be reset * the next time this view is laid out. * * @return true if partial layout has been requested */ public final boolean isPartialLayoutRequested() { return (mPrivateFlags3 & PFLAG3_PARTIAL_LAYOUT_REQUESTED) == PFLAG3_PARTIAL_LAYOUT_REQUESTED; } /** * Returns true if this view's {@link ViewGroup.LayoutParams LayoutParams} changed * since the last time this view was successfully laid out. Typically this happens as a * result of a call to {@link #setLayoutParams(LayoutParams)}. * * @return true if this view's LayoutParams changed since last layout. */ public final boolean didLayoutParamsChange() { return (mPrivateFlags3 & PFLAG3_LAYOUT_PARAMS_CHANGED) == PFLAG3_LAYOUT_PARAMS_CHANGED; } /** * Return true if o is a ViewGroup that is laying out using optical bounds. * @hide Loading Loading @@ -16906,6 +16964,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (changed || (mPrivateFlags & PFLAG_LAYOUT_REQUIRED) == PFLAG_LAYOUT_REQUIRED) { onLayout(changed, l, t, r, b); mPrivateFlags &= ~PFLAG_LAYOUT_REQUIRED; mPrivateFlags3 &= ~PFLAG3_LAYOUT_PARAMS_CHANGED; ListenerInfo li = mListenerInfo; if (li != null && li.mOnLayoutChangeListeners != null) { Loading @@ -16919,6 +16978,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } mPrivateFlags &= ~PFLAG_FORCE_LAYOUT; mPrivateFlags3 &= ~PFLAG3_PARTIAL_LAYOUT_REQUESTED; mPrivateFlags3 |= PFLAG3_IS_LAID_OUT; } Loading Loading @@ -19012,7 +19072,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags |= PFLAG_INVALIDATED; if (mParent != null && !mParent.isLayoutRequested()) { mParent.requestLayout(); mParent.requestLayoutForChild(this); } if (mAttachInfo != null && mAttachInfo.mViewRequestingLayout == this) { mAttachInfo.mViewRequestingLayout = null; Loading @@ -19031,6 +19091,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags |= PFLAG_INVALIDATED; } void forcePartialLayout() { forceLayout(); mPrivateFlags3 |= PFLAG3_PARTIAL_LAYOUT_REQUESTED; } /** * <p> * This is called to find out how big a view should be. The parent Loading Loading @@ -21867,6 +21932,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, interface Callbacks { void playSoundEffect(int effectId); boolean performHapticFeedback(int effectId, boolean always); void schedulePartialLayout(); } /** Loading Loading @@ -22241,6 +22307,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ IBinder mDragToken; /** * Used to track views that need (at least) a partial relayout at their current size * during the next traversal. */ final List<View> mPartialLayoutViews = new ArrayList<View>(); /** * Creates a new set of attachment information with the specified * events handler and thread. core/java/android/view/ViewGroup.java +169 −1 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; /** * <p> Loading Loading @@ -5516,6 +5518,172 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager protected abstract void onLayout(boolean changed, int l, int t, int r, int b); /** * {@inheritDoc} * * <p>Most subclasses should not need to override this method. The default implementation * will call {@link #findDependentLayoutAxes(View, int)} to determine how * to optimally proceed. If neither horizontal nor vertical layout depends on the given * child, this method will call {@link #requestPartialLayoutForChild(View)}. If one or both * do, it will call {@link #requestLayout()}.</p> * * @param child Child requesting a layout */ @Override public void requestLayoutForChild(View child) { if (child == null || child.getParent() != this) { throw new IllegalArgumentException( "child parameter must be a direct child view of this ViewGroup"); } // If we don't have a parent ourselves, record that we need a full layout. // Our whole subtree is detached. final ViewParent parent = getParent(); if (parent == null) { requestLayout(); return; } // We can optimize the layout request for this child into a partial layout // if the child has already been laid out at least once and neither horizontal nor // vertical layout within ourselves is dependent on pending layout changes within // this child. Otherwise we need to request a full layout for ourselves and continue // to recurse up the view hierarchy. if (child.isLaidOut() && findDependentLayoutAxes(child, FLAG_LAYOUT_AXIS_ANY) == 0) { requestPartialLayoutForChild(child); } else { requestLayout(); } } /** * {@inheritDoc} * * <p>The default implementation returns {@link #FLAG_LAYOUT_AXIS_ANY}. * Optimized implementations for specific ViewGroup subclasses may check if the child's * {@link View#didLayoutParamsChange() LayoutParams changed} and in what ways.</p> * * @param child Direct child of this ViewParent to check * @param axisFilter Which axes to check for dependencies. Can be * {@link #FLAG_LAYOUT_AXIS_HORIZONTAL}, {@link #FLAG_LAYOUT_AXIS_VERTICAL} * or {@link #FLAG_LAYOUT_AXIS_ANY}. * @return Axes of this ViewParent that depend on the given child's layout changes */ @Override public int findDependentLayoutAxes(View child, int axisFilter) { return FLAG_LAYOUT_AXIS_ANY; } /** * This is a helper implementation for {@link #findDependentLayoutAxes(View, int)} that * is not the default implementation in ViewGroup. This is to preserve compatibility with * existing app-side ViewGroup subclasses that existed before the partial layout system was * added to Android. It explicitly checks that the LayoutParams of the child are of the * expected type so that subclasses of standard framework layouts do not erroneously * start believing that it's safe to do a partial layout when that assertion can't * reasonably be confirmed. * * <p>If you're reading this as an author of a custom ViewGroup's findDependentLayoutAxes * method you might be frustrated to discover that it is not a part of the Android public API. * Many ViewGroup implementations will need to make small but important modifications * to an implementation like this one in order to be correct. Instead of encouraging * view authors to call this method, then make their own redundant recursive calls to * <code>getParent().findDependentLayoutAxes(...)</code> in addition to the one * that can happen here, this method is hidden and only used internally.</p> * * <p>Do feel free to copy this implementation and adapt it to suit your own purposes.</p> * * @hide */ protected final int findDependentLayoutAxesHelper(View child, int axisFilter, Class<?> layoutParamsClass) { if (!checkPartialLayoutParams(child, layoutParamsClass)) return axisFilter; if (child.didLayoutParamsChange()) { // Anything could have changed about our previous assumptions. return axisFilter; } final LayoutParams lp = child.getLayoutParams(); // Our layout can always end up depending on a WRAP_CONTENT child. final int wrapAxisFilter = ((lp.width == WRAP_CONTENT ? FLAG_LAYOUT_AXIS_HORIZONTAL : 0) | (lp.height == WRAP_CONTENT ? FLAG_LAYOUT_AXIS_VERTICAL : 0)) & axisFilter; if (wrapAxisFilter == axisFilter) { // We know all queried axes are affected, just return early. return wrapAxisFilter; } // Our layout *may* depend on a MATCH_PARENT child, depending on whether we can determine // that our layout will remain stable within our parent. We need to ask. final int matchAxisFilter = ((lp.width == MATCH_PARENT ? FLAG_LAYOUT_AXIS_HORIZONTAL : 0) | (lp.height == MATCH_PARENT ? FLAG_LAYOUT_AXIS_VERTICAL : 0)) & axisFilter; if (matchAxisFilter != 0) { final ViewParent parent = getParent(); if (parent != null) { // If our parent depends on us for an axis, then our layout can also be affected // by a MATCH_PARENT child along that axis. return getParent().findDependentLayoutAxes(this, matchAxisFilter) | wrapAxisFilter; } // If we don't have a parent, assume we're affected // in any determined affected direction. return matchAxisFilter | wrapAxisFilter; } // Two exact sizes and LayoutParams didn't change. We're safe. return 0; } /** * Throw an IllegalArgumentException if the supplied view is not a direct child of * this ViewGroup and return false if this view's LayoutParams is not of class lpClass. * Implementations of {@link ViewGroup#findDependentLayoutAxes(View, int)} use this * to check input parameters and defensively return the full axis filter mask themselves * if the LayoutParams class is not of the exact expected type; e.g. it is a subclass * of one of the standard framework layouts and we can't make assumptions. * @hide */ protected final boolean checkPartialLayoutParams(View child, Class<?> lpClass) { if (child.getParent() != this) { throw new IllegalArgumentException("View " + child + " is not a direct child of " + this); } final ViewGroup.LayoutParams lp = child.getLayoutParams(); return lp != null || lp.getClass() == lpClass; } /** * Called when a child of this ViewParent requires a relayout before the next frame * is drawn, but the caller can guarantee that the size of the child will not change * during a measure and layout pass. * * <p>A call to this method will schedule a partial layout for the supplied view as long as * it is a direct child of this ViewGroup and this ViewGroup is attached to a window. * On the next scheduled view hierarchy traversal the given child view will be re-measured * at its current measured size and re-laid out at its current position within its parent.</p> * * @param child Child that requires a partial layout */ public void requestPartialLayoutForChild(View child) { if (!child.isPartialLayoutRequested()) { child.forcePartialLayout(); if (mAttachInfo != null) { final List<View> partialLayoutViews = mAttachInfo.mPartialLayoutViews; final boolean schedule = partialLayoutViews.isEmpty(); partialLayoutViews.add(child); if (schedule) { mAttachInfo.mRootCallbacks.schedulePartialLayout(); } child.invalidate(); } else { requestLayout(); } } } /** * Indicates whether the view group has the ability to animate its children * after the first layout. Loading Loading @@ -5862,7 +6030,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * of its descendants */ protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return p; return new LayoutParams(p); } /** Loading core/java/android/view/ViewParent.java +49 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
api/current.txt +10 −0 Original line number Diff line number Diff line Loading @@ -36263,6 +36263,7 @@ package android.view { method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(); method public void createContextMenu(android.view.ContextMenu); method public void destroyDrawingCache(); method public final boolean didLayoutParamsChange(); method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets); method public void dispatchConfigurationChanged(android.content.res.Configuration); method public void dispatchDisplayHint(int); Loading Loading @@ -36488,6 +36489,7 @@ package android.view { method public boolean isOpaque(); method protected boolean isPaddingOffsetRequired(); method public boolean isPaddingRelative(); method public final boolean isPartialLayoutRequested(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); Loading Loading @@ -37097,6 +37099,7 @@ package android.view { method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>); method protected boolean drawChild(android.graphics.Canvas, android.view.View, long); method public void endViewTransition(android.view.View); method public int findDependentLayoutAxes(android.view.View, int); method public android.view.View focusSearch(android.view.View, int); method public void focusableViewAvailable(android.view.View); method public boolean gatherTransparentRegion(android.graphics.Region); Loading Loading @@ -37163,6 +37166,8 @@ package android.view { method public void requestChildFocus(android.view.View, android.view.View); method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); method public void requestDisallowInterceptTouchEvent(boolean); method public void requestLayoutForChild(android.view.View); method public void requestPartialLayoutForChild(android.view.View); method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public void requestTransparentRegion(android.view.View); method public void scheduleLayoutAnimation(); Loading Loading @@ -37277,6 +37282,7 @@ package android.view { method public abstract void childHasTransientStateChanged(android.view.View, boolean); method public abstract void clearChildFocus(android.view.View); method public abstract void createContextMenu(android.view.ContextMenu); method public abstract int findDependentLayoutAxes(android.view.View, int); method public abstract android.view.View focusSearch(android.view.View, int); method public abstract void focusableViewAvailable(android.view.View); method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); Loading Loading @@ -37306,12 +37312,16 @@ package android.view { method public abstract void requestDisallowInterceptTouchEvent(boolean); method public abstract void requestFitSystemWindows(); method public abstract void requestLayout(); method public abstract void requestLayoutForChild(android.view.View); method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public abstract void requestTransparentRegion(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View, float, float); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int); field public static final int FLAG_LAYOUT_AXIS_ANY = 3; // 0x3 field public static final int FLAG_LAYOUT_AXIS_HORIZONTAL = 1; // 0x1 field public static final int FLAG_LAYOUT_AXIS_VERTICAL = 2; // 0x2 } public class ViewPropertyAnimator {
api/system-current.txt +10 −0 Original line number Diff line number Diff line Loading @@ -38586,6 +38586,7 @@ package android.view { method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(); method public void createContextMenu(android.view.ContextMenu); method public void destroyDrawingCache(); method public final boolean didLayoutParamsChange(); method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets); method public void dispatchConfigurationChanged(android.content.res.Configuration); method public void dispatchDisplayHint(int); Loading Loading @@ -38811,6 +38812,7 @@ package android.view { method public boolean isOpaque(); method protected boolean isPaddingOffsetRequired(); method public boolean isPaddingRelative(); method public final boolean isPartialLayoutRequested(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); Loading Loading @@ -39420,6 +39422,7 @@ package android.view { method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>); method protected boolean drawChild(android.graphics.Canvas, android.view.View, long); method public void endViewTransition(android.view.View); method public int findDependentLayoutAxes(android.view.View, int); method public android.view.View focusSearch(android.view.View, int); method public void focusableViewAvailable(android.view.View); method public boolean gatherTransparentRegion(android.graphics.Region); Loading Loading @@ -39486,6 +39489,8 @@ package android.view { method public void requestChildFocus(android.view.View, android.view.View); method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); method public void requestDisallowInterceptTouchEvent(boolean); method public void requestLayoutForChild(android.view.View); method public void requestPartialLayoutForChild(android.view.View); method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public void requestTransparentRegion(android.view.View); method public void scheduleLayoutAnimation(); Loading Loading @@ -39600,6 +39605,7 @@ package android.view { method public abstract void childHasTransientStateChanged(android.view.View, boolean); method public abstract void clearChildFocus(android.view.View); method public abstract void createContextMenu(android.view.ContextMenu); method public abstract int findDependentLayoutAxes(android.view.View, int); method public abstract android.view.View focusSearch(android.view.View, int); method public abstract void focusableViewAvailable(android.view.View); method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); Loading Loading @@ -39629,12 +39635,16 @@ package android.view { method public abstract void requestDisallowInterceptTouchEvent(boolean); method public abstract void requestFitSystemWindows(); method public abstract void requestLayout(); method public abstract void requestLayoutForChild(android.view.View); method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public abstract void requestTransparentRegion(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View); method public abstract boolean showContextMenuForChild(android.view.View, float, float); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int); field public static final int FLAG_LAYOUT_AXIS_ANY = 3; // 0x3 field public static final int FLAG_LAYOUT_AXIS_HORIZONTAL = 1; // 0x1 field public static final int FLAG_LAYOUT_AXIS_VERTICAL = 2; // 0x2 } public class ViewPropertyAnimator {
core/java/android/view/View.java +77 −5 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import android.view.AccessibilityIterators.TextSegmentIterator; import android.view.AccessibilityIterators.CharacterTextSegmentIterator; import android.view.AccessibilityIterators.WordTextSegmentIterator; import android.view.AccessibilityIterators.ParagraphTextSegmentIterator; import android.view.ViewGroup.LayoutParams; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEventSource; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -2416,6 +2417,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG3_SCROLL_INDICATOR_END * 1 PFLAG3_ASSIST_BLOCKED * 1111111 PFLAG3_POINTER_ICON_MASK * 1 PFLAG3_PARTIAL_LAYOUT_REQUESTED * 1 PFLAG3_LAYOUT_PARAMS_CHANGED * |-------|-------|-------|-------| */ Loading Loading @@ -2504,6 +2507,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static final int PFLAG3_SCROLL_INDICATOR_END = 0x2000; /* End of masks for mPrivateFlags3 */ static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED; Loading Loading @@ -2641,6 +2645,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static final int PFLAG3_POINTER_ICON_VALUE_START = 3 << PFLAG3_POINTER_ICON_LSHIFT; /** * Flag indicating that this view has requested a partial layout and * is added to the AttachInfo's list of views that need a partial layout * request handled on the next traversal. */ static final int PFLAG3_PARTIAL_LAYOUT_REQUESTED = 0x800000; /** * Flag indicating that this view's LayoutParams have been explicitly changed * since the last layout pass. */ static final int PFLAG3_LAYOUT_PARAMS_CHANGED = 0x1000000; /** * Always allow a user to over-scroll this view, provided it is a * view that can scroll. Loading Loading @@ -12622,10 +12639,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * ViewGroup.LayoutParams, and these correspond to the different subclasses * of ViewGroup that are responsible for arranging their children. * * This method may return null if this View is not attached to a parent * <p>This method may return null if this View is not attached to a parent * ViewGroup or {@link #setLayoutParams(android.view.ViewGroup.LayoutParams)} * was not invoked successfully. When a View is attached to a parent * ViewGroup, this method must not return null. * ViewGroup, this method must not return null.</p> * * <p>Callers that modify the returned LayoutParams object should call * {@link #setLayoutParams(LayoutParams)} to explicitly inform the view that * LayoutParams have changed.</p> * * @return The LayoutParams associated with this view, or null if no * parameters have been set yet Loading @@ -12642,6 +12663,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * correspond to the different subclasses of ViewGroup that are responsible * for arranging their children. * * <p>If the View's existing LayoutParams object as obtained by {@link #getLayoutParams()} is * modified, you should call this method to inform the view that it has changed.</p> * * @param params The layout parameters for this view, cannot be null */ public void setLayoutParams(ViewGroup.LayoutParams params) { Loading @@ -12649,6 +12673,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, throw new NullPointerException("Layout parameters cannot be null"); } mLayoutParams = params; mPrivateFlags3 |= PFLAG3_LAYOUT_PARAMS_CHANGED; resolveLayoutParams(); if (mParent instanceof ViewGroup) { ((ViewGroup) mParent).onSetLayoutParams(this, params); Loading Loading @@ -14324,7 +14349,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mParent.requestTransparentRegion(this); } mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; if ((mPrivateFlags & PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { initialAwakenScrollBars(); mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } mPrivateFlags3 &= ~(PFLAG3_IS_LAID_OUT | PFLAG3_PARTIAL_LAYOUT_REQUESTED); jumpDrawablesToCurrentState(); Loading Loading @@ -14662,8 +14692,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ @CallSuper protected void onDetachedFromWindowInternal() { if (mAttachInfo != null && isPartialLayoutRequested()) { mAttachInfo.mPartialLayoutViews.remove(this); } mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; mPrivateFlags3 &= ~(PFLAG3_IS_LAID_OUT | PFLAG3_PARTIAL_LAYOUT_REQUESTED | PFLAG3_LAYOUT_PARAMS_CHANGED); removeUnsetPressCallback(); removeLongPressCallback(); Loading Loading @@ -16849,6 +16884,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return (mPrivateFlags & PFLAG_FORCE_LAYOUT) == PFLAG_FORCE_LAYOUT; } /** * Indicates whether or not this view has requested a partial layout that * may not affect its size or position within its parent. This state will be reset * the next time this view is laid out. * * @return true if partial layout has been requested */ public final boolean isPartialLayoutRequested() { return (mPrivateFlags3 & PFLAG3_PARTIAL_LAYOUT_REQUESTED) == PFLAG3_PARTIAL_LAYOUT_REQUESTED; } /** * Returns true if this view's {@link ViewGroup.LayoutParams LayoutParams} changed * since the last time this view was successfully laid out. Typically this happens as a * result of a call to {@link #setLayoutParams(LayoutParams)}. * * @return true if this view's LayoutParams changed since last layout. */ public final boolean didLayoutParamsChange() { return (mPrivateFlags3 & PFLAG3_LAYOUT_PARAMS_CHANGED) == PFLAG3_LAYOUT_PARAMS_CHANGED; } /** * Return true if o is a ViewGroup that is laying out using optical bounds. * @hide Loading Loading @@ -16906,6 +16964,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (changed || (mPrivateFlags & PFLAG_LAYOUT_REQUIRED) == PFLAG_LAYOUT_REQUIRED) { onLayout(changed, l, t, r, b); mPrivateFlags &= ~PFLAG_LAYOUT_REQUIRED; mPrivateFlags3 &= ~PFLAG3_LAYOUT_PARAMS_CHANGED; ListenerInfo li = mListenerInfo; if (li != null && li.mOnLayoutChangeListeners != null) { Loading @@ -16919,6 +16978,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } mPrivateFlags &= ~PFLAG_FORCE_LAYOUT; mPrivateFlags3 &= ~PFLAG3_PARTIAL_LAYOUT_REQUESTED; mPrivateFlags3 |= PFLAG3_IS_LAID_OUT; } Loading Loading @@ -19012,7 +19072,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags |= PFLAG_INVALIDATED; if (mParent != null && !mParent.isLayoutRequested()) { mParent.requestLayout(); mParent.requestLayoutForChild(this); } if (mAttachInfo != null && mAttachInfo.mViewRequestingLayout == this) { mAttachInfo.mViewRequestingLayout = null; Loading @@ -19031,6 +19091,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags |= PFLAG_INVALIDATED; } void forcePartialLayout() { forceLayout(); mPrivateFlags3 |= PFLAG3_PARTIAL_LAYOUT_REQUESTED; } /** * <p> * This is called to find out how big a view should be. The parent Loading Loading @@ -21867,6 +21932,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, interface Callbacks { void playSoundEffect(int effectId); boolean performHapticFeedback(int effectId, boolean always); void schedulePartialLayout(); } /** Loading Loading @@ -22241,6 +22307,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ IBinder mDragToken; /** * Used to track views that need (at least) a partial relayout at their current size * during the next traversal. */ final List<View> mPartialLayoutViews = new ArrayList<View>(); /** * Creates a new set of attachment information with the specified * events handler and thread.
core/java/android/view/ViewGroup.java +169 −1 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; /** * <p> Loading Loading @@ -5516,6 +5518,172 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager protected abstract void onLayout(boolean changed, int l, int t, int r, int b); /** * {@inheritDoc} * * <p>Most subclasses should not need to override this method. The default implementation * will call {@link #findDependentLayoutAxes(View, int)} to determine how * to optimally proceed. If neither horizontal nor vertical layout depends on the given * child, this method will call {@link #requestPartialLayoutForChild(View)}. If one or both * do, it will call {@link #requestLayout()}.</p> * * @param child Child requesting a layout */ @Override public void requestLayoutForChild(View child) { if (child == null || child.getParent() != this) { throw new IllegalArgumentException( "child parameter must be a direct child view of this ViewGroup"); } // If we don't have a parent ourselves, record that we need a full layout. // Our whole subtree is detached. final ViewParent parent = getParent(); if (parent == null) { requestLayout(); return; } // We can optimize the layout request for this child into a partial layout // if the child has already been laid out at least once and neither horizontal nor // vertical layout within ourselves is dependent on pending layout changes within // this child. Otherwise we need to request a full layout for ourselves and continue // to recurse up the view hierarchy. if (child.isLaidOut() && findDependentLayoutAxes(child, FLAG_LAYOUT_AXIS_ANY) == 0) { requestPartialLayoutForChild(child); } else { requestLayout(); } } /** * {@inheritDoc} * * <p>The default implementation returns {@link #FLAG_LAYOUT_AXIS_ANY}. * Optimized implementations for specific ViewGroup subclasses may check if the child's * {@link View#didLayoutParamsChange() LayoutParams changed} and in what ways.</p> * * @param child Direct child of this ViewParent to check * @param axisFilter Which axes to check for dependencies. Can be * {@link #FLAG_LAYOUT_AXIS_HORIZONTAL}, {@link #FLAG_LAYOUT_AXIS_VERTICAL} * or {@link #FLAG_LAYOUT_AXIS_ANY}. * @return Axes of this ViewParent that depend on the given child's layout changes */ @Override public int findDependentLayoutAxes(View child, int axisFilter) { return FLAG_LAYOUT_AXIS_ANY; } /** * This is a helper implementation for {@link #findDependentLayoutAxes(View, int)} that * is not the default implementation in ViewGroup. This is to preserve compatibility with * existing app-side ViewGroup subclasses that existed before the partial layout system was * added to Android. It explicitly checks that the LayoutParams of the child are of the * expected type so that subclasses of standard framework layouts do not erroneously * start believing that it's safe to do a partial layout when that assertion can't * reasonably be confirmed. * * <p>If you're reading this as an author of a custom ViewGroup's findDependentLayoutAxes * method you might be frustrated to discover that it is not a part of the Android public API. * Many ViewGroup implementations will need to make small but important modifications * to an implementation like this one in order to be correct. Instead of encouraging * view authors to call this method, then make their own redundant recursive calls to * <code>getParent().findDependentLayoutAxes(...)</code> in addition to the one * that can happen here, this method is hidden and only used internally.</p> * * <p>Do feel free to copy this implementation and adapt it to suit your own purposes.</p> * * @hide */ protected final int findDependentLayoutAxesHelper(View child, int axisFilter, Class<?> layoutParamsClass) { if (!checkPartialLayoutParams(child, layoutParamsClass)) return axisFilter; if (child.didLayoutParamsChange()) { // Anything could have changed about our previous assumptions. return axisFilter; } final LayoutParams lp = child.getLayoutParams(); // Our layout can always end up depending on a WRAP_CONTENT child. final int wrapAxisFilter = ((lp.width == WRAP_CONTENT ? FLAG_LAYOUT_AXIS_HORIZONTAL : 0) | (lp.height == WRAP_CONTENT ? FLAG_LAYOUT_AXIS_VERTICAL : 0)) & axisFilter; if (wrapAxisFilter == axisFilter) { // We know all queried axes are affected, just return early. return wrapAxisFilter; } // Our layout *may* depend on a MATCH_PARENT child, depending on whether we can determine // that our layout will remain stable within our parent. We need to ask. final int matchAxisFilter = ((lp.width == MATCH_PARENT ? FLAG_LAYOUT_AXIS_HORIZONTAL : 0) | (lp.height == MATCH_PARENT ? FLAG_LAYOUT_AXIS_VERTICAL : 0)) & axisFilter; if (matchAxisFilter != 0) { final ViewParent parent = getParent(); if (parent != null) { // If our parent depends on us for an axis, then our layout can also be affected // by a MATCH_PARENT child along that axis. return getParent().findDependentLayoutAxes(this, matchAxisFilter) | wrapAxisFilter; } // If we don't have a parent, assume we're affected // in any determined affected direction. return matchAxisFilter | wrapAxisFilter; } // Two exact sizes and LayoutParams didn't change. We're safe. return 0; } /** * Throw an IllegalArgumentException if the supplied view is not a direct child of * this ViewGroup and return false if this view's LayoutParams is not of class lpClass. * Implementations of {@link ViewGroup#findDependentLayoutAxes(View, int)} use this * to check input parameters and defensively return the full axis filter mask themselves * if the LayoutParams class is not of the exact expected type; e.g. it is a subclass * of one of the standard framework layouts and we can't make assumptions. * @hide */ protected final boolean checkPartialLayoutParams(View child, Class<?> lpClass) { if (child.getParent() != this) { throw new IllegalArgumentException("View " + child + " is not a direct child of " + this); } final ViewGroup.LayoutParams lp = child.getLayoutParams(); return lp != null || lp.getClass() == lpClass; } /** * Called when a child of this ViewParent requires a relayout before the next frame * is drawn, but the caller can guarantee that the size of the child will not change * during a measure and layout pass. * * <p>A call to this method will schedule a partial layout for the supplied view as long as * it is a direct child of this ViewGroup and this ViewGroup is attached to a window. * On the next scheduled view hierarchy traversal the given child view will be re-measured * at its current measured size and re-laid out at its current position within its parent.</p> * * @param child Child that requires a partial layout */ public void requestPartialLayoutForChild(View child) { if (!child.isPartialLayoutRequested()) { child.forcePartialLayout(); if (mAttachInfo != null) { final List<View> partialLayoutViews = mAttachInfo.mPartialLayoutViews; final boolean schedule = partialLayoutViews.isEmpty(); partialLayoutViews.add(child); if (schedule) { mAttachInfo.mRootCallbacks.schedulePartialLayout(); } child.invalidate(); } else { requestLayout(); } } } /** * Indicates whether the view group has the ability to animate its children * after the first layout. Loading Loading @@ -5862,7 +6030,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * of its descendants */ protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return p; return new LayoutParams(p); } /** Loading
core/java/android/view/ViewParent.java +49 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes