Skip to content

Commit 2902fa7

Browse files
Renamed HorizontalDividerItemDecoration to RecyclerViewDividerItemDecoration and improved the documentation comments in this class.
1 parent 43b8931 commit 2902fa7

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

library/src/main/java/com/tazkiyatech/utils/views/HorizontalDividerItemDecoration.java renamed to library/src/main/java/com/tazkiyatech/utils/views/RecyclerViewDividerItemDecoration.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@
55
import android.graphics.drawable.Drawable;
66
import android.view.View;
77

8+
import androidx.annotation.ColorInt;
89
import androidx.annotation.NonNull;
910
import androidx.recyclerview.widget.RecyclerView;
1011

1112
/**
1213
* An extension of {@link RecyclerView.ItemDecoration} that
13-
* – when applied to a {@link RecyclerView} –
14-
* draws a horizontal divider at the bottom of each item in the {@link RecyclerView}.
14+
* draws a divider between each item in a {@link RecyclerView}.
1515
* <p>
16-
* This class is a modification of N J's answer on Stack Overflow <a href="http://stackoverflow.com/a/31243174/1071320">here</a>.
16+
* Unlike the {@link androidx.recyclerview.widget.DividerItemDecoration} class offered by the
17+
* <a href="https://maven.google.com/web/index.html#androidx.recyclerview:recyclerview">recyclerview</a>
18+
* library, this class does not draw the divider under the final item in the {@link RecyclerView}.
19+
* <p>
20+
* See <a href="https://stackoverflow.com/a/27037230/1071320">this answer</a> in Stack Overflow
21+
* for a better understanding of {@link RecyclerView.ItemDecoration}.
1722
*/
18-
public class HorizontalDividerItemDecoration extends RecyclerView.ItemDecoration {
23+
public class RecyclerViewDividerItemDecoration extends RecyclerView.ItemDecoration {
1924

2025
private final Drawable dividerDrawable;
2126
private final int dividerHeightPixels;
@@ -25,15 +30,15 @@ public class HorizontalDividerItemDecoration extends RecyclerView.ItemDecoration
2530
/**
2631
* Constructor.
2732
*
28-
* @param dividerColor the color value to apply to the divider.
29-
* @param dividerHeightPixels the height to apply to the divider (in pixels).
30-
* @param dividerMarginLeftPixels the size of the left margin (in pixels).
31-
* @param dividerMarginRightPixels the size of the right margin (in pixels).
33+
* @param dividerColor The color to apply to the divider.
34+
* @param dividerHeightPixels The height to apply to the divider (in pixels).
35+
* @param dividerMarginLeftPixels The left margin to apply to the divider (in pixels).
36+
* @param dividerMarginRightPixels The right margin to apply to the divider (in pixels).
3237
*/
33-
public HorizontalDividerItemDecoration(int dividerColor,
34-
int dividerHeightPixels,
35-
int dividerMarginLeftPixels,
36-
int dividerMarginRightPixels) {
38+
public RecyclerViewDividerItemDecoration(@ColorInt int dividerColor,
39+
int dividerHeightPixels,
40+
int dividerMarginLeftPixels,
41+
int dividerMarginRightPixels) {
3742
this.dividerDrawable = new ColorDrawable(dividerColor);
3843
this.dividerHeightPixels = dividerHeightPixels;
3944
this.dividerMarginLeftPixels = dividerMarginLeftPixels;

0 commit comments

Comments
 (0)