diff options
| author | Romain Guy <romainguy@android.com> | 2009-11-04 13:59:48 -0800 |
|---|---|---|
| committer | Romain Guy <romainguy@android.com> | 2009-11-04 16:57:07 -0800 |
| commit | 293451e4f005a26386db873f5192f86585cc79bc (patch) | |
| tree | 395c76029609717648064670ad66ce13ccce828c /core/java/android/view | |
| parent | b5e380a799b1c22d51364a2b9b3abe02e2eb83cf (diff) | |
| download | frameworks_base-293451e4f005a26386db873f5192f86585cc79bc.zip frameworks_base-293451e4f005a26386db873f5192f86585cc79bc.tar.gz frameworks_base-293451e4f005a26386db873f5192f86585cc79bc.tar.bz2 | |
Remove unused field and add new API to control the children drawing order.
Approved by: xav, hackbod, mcleron.
Change-Id: I3bbfb4f96e3c9adedbb68d78703059a2df1e2013
Diffstat (limited to 'core/java/android/view')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index f7b7f02..e2f15c7 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -150,6 +150,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager /** * When set, the drawing method will call {@link #getChildDrawingOrder(int, int)} * to get the index of the child to draw for that iteration. + * + * @hide */ protected static final int FLAG_USE_CHILD_DRAWING_ORDER = 0x400; @@ -1307,11 +1309,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * if you want to change the drawing order of children. By default, it * returns i. * <p> - * 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; |
