Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add api to change progress animation duration #65

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class WaveLoadingView extends View {
private static final float DEFAULT_TITLE_TOP_SIZE = 18.0f;
private static final float DEFAULT_TITLE_CENTER_SIZE = 22.0f;
private static final float DEFAULT_TITLE_BOTTOM_SIZE = 18.0f;
private int progressDuration = 1000;

public enum ShapeType {
TRIANGLE,
Expand Down Expand Up @@ -558,7 +559,7 @@ public float getAmplitudeRatio() {
public void setProgressValue(int progress) {
mProgressValue = progress;
ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(this, "waterLevelRatio", mWaterLevelRatio, ((float) mProgressValue / 100));
waterLevelAnim.setDuration(1000);
waterLevelAnim.setDuration(progressDuration);
waterLevelAnim.setInterpolator(new DecelerateInterpolator());
AnimatorSet animatorSetProgress = new AnimatorSet();
animatorSetProgress.play(waterLevelAnim);
Expand Down Expand Up @@ -836,4 +837,12 @@ else if (direction == 3) {

return path;
}

/**
* set duration of progress change animation, 1000ms by default
* @param progressDuration duration of progress change animation
*/
public void setProgressDuration(int progressDuration) {
this.progressDuration = progressDuration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected void onCreate(Bundle savedInstanceState) {
mWaveLoadingView = (WaveLoadingView) findViewById(R.id.waveLoadingView);
// Sets the length of the animation, default is 1000.
mWaveLoadingView.setAnimDuration(3000);
mWaveLoadingView.setProgressDuration(3000);

// Shape Type
findViewById(R.id.tv_shape).setOnClickListener(new View.OnClickListener() {
Expand Down