From 293451e4f005a26386db873f5192f86585cc79bc Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 4 Nov 2009 13:59:48 -0800 Subject: [PATCH] Remove unused field and add new API to control the children drawing order. Approved by: xav, hackbod, mcleron. Change-Id: I3bbfb4f96e3c9adedbb68d78703059a2df1e2013 --- api/current.xml | 35 ++++++++++++++++-------- core/java/android/view/ViewGroup.java | 38 +++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/api/current.xml b/api/current.xml index 3abd38b6a16ed..e72a88c5aeb17 100644 --- a/api/current.xml +++ b/api/current.xml @@ -161987,6 +161987,17 @@ visibility="public" > + + + + + + - - - * NOTE: In order for this method to be called, the - * {@link #FLAG_USE_CHILD_DRAWING_ORDER} must be set. + * NOTE: In order for this method to be called, you must enable child ordering + * first by calling {@link #setChildrenDrawingOrderEnabled(boolean)}. * * @param i The current iteration. * @return The index of the child to draw this iteration. + * + * @see #setChildrenDrawingOrderEnabled(boolean) + * @see #isChildrenDrawingOrderEnabled() */ protected int getChildDrawingOrder(int childCount, int i) { return i; @@ -2706,6 +2711,35 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager setBooleanFlag(FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled); } + /** + * Indicates whether the ViewGroup is drawing its children in the order defined by + * {@link #getChildDrawingOrder(int, int)}. + * + * @return true if children drawing order is defined by {@link #getChildDrawingOrder(int, int)}, + * false otherwise + * + * @see #setChildrenDrawingOrderEnabled(boolean) + * @see #getChildDrawingOrder(int, int) + */ + @ViewDebug.ExportedProperty + protected boolean isChildrenDrawingOrderEnabled() { + return (mGroupFlags & FLAG_USE_CHILD_DRAWING_ORDER) == FLAG_USE_CHILD_DRAWING_ORDER; + } + + /** + * Tells the ViewGroup whether to draw its children in the order defined by the method + * {@link #getChildDrawingOrder(int, int)}. + * + * @param enabled true if the order of the children when drawing is determined by + * {@link #getChildDrawingOrder(int, int)}, false otherwise + * + * @see #isChildrenDrawingOrderEnabled() + * @see #getChildDrawingOrder(int, int) + */ + protected void setChildrenDrawingOrderEnabled(boolean enabled) { + setBooleanFlag(FLAG_USE_CHILD_DRAWING_ORDER, enabled); + } + private void setBooleanFlag(int flag, boolean value) { if (value) { mGroupFlags |= flag;