View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

Overview

Android Arsenal

RippleView

View that imitates Ripple Effect on click which was introduced in Android L.

Sample Screenshot

Usage

For a working implementation, Have a look at the Sample Project - RippleViewExample

  1. Include the library as local library project.

  2. Include the RippleView widget in your layout.

    <com.indris.material.RippleView
            android:id="@+id/btn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            ripple:alphaFactor="0.7"
            ripple:rippleColor="#58FAAC" >
    </com.indris.material.RippleView>
  3. In your onCreate method refer to the View and add 'OnClickListener' for the same.

    mButton = (RippleView) findViewById(R.id.btn);
    mButton.setOnClickListener(new View.OnClickListener() {
    	@Override
    	public void onClick(View v) {
    		//your code
    	}
    });

Customization

There are three attributes which are applicable to RippleView.

  • rippleColor Color of the Ripple

  • alphaFactor Opacity of the Ripple

  • hover Hover effect on the button

  • You can also set these attributes from your java code by calling setRippleColor(rippleColor, alphaFactor) and setHover(enabled) respectively.

Compatibility

  • Android GingerBread 2.3+

Changelog

Current Version: 1.2

  • Added option to enable or disable Hover
  • Added GingerBread Support
  • Bug fixes

Version: 1.1

  • Improved Animation
  • Added Hover Effect (Thanks to YangHui)

Version: 1.0

  • Initial Build

Author

Credits

License

Copyright 2014 Muthuramakrishnan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Fix issue #15, added listener for ACTION_DOWN

    Fix issue #15, added listener for ACTION_DOWN

    Added line 120-142, listener for ACTION_DOWN animation.

    This update ensures the mIsAnimating status to be true when the animation starts, so as when ACTION_UP happens mRadiusAnimator.cancel() goes off before a new ObjectAnimator is created.

    opened by roycezhc 3
  • Wait for Ripple animation to finish before performing the onclick action

    Wait for Ripple animation to finish before performing the onclick action

    Hi,

    Is there a way to wait for the animation to finish before performing the action inside the onclicklistener so that the complete animation is visible before say moving to a new activity? Thanks!

    opened by xarlotie 3
  • RippleView ICS FATAL EXCEPTION

    RippleView ICS FATAL EXCEPTION

    Hi.. I noticed that using the ripple view inside a listview item, if Android version is ICS, this cause app's crash.. Instead on Android 4.4 it works well.

    Logcat:

    09-13 22:52:11.594 20969-20969/com.wax.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.UnsupportedOperationException at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:408) at com.indris.material.RippleView.onDraw(RippleView.java:222) at android.view.View.draw(View.java:10982) at android.view.View.getDisplayList(View.java:10421) at android.view.ViewGroup.drawChild(ViewGroup.java:2850) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489) at android.view.View.getDisplayList(View.java:10419) at android.view.ViewGroup.drawChild(ViewGroup.java:2850) at android.widget.ListView.drawChild(ListView.java:3223) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489) at android.widget.AbsListView.dispatchDraw(AbsListView.java:2092) at android.widget.ListView.dispatchDraw(ListView.java:3218) at android.view.View.draw(View.java:10985) at android.widget.AbsListView.draw(AbsListView.java:3398) at android.view.View.getDisplayList(View.java:10421) at android.view.ViewGroup.drawChild(ViewGroup.java:2850) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489) at android.view.View.getDisplayList(View.java:10419) at android.view.ViewGroup.drawChild(ViewGroup.java:2850) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489) at android.view.View.draw(View.java:10985) at android.support.v4.view.ViewPager.draw(ViewPager.java:2176) at android.view.View.getDisplayList(View.java:10421) at android.view.ViewGroup.drawChild(ViewGroup.java:2850) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489) at android.view.View.getDisplayList(View.java:10419) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597) at android.view.View.getDisplayList(View.java:10384) at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842) at android.view.ViewRootImpl.draw(ViewRootImpl.java:1935) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1659) at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2467) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) at dalvik.system.NativeStart.main(Native Method)

    opened by fcannizzaro 3
  • Issue: First animation is still running.

    Issue: First animation is still running.

    When I changed the animation duration of the ACTION_DOWN from 400 to 4000, the animation will keep showing on the screen after the animation triggered by the ACTION_UP stops.

    opened by roycezhc 2
  • Fixed Android M Crash

    Fixed Android M Crash

    • Removed Icons from Library
    • Moved libs file to Sample App. libs should not be present in Library App.
    • Configured Library manifest to suit the library specs
    opened by ashik94vc 0
  • Android 6.0 Marshmallow bug -- Fatal Exception: java.lang.IllegalStateException Underflow in restore - more restores than saves (RippleView.java:166)

    Android 6.0 Marshmallow bug -- Fatal Exception: java.lang.IllegalStateException Underflow in restore - more restores than saves (RippleView.java:166)

    Log:

    com.andexert.library.RippleView.draw (RippleView.java:166) android.view.View.updateDisplayListIfDirty (View.java:15174) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3593) android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3573) android.view.View.updateDisplayListIfDirty (View.java:15134) android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:281) android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:287) android.view.ThreadedRenderer.draw (ThreadedRenderer.java:322) android.view.ViewRootImpl.draw (ViewRootImpl.java:2615) android.view.ViewRootImpl.performDraw (ViewRootImpl.java:2434) android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2067) android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1107) android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6013) android.view.Choreographer$CallbackRecord.run (Choreographer.java:858) android.view.Choreographer.doCallbacks (Choreographer.java:670) android.view.Choreographer.doFrame (Choreographer.java:606) android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:844)

    bug 
    opened by conzorz 2
  • Problems Inside ListView

    Problems Inside ListView

    Hi, when I press and move out the view, The circle still displayed and don't disappear until I click again in the view. It's a ListView with RippleView's in each row. Regards.

    bug 
    opened by fhrdina 0
