Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ripples using Probe and MostafaGazar's Widgets
import org.lucasr.probe.Interceptor;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import java.util.WeakHashMap;
/* this class is a Probe Interceptor that gives views a ripple effect
* using
public class RippleInterceptor extends Interceptor {
private Context mContext;
private WeakHashMap<View, RippleView> mMapping;
public RippleInterceptor(Context context) {
mContext = context;
mMapping = new WeakHashMap<>();
public void onLayout(View view, boolean changed,
int left, int top, int right, int bottom) {
if (!(view instanceof ViewGroup)) {
RippleView rippleView = mMapping.get(view);
if (rippleView == null) {
rippleView = new RippleView(mContext, view);
mMapping.put(view, rippleView);
super.onLayout(view, changed, left, top, right, bottom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment