Since the first release of the open source library SmartRefreshLayout last year, I have deeply felt the fun of open source. So I plan to open source some of my own practical open source libraries in the future development process for everyone to use, discuss, upgrade. MultiWaveHeader is the second open source library to be released! Take a look at the following display effect.

Demo

Login scenarios

Download the APK – Demo

Project address: github.com/MultiWaveHe…

features

MultiWaveHeader is an open source Android wave library that allows you to highly customize each wave and increase the number of waves at will. Thus through the user’s own creative customization, can be used in different page scenarios. At present, the popular open source libraries of water waves that github can search, such as Tangqi92 /WaveLoadingView, John990 /WaveView, Gelitenight /WaveView, etc. seem not to be highly customizable to the water waves themselves, they are all fixed two waves.

The console

The direction of

At the top of the At the bottom of the

The number of

A pair of A single

use

1. Add dependencies in build.gradle

compile 'com. Scwang. Wave: MultiWaveHeader: 1.0.0 - alpha - 1'
Copy the code

2. Add MultiWaveHeader to the XML layout file

<com.scwang.wave.MultiWaveHeader
    android:id="@+id/waveHeader"
    android:layout_width="match_parent"
    android:layout_height="200dp">
Copy the code

attribute

Some basic properties can be configured.

java
    MultiWaveHeader waveHeader = findViewById(R.id.waveHeader);

    waveHeader.setStartColor(R.color.colorPrimary);
    waveHeader.setCloseColor(R.color.colorPrimaryDark);
    waveHeader.setColorAlpha(.5f);

    waveHeader.setWaveHeight(50);
    waveHeader.setGradientAngle(360);
    waveHeader.setProgress(.8f);
    waveHeader.setVelocity(1f);
    waveHeader.setScaleY(-1f);

    waveHeader.setWaves("PairWave");

    waveHeader.start();
    waveHeader.stop();
    waveHeader.isRunning();
Copy the code
xml
    <com.scwang.wave.MultiWaveHeader
        android:id="@+id/waveHeader"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:scaleY="1"
        app:mwhVelocity="1"
        app:mwhProgress="1"
        app:mwhRunning="true"
        app:mwhGradientAngle="45"
        app:mwhWaveHeight="50dp"
        app:mwhColorAlpha="0.45"
        app:mwhStartColor="@color/colorPrimaryDark"
        app:mwhCloseColor="@color/colorPrimaryLight"
        app:mwhWaves="MultiWave">
Copy the code

Precision custom

MultiWaveHeader allows precise customization of each wave’s parameters: offset, stretch, speed and direction.

java
    MultiWaveHeader waveHeader = findViewById(R.id.waveHeader);


    String[] waves = new String[]{
        "- 26,25,1.4 70, 1.4,".//wave-1:offsetX(dp),offsetY(dp),scaleX,scaleY,velocity(dp/s)
        "100,5,1.4, 1.2, 15"."- 10 420,0,1.15, 1,".// Wave-3: Horizontal offset (DP), Vertical offset (DP), Horizontal stretch, vertical stretch, speed (DP /s)
        "20,10,1.7 520, 1.5,"."220,0,1,1,-15"}; waveHeader.setWaves(TextUtils.join("", Arrays.asList(waves)));// custom
    waveHeader.setWaves("PairWave");// default two waves
    waveHeader.setWaves("MultiWave");// default five waves

Copy the code
xml
    <com.scwang.wave.MultiWaveHeader
        android:id="@+id/waveHeader"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        app:mwhWaves="PairWave"
        app:mwhWaves="MultiWave"
        app:mwhWaves="70,25,1.4, 1.4, 26-100,5,1.4, 1.2, 15, 420,0,1.15, 1, 520-10,10,1.7, 1.5, 20 220,0,1,1, 15">
Copy the code