@@ -37,6 +37,7 @@ public class UberProgressView extends View {
3737 private int stationaryCircleColor ;
3838 private int fadingCircleColor ;
3939 private int oribitingCircleColor ;
40+ private int roationDirection ;
4041
4142 // Animation calculation fields
4243 private float currentAnimationTime = 0 ;
@@ -77,6 +78,7 @@ private void init(Context context, AttributeSet attributeSet) {
7778 stationaryCircleColor = typedArray .getColor (R .styleable .UberProgressView_stationary_circle_color , Color .parseColor ("#29B6F6" ));
7879 fadingCircleColor = typedArray .getColor (R .styleable .UberProgressView_fading_circle_color , Color .parseColor ("#29B6F6" ));
7980 oribitingCircleColor = typedArray .getColor (R .styleable .UberProgressView_orbiting_circle_color , Color .parseColor ("#29B6F6" ));
81+ roationDirection = typedArray .getInt (R .styleable .UberProgressView_direction , 0 );
8082 rStationary = typedArray .getDimension (R .styleable .UberProgressView_stationary_circle_radius , 12f );
8183 float orbitingCircleRadius = typedArray .getDimension (R .styleable .UberProgressView_orbiting_circle_radius , 6f );
8284 // In order to make sure the orbiting circles are at least 75% the
@@ -150,6 +152,7 @@ protected void onDraw(Canvas canvas) {
150152
151153 drawCircle (canvas , theta , mPaintOrbitingCircle1 );
152154
155+
153156 if (theta > 15 && theta < 270 ) {
154157 drawCircle (canvas , theta - movementFactor1 , mPaintOrbitingCircle2 );
155158 }
@@ -177,11 +180,18 @@ protected void onWindowVisibilityChanged(int visibility) {
177180 private void drawCircle (Canvas canvas , float theta , Paint paint ) {
178181
179182 double thetaInRadians = Math .toRadians (theta );
183+ float oribitingCX , oribitingCY ;
180184
181- float oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float ) Math .cos (thetaInRadians ));
182- float oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float ) Math .sin (thetaInRadians ));
185+ if (roationDirection == 0 ) {
186+ oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float ) Math .cos (thetaInRadians ));
187+ oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float ) Math .sin (thetaInRadians ));
188+ } else {
189+ oribitingCX = cXStationary + (orbitPathDistanceFromCenter * (float ) Math .sin (thetaInRadians ));
190+ oribitingCY = cYStationary + (orbitPathDistanceFromCenter * (float ) Math .cos (thetaInRadians ));
191+ }
183192
184193 canvas .drawCircle (oribitingCX , oribitingCY , rOrbiting , paint );
194+
185195 }
186196
187197 private float getLagFactor (float K ) {
0 commit comments