Skip to content

Commit fb81ccd

Browse files
committed
Reformatted code according to my code style
1 parent aed475f commit fb81ccd

File tree

91 files changed

+7597
-7646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+7597
-7646
lines changed

hellocharts-library/src/lecho/lib/hellocharts/animation/ChartAnimationListener.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
/**
44
* Listener used to listen for chart animation start and stop events. Implementations of this interface can be used for
55
* all types of chart animations(data, viewport, PieChart rotation).
6-
*
76
*/
87
public interface ChartAnimationListener {
98

10-
public void onAnimationStarted();
9+
public void onAnimationStarted();
1110

12-
public void onAnimationFinished();
11+
public void onAnimationFinished();
1312

1413
}

hellocharts-library/src/lecho/lib/hellocharts/animation/ChartDataAnimator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
public interface ChartDataAnimator {
44

5-
public static final long DEFAULT_ANIMATION_DURATION = 500;
5+
public static final long DEFAULT_ANIMATION_DURATION = 500;
66

7-
public void startAnimation(long duration);
7+
public void startAnimation(long duration);
88

9-
public void cancelAnimation();
9+
public void cancelAnimation();
1010

11-
public boolean isAnimationStarted();
11+
public boolean isAnimationStarted();
1212

13-
public void setChartAnimationListener(ChartAnimationListener animationListener);
13+
public void setChartAnimationListener(ChartAnimationListener animationListener);
1414

1515
}
Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,77 @@
11
package lecho.lib.hellocharts.animation;
22

3-
import lecho.lib.hellocharts.view.Chart;
43
import android.animation.Animator;
54
import android.animation.Animator.AnimatorListener;
65
import android.animation.ValueAnimator;
76
import android.animation.ValueAnimator.AnimatorUpdateListener;
87
import android.annotation.SuppressLint;
98

9+
import lecho.lib.hellocharts.view.Chart;
10+
1011
@SuppressLint("NewApi")
1112
public class ChartDataAnimatorV14 implements ChartDataAnimator, AnimatorListener, AnimatorUpdateListener {
12-
private ValueAnimator animator;
13-
private final Chart chart;
14-
private ChartAnimationListener animationListener = new DummyChartAnimationListener();
13+
private ValueAnimator animator;
14+
private final Chart chart;
15+
private ChartAnimationListener animationListener = new DummyChartAnimationListener();
1516

16-
public ChartDataAnimatorV14(Chart chart) {
17-
this.chart = chart;
18-
animator = ValueAnimator.ofFloat(0.0f, 1.0f);
19-
animator.addListener(this);
20-
animator.addUpdateListener(this);
21-
}
17+
public ChartDataAnimatorV14(Chart chart) {
18+
this.chart = chart;
19+
animator = ValueAnimator.ofFloat(0.0f, 1.0f);
20+
animator.addListener(this);
21+
animator.addUpdateListener(this);
22+
}
2223

23-
@Override
24-
public void startAnimation(long duration) {
25-
if (duration >= 0) {
26-
animator.setDuration(duration);
27-
} else {
28-
animator.setDuration(DEFAULT_ANIMATION_DURATION);
29-
}
30-
animator.start();
31-
}
24+
@Override
25+
public void startAnimation(long duration) {
26+
if (duration >= 0) {
27+
animator.setDuration(duration);
28+
} else {
29+
animator.setDuration(DEFAULT_ANIMATION_DURATION);
30+
}
31+
animator.start();
32+
}
3233

33-
@Override
34-
public void cancelAnimation() {
35-
animator.cancel();
36-
}
34+
@Override
35+
public void cancelAnimation() {
36+
animator.cancel();
37+
}
3738

38-
@Override
39-
public void onAnimationUpdate(ValueAnimator animation) {
40-
chart.animationDataUpdate(animation.getAnimatedFraction());
41-
}
39+
@Override
40+
public void onAnimationUpdate(ValueAnimator animation) {
41+
chart.animationDataUpdate(animation.getAnimatedFraction());
42+
}
4243

43-
@Override
44-
public void onAnimationCancel(Animator animation) {
45-
}
44+
@Override
45+
public void onAnimationCancel(Animator animation) {
46+
}
4647

47-
@Override
48-
public void onAnimationEnd(Animator animation) {
49-
chart.animationDataFinished();
50-
animationListener.onAnimationFinished();
51-
}
48+
@Override
49+
public void onAnimationEnd(Animator animation) {
50+
chart.animationDataFinished();
51+
animationListener.onAnimationFinished();
52+
}
5253

53-
@Override
54-
public void onAnimationRepeat(Animator animation) {
55-
}
54+
@Override
55+
public void onAnimationRepeat(Animator animation) {
56+
}
5657

57-
@Override
58-
public void onAnimationStart(Animator animation) {
59-
animationListener.onAnimationStarted();
60-
}
58+
@Override
59+
public void onAnimationStart(Animator animation) {
60+
animationListener.onAnimationStarted();
61+
}
6162

62-
@Override
63-
public boolean isAnimationStarted() {
64-
return animator.isStarted();
65-
}
63+
@Override
64+
public boolean isAnimationStarted() {
65+
return animator.isStarted();
66+
}
6667

67-
@Override
68-
public void setChartAnimationListener(ChartAnimationListener animationListener) {
69-
if (null == animationListener) {
70-
this.animationListener = new DummyChartAnimationListener();
71-
} else {
72-
this.animationListener = animationListener;
73-
}
74-
}
68+
@Override
69+
public void setChartAnimationListener(ChartAnimationListener animationListener) {
70+
if (null == animationListener) {
71+
this.animationListener = new DummyChartAnimationListener();
72+
} else {
73+
this.animationListener = animationListener;
74+
}
75+
}
7576

7677
}
Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,77 @@
11
package lecho.lib.hellocharts.animation;
22

