@@ -37,6 +37,7 @@ public class UberProgressView extends View {
37
37
private int stationaryCircleColor ;
38
38
private int fadingCircleColor ;
39
39
private int oribitingCircleColor ;
40
+ private int roationDirection ;
40
41
41
42
// Animation calculation fields
42
43
private float currentAnimationTime = 0 ;
@@ -77,6 +78,7 @@ private void init(Context context, AttributeSet attributeSet) {
77
78
stationaryCircleColor = typedArray .getColor (R .styleable .UberProgressView_stationary_circle_color , Color .parseColor ("#29B6F6" ));
78
79
fadingCircleColor = typedArray .getColor (R .styleable .UberProgressView_fading_circle_color , Color .parseColor ("#29B6F6" ));
79
80
oribitingCircleColor = typedArray .getColor (R .styleable .UberProgressView_orbiting_circle_color , Color .parseColor ("#29B6F6" ));
81
+ roationDirection = typedArray .getInt (R .styleable .UberProgressView_direction , 0 );
80
82
rStationary = typedArray .getDimension (R .styleable .UberProgressView_stationary_circle_radius , 12f );
81
83
float orbitingCircleRadius = typedArray .getDimension (R .styleable .UberProgressView_orbiting_circle_radius , 6f );
82
84
// In order to make sure the orbiting circles are at least 75% the
@@ -150,6 +152,7 @@ protected void onDraw(Canvas canvas) {
150
152
151
153
drawCircle (canvas , theta , mPaintOrbitingCircle1 );
152
154
155
+
153
156
if (theta > 15 && theta < 270 ) {
154
157
drawCircle (canvas , theta - movementFactor1 , mPaintOrbitingCircle2 );
155
158
}
@@ -177,11 +180,18 @@ protected void onWindowVisibilityChanged(int visibility) {
177
180
private void drawCircle (Canvas canvas , float theta , Paint paint ) {
178
181
179
182
double thetaInRadians = Math .toRadians (theta );
183
+ float oribitingCX , oribitingCY ;
180
184
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
+ }
183
192
184
193
canvas .drawCircle (oribitingCX , oribitingCY , rOrbiting , paint );
194
+
185
195
}
186
196
187
197
private float getLagFactor (float K ) {
0 commit comments