Do not draw the dot icon if there is only one page

This commit is contained in:
CappielloAntonio 2021-08-30 09:15:16 +02:00
parent 1c23e53ed7
commit c5f39cf9ee

View file

@ -51,6 +51,10 @@ public class DotsIndicatorDecoration extends RecyclerView.ItemDecoration {
int itemCount = (int) Math.ceil((double) parent.getAdapter().getItemCount() / 5);
if (itemCount <= 1) {
return;
}
// center horizontally, calculate width and subtract half from center
float totalLength = this.radius * 2 * itemCount;
float paddingBetweenItems = Math.max(0, itemCount - 1) * indicatorItemPadding;