summaryrefslogtreecommitdiff
path: root/core/java/android/widget/GridLayout.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-05-30 15:59:53 -0700
committerTor Norbye <tnorbye@google.com>2013-09-11 14:55:38 -0700
commitd9273d6f289d9b55da3fd0db2f659fdfb48106a8 (patch)
treedd8bf34b123a4327a7fc55c944adf62e25aaa50d /core/java/android/widget/GridLayout.java
parent78d00050272d796cc77557b9b715604d1c566c01 (diff)
Add typedefs and nullness annotations.
This changeset adds in typedef annotations (custom annotations marked with @IntDef) for various int parameters and return values in the API. It also adds nullness annotations for cases where the documentation explicitly mentioned null policy, or where it was blindingly obvious from the context. Also fixed some typos in the documentation. Change-Id: Ica27c01368895818e26237544edd8483007155bb
Diffstat (limited to 'core/java/android/widget/GridLayout.java')
-rw-r--r--core/java/android/widget/GridLayout.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 932dac3287ef..430536121951 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.IntDef;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -35,6 +36,8 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.RemoteViews.RemoteView;
import com.android.internal.R;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
@@ -165,6 +168,11 @@ public class GridLayout extends ViewGroup {
// Public constants
+ /** @hide */
+ @IntDef({HORIZONTAL, VERTICAL})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface Orientation {}
+
/**
* The horizontal orientation.
*/
@@ -186,6 +194,11 @@ public class GridLayout extends ViewGroup {
*/
public static final int UNDEFINED = Integer.MIN_VALUE;
+ /** @hide */
+ @IntDef({ALIGN_BOUNDS, ALIGN_MARGINS})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface AlignmentMode {}
+
/**
* This constant is an {@link #setAlignmentMode(int) alignmentMode}.
* When the {@code alignmentMode} is set to {@link #ALIGN_BOUNDS}, alignment
@@ -313,6 +326,7 @@ public class GridLayout extends ViewGroup {
*
* @attr ref android.R.styleable#GridLayout_orientation
*/
+ @Orientation
public int getOrientation() {
return mOrientation;
}
@@ -353,7 +367,7 @@ public class GridLayout extends ViewGroup {
*
* @attr ref android.R.styleable#GridLayout_orientation
*/
- public void setOrientation(int orientation) {
+ public void setOrientation(@Orientation int orientation) {
if (this.mOrientation != orientation) {
this.mOrientation = orientation;
invalidateStructure();
@@ -484,6 +498,7 @@ public class GridLayout extends ViewGroup {
*
* @attr ref android.R.styleable#GridLayout_alignmentMode
*/
+ @AlignmentMode
public int getAlignmentMode() {
return mAlignmentMode;
}
@@ -503,7 +518,7 @@ public class GridLayout extends ViewGroup {
*
* @attr ref android.R.styleable#GridLayout_alignmentMode
*/
- public void setAlignmentMode(int alignmentMode) {
+ public void setAlignmentMode(@AlignmentMode int alignmentMode) {
this.mAlignmentMode = alignmentMode;
requestLayout();
}