race604 / WaveLoading

A wave-like loading drawable
1.45k stars 173 forks source link

Setting amplitude removes wave #5

Open tylergets opened 7 years ago

tylergets commented 7 years ago

Hey, I am trying to use this library however whenever I set the amplitude to anything, the wave animation no longer works. It becomes a straight line.

This is android 7.0 on an LG G5.

I am setting the amplitude as so

 mWaveDrawable = new WaveDrawable(this, R.drawable.bar_filler);
        mWaveDrawable.setIndeterminate(true);
        mWaveDrawable.setWaveAmplitude(32);
        binding.imageView3.setImageDrawable(mWaveDrawable);
race604 commented 7 years ago

I have test your code on my device(Xiaomi 5, Andorid 7.0), it works fine. Does the demo work properly on your device?

moolight-seashell commented 5 years ago

i am in a fragment and the waves desapear when i set it (android 6.0+)

   `ImageView imageView = v.findViewById(R.id.battery);`
    `Drawable mWaveDrawable = new WaveDrawable(imageView.getDrawable());`
    `//((WaveDrawable) mWaveDrawable).setIndeterminate(true);`
    `mWaveDrawable.setLevel(35);`
    `((WaveDrawable) mWaveDrawable).setWaveAmplitude(40);`
    `((WaveDrawable) mWaveDrawable).setWaveLength(150);`
    `((WaveDrawable) mWaveDrawable).setWaveSpeed(5);`
    `imageView.setImageDrawable(mWaveDrawable);`
moolight-seashell commented 5 years ago

why we do not have a mAnimator.start(); inside the setLevel() function ?