3-
import lecho.lib.hellocharts.view.Chart;
43
import android.os.Handler;
54
import android.os.SystemClock;
65
import android.view.animation.AccelerateDecelerateInterpolator;
76
import android.view.animation.Interpolator;
87

8+
import lecho.lib.hellocharts.view.Chart;
9+
910
public class ChartDataAnimatorV8 implements ChartDataAnimator {
1011

11-
long start;
12-
boolean isAnimationStarted = false;
13-
long duration;
14-
final Chart chart;
15-
final Handler handler;
16-
final Interpolator interpolator = new AccelerateDecelerateInterpolator();
17-
private ChartAnimationListener animationListener = new DummyChartAnimationListener();
18-
private final Runnable runnable = new Runnable() {
12+
long start;
13+
boolean isAnimationStarted = false;
14+
long duration;
15+
final Chart chart;
16+
final Handler handler;
17+
final Interpolator interpolator = new AccelerateDecelerateInterpolator();
18+
private ChartAnimationListener animationListener = new DummyChartAnimationListener();
19+
private final Runnable runnable = new Runnable() {
1920

20-
@Override
21-
public void run() {
22-
long elapsed = SystemClock.uptimeMillis() - start;
23-
if (elapsed > duration) {
24-
isAnimationStarted = false;
25-
handler.removeCallbacks(runnable);
26-
chart.animationDataFinished();
27-
return;
28-
}
29-
float scale = Math.min(interpolator.getInterpolation((float) elapsed / duration), 1);
30-
chart.animationDataUpdate(scale);
31-
handler.postDelayed(this, 16);
21+
@Override
22+
public void run() {
23+
long elapsed = SystemClock.uptimeMillis() - start;
24+
if (elapsed > duration) {
25+
isAnimationStarted = false;
26+
handler.removeCallbacks(runnable);
27+
chart.animationDataFinished();
28+
return;
29+
}
30+
float scale = Math.min(interpolator.getInterpolation((float) elapsed / duration), 1);
31+
chart.animationDataUpdate(scale);
32+
handler.postDelayed(this, 16);
3233

33-
}
34-
};
34+
}
35+
};
3536

36-
public ChartDataAnimatorV8(Chart chart) {
37-
this.chart = chart;
38-
this.handler = new Handler();
39-
}
37+
public ChartDataAnimatorV8(Chart chart) {
38+
this.chart = chart;
39+
this.handler = new Handler();
40+
}
4041

41-
@Override
42-
public void startAnimation(long duration) {
43-
if (duration >= 0) {
44-
this.duration = duration;
45-
} else {
46-
this.duration = DEFAULT_ANIMATION_DURATION;
47-
}
42+
@Override
43+
public void startAnimation(long duration) {
44+
if (duration >= 0) {
45+
this.duration = duration;
46+
} else {
47+
this.duration = DEFAULT_ANIMATION_DURATION;
48+
}
4849

49-
isAnimationStarted = true;
50-
animationListener.onAnimationStarted();
51-
start = SystemClock.uptimeMillis();
52-
handler.post(runnable);
53-
}
50+
isAnimationStarted = true;
51+
animationListener.onAnimationStarted();
52+
start = SystemClock.uptimeMillis();
53+
handler.post(runnable);
54+
}
5455

55-
@Override
56-
public void cancelAnimation() {
57-
isAnimationStarted = false;
58-
handler.removeCallbacks(runnable);
59-
chart.animationDataFinished();
60-
animationListener.onAnimationFinished();
61-
}
56+
@Override
57+
public void cancelAnimation() {
58+
isAnimationStarted = false;
59+
handler.removeCallbacks(runnable);
60+
chart.animationDataFinished();
61+
animationListener.onAnimationFinished();
62+
}
6263

63-
@Override
64-
public boolean isAnimationStarted() {
65-
return isAnimationStarted;
66-
}
64+
@Override
65+
public boolean isAnimationStarted() {
66+
return isAnimationStarted;
67+
}
6768

68-
@Override
69-
public void setChartAnimationListener(ChartAnimationListener animationListener) {
70-
if (null == animationListener) {
71-
this.animationListener = new DummyChartAnimationListener();
72-
} else {
73-
this.animationListener = animationListener;
74-
}
75-
}
69+
@Override
70+
public void setChartAnimationListener(ChartAnimationListener animationListener) {
71+
if (null == animationListener) {
72+
this.animationListener = new DummyChartAnimationListener();
73+
} else {
74+
this.animationListener = animationListener;
75+
}
76+
}
7677
}

hellocharts-library/src/lecho/lib/hellocharts/animation/ChartViewportAnimator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
public interface ChartViewportAnimator {
66

7-
public static final int FAST_ANIMATION_DURATION = 300;
7+
public static final int FAST_ANIMATION_DURATION = 300;
88

9-
public void startAnimation(Viewport startViewport, Viewport targetViewport);
9+
public void startAnimation(Viewport startViewport, Viewport targetViewport);
1010

11-
public void startAnimation(Viewport startViewport, Viewport targetViewport, long duration);
11+
public void startAnimation(Viewport startViewport, Viewport targetViewport, long duration);
1212

13-
public void cancelAnimation();
13+
public void cancelAnimation();
1414

15-
public boolean isAnimationStarted();
15+
public boolean isAnimationStarted();
1616

17-
public void setChartAnimationListener(ChartAnimationListener animationListener);
17+
public void setChartAnimationListener(ChartAnimationListener animationListener);
1818

1919
}

0 commit comments

Comments
 (0)