GeezerVison is showing github.com — sysn · JingMeng/AndroidCustomView@f961b32
File tree
Expand file treeCollapse file tree
Open diff view settings
app/src/main/java/com/allen/androidcustomview
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: app/src/main/java/com/allen/androidcustomview/activity/ProgressBarActivity.java +14-6Lines changed: 14 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,21 @@ public void currentProgressListener(float currentProgress) { |
51 | 51 | circleProgressBarView.startProgressAnimation(); |
52 | 52 |
|
53 | 53 |
|
| 54 | + /** |
| 55 | + * 横向的进度条 |
| 56 | + */ |
54 | 57 | horizontalProgressBar = (HorizontalProgressBar) findViewById(R.id.horizontal_progress_view); |
| 58 | + |
| 59 | + horizontalProgressBar.setProgressWithAnimation(100).setProgressListener(new HorizontalProgressBar.ProgressListener() { |
| 60 | + @Override |
| 61 | + public void currentProgressListener(float currentProgress) { |
| 62 | + } |
| 63 | + }); |
| 64 | + horizontalProgressBar.startProgressAnimation(); |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
55 | 69 | productProgressBar = (ProductProgressBar) findViewById(R.id.product_progress_view); |
56 | 70 | loadingView = (LoadingView) findViewById(R.id.loading_view); |
57 | 71 | loadingLineView = (LoadingLineView) findViewById(R.id.loading_line_view); |
@@ -60,12 +74,6 @@ public void currentProgressListener(float currentProgress) { |
60 | 74 | button = (Button) findViewById(R.id.startAnimationBtn); |
61 | 75 | studyPlanProgressView = findViewById(R.id.study_plan_progress_view); |
62 | 76 |
|
63 | | - horizontalProgressBar.setProgressWithAnimation(60).setProgressListener(new HorizontalProgressBar.ProgressListener() { |
64 | | - @Override |
65 | | - public void currentProgressListener(float currentProgress) { |
66 | | - } |
67 | | - }); |
68 | | - horizontalProgressBar.startProgressAnimation(); |
69 | 77 |
|
70 | 78 | productProgressBar.setProgress(60).setProgressListener(new ProductProgressBar.ProgressListener() { |
71 | 79 | @Override |
|
Collapse file
Copy file name to clipboardExpand all lines: app/src/main/java/com/allen/androidcustomview/widget/CircleProgressBarView.java +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -181,7 +181,11 @@ private void initAnimation() { |
181 | 181 | public void onAnimationUpdate(ValueAnimator valueAnimator) { |
182 | 182 | float value = (float) valueAnimator.getAnimatedValue(); |
183 | 183 | mProgress = value; |
184 | | - currentProgress = value * 360 / 100; |
| 184 | + /** |
| 185 | + * value 是百分制的,但是我们的圆是360度的,所以需要处理一下 |
| 186 | + * drawArc 里面的数据 解析了这一部分 |
| 187 | + */ |
| 188 | + currentProgress = value / 100 * 360; |
185 | 189 |
|
186 | 190 | if (progressListener != null) { |
187 | 191 | progressListener.currentProgressListener(roundTwo(value)); |
|