WaveView
WaveView copied to clipboard
Smooth leveling on setting level
Between setting new levels, the wave level changes immediately. However I want the level to rise and fall gradually. How can I achieve that?
private void updateWaveViewWithAnimation(int start, int end, long duration) {
ValueAnimator valueAnimator = ValueAnimator.ofInt(start, end);
valueAnimator.setDuration(duration);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
waveView.setProgress((int)valueAnimator.getAnimatedValue());
}
});
valueAnimator.start();
}
I am using this but it is not really smooth on emulator.
Unfortunately, in my case it diddn't provide me a solution. Thanks for trying anyways, it's a good approach though 👍