aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java b/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java
index b6ec0d0..78e915d 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java
+++ b/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java
@@ -27,6 +27,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
+import android.support.annotation.ColorInt;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
@@ -37,6 +38,7 @@ import java.util.Arrays;
import ca.allanwang.kau.R;
import ca.allanwang.kau.utils.AnimHolder;
+import ca.allanwang.kau.utils.ColorUtilsKt;
/**
* An ink inspired widget for indicating pages in a {@link ViewPager}.
@@ -62,6 +64,13 @@ public class InkPageIndicator extends View implements ViewPager.OnPageChangeList
private int unselectedColour;
private int selectedColour;
+ public void setColour(@ColorInt int color) {
+ selectedColour = color;
+ unselectedColour = ColorUtilsKt.adjustAlpha(color, 0.5f);
+ selectedPaint.setColor(selectedColour);
+ unselectedPaint.setColor(unselectedColour);
+ }
+
// derived from attributes
private float dotRadius;
private float halfDotRadius;