From 0483d16f6b7cc6181b1cb8e72cf2058e7ee1f835 Mon Sep 17 00:00:00 2001 From: Balys Valentukevicius Date: Sat, 31 Jan 2015 16:07:22 +0000 Subject: [PATCH] Added methods to start a ripple manually #25 --- .../balysv/materialripple/MaterialRippleLayout.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java b/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java index 6e77985..bee4181 100644 --- a/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java +++ b/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java @@ -574,6 +574,16 @@ public void setDefaultRippleAlpha(int alpha) { invalidate(); } + public void performRipple() { + currentCoords = new Point(getWidth() / 2, getHeight() / 2); + startRipple(null); + } + + public void performRipple(Point anchor) { + currentCoords = new Point(anchor.x, anchor.y); + startRipple(null); + } + /** * {@link Canvas#clipPath(Path)} is not supported in hardware accelerated layers * before API 18. Use software layer instead