From 61afc8b4cd0b6074d2e0d9853d69db2be880fe50 Mon Sep 17 00:00:00 2001 From: David Greenhalgh Date: Mon, 13 Jul 2015 10:50:22 -0400 Subject: [PATCH 1/4] Added DividerItemDecoration docs --- .../linear/DividerItemDecoration.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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..142297f 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,6 +7,10 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * An ItemDecoration used to add interior dividers to a RecyclerView with a + * LinearLayoutManager + */ public class DividerItemDecoration extends RecyclerView.ItemDecoration { private Drawable mDivider; @@ -21,6 +25,16 @@ public DividerItemDecoration(Drawable divider) { mDivider = divider; } + /** + * Override of RecyclerView.ItemDecoration#onDraw + *

+ * This implementation draws horizontal or vertical dividers onto the + * parent RecyclerView. + * + * @param canvas The Canvas onto which dividers will be drawn + * @param parent The RecyclerView onto which dividers are being added + * @param state The current state of the RecyclerView + */ @Override public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { if (mOrientation == LinearLayoutManager.HORIZONTAL) { @@ -30,6 +44,17 @@ public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) } } + /** + * Override of RecyclerView.ItemDecoration#getItemOffsets + *

+ * This implementation determines the size and location of offsets between + * items in the RecyclerView parent. + * + * @param outRect The Rect of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The RecyclerView onto which dividers are being added + * @param state The current state of the RecyclerView + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); @@ -49,6 +74,10 @@ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, Recycle /** * Adds dividers to a RecyclerView with a LinearLayoutManager (or its * subclass) oriented horizontally. + * + * @param canvas The Canvas onto which horizontal dividers will be drawn + * @param parent The RecyclerView onto which horizontal dividers are being + * added */ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { int parentTop = parent.getPaddingTop(); @@ -71,6 +100,10 @@ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { /** * Adds dividers to a RecyclerView with a LinearLayoutManager (or its * subclass) oriented vertically. + * + * @param canvas The Canvas onto which vertical dividers will be drawn + * @param parent The RecyclerView onto which vertical dividers are being + * added */ private void drawVerticalDividers(Canvas canvas, RecyclerView parent) { int parentLeft = parent.getPaddingLeft(); From a16932decbbcf205ed1f47a7f0c23503e9c1d420 Mon Sep 17 00:00:00 2001 From: David Greenhalgh Date: Mon, 13 Jul 2015 11:18:59 -0400 Subject: [PATCH 2/4] Added start and end offset docs --- .../linear/DividerItemDecoration.java | 2 +- .../linear/EndOffsetItemDecoration.java | 26 +++++++++++++++++++ .../linear/StartOffsetItemDecoration.java | 26 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) 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 142297f..388ae54 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 @@ -17,7 +17,7 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration { private int mOrientation; /** - * Adds dividers to a RecyclerView with a LinearLayoutManager. + * Constructor that takes in a Drawable to be used as the interior divider * * @param divider A divider Drawable to be drawn on the RecyclerView */ 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..48bde6b 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; +/** + * An ItemDecoration used to add an offset to the end of a RecyclerView using a + * LinearLayoutManager. + *

+ * If the LinearLayoutManager is oriented vertically, the offset will be added + * to the bottom of the RecyclerView. If the LinearLayoutManager is oriented + * horizontally, the offset will be added to the right of the RecyclerView. + */ public class EndOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; + /** + * Constructor that takes in the size of the offset to be added to the end + * of the RecyclerView + * + * @param offsetPx The size of the offset to be added to the end of the + * RecyclerView in pixels + */ public EndOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } + /** + * Override of RecyclerView.ItemDecoration#getItemOffsets + *

+ * This implementation determines the size and location of the offset to be + * added to the end of the RecyclerView. + * + * @param outRect The Rect of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The RecyclerView onto which an offset is being added + * @param state The current state of the 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..e456661 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; +/** + * An ItemDecoration used to add an offset to the start of a RecyclerView using + * a LinearLayoutManager. + *

+ * If the LinearLayoutManager is oriented vertically, the offset will be added + * to the top of the RecyclerView. If the LinearLayoutManager is oriented + * horizontally, the offset will be added to the left of the RecyclerView. + */ public class StartOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; + /** + * Constructor that takes in the size of the offset to be added to the + * start of the RecyclerView + * + * @param offsetPx The size of the offset to be added to the start of the + * RecyclerView in pixels + */ public StartOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } + /** + * Override of RecyclerView.ItemDecoration#getItemOffsets + *

+ * This implementation determines the size and location of the offset to be + * added to the start of the RecyclerView. + * + * @param outRect The Rect of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The RecyclerView onto which an offset is being added + * @param state The current state of the RecyclerView + */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); From 0dd25b6fef4c823662d58dc836b44e97b7b858e4 Mon Sep 17 00:00:00 2001 From: David Greenhalgh Date: Mon, 13 Jul 2015 12:53:16 -0400 Subject: [PATCH 3/4] Added docs to grid pkg --- .../grid/GridBottomOffsetItemDecoration.java | 23 ++++++++++++++ .../grid/GridDividerItemDecoration.java | 30 +++++++++++++++---- .../grid/GridTopOffsetItemDecoration.java | 23 ++++++++++++++ .../linear/DividerItemDecoration.java | 10 +++---- .../linear/EndOffsetItemDecoration.java | 8 ++--- .../linear/StartOffsetItemDecoration.java | 10 +++---- 6 files changed, 85 insertions(+), 19 deletions(-) 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..c618582 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,39 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * An ItemDecoration used to add an offset to the bottom of a RecyclerView + * using a GridLayoutManager or its subclass + */ public class GridBottomOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; private int mNumColumns; + /** + * Constructor that takes in the size of the offset to be added to the + * bottom of the RecyclerView + * + * @param offsetPx The size of the offset to be added to the bottom of the + * RecyclerView in pixels + * @param numColumns The number of columns in the grid of the RecyclerView + */ public GridBottomOffsetItemDecoration(int offsetPx, int numColumns) { mOffsetPx = offsetPx; mNumColumns = numColumns; } + /** + * Override of RecyclerView.ItemDecoration#getItemOffsets + *

+ * This implementation determines the size and the location of the offset + * to be added to the bottom of the RecyclerView + * + * @param outRect The Rect of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The RecyclerView onto which an offset is being added + * @param state The current state of the 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..f3be340 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; +/** + * An ItemDecoration used to add interior dividers to a RecyclerView with a + * GridLayoutManager + */ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { private Drawable mHorizontalDivider; @@ -13,7 +17,7 @@ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { private int mNumColumns; /** - * Adds dividers to a RecyclerView with a GridLayoutManager. + * Constructor that takes in Drawables to be used as interior dividers * * @param horizontalDivider A divider Drawable to be drawn on the rows of * the grid of the RecyclerView @@ -27,6 +31,16 @@ public GridDividerItemDecoration(Drawable horizontalDivider, Drawable verticalDi mNumColumns = numColumns; } + /** + * Override of RecyclerView.ItemDecoration#onDraw + *

+ * This implementation draws horizontal and/or vertical dividers onto the + * parent RecyclerView. + * + * @param canvas The Canvas onto which dividers will be drawn + * @param parent The RecyclerView onto which dividers are being added + * @param state The current state of the RecyclerView + */ @Override public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { drawHorizontalDividers(canvas, parent); @@ -49,8 +63,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 RecyclerView with a GridLayoutManager or + * its subclass + * + * @param canvas The Canvas onto which dividers will be drawn + * @param parent The RecyclerView onto which dividers are being added */ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { int parentTop = parent.getPaddingTop(); @@ -69,8 +86,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 RecyclerView with a GridLayoutManager or its + * subclass + * + * @param canvas The Canvas onto which dividers will be drawn + * @param parent The 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..b9645d5 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,39 @@ import android.support.v7.widget.RecyclerView; import android.view.View; +/** + * An ItemDecoration used to add an offset to the top of a RecyclerView using a + * GridLayoutManager or its subclass + */ public class GridTopOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mOffsetPx; private int mNumColumns; + /** + * Constructor that takes in the size of the offset to be added to the top + * of the RecyclerView + * + * @param offsetPx The size of the offset to be added to the top of the + * RecyclerView in pixels + * @param numColumns The number of columns in the grid of the RecyclerView + */ public GridTopOffsetItemDecoration(int offsetPx, int numColumns) { mOffsetPx = offsetPx; mNumColumns = numColumns; } + /** + * Override of RecyclerView.ItemDecoration#getItemOffsets + *

+ * This implementation determines the size and the location of the offset + * to be added to the top of the RecyclerView + * + * @param outRect The Rect of offsets to be added around the child view + * @param view The child view to be decorated with an offset + * @param parent The RecyclerView onto which an offset is being added + * @param state The current state of the 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 388ae54..785e11b 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 @@ -9,7 +9,7 @@ /** * An ItemDecoration used to add interior dividers to a RecyclerView with a - * LinearLayoutManager + * LinearLayoutManager or its subclass */ public class DividerItemDecoration extends RecyclerView.ItemDecoration { @@ -72,8 +72,8 @@ 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 RecyclerView with a LinearLayoutManager or its + * subclass oriented horizontally * * @param canvas The Canvas onto which horizontal dividers will be drawn * @param parent The RecyclerView onto which horizontal dividers are being @@ -98,8 +98,8 @@ private void drawHorizontalDividers(Canvas canvas, RecyclerView parent) { } /** - * Adds dividers to a RecyclerView with a LinearLayoutManager (or its - * subclass) oriented vertically. + * Adds dividers to a RecyclerView with a LinearLayoutManager or its + * subclass oriented vertically * * @param canvas The Canvas onto which vertical dividers will be drawn * @param parent The RecyclerView onto which vertical dividers are being 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 48bde6b..9746999 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 @@ -7,11 +7,11 @@ /** * An ItemDecoration used to add an offset to the end of a RecyclerView using a - * LinearLayoutManager. + * LinearLayoutManager or its subclass. *

- * If the LinearLayoutManager is oriented vertically, the offset will be added - * to the bottom of the RecyclerView. If the LinearLayoutManager is oriented - * horizontally, the offset will be added to the right of the RecyclerView. + * If the LayoutManager is oriented vertically, the offset will be added to the + * bottom of the RecyclerView. If the LayoutManager is oriented horizontally, + * the offset will be added to the right of the RecyclerView. */ public class EndOffsetItemDecoration extends RecyclerView.ItemDecoration { 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 e456661..2a9fba3 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 @@ -7,11 +7,11 @@ /** * An ItemDecoration used to add an offset to the start of a RecyclerView using - * a LinearLayoutManager. + * a LinearLayoutManager or its subclass *

- * If the LinearLayoutManager is oriented vertically, the offset will be added - * to the top of the RecyclerView. If the LinearLayoutManager is oriented - * horizontally, the offset will be added to the left of the RecyclerView. + * If the LayoutManager is oriented vertically, the offset will be added to the + * top of the RecyclerView. If the LayoutManager is oriented horizontally, the + * offset will be added to the left of the RecyclerView. */ public class StartOffsetItemDecoration extends RecyclerView.ItemDecoration { @@ -32,7 +32,7 @@ public StartOffsetItemDecoration(int offsetPx) { * Override of RecyclerView.ItemDecoration#getItemOffsets *

* This implementation determines the size and location of the offset to be - * added to the start of the RecyclerView. + * added to the start of the RecyclerView * * @param outRect The Rect of offsets to be added around the child view * @param view The child view to be decorated with an offset From 80be8007644c231806fc606afb115fb8a4b1656f Mon Sep 17 00:00:00 2001 From: David Greenhalgh Date: Mon, 13 Jul 2015 14:30:11 -0400 Subject: [PATCH 4/4] Adhered to Javadoc style --- .../grid/GridBottomOffsetItemDecoration.java | 25 ++++---- .../grid/GridDividerItemDecoration.java | 55 ++++++++++-------- .../grid/GridTopOffsetItemDecoration.java | 25 ++++---- .../linear/DividerItemDecoration.java | 58 ++++++++++--------- .../linear/EndOffsetItemDecoration.java | 32 +++++----- .../linear/StartOffsetItemDecoration.java | 32 +++++----- 6 files changed, 118 insertions(+), 109 deletions(-) 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 c618582..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 @@ -5,8 +5,8 @@ import android.view.View; /** - * An ItemDecoration used to add an offset to the bottom of a RecyclerView - * using a GridLayoutManager or its subclass + * 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 { @@ -14,12 +14,12 @@ public class GridBottomOffsetItemDecoration extends RecyclerView.ItemDecoration private int mNumColumns; /** - * Constructor that takes in the size of the offset to be added to the - * bottom of the RecyclerView + * 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 - * RecyclerView in pixels - * @param numColumns The number of columns in the grid of the RecyclerView + * {@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; @@ -27,15 +27,14 @@ public GridBottomOffsetItemDecoration(int offsetPx, int numColumns) { } /** - * Override of RecyclerView.ItemDecoration#getItemOffsets - *

- * This implementation determines the size and the location of the offset - * to be added to the bottom of the RecyclerView + * Determines the size and the location of the offset to be added to the + * bottom of the {@link RecyclerView}. * - * @param outRect The Rect of offsets to be added around the child view + * @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 RecyclerView onto which an offset is being added - * @param state The current state of the RecyclerView + * @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) { 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 f3be340..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 @@ -7,8 +7,8 @@ import android.view.View; /** - * An ItemDecoration used to add interior dividers to a RecyclerView with a - * GridLayoutManager + * Adds interior dividers to a {@link RecyclerView} with a + * {@link android.support.v7.widget.GridLayoutManager}. */ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { @@ -17,13 +17,14 @@ public class GridDividerItemDecoration extends RecyclerView.ItemDecoration { private int mNumColumns; /** - * Constructor that takes in Drawables to be used as interior dividers + * 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; @@ -32,14 +33,12 @@ public GridDividerItemDecoration(Drawable horizontalDivider, Drawable verticalDi } /** - * Override of RecyclerView.ItemDecoration#onDraw - *

- * This implementation draws horizontal and/or vertical dividers onto the - * parent RecyclerView. + * Draws horizontal and/or vertical dividers onto the parent {@link RecyclerView}. * - * @param canvas The Canvas onto which dividers will be drawn - * @param parent The RecyclerView onto which dividers are being added - * @param state The current state of the 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) { @@ -47,6 +46,16 @@ public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) 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); @@ -63,11 +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 Canvas onto which dividers will be drawn - * @param parent The RecyclerView onto which dividers are being added + * @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(); @@ -86,11 +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 Canvas onto which dividers will be drawn - * @param parent The RecyclerView onto which dividers are being added + * @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 b9645d5..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 @@ -5,8 +5,8 @@ import android.view.View; /** - * An ItemDecoration used to add an offset to the top of a RecyclerView using a - * GridLayoutManager or its subclass + * 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 { @@ -14,12 +14,12 @@ public class GridTopOffsetItemDecoration extends RecyclerView.ItemDecoration { private int mNumColumns; /** - * Constructor that takes in the size of the offset to be added to the top - * of the RecyclerView + * 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 - * RecyclerView in pixels - * @param numColumns The number of columns in the grid of the RecyclerView + * {@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; @@ -27,15 +27,14 @@ public GridTopOffsetItemDecoration(int offsetPx, int numColumns) { } /** - * Override of RecyclerView.ItemDecoration#getItemOffsets - *

- * This implementation determines the size and the location of the offset - * to be added to the top of the RecyclerView + * Determines the size and the location of the offset to be added to the + * top of the {@link RecyclerView}. * - * @param outRect The Rect of offsets to be added around the child view + * @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 RecyclerView onto which an offset is being added - * @param state The current state of the RecyclerView + * @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) { 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 785e11b..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 @@ -8,8 +8,8 @@ import android.view.View; /** - * An ItemDecoration used to add interior dividers to a RecyclerView with a - * LinearLayoutManager or its subclass + * Adds interior dividers to a {@link RecyclerView} with a + * {@link LinearLayoutManager} or its subclass. */ public class DividerItemDecoration extends RecyclerView.ItemDecoration { @@ -17,23 +17,22 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration { private int mOrientation; /** - * Constructor that takes in a Drawable to be used as the interior divider + * 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; } /** - * Override of RecyclerView.ItemDecoration#onDraw - *

- * This implementation draws horizontal or vertical dividers onto the - * parent RecyclerView. + * Draws horizontal or vertical dividers onto the parent {@link RecyclerView}. * - * @param canvas The Canvas onto which dividers will be drawn - * @param parent The RecyclerView onto which dividers are being added - * @param state The current state of the 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) { @@ -45,15 +44,16 @@ public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) } /** - * Override of RecyclerView.ItemDecoration#getItemOffsets - *

- * This implementation determines the size and location of offsets between - * items in the RecyclerView parent. + * Determines the size and location of offsets between items in the parent + * {@link RecyclerView}. * - * @param outRect The Rect of offsets to be added around the child view + * @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 RecyclerView onto which dividers are being added - * @param state The current state of the RecyclerView + * @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) { @@ -72,12 +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 Canvas onto which horizontal dividers will be drawn - * @param parent The RecyclerView onto which horizontal dividers are being - * added + * @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(); @@ -98,12 +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 Canvas onto which vertical dividers will be drawn - * @param parent The RecyclerView onto which vertical dividers are being - * added + * @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 9746999..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 @@ -6,38 +6,38 @@ import android.view.View; /** - * An ItemDecoration used to add an offset to the end of a RecyclerView using a - * LinearLayoutManager or its subclass. - *

- * If the LayoutManager is oriented vertically, the offset will be added to the - * bottom of the RecyclerView. If the LayoutManager is oriented horizontally, - * the offset will be added to the right of the RecyclerView. + * 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; /** - * Constructor that takes in the size of the offset to be added to the end - * of the RecyclerView + * 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 - * RecyclerView in pixels + * {@code RecyclerView} in pixels */ public EndOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } /** - * Override of RecyclerView.ItemDecoration#getItemOffsets - *

- * This implementation determines the size and location of the offset to be - * added to the end of the RecyclerView. + * Determines the size and location of the offset to be added to the end + * of the {@link RecyclerView}. * - * @param outRect The Rect of offsets to be added around the child view + * @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 RecyclerView onto which an offset is being added - * @param state The current state of the RecyclerView + * @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) { 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 2a9fba3..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 @@ -6,38 +6,38 @@ import android.view.View; /** - * An ItemDecoration used to add an offset to the start of a RecyclerView using - * a LinearLayoutManager or its subclass - *

- * If the LayoutManager is oriented vertically, the offset will be added to the - * top of the RecyclerView. If the LayoutManager is oriented horizontally, the - * offset will be added to the left of the RecyclerView. + * 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; /** - * Constructor that takes in the size of the offset to be added to the - * start of the RecyclerView + * 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 - * RecyclerView in pixels + * {@code RecyclerView} in pixels */ public StartOffsetItemDecoration(int offsetPx) { mOffsetPx = offsetPx; } /** - * Override of RecyclerView.ItemDecoration#getItemOffsets - *

- * This implementation determines the size and location of the offset to be - * added to the start of the RecyclerView + * Determines the size and location of the offset to be added to the start + * of the {@link RecyclerView}. * - * @param outRect The Rect of offsets to be added around the child view + * @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 RecyclerView onto which an offset is being added - * @param state The current state of the RecyclerView + * @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) {