Skip to content

Allow programmatic setting of firstDotDrawable/lastDotDrawable #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.2.5
- Add support for setting custom first and last page indicators programmatically

## 1.2.4
- Add support for custom first and last page indicators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public class ScrollingPagerIndicator extends View {
private int selectedDotColor;

@Nullable
private final Drawable firstDotDrawable;
private Drawable firstDotDrawable;

@Nullable
private final Drawable lastDotDrawable;
private Drawable lastDotDrawable;

private boolean looped;

Expand Down Expand Up @@ -241,6 +241,24 @@ public void setOrientation(@Orientation int orientation) {
}
}

/**
* Set custom Drawable for first dot (null for default circle)
* @param drawable
*/
public void setFirstDotDrawable(@Nullable Drawable drawable) {
firstDotDrawable = drawable;
invalidate();
}

/**
* Set custom Drawable for last dot (null for default circle)
* @param drawable
*/
public void setLastDotDrawable(@Nullable Drawable drawable) {
lastDotDrawable = drawable;
invalidate();
}

/**
* Attaches indicator to ViewPager
*
Expand Down