WaveView icon indicating copy to clipboard operation
WaveView copied to clipboard

feat: Wave color customisable

Open Kalaiz opened this issue 4 years ago • 1 comments

  • Users can apply background color, wave filling's color and alpha declaratively (XML) or programatically. [#6,#23]

  • Users can alter above and below wave's color and alpha. [#23]
<com.john.waveview.WaveView
        android:id="@+id/wave_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF"
        wave:above_wave_color="@color/dark_blue"
        wave:blow_wave_color="@color/light_blue"
        wave:above_wave_color_alpha="0.5"
        wave:blow_wave_color_alpha="0.3"
        wave:progress="80"
        wave:wave_height="large"
        wave:wave_hz="normal"
        wave:wave_length="middle" 
        wave:wave_color="@color/holo_purple"
        wave:wave_alpha="0.5"/>
        waveView.setAboveWaveColor(color);
        waveView.setBlowWaveColor(color);
        waveView.setWaveColor(color);
        waveView.setWaveAlpha(0.5f);
        waveView.setAboveWaveColorAlpha(0.3f);
        waveView.setBlowWaveColorAlpha(0.3f);
  • Made default above and below wave color to be that of the actual wave color, instead of white color.
  • Users can make the wave color to be their gradient color. [#24]

....
wave:background="@drawable/gradient_background"/>

waveView.setWaveBackgroundDrawable(getResources().getDrawable(R.drawable.gradient_background));

Kalaiz avatar Feb 23 '21 12:02 Kalaiz

Hey @john990, your custom view is awesome. I have done just a few works on it to address the extensibility aspect in the recent pull requests.

If you want, I will be able to merge #25, #26, #27 into one PR and add some brief unit test ( Situations of setting progress value, changing screen orientation, onPause and onResume etc ) to check if anything breaks. Sidenote: Each PR is independent and does not depend on it's previous PR.

Kalaiz avatar Feb 23 '21 12:02 Kalaiz