diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridBottomOffsetItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridBottomOffsetItemDecoration.java index c75ef6e..5ee1fb0 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridBottomOffsetItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridBottomOffsetItemDecoration.java @@ -4,16 +4,38 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds an offset to the bottom of a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager} or its subclass. + */ public class GridBottomOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; private int mNumColumns; + /** + * Sole constructor. Takes in the size of the offset to be added to the + * bottom of the {@link RecyclerView}. + * + * @param offsetPx The size of the offset to be added to the bottom of the + * {@code RecyclerView} in pixels + * @param numColumns The number of columns in the grid of the {@code RecyclerView} + */ public GridBottomOffsetItemDecoration(int offsetPx, int numColumns) { mOffsetPx = offsetPx; mNumColumns = numColumns; } + /** + * Determines the size and the location of the offset to be added to the + * bottom of the {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridDividerItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridDividerItemDecoration.java index 1313944..759cc74 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridDividerItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridDividerItemDecoration.java @@ -6,6 +6,10 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds interior dividers to a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager}. + */ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { private Drawable mHorizontalDivider; @@ -13,13 +17,14 @@ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { private int mNumColumns; /** - * Adds dividers to a RecyclerView with a GridLayoutManager. + * Sole constructor. Takes in {@link Drawable} objects to be used as + * horizontal and vertical dividers. * - * @param horizontalDivider A divider Drawable to be drawn on the rows of - * the grid of the RecyclerView - * @param verticalDivider A divider Drawable to be drawn on the columns of - * the grid of the RecyclerView - * @param numColumns The number of columns in the grid of the RecyclerView + * @param horizontalDivider A divider {@code Drawable} to be drawn on the + * rows of the grid of the {@link RecyclerView} + * @param verticalDivider A divider {@code Drawable} to be drawn on the + * columns of the grid of the {@code RecyclerView} + * @param numColumns The number of columns in the grid of the {@code RecyclerView} */ public GridDividerItemDecoration(Drawable horizontalDivider, Drawable verticalDivider, int numColumns) { mHorizontalDivider = horizontalDivider; @@ -27,12 +32,30 @@ public GridDividerItemDecoration(Drawable horizontalDivider, Drawable verticalDi mNumColumns = numColumns; } + /** + * Draws horizontal and/or vertical dividers onto the parent {@link RecyclerView}. + * + * @param canvas The {@link Canvas} onto which dividers will be drawn + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { drawHorizontalDividers(canvas, parent); drawVerticalDividers(canvas, parent); } + /** + * Determines the size and location of offsets between items in the parent + * {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); @@ -49,8 +72,11 @@ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, Recycle } /** - * Adds horizontal dividers to a RecyclerView with a GridLayoutManager (or - * its subclass). + * Adds horizontal dividers to a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager} or its subclass. + * + * @param canvas The {@link Canvas} onto which dividers will be drawn + * @param parent The {@code RecyclerView} onto which dividers are being added */ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { int parentTop = parent.getPaddingTop(); @@ -69,8 +95,11 @@ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { } /** - * Adds vertical dividers to a RecyclerView with a GridLayoutManager (or - * its subclass). + * Adds vertical dividers to a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager} or its subclass. + * + * @param canvas The {@link Canvas} onto which dividers will be drawn + * @param parent The {@code RecyclerView} onto which dividers are being added */ private void drawVerticalDividers(Canvas canvas, RecyclerView parent) { int parentLeft = parent.getPaddingLeft(); diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridTopOffsetItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridTopOffsetItemDecoration.java index 403b16c..7e5e5d3 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridTopOffsetItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridTopOffsetItemDecoration.java @@ -4,16 +4,38 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds an offset to the top of a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager} or its subclass. + */ public class GridTopOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; private int mNumColumns; + /** + * Sole constructor. Takes in the size of the offset to be added to the top + * of the {@link RecyclerView}. + * + * @param offsetPx The size of the offset to be added to the top of the + * {@code RecyclerView} in pixels + * @param numColumns The number of columns in the grid of the {@code RecyclerView} + */ public GridTopOffsetItemDecoration(int offsetPx, int numColumns) { mOffsetPx = offsetPx; mNumColumns = numColumns; } + /** + * Determines the size and the location of the offset to be added to the + * top of the {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/DividerItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/DividerItemDecoration.java index 4ed00ed..7fb2cd7 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/DividerItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/DividerItemDecoration.java @@ -7,20 +7,33 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds interior dividers to a {@link RecyclerView} with a + * {@link LinearLayoutManager} or its subclass. + */ public class DividerItemDecoration extends RecyclerView.ItemDecoration { private Drawable mDivider; private int mOrientation; /** - * Adds dividers to a RecyclerView with a LinearLayoutManager. + * Sole constructor. Takes in a {@link Drawable} to be used as the interior + * divider. * - * @param divider A divider Drawable to be drawn on the RecyclerView + * @param divider A divider {@code Drawable} to be drawn on the {@link RecyclerView} */ public DividerItemDecoration(Drawable divider) { mDivider = divider; } + /** + * Draws horizontal or vertical dividers onto the parent {@link RecyclerView}. + * + * @param canvas The {@link Canvas} onto which dividers will be drawn + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { if (mOrientation == LinearLayoutManager.HORIZONTAL) { @@ -30,6 +43,18 @@ public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) } } + /** + * Determines the size and location of offsets between items in the parent + * {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child + * view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being + * added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); @@ -47,8 +72,13 @@ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, Recycle } /** - * Adds dividers to a RecyclerView with a LinearLayoutManager (or its - * subclass) oriented horizontally. + * Adds dividers to a {@link RecyclerView} with a + * {@link LinearLayoutManager} or its subclass oriented horizontally. + * + * @param canvas The {@link Canvas} onto which horizontal dividers will be + * drawn + * @param parent The {@code RecyclerView} onto which horizontal dividers + * are being added */ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { int parentTop = parent.getPaddingTop(); @@ -69,8 +99,13 @@ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { } /** - * Adds dividers to a RecyclerView with a LinearLayoutManager (or its - * subclass) oriented vertically. + * Adds dividers to a {@link RecyclerView} with a + * {@link LinearLayoutManager} or its subclass oriented vertically. + * + * @param canvas The {@link Canvas} onto which vertical dividers will be + * drawn + * @param parent The {@code RecyclerView} onto which vertical dividers are + * being added */ private void drawVerticalDividers(Canvas canvas, RecyclerView parent) { int parentLeft = parent.getPaddingLeft(); diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/EndOffsetItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/EndOffsetItemDecoration.java index 5162c3a..37a24f6 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/EndOffsetItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/EndOffsetItemDecoration.java @@ -5,14 +5,40 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds an offset to the end of a {@link RecyclerView} using a + * {@link LinearLayoutManager} or its subclass. + *

+ * If the {@link android.support.v7.widget.RecyclerView.LayoutManager} is + * oriented vertically, the offset will be added to the bottom of the + * {@code RecyclerView}. If the {@code LayoutManager} is oriented horizontally, + * the offset will be added to the right of the {@code RecyclerView}. + */ public class EndOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; + /** + * Sole constructor. Takes in the size of the offset to be added to the end + * of the {@link RecyclerView}. + * + * @param offsetPx The size of the offset to be added to the end of the + * {@code RecyclerView} in pixels + */ public EndOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } + /** + * Determines the size and location of the offset to be added to the end + * of the {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); diff --git a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/StartOffsetItemDecoration.java b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/StartOffsetItemDecoration.java index 3235c04..18015a0 100644 --- a/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/StartOffsetItemDecoration.java +++ b/simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/StartOffsetItemDecoration.java @@ -5,14 +5,40 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * Adds an offset to the start of a {@link RecyclerView} using a + * {@link LinearLayoutManager} or its subclass. + *

+ * If the {@link android.support.v7.widget.RecyclerView.LayoutManager} is + * oriented vertically, the offset will be added to the top of the + * {@code RecyclerView}. If the {@code LayoutManager} is oriented horizontally, + * the offset will be added to the left of the {@code RecyclerView}. + */ public class StartOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; + /** + * Sole constructor. Takes in the size of the offset to be added to the + * start of the {@link RecyclerView}. + * + * @param offsetPx The size of the offset to be added to the start of the + * {@code RecyclerView} in pixels + */ public StartOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } + /** + * Determines the size and location of the offset to be added to the start + * of the {@link RecyclerView}. + * + * @param outRect The {@link Rect} of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The {@code RecyclerView} onto which dividers are being added + * @param state The current {@link android.support.v7.widget.RecyclerView.State} + * of the {@code RecyclerView} + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state);