balysv / material-ripple

Android L Ripple effect wrapper for Views
Apache License 2.0
2.36k stars 479 forks source link

Changing color causes Ripple lost #53

Open marioguerriero opened 9 years ago

marioguerriero commented 9 years ago

I have the following Ripple in my layout

<com.balysv.materialripple.MaterialRippleLayout
            android:id="@+id/ripple"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:mrl_rippleColor="@color/green"
            app:mrl_rippleAlpha="0.8"
            app:mrl_rippleDimension="1dp"
            app:mrl_rippleDuration="350"
            app:mrl_ripplePersistent="true" >

            ...

</com.balysv.materialripple.MaterialRippleLayout>

And everything works as expected. By the way I tried to change ripple's color programmatically with the following Java code:

ripple.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                         selected = !selected;
                         ripple.setRippleColor(!selected ? white : green);
                }
});

At the first tap on my view ripple effect works fine. From the second tap it does not work anymore. Color is changed but ripple effect is not performed.