diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2011-06-06 16:30:29 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2011-06-06 16:41:16 -0700 |
commit | 9e3b002d3f9141d54948a65e0330fdcd09e75a30 (patch) | |
tree | 1389bd410e9cc7ba8429fc6c88bfd5801cd7ae12 | |
parent | 04a5a95450fab72fb8fef43d878de05764792f1a (diff) | |
download | frameworks_base-9e3b002d3f9141d54948a65e0330fdcd09e75a30.zip frameworks_base-9e3b002d3f9141d54948a65e0330fdcd09e75a30.tar.gz frameworks_base-9e3b002d3f9141d54948a65e0330fdcd09e75a30.tar.bz2 |
Rename Gravity BEFORE/AFTER to START/END
- following spec proposal for having CSS3 like naming
Change-Id: Id5e316a2d9b54b9f20bbcb168fea6a3a83882e1b
-rw-r--r-- | api/current.txt | 4 | ||||
-rw-r--r-- | core/java/android/view/Gravity.java | 28 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/FrameLayout.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/LinearLayout.java | 16 | ||||
-rw-r--r-- | core/java/android/widget/RelativeLayout.java | 19 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 4 | ||||
-rw-r--r-- | core/tests/coretests/src/android/view/GravityTest.java | 8 |
8 files changed, 44 insertions, 43 deletions
diff --git a/api/current.txt b/api/current.txt index 8ef07de..d67aa53 100644 --- a/api/current.txt +++ b/api/current.txt @@ -20435,14 +20435,12 @@ package android.view { method public static int getAbsoluteGravity(int, boolean); method public static boolean isHorizontal(int); method public static boolean isVertical(int); - field public static final int AFTER = 8388613; // 0x800005 field public static final int AXIS_CLIP = 8; // 0x8 field public static final int AXIS_PULL_AFTER = 4; // 0x4 field public static final int AXIS_PULL_BEFORE = 2; // 0x2 field public static final int AXIS_SPECIFIED = 1; // 0x1 field public static final int AXIS_X_SHIFT = 0; // 0x0 field public static final int AXIS_Y_SHIFT = 4; // 0x4 - field public static final int BEFORE = 8388611; // 0x800003 field public static final int BOTTOM = 80; // 0x50 field public static final int CENTER = 17; // 0x11 field public static final int CENTER_HORIZONTAL = 1; // 0x1 @@ -20451,6 +20449,7 @@ package android.view { field public static final int CLIP_VERTICAL = 128; // 0x80 field public static final int DISPLAY_CLIP_HORIZONTAL = 16777216; // 0x1000000 field public static final int DISPLAY_CLIP_VERTICAL = 268435456; // 0x10000000 + field public static final int END = 8388613; // 0x800005 field public static final int FILL = 119; // 0x77 field public static final int FILL_HORIZONTAL = 7; // 0x7 field public static final int FILL_VERTICAL = 112; // 0x70 @@ -20460,6 +20459,7 @@ package android.view { field public static final int RELATIVE_HORIZONTAL_DIRECTION = 8388608; // 0x800000 field public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = 8388615; // 0x800007 field public static final int RIGHT = 5; // 0x5 + field public static final int START = 8388611; // 0x800003 field public static final int TOP = 48; // 0x30 field public static final int VERTICAL_GRAVITY_MASK = 112; // 0x70 } diff --git a/core/java/android/view/Gravity.java b/core/java/android/view/Gravity.java index b2a35d3..ba06795 100644 --- a/core/java/android/view/Gravity.java +++ b/core/java/android/view/Gravity.java @@ -109,16 +109,16 @@ public class Gravity */ public static final int DISPLAY_CLIP_HORIZONTAL = 0x01000000; - /** Push object to x-axis position before its container, not changing its size. */ - public static final int BEFORE = RELATIVE_HORIZONTAL_DIRECTION | LEFT; + /** Push object to x-axis position at the start of its container, not changing its size. */ + public static final int START = RELATIVE_HORIZONTAL_DIRECTION | LEFT; - /** Push object to x-axis position after its container, not changing its size. */ - public static final int AFTER = RELATIVE_HORIZONTAL_DIRECTION | RIGHT; + /** Push object to x-axis position at the end of its container, not changing its size. */ + public static final int END = RELATIVE_HORIZONTAL_DIRECTION | RIGHT; /** * Binary mask for the horizontal gravity and script specific direction bit. */ - public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = BEFORE | AFTER; + public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = START | END; /** * Apply a gravity constant to an object. This suppose that the layout direction is LTR. @@ -342,8 +342,8 @@ public class Gravity /** * <p>Convert script specific gravity to absolute horizontal value.</p> * - * if horizontal direction is LTR, then BEFORE will set LEFT and AFTER will set RIGHT. - * if horizontal direction is RTL, then BEFORE will set RIGHT and AFTER will set LEFT. + * if horizontal direction is LTR, then START will set LEFT and END will set RIGHT. + * if horizontal direction is RTL, then START will set RIGHT and END will set LEFT. * * @param gravity The gravity to convert to absolute (horizontal) values. * @param isRtl Whether the layout is right-to-left. @@ -351,11 +351,11 @@ public class Gravity */ public static int getAbsoluteGravity(int gravity, boolean isRtl) { int result = gravity; - // If layout is script specific and gravity is horizontal relative (BEFORE or AFTER) + // If layout is script specific and gravity is horizontal relative (START or END) if ((result & RELATIVE_HORIZONTAL_DIRECTION) > 0) { - if ((result & Gravity.BEFORE) == Gravity.BEFORE) { - // Remove the BEFORE bit - result &= ~BEFORE; + if ((result & Gravity.START) == Gravity.START) { + // Remove the START bit + result &= ~START; if (isRtl) { // Set the RIGHT bit result |= RIGHT; @@ -363,9 +363,9 @@ public class Gravity // Set the LEFT bit result |= LEFT; } - } else if ((result & Gravity.AFTER) == Gravity.AFTER) { - // Remove the AFTER bit - result &= ~AFTER; + } else if ((result & Gravity.END) == Gravity.END) { + // Remove the END bit + result &= ~END; if (isRtl) { // Set the LEFT bit result |= LEFT; diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index a1ddd08..b0181bb 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -77,8 +77,8 @@ public interface WindowManager extends ViewManager { implements Parcelable { /** * X position for this window. With the default gravity it is ignored. - * When using {@link Gravity#LEFT} or {@link Gravity#BEFORE} or {@link Gravity#RIGHT} or - * {@link Gravity#AFTER} it provides an offset from the given edge. + * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or + * {@link Gravity#END} it provides an offset from the given edge. */ @ViewDebug.ExportedProperty public int x; diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 4ee16e7..6b498fe 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -115,7 +115,7 @@ public class FrameLayout extends ViewGroup { } /** - * Describes how the foreground is positioned. Defaults to BEFORE and TOP. + * Describes how the foreground is positioned. Defaults to START and TOP. * * @param foregroundGravity See {@link android.view.Gravity} * @@ -125,7 +125,7 @@ public class FrameLayout extends ViewGroup { public void setForegroundGravity(int foregroundGravity) { if (mForegroundGravity != foregroundGravity) { if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { - foregroundGravity |= Gravity.BEFORE; + foregroundGravity |= Gravity.START; } if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index f843574..3876735 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -116,10 +116,10 @@ public class LinearLayout extends ViewGroup { equals = Gravity.LEFT, name = "LEFT"), @ViewDebug.FlagToString(mask = Gravity.RIGHT, equals = Gravity.RIGHT, name = "RIGHT"), - @ViewDebug.FlagToString(mask = Gravity.BEFORE, - equals = Gravity.BEFORE, name = "BEFORE"), - @ViewDebug.FlagToString(mask = Gravity.AFTER, - equals = Gravity.AFTER, name = "AFTER"), + @ViewDebug.FlagToString(mask = Gravity.START, + equals = Gravity.START, name = "START"), + @ViewDebug.FlagToString(mask = Gravity.END, + equals = Gravity.END, name = "END"), @ViewDebug.FlagToString(mask = Gravity.CENTER_VERTICAL, equals = Gravity.CENTER_VERTICAL, name = "CENTER_VERTICAL"), @ViewDebug.FlagToString(mask = Gravity.FILL_VERTICAL, @@ -135,7 +135,7 @@ public class LinearLayout extends ViewGroup { @ViewDebug.FlagToString(mask = Gravity.RELATIVE_HORIZONTAL_DIRECTION, equals = Gravity.RELATIVE_HORIZONTAL_DIRECTION, name = "RELATIVE") }) - private int mGravity = Gravity.BEFORE | Gravity.TOP; + private int mGravity = Gravity.START | Gravity.TOP; @ViewDebug.ExportedProperty(category = "measurement") private int mTotalLength; @@ -1649,7 +1649,7 @@ public class LinearLayout extends ViewGroup { public void setGravity(int gravity) { if (mGravity != gravity) { if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { - gravity |= Gravity.BEFORE; + gravity |= Gravity.START; } if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { @@ -1742,8 +1742,8 @@ public class LinearLayout extends ViewGroup { @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), - @ViewDebug.IntToString(from = Gravity.BEFORE, to = "BEFORE"), - @ViewDebug.IntToString(from = Gravity.AFTER, to = "AFTER"), + @ViewDebug.IntToString(from = Gravity.START, to = "START"), + @ViewDebug.IntToString(from = Gravity.END, to = "END"), @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index acd8539..5562bf7 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -16,6 +16,15 @@ package android.widget; +import com.android.internal.R; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.SortedSet; +import java.util.TreeSet; + import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; @@ -32,14 +41,6 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.widget.RemoteViews.RemoteView; -import com.android.internal.R; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.SortedSet; -import java.util.TreeSet; import static android.util.Log.d; @@ -222,7 +223,7 @@ public class RelativeLayout extends ViewGroup { public void setGravity(int gravity) { if (mGravity != gravity) { if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { - gravity |= Gravity.BEFORE; + gravity |= Gravity.START; } if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 88ab442..f18ddd2 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -2094,7 +2094,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ public void setGravity(int gravity) { if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { - gravity |= Gravity.BEFORE; + gravity |= Gravity.START; } if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { gravity |= Gravity.TOP; @@ -10010,7 +10010,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private boolean mSelectAllOnFocus = false; - private int mGravity = Gravity.TOP | Gravity.BEFORE; + private int mGravity = Gravity.TOP | Gravity.START; private boolean mHorizontallyScrolling; private int mAutoLinkMask; diff --git a/core/tests/coretests/src/android/view/GravityTest.java b/core/tests/coretests/src/android/view/GravityTest.java index 180a390..2a7a64f 100644 --- a/core/tests/coretests/src/android/view/GravityTest.java +++ b/core/tests/coretests/src/android/view/GravityTest.java @@ -59,11 +59,11 @@ public class GravityTest extends AndroidTestCase { assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, false); assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, true); - assertOneGravity(Gravity.LEFT, Gravity.BEFORE, false); - assertOneGravity(Gravity.RIGHT, Gravity.BEFORE, true); + assertOneGravity(Gravity.LEFT, Gravity.START, false); + assertOneGravity(Gravity.RIGHT, Gravity.START, true); - assertOneGravity(Gravity.RIGHT, Gravity.AFTER, false); - assertOneGravity(Gravity.LEFT, Gravity.AFTER, true); + assertOneGravity(Gravity.RIGHT, Gravity.END, false); + assertOneGravity(Gravity.LEFT, Gravity.END, true); } private void assertOneGravity(int expected, int initial, boolean isRtl) { |