Skip to content

evan-choi/CompatRippleDrawable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

CompatRippleDrawable

API

Android Pie Style RippleDrawable

Setup

Including file in your project

CompatRippleDrawble.java

Usage

Use static setup any View

Drawable drawable = new CompatRippleDrawable.Builder()
        .setCornerRadius(/* Corner Radius */)
        .setColor(/* Ripple Color */)
        .setAlpha(/* Ripple Alpha */)
        .build();
        
/* view */.setBackground(drawable);

Support for Android api versions < 21 (LOLLIPOP)

Case - Extended view

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        /* drawable */.setHotspot(event.getX(), event.getY());
    }
    return super.onTouchEvent(event);
}

Case - TouchListener

/* view */.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            /* drawable */.setHotspot(event.getX(), event.getY());
        }
        return false;
    }
});

Preview

Preview

Releases

No releases published

Packages

No packages published

Languages