Owner
Muthuramakrishnan Viswanathan
Open Source Software Developer, Perfectionist, Technology Evangelist, UI/UX Designer, Public Speaker, Producer/DJ, Philatelist
Muthuramakrishnan Viswanathan
This is a android custom view , like a scratch card effect!

ScratchView This is a android custom view , like a scratch card effect! Last Update 采纳DearZack童鞋的优化思路,把计算擦除面积比例的操作放在手指离开屏幕时,以降低对CPU的占用。 Articles Scrat

D_clock爱吃葱花 316 Nov 29, 2022
This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)

Android-PickerView English Document 注意事项、详请使用方式、更新日志等,请查看 Wiki文档 Wiki文档,Wiki文档,Wiki文档 !~ 重要的事情说三遍 对于使用上有任何疑问或优化建议等,欢迎加入QQ群讨论交流技术问题。 交流群1: 387051294(推荐

Bigkoo 13.2k Jan 6, 2023
Simple and fantastic wheel view in realistic effect for android.

Overview ![Size](https://img.shields.io/badge/Size-17 KB-e91e63.svg) Contact Preview Demo WheelPicke.APK Include Compile compile 'cn.aigestudio.wheelp

Aige 2.5k Jan 6, 2023
Pop animation with circular dust effect for any view updation

Popview-Android Pop animation with circular dust effect for any view updation Getting Started In your build.gradle dependencies { compile 'rb.popv

R B Krishna 489 Dec 28, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
Android ImageViews animated by Ken Burns Effect

KenBurnsView Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the Ken Burn

Flávio Faria 2.7k Dec 23, 2022
A TagView library for Android. Customize your own & Drag effect.

AndroidTagView An Android TagView library. You can customize awesome TagView by using this library. Screenshots Usage Step 1 Add below dependency in y

lujun 1.7k Dec 29, 2022
JetCompose - Blur Effect in Android 12 with motion layout carousel

JetCompose Blur Effect in Android 12 with motion layout carousel

Vikas Singh 4 Jul 27, 2022
Glass-break effect for views

BrokenView Glass-break effect for views. Demo Download APK Usage Android Studio dependencies { compile 'com.zys:brokenview:1.0.3' } Eclipse Just pu

null 858 Jan 6, 2023
An Index Side Bar With Wave Effect

WaveSideBar You can use WaveSideBar in the contacts page of your application. Refer to AlexLiuSheng/AnimSideBar. Screenshot Include the WaveSideBar to

郭佳哲 1.3k Dec 12, 2022
Squishy button effect with kotlin

Squishy Usage Add squishy() modifier on your composable element. Text( text = "Squishhhhyyyyy", modifier = Modifier .size(200.dp, 100.dp

null 43 Jul 9, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022
A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.

FreeDrawView A View that let you draw freely on it. You can customize paint width, alpha and color. Can be useful for notes app, signatures or hands-f

Riccardo Moro 643 Nov 28, 2022
A custom view, in which device contact list is displayed

Getting Started This repository contains a custom view, in which device contact list is displayed Implementation Go to Settings.gradle, inside reposit

Ankit Kumar 2 May 7, 2022
Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.

CircleDisplay Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations. Features Core featur

Philipp Jahoda 287 Nov 18, 2022
FloatingView can make the target view floating above the anchor view with cool animation

FloatingView FloatingView can make the target view floating above the anchor view with cool animation Links 中文版 README Blog about FloatingView demo.ap

UFreedom 1.8k Dec 27, 2022
用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View.

PathAnimView 用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View. 现已经找到图片->SVG->PATH的正确姿势, Now i have a pic.I have a view. Oh~,Path(A

张旭童 1.1k Oct 28, 2022
Android library which allows you to swipe down from an activity to close it.

Android Sliding Activity Library Easily create activities that can slide vertically on the screen and fit well into the Material Design age. Features

Jake Klinker 1.3k Nov 25, 2022