balysv / material-ripple

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

Not able to disable clicks #76

Open shahimclt opened 7 years ago

shahimclt commented 7 years ago

I Applied MRL on a LinearLayout. I want to disable/enable clicks on that view using view.setClickable(boolean). but the MRL seems to ignore that. So is there any way to enable/disable the ripple and click action?

Hitexroid commented 7 years ago

set rippleAlpha to 0

SirWellington commented 7 years ago

I am also having this problem, and setting the alpha to 0 did not help.

SirWellington commented 7 years ago

Worked around this problem by using my own boolean flag to prevent multiple firings.

if (inFlight)
  return

inFlight = true
//some code...
inFlight = false
akashk1992 commented 7 years ago

@shahimclt you have to customise the library>> Write below public method in MaterialRippleLayout class public void setEnableRipple(boolean enable) { this.rippleEnable = enable;//Default Value Should be set to 'true' at class level }

And in onTouch: @Override public boolean onTouchEvent(MotionEvent event) { boolean superOnTouchEvent = super.onTouchEvent(event); if (!rippleEnable) return superOnTouchEvent; ..... ..... }

Usage : materialRippleLayout.setEnableRipple(false);

That's it..

Hitexroid commented 5 years ago

Works for me .

rippleLayout.setRippleOverlay(false);
rippleLayout.setDefaultRippleAlpha(0);
M0N3 commented 4 years ago

set rippleAlpha to 0

then set it's value to 51 in clickListener