├── .gitattributes ├── .gitignore ├── README.md ├── RippleView ├── .gitattributes ├── .gitignore ├── AndroidManifest.xml ├── libs │ └── nineoldandroids-2.4.0.jar ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── attrs.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── indris │ └── material │ └── RippleView.java ├── RippleViewExample ├── .gitignore ├── AndroidManifest.xml ├── ic_launcher-web.png ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── drawable │ │ └── card_bk.xml │ ├── layout │ │ └── activity_ripple_view.xml │ ├── menu │ │ └── ripple_view.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ ├── values-w820dp │ │ └── dimens.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── indris │ └── sample │ └── RippleViewActivity.java └── Screens ├── Screen.gif └── ScreenOld.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # ========================= 26 | # Operating System Files 27 | # ========================= 28 | 29 | # OSX 30 | # ========================= 31 | 32 | .DS_Store 33 | .AppleDouble 34 | .LSOverride 35 | 36 | # Icon must ends with two \r. 37 | Icon 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear on external disk 43 | .Spotlight-V100 44 | .Trashes 45 | 46 | # Windows 47 | # ========================= 48 | 49 | # Windows image file caches 50 | Thumbs.db 51 | ehthumbs.db 52 | 53 | # Folder config file 54 | Desktop.ini 55 | 56 | # Recycle Bin used on file shares 57 | $RECYCLE.BIN/ 58 | 59 | # Windows Installer files 60 | *.cab 61 | *.msi 62 | *.msm 63 | *.msp 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RippleView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/923) 2 | 3 | # RippleView 4 | 5 | View that imitates Ripple Effect on click which was introduced in Android L. 6 | 7 | ![Sample Screenshot](https://raw.github.com/siriscac/RippleView/master/Screens/Screen.gif) 8 | 9 | # Usage 10 | 11 | *For a working implementation, Have a look at the Sample Project - RippleViewExample* 12 | 13 | 1. Include the library as local library project. 14 | 15 | 2. Include the RippleView widget in your layout. 16 | 17 | ```xml 18 | 24 | 25 | ``` 26 | 27 | 3. In your `onCreate` method refer to the View and add 'OnClickListener' for the same. 28 | 29 | ```java 30 | mButton = (RippleView) findViewById(R.id.btn); 31 | mButton.setOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | //your code 35 | } 36 | }); 37 | ``` 38 | 39 | # Customization 40 | 41 | There are three attributes which are applicable to `RippleView`. 42 | 43 | * `rippleColor` Color of the Ripple 44 | * `alphaFactor` Opacity of the Ripple 45 | * `hover` Hover effect on the button 46 | 47 | * You can also set these attributes from your java code by calling `setRippleColor(rippleColor, alphaFactor)` and `setHover(enabled)` respectively. 48 | 49 | # Compatibility 50 | 51 | * Android GingerBread 2.3+ 52 | 53 | # Changelog 54 | 55 | ### Current Version: 1.2 56 | 57 | * Added option to enable or disable Hover 58 | * Added GingerBread Support 59 | * Bug fixes 60 | 61 | ### Version: 1.1 62 | 63 | * Improved Animation 64 | * Added Hover Effect (Thanks to [YangHui](https://github.com/kyze8439690)) 65 | 66 | ### Version: 1.0 67 | 68 | * Initial Build 69 | 70 | # Author 71 | 72 | * Muthuramakrishnan - 73 | 74 | ### Credits 75 | 76 | * [Niek Haarman](https://github.com/nhaarman) 77 | 78 | # License 79 | 80 | Copyright 2014 Muthuramakrishnan 81 | 82 | Licensed under the Apache License, Version 2.0 (the "License"); 83 | you may not use this file except in compliance with the License. 84 | You may obtain a copy of the License at 85 | 86 | http://www.apache.org/licenses/LICENSE-2.0 87 | 88 | Unless required by applicable law or agreed to in writing, software 89 | distributed under the License is distributed on an "AS IS" BASIS, 90 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 91 | See the License for the specific language governing permissions and 92 | limitations under the License. 93 | -------------------------------------------------------------------------------- /RippleView/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /RippleView/.gitignore: -------------------------------------------------------------------------------- 1 | /gen 2 | /bin 3 | /proguard-project.txt 4 | .project 5 | .classpath 6 | /.settings 7 | -------------------------------------------------------------------------------- /RippleView/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /RippleView/libs/nineoldandroids-2.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleView/libs/nineoldandroids-2.4.0.jar -------------------------------------------------------------------------------- /RippleView/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library=true 16 | -------------------------------------------------------------------------------- /RippleView/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleView/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleView/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleView/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleView/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleView/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleView/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RippleView/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /RippleView/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /RippleView/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | RippleView 4 | 5 | 6 | -------------------------------------------------------------------------------- /RippleView/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /RippleView/src/com/indris/material/RippleView.java: -------------------------------------------------------------------------------- 1 | package com.indris.material; 2 | 3 | /* 4 | * Copyright (C) 2013 Muthuramakrishnan 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import android.annotation.SuppressLint; 20 | import android.content.Context; 21 | import android.content.res.TypedArray; 22 | import android.graphics.*; 23 | import android.util.AttributeSet; 24 | import android.util.Log; 25 | import android.view.MotionEvent; 26 | import android.view.animation.AccelerateDecelerateInterpolator; 27 | import android.widget.Button; 28 | import com.indris.R; 29 | import com.nineoldandroids.animation.Animator; 30 | import com.nineoldandroids.animation.ObjectAnimator; 31 | import com.nineoldandroids.view.ViewHelper; 32 | 33 | @SuppressLint("ClickableViewAccessibility") 34 | public class RippleView extends Button { 35 | 36 | private float mDownX; 37 | private float mDownY; 38 | private float mAlphaFactor; 39 | private float mDensity; 40 | private float mRadius; 41 | private float mMaxRadius; 42 | 43 | private int mRippleColor; 44 | private boolean mIsAnimating = false; 45 | private boolean mHover = true; 46 | 47 | private RadialGradient mRadialGradient; 48 | private Paint mPaint; 49 | private ObjectAnimator mRadiusAnimator; 50 | 51 | private int dp(int dp) { 52 | return (int) (dp * mDensity + 0.5f); 53 | } 54 | 55 | public RippleView(Context context) { 56 | this(context, null); 57 | } 58 | 59 | public RippleView(Context context, AttributeSet attrs) { 60 | this(context, attrs, 0); 61 | } 62 | 63 | public RippleView(Context context, AttributeSet attrs, int defStyle) { 64 | super(context, attrs, defStyle); 65 | init(); 66 | TypedArray a = context.obtainStyledAttributes(attrs, 67 | R.styleable.RippleView); 68 | mRippleColor = a.getColor(R.styleable.RippleView_rippleColor, 69 | mRippleColor); 70 | mAlphaFactor = a.getFloat(R.styleable.RippleView_alphaFactor, 71 | mAlphaFactor); 72 | mHover = a.getBoolean(R.styleable.RippleView_hover, mHover); 73 | a.recycle(); 74 | } 75 | 76 | public void init() { 77 | mDensity = getContext().getResources().getDisplayMetrics().density; 78 | 79 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); 80 | mPaint.setAlpha(100); 81 | setRippleColor(Color.BLACK, 0.2f); 82 | 83 | } 84 | 85 | public void setRippleColor(int rippleColor, float alphaFactor) { 86 | mRippleColor = rippleColor; 87 | mAlphaFactor = alphaFactor; 88 | } 89 | 90 | public void setHover(boolean enabled) { 91 | mHover = enabled; 92 | } 93 | 94 | @Override 95 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 96 | super.onSizeChanged(w, h, oldw, oldh); 97 | mMaxRadius = (float) Math.sqrt(w * w + h * h); 98 | } 99 | 100 | private boolean mAnimationIsCancel; 101 | private Rect mRect; 102 | 103 | @Override 104 | public boolean onTouchEvent(final MotionEvent event) { 105 | Log.d("TouchEvent", String.valueOf(event.getActionMasked())); 106 | Log.d("mIsAnimating", String.valueOf(mIsAnimating)); 107 | Log.d("mAnimationIsCancel", String.valueOf(mAnimationIsCancel)); 108 | boolean superResult = super.onTouchEvent(event); 109 | if (event.getActionMasked() == MotionEvent.ACTION_DOWN 110 | && this.isEnabled() && mHover) { 111 | mRect = new Rect(getLeft(), getTop(), getRight(), getBottom()); 112 | mAnimationIsCancel = false; 113 | mDownX = event.getX(); 114 | mDownY = event.getY(); 115 | 116 | mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", 0, dp(50)) 117 | .setDuration(400); 118 | mRadiusAnimator 119 | .setInterpolator(new AccelerateDecelerateInterpolator()); 120 | mRadiusAnimator.addListener(new Animator.AnimatorListener() { 121 | @Override 122 | public void onAnimationStart(Animator animator) { 123 | mIsAnimating = true; 124 | } 125 | 126 | @Override 127 | public void onAnimationEnd(Animator animator) { 128 | setRadius(0); 129 | ViewHelper.setAlpha(RippleView.this, 1); 130 | mIsAnimating = false; 131 | } 132 | 133 | @Override 134 | public void onAnimationCancel(Animator animator) { 135 | 136 | } 137 | 138 | @Override 139 | public void onAnimationRepeat(Animator animator) { 140 | 141 | } 142 | }); 143 | mRadiusAnimator.start(); 144 | if (!superResult) { 145 | return true; 146 | } 147 | } else if (event.getActionMasked() == MotionEvent.ACTION_MOVE 148 | && this.isEnabled() && mHover) { 149 | mDownX = event.getX(); 150 | mDownY = event.getY(); 151 | 152 | // Cancel the ripple animation when moved outside 153 | if (mAnimationIsCancel = !mRect.contains( 154 | getLeft() + (int) event.getX(), 155 | getTop() + (int) event.getY())) { 156 | setRadius(0); 157 | } else { 158 | setRadius(dp(50)); 159 | } 160 | if (!superResult) { 161 | return true; 162 | } 163 | } else if (event.getActionMasked() == MotionEvent.ACTION_UP 164 | && !mAnimationIsCancel && this.isEnabled()) { 165 | mDownX = event.getX(); 166 | mDownY = event.getY(); 167 | 168 | final float tempRadius = (float) Math.sqrt(mDownX * mDownX + mDownY 169 | * mDownY); 170 | float targetRadius = Math.max(tempRadius, mMaxRadius); 171 | 172 | if (mIsAnimating) { 173 | mRadiusAnimator.cancel(); 174 | } 175 | mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", dp(50), 176 | targetRadius); 177 | mRadiusAnimator.setDuration(500); 178 | mRadiusAnimator 179 | .setInterpolator(new AccelerateDecelerateInterpolator()); 180 | mRadiusAnimator.addListener(new Animator.AnimatorListener() { 181 | @Override 182 | public void onAnimationStart(Animator animator) { 183 | mIsAnimating = true; 184 | } 185 | 186 | @Override 187 | public void onAnimationEnd(Animator animator) { 188 | setRadius(0); 189 | ViewHelper.setAlpha(RippleView.this, 1); 190 | mIsAnimating = false; 191 | } 192 | 193 | @Override 194 | public void onAnimationCancel(Animator animator) { 195 | 196 | } 197 | 198 | @Override 199 | public void onAnimationRepeat(Animator animator) { 200 | 201 | } 202 | }); 203 | mRadiusAnimator.start(); 204 | if (!superResult) { 205 | return true; 206 | } 207 | } 208 | return superResult; 209 | } 210 | 211 | public int adjustAlpha(int color, float factor) { 212 | int alpha = Math.round(Color.alpha(color) * factor); 213 | int red = Color.red(color); 214 | int green = Color.green(color); 215 | int blue = Color.blue(color); 216 | return Color.argb(alpha, red, green, blue); 217 | } 218 | 219 | public void setRadius(final float radius) { 220 | mRadius = radius; 221 | if (mRadius > 0) { 222 | mRadialGradient = new RadialGradient(mDownX, mDownY, mRadius, 223 | adjustAlpha(mRippleColor, mAlphaFactor), mRippleColor, 224 | Shader.TileMode.MIRROR); 225 | mPaint.setShader(mRadialGradient); 226 | } 227 | invalidate(); 228 | } 229 | 230 | private Path mPath = new Path(); 231 | 232 | @Override 233 | protected void onDraw(final Canvas canvas) { 234 | super.onDraw(canvas); 235 | 236 | if (isInEditMode()) { 237 | return; 238 | } 239 | 240 | canvas.save(Canvas.CLIP_SAVE_FLAG); 241 | 242 | mPath.reset(); 243 | mPath.addCircle(mDownX, mDownY, mRadius, Path.Direction.CW); 244 | 245 | canvas.clipPath(mPath); 246 | canvas.restore(); 247 | 248 | canvas.drawCircle(mDownX, mDownY, mRadius, mPaint); 249 | } 250 | 251 | } 252 | -------------------------------------------------------------------------------- /RippleViewExample/.gitignore: -------------------------------------------------------------------------------- 1 | /gen 2 | /bin 3 | /proguard-project.txt 4 | .project 5 | .classpath 6 | /.settings 7 | -------------------------------------------------------------------------------- /RippleViewExample/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RippleViewExample/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleViewExample/ic_launcher-web.png -------------------------------------------------------------------------------- /RippleViewExample/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../RippleView 16 | -------------------------------------------------------------------------------- /RippleViewExample/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleViewExample/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleViewExample/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleViewExample/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleViewExample/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleViewExample/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleViewExample/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/RippleViewExample/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /RippleViewExample/res/drawable/card_bk.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RippleViewExample/res/layout/activity_ripple_view.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 27 | 28 | -------------------------------------------------------------------------------- /RippleViewExample/res/menu/ripple_view.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RippleViewExample/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RippleViewExample/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /RippleViewExample/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /RippleViewExample/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /RippleViewExample/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RippleViewExample 5 | Hello world! 6 | Settings 7 | Click Me 8 | 9 | 10 | -------------------------------------------------------------------------------- /RippleViewExample/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /RippleViewExample/src/com/indris/sample/RippleViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.indris.sample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | import android.view.View; 8 | import android.widget.Toast; 9 | 10 | import com.indris.material.RippleView; 11 | 12 | 13 | public class RippleViewActivity extends Activity { 14 | 15 | RippleView mButton; 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_ripple_view); 20 | mButton = (RippleView) findViewById(R.id.btn); 21 | mButton.setOnClickListener(new View.OnClickListener() { 22 | 23 | @Override 24 | public void onClick(View v) { 25 | Toast.makeText(getApplicationContext(), "Ripples Yo! :D", Toast.LENGTH_LONG).show(); 26 | } 27 | }); 28 | } 29 | 30 | 31 | @Override 32 | public boolean onCreateOptionsMenu(Menu menu) { 33 | // Inflate the menu; this adds items to the action bar if it is present. 34 | getMenuInflater().inflate(R.menu.ripple_view, menu); 35 | return true; 36 | } 37 | 38 | @Override 39 | public boolean onOptionsItemSelected(MenuItem item) { 40 | // Handle action bar item clicks here. The action bar will 41 | // automatically handle clicks on the Home/Up button, so long 42 | // as you specify a parent activity in AndroidManifest.xml. 43 | int id = item.getItemId(); 44 | if (id == R.id.action_settings) { 45 | return true; 46 | } 47 | return super.onOptionsItemSelected(item); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Screens/Screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/Screens/Screen.gif -------------------------------------------------------------------------------- /Screens/ScreenOld.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siriscac/RippleView/f0eb3cbd8fef7031ccd41a92f0dd798d637c6031/Screens/ScreenOld.gif --------------------------------------------------------------------------------