Example usage for android.graphics.drawable RippleDrawable setHotspot

List of usage examples for android.graphics.drawable RippleDrawable setHotspot

Introduction

In this page you can find the example usage for android.graphics.drawable RippleDrawable setHotspot.

Prototype

@Override
    public void setHotspot(float x, float y) 

Source Link

Usage

From source file:com.winneredge.stockly.wcommons.floatingactionwidget.FloatingActionButton.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionUp() {
    if (mBackgroundDrawable instanceof StateListDrawable) {
        StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
        drawable.setState(new int[] { android.R.attr.state_enabled });
    } else if (Util.hasLollipop()) {
        RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
        ripple.setState(new int[] { android.R.attr.state_enabled });
        ripple.setHotspot(calculateCenterX(), calculateCenterY());
        ripple.setVisible(true, true);//from   w  w  w  . j  a  v a2s .  c o  m
    }
}

From source file:com.winneredge.stockly.wcommons.floatingactionwidget.FloatingActionButton.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionDown() {
    if (mBackgroundDrawable instanceof StateListDrawable) {
        StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
        drawable.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
    } else if (Util.hasLollipop()) {
        RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
        ripple.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
        ripple.setHotspot(calculateCenterX(), calculateCenterY());
        ripple.setVisible(true, true);/*from w w  w. jav  a2  s .  c om*/
    }
}