diff --git a/README.md b/README.md
index 7281422..66d3192 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ dependencies {
# Usage
-In your Layout XML add this
+In your Layout XML add this (all the app:.... attributes are optional and have default values
```
@@ -47,6 +48,7 @@ In your Layout XML add this
| stationary_circle_color | Color of the stationary circle in the center. | color | #29B6F6 |
| orbiting_circle_radius | Radius of the orbiting circles. | dimension | 2dp |
| stationary_circle_radius| Radius of the stationary circle in the center. | dimension | 4dp |
+| direction | Direction of rotation of outer dot | enum | clockwise |
# Design Inspiration
diff --git a/uberprogressview/src/main/java/org/lazysource/uberprogressview/UberProgressView.java b/uberprogressview/src/main/java/org/lazysource/uberprogressview/UberProgressView.java
index 6b06729..ddd12b2 100644
--- a/uberprogressview/src/main/java/org/lazysource/uberprogressview/UberProgressView.java
+++ b/uberprogressview/src/main/java/org/lazysource/uberprogressview/UberProgressView.java
@@ -37,6 +37,7 @@ public class UberProgressView extends View {
private int stationaryCircleColor;
private int fadingCircleColor;
private int oribitingCircleColor;
+ private int roationDirection;
// Animation calculation fields
private float currentAnimationTime = 0;
@@ -77,6 +78,7 @@ private void init(Context context, AttributeSet attributeSet) {
stationaryCircleColor = typedArray.getColor(R.styleable.UberProgressView_stationary_circle_color, Color.parseColor("#29B6F6"));
fadingCircleColor = typedArray.getColor(R.styleable.UberProgressView_fading_circle_color, Color.parseColor("#29B6F6"));
oribitingCircleColor = typedArray.getColor(R.styleable.UberProgressView_orbiting_circle_color, Color.parseColor("#29B6F6"));
+ roationDirection = typedArray.getInt(R.styleable.UberProgressView_direction, 0);
rStationary = typedArray.getDimension(R.styleable.UberProgressView_stationary_circle_radius, 12f);
float orbitingCircleRadius = typedArray.getDimension(R.styleable.UberProgressView_orbiting_circle_radius, 6f);
// In order to make sure the orbiting circles are at least 75% the
@@ -150,6 +152,7 @@ protected void onDraw(Canvas canvas) {
drawCircle(canvas, theta, mPaintOrbitingCircle1);
+
if (theta > 15 && theta < 270) {
drawCircle(canvas, theta - movementFactor1, mPaintOrbitingCircle2);
}
@@ -177,11 +180,18 @@ protected void onWindowVisibilityChanged(int visibility) {
private void drawCircle(Canvas canvas, float theta, Paint paint) {
double thetaInRadians = Math.toRadians(theta);
+ float oribitingCX, oribitingCY;
- float oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float) Math.cos(thetaInRadians));
- float oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float) Math.sin(thetaInRadians));
+ if (roationDirection == 0) {
+ oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float) Math.cos(thetaInRadians));
+ oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float) Math.sin(thetaInRadians));
+ } else {
+ oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float) Math.sin(thetaInRadians));
+ oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float) Math.cos(thetaInRadians));
+ }
canvas.drawCircle(oribitingCX, oribitingCY, rOrbiting, paint);
+
}
private float getLagFactor(float K) {
diff --git a/uberprogressview/src/main/res/values/attrs.xml b/uberprogressview/src/main/res/values/attrs.xml
index 41a08d2..33b6a67 100644
--- a/uberprogressview/src/main/res/values/attrs.xml
+++ b/uberprogressview/src/main/res/values/attrs.xml
@@ -8,6 +8,10 @@
+
+
+
+
\ No newline at end of file