├── .gitignore
├── LICENSE.txt
├── README.md
├── build.gradle
├── demo.gif
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── header.png
├── library
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── andexert
│ │ └── library
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── andexert
│ │ └── library
│ │ └── RippleView.java
│ └── res
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ └── styles.xml
├── sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── andexert
│ │ └── rippleeffect
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── andexert
│ │ └── rippleeffect
│ │ ├── CustomAdapter.java
│ │ ├── CustomListViewAdapter.java
│ │ ├── MainActivity.java
│ │ └── OnTapListener.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── drawable
│ ├── ic_profil_plus.png
│ ├── selector_row.xml
│ └── shape_example.xml
│ ├── layout
│ ├── activity_main_list.xml
│ ├── activity_main_recycler.xml
│ └── row_view.xml
│ ├── menu
│ └── main.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | #Android generated
2 | bin
3 | gen
4 |
5 | #Eclipse
6 | .project
7 | .classpath
8 | .settings
9 |
10 | #IntelliJ IDEA
11 | .idea
12 | *.iml
13 | *.ipr
14 | *.iws
15 | out
16 |
17 | #Gradle
18 | .gradle
19 | build
20 |
21 | #Maven
22 | target
23 | release.properties
24 | pom.xml.*
25 | project.properties
26 |
27 | #Ant
28 | build.xml
29 | local.properties
30 | gradle.properties
31 | proguard.cfg
32 |
33 | #OSX
34 | .DS_Store/
35 |
36 | # Crashlytics
37 | com_crashlytics_export_strings.xml
38 | crashlytics-build.properties
39 | crashlytics.properties
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Robin Chutaux
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | RippleEffect
2 | ================
3 |
4 | 
5 |
6 | ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a maximum of customization. [You can find a sample](https://github.com/traex/ExpandableLayout/blob/master/sample/) that how to use an ExpandableLayout to your layout.
7 |
8 | 
9 |
10 | ### Integration
11 | The lib is available on Maven Central, you can find it with [Gradle, please](http://gradleplease.appspot.com/#rippleeffect)
12 |
13 | ``` xml
14 |
15 | dependencies {
16 | compile 'com.github.traex.rippleeffect:library:1.3'
17 | }
18 |
19 | ```
20 |
21 | ### Usage
22 |
23 | #### RippleView
24 |
25 | Declare a RippleView inside your XML layout file with a content like an ImageView or whatever.
26 |
27 | ``` xml
28 |
35 |
36 |
43 |
44 |
45 | ```
46 |
47 | If you want to know when the Ripple effect is finished, you can set a listener on your view
48 | ``` java
49 | rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
50 |
51 | @Override
52 | public void onComplete(RippleView rippleView) {
53 | Log.d("Sample", "Ripple completed");
54 | }
55 |
56 | });
57 | ```
58 |
59 | If you want to add an `OnClickListener` don't forget to add it to the RippleView like this:
60 | ``` java
61 | final RippleView rippleView = (RippleView) findViewById(R.id.rippleView);
62 | rippleView.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | //TODO: onRippleViewClick
66 | }
67 | });
68 | ```
69 |
70 |
71 | ### Customization
72 |
73 | You can change several attributes in the XML file, you have to remove "rv_" if you are using a version below v1.1.1 :
74 |
75 | * app:rv_alpha [integer def:90 0-255] --> Alpha of the ripple
76 | * app:rv_framerate [integer def:10] --> Frame rate of the ripple animation
77 | * app:rv_rippleDuration [integer def:400] --> Duration of the ripple animation
78 | * app:rv_ripplePadding [dimension def:0] --> Add a padding to the ripple
79 | * app:rv_color [color def:@android:color/white] --> Color of the ripple
80 | * app:rv_centered [boolean def:false] --> Center ripple in the child view
81 | * app:rv_type [enum (simpleRipple, doubleRipple) def:simpleRipple] --> Simple or double ripple
82 | * app:rv_zoom [boolean def:false] --> Enable zoom animation
83 | * app:rv_zoomDuration [integer def:150] --> Duration of zoom animation
84 | * app:rv_zoomScale [float def:1.03] --> Scale of zoom animation
85 |
86 | For each attribute you can use getters and setters to change values dynamically.
87 |
88 | ### Troubleshooting
89 |
90 | If you want to use the double ripple you have to set a background for the RippleView or for its child.
91 |
92 | #### Acknowledgements
93 |
94 | Thanks to [Google](https://www.google.com/design/spec/material-design/introduction.html) for its Material Design :)
95 |
96 | ### MIT License
97 |
98 | ```
99 | The MIT License (MIT)
100 |
101 | Copyright (c) 2014 Robin Chutaux
102 |
103 | Permission is hereby granted, free of charge, to any person obtaining a copy
104 | of this software and associated documentation files (the "Software"), to deal
105 | in the Software without restriction, including without limitation the rights
106 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
107 | copies of the Software, and to permit persons to whom the Software is
108 | furnished to do so, subject to the following conditions:
109 |
110 | The above copyright notice and this permission notice shall be included in
111 | all copies or substantial portions of the Software.
112 |
113 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
114 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
115 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
116 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
117 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
118 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
119 | THE SOFTWARE.
120 | ```
121 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 |
17 | if (hasProperty("VERSION_NAME")) {
18 | version = VERSION_NAME
19 | group = GROUP
20 | }
21 | repositories {
22 | jcenter()
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/demo.gif
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Feb 23 23:24:33 CET 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/header.png
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | #Android generated
2 | bin
3 | gen
4 |
5 | #Eclipse
6 | .project
7 | .classpath
8 | .settings
9 |
10 | #IntelliJ IDEA
11 | .idea
12 | *.iml
13 | *.ipr
14 | *.iws
15 | out
16 |
17 | #Gradle
18 | .gradle
19 | build
20 |
21 | #Maven
22 | target
23 | release.properties
24 | pom.xml.*
25 | project.properties
26 |
27 | #Ant
28 | build.xml
29 | local.properties
30 | gradle.properties
31 | proguard.cfg
32 |
33 | #OSX
34 | .DS_Store/
35 |
36 | # Crashlytics
37 | com_crashlytics_export_strings.xml
38 | crashlytics-build.properties
39 | crashlytics.properties
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 23
10 | versionCode 9
11 | versionName "1.3"
12 | }
13 | lintOptions {
14 | abortOnError false
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | compile 'com.android.support:support-annotations:23.1.1'
27 | }
28 |
29 | if (hasProperty("VERSION_NAME"))
30 | {
31 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
32 | }
33 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:/Users/robin.chutaux/Documents/adt/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/andexert/library/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.andexert.library;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/java/com/andexert/library/RippleView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Robin Chutaux
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package com.andexert.library;
26 |
27 | import android.content.Context;
28 | import android.content.res.TypedArray;
29 | import android.graphics.Bitmap;
30 | import android.graphics.Canvas;
31 | import android.graphics.Color;
32 | import android.graphics.Paint;
33 | import android.graphics.PorterDuff;
34 | import android.graphics.PorterDuffXfermode;
35 | import android.graphics.Rect;
36 | import android.os.Build;
37 | import android.os.Handler;
38 | import android.support.annotation.ColorRes;
39 | import android.util.AttributeSet;
40 | import android.view.GestureDetector;
41 | import android.view.MotionEvent;
42 | import android.view.animation.Animation;
43 | import android.view.animation.ScaleAnimation;
44 | import android.widget.AdapterView;
45 | import android.widget.RelativeLayout;
46 |
47 |
48 | /**
49 | * RippleView custom layout
50 | *
51 | * Custom Layout that allows to use Ripple UI pattern above API 21
52 | *
53 | * @author Chutaux Robin
54 | * @version 2015.0512
55 | */
56 | public class RippleView extends RelativeLayout {
57 |
58 | private int WIDTH;
59 | private int HEIGHT;
60 | private int frameRate = 10;
61 | private int rippleDuration = 400;
62 | private int rippleAlpha = 90;
63 | private Handler canvasHandler;
64 | private float radiusMax = 0;
65 | private boolean animationRunning = false;
66 | private int timer = 0;
67 | private int timerEmpty = 0;
68 | private int durationEmpty = -1;
69 | private float x = -1;
70 | private float y = -1;
71 | private int zoomDuration;
72 | private float zoomScale;
73 | private ScaleAnimation scaleAnimation;
74 | private Boolean hasToZoom;
75 | private Boolean isCentered;
76 | private Integer rippleType;
77 | private Paint paint;
78 | private Bitmap originBitmap;
79 | private int rippleColor;
80 | private int ripplePadding;
81 | private GestureDetector gestureDetector;
82 | private final Runnable runnable = new Runnable() {
83 | @Override
84 | public void run() {
85 | invalidate();
86 | }
87 | };
88 |
89 | private OnRippleCompleteListener onCompletionListener;
90 |
91 | public RippleView(Context context) {
92 | super(context);
93 | }
94 |
95 | public RippleView(Context context, AttributeSet attrs) {
96 | super(context, attrs);
97 | init(context, attrs);
98 | }
99 |
100 | public RippleView(Context context, AttributeSet attrs, int defStyle) {
101 | super(context, attrs, defStyle);
102 | init(context, attrs);
103 | }
104 |
105 | /**
106 | * Method that initializes all fields and sets listeners
107 | *
108 | * @param context Context used to create this view
109 | * @param attrs Attribute used to initialize fields
110 | */
111 | private void init(final Context context, final AttributeSet attrs) {
112 | if (isInEditMode())
113 | return;
114 |
115 | final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
116 | rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.color.rippelColor));
117 | rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
118 | hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
119 | isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
120 | rippleDuration = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, rippleDuration);
121 | frameRate = typedArray.getInteger(R.styleable.RippleView_rv_framerate, frameRate);
122 | rippleAlpha = typedArray.getInteger(R.styleable.RippleView_rv_alpha, rippleAlpha);
123 | ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
124 | canvasHandler = new Handler();
125 | zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
126 | zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
127 | typedArray.recycle();
128 | paint = new Paint();
129 | paint.setAntiAlias(true);
130 | paint.setStyle(Paint.Style.FILL);
131 | paint.setColor(rippleColor);
132 | paint.setAlpha(rippleAlpha);
133 | this.setWillNotDraw(false);
134 |
135 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
136 | @Override
137 | public void onLongPress(MotionEvent event) {
138 | super.onLongPress(event);
139 | animateRipple(event);
140 | sendClickEvent(true);
141 | }
142 |
143 | @Override
144 | public boolean onSingleTapConfirmed(MotionEvent e) {
145 | return true;
146 | }
147 |
148 | @Override
149 | public boolean onSingleTapUp(MotionEvent e) {
150 | return true;
151 | }
152 | });
153 |
154 | this.setDrawingCacheEnabled(true);
155 | this.setClickable(true);
156 | }
157 |
158 | @Override
159 | public void draw(Canvas canvas) {
160 | super.draw(canvas);
161 | if (animationRunning) {
162 | canvas.save();
163 | if (rippleDuration <= timer * frameRate) {
164 | animationRunning = false;
165 | timer = 0;
166 | durationEmpty = -1;
167 | timerEmpty = 0;
168 | // There is problem on Android M where canvas.restore() seems to be called automatically
169 | // For now, don't call canvas.restore() manually on Android M (API 23)
170 | if(Build.VERSION.SDK_INT != 23) {
171 | canvas.restore();
172 | }
173 | invalidate();
174 | if (onCompletionListener != null) onCompletionListener.onComplete(this);
175 | return;
176 | } else
177 | canvasHandler.postDelayed(runnable, frameRate);
178 |
179 | if (timer == 0)
180 | canvas.save();
181 |
182 |
183 | canvas.drawCircle(x, y, (radiusMax * (((float) timer * frameRate) / rippleDuration)), paint);
184 |
185 | paint.setColor(Color.parseColor("#ffff4444"));
186 |
187 | if (rippleType == 1 && originBitmap != null && (((float) timer * frameRate) / rippleDuration) > 0.4f) {
188 | if (durationEmpty == -1)
189 | durationEmpty = rippleDuration - timer * frameRate;
190 |
191 | timerEmpty++;
192 | final Bitmap tmpBitmap = getCircleBitmap((int) ((radiusMax) * (((float) timerEmpty * frameRate) / (durationEmpty))));
193 | canvas.drawBitmap(tmpBitmap, 0, 0, paint);
194 | tmpBitmap.recycle();
195 | }
196 |
197 | paint.setColor(rippleColor);
198 |
199 | if (rippleType == 1) {
200 | if ((((float) timer * frameRate) / rippleDuration) > 0.6f)
201 | paint.setAlpha((int) (rippleAlpha - ((rippleAlpha) * (((float) timerEmpty * frameRate) / (durationEmpty)))));
202 | else
203 | paint.setAlpha(rippleAlpha);
204 | }
205 | else
206 | paint.setAlpha((int) (rippleAlpha - ((rippleAlpha) * (((float) timer * frameRate) / rippleDuration))));
207 |
208 | timer++;
209 | }
210 | }
211 |
212 | @Override
213 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
214 | super.onSizeChanged(w, h, oldw, oldh);
215 | WIDTH = w;
216 | HEIGHT = h;
217 |
218 | scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
219 | scaleAnimation.setDuration(zoomDuration);
220 | scaleAnimation.setRepeatMode(Animation.REVERSE);
221 | scaleAnimation.setRepeatCount(1);
222 | }
223 |
224 | /**
225 | * Launch Ripple animation for the current view with a MotionEvent
226 | *
227 | * @param event MotionEvent registered by the Ripple gesture listener
228 | */
229 | public void animateRipple(MotionEvent event) {
230 | createAnimation(event.getX(), event.getY());
231 | }
232 |
233 | /**
234 | * Launch Ripple animation for the current view centered at x and y position
235 | *
236 | * @param x Horizontal position of the ripple center
237 | * @param y Vertical position of the ripple center
238 | */
239 | public void animateRipple(final float x, final float y) {
240 | createAnimation(x, y);
241 | }
242 |
243 | /**
244 | * Create Ripple animation centered at x, y
245 | *
246 | * @param x Horizontal position of the ripple center
247 | * @param y Vertical position of the ripple center
248 | */
249 | private void createAnimation(final float x, final float y) {
250 | if (this.isEnabled() && !animationRunning) {
251 | if (hasToZoom)
252 | this.startAnimation(scaleAnimation);
253 |
254 | radiusMax = Math.max(WIDTH, HEIGHT);
255 |
256 | if (rippleType != 2)
257 | radiusMax /= 2;
258 |
259 | radiusMax -= ripplePadding;
260 |
261 | if (isCentered || rippleType == 1) {
262 | this.x = getMeasuredWidth() / 2;
263 | this.y = getMeasuredHeight() / 2;
264 | } else {
265 | this.x = x;
266 | this.y = y;
267 | }
268 |
269 | animationRunning = true;
270 |
271 | if (rippleType == 1 && originBitmap == null)
272 | originBitmap = getDrawingCache(true);
273 |
274 | invalidate();
275 | }
276 | }
277 |
278 | @Override
279 | public boolean onTouchEvent(MotionEvent event) {
280 | if (gestureDetector.onTouchEvent(event)) {
281 | animateRipple(event);
282 | sendClickEvent(false);
283 | }
284 | return super.onTouchEvent(event);
285 | }
286 |
287 | @Override
288 | public boolean onInterceptTouchEvent(MotionEvent event) {
289 | this.onTouchEvent(event);
290 | return super.onInterceptTouchEvent(event);
291 | }
292 |
293 | /**
294 | * Send a click event if parent view is a Listview instance
295 | *
296 | * @param isLongClick Is the event a long click ?
297 | */
298 | private void sendClickEvent(final Boolean isLongClick) {
299 | if (getParent() instanceof AdapterView) {
300 | final AdapterView adapterView = (AdapterView) getParent();
301 | final int position = adapterView.getPositionForView(this);
302 | final long id = adapterView.getItemIdAtPosition(position);
303 | if (isLongClick) {
304 | if (adapterView.getOnItemLongClickListener() != null)
305 | adapterView.getOnItemLongClickListener().onItemLongClick(adapterView, this, position, id);
306 | } else {
307 | if (adapterView.getOnItemClickListener() != null)
308 | adapterView.getOnItemClickListener().onItemClick(adapterView, this, position, id);
309 | }
310 | }
311 | }
312 |
313 | private Bitmap getCircleBitmap(final int radius) {
314 | final Bitmap output = Bitmap.createBitmap(originBitmap.getWidth(), originBitmap.getHeight(), Bitmap.Config.ARGB_8888);
315 | final Canvas canvas = new Canvas(output);
316 | final Paint paint = new Paint();
317 | final Rect rect = new Rect((int)(x - radius), (int)(y - radius), (int)(x + radius), (int)(y + radius));
318 |
319 | paint.setAntiAlias(true);
320 | canvas.drawARGB(0, 0, 0, 0);
321 | canvas.drawCircle(x, y, radius, paint);
322 |
323 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
324 | canvas.drawBitmap(originBitmap, rect, rect, paint);
325 |
326 | return output;
327 | }
328 |
329 | /**
330 | * Set Ripple color, default is #FFFFFF
331 | *
332 | * @param rippleColor New color resource
333 | */
334 | @ColorRes
335 | public void setRippleColor(int rippleColor) {
336 | this.rippleColor = getResources().getColor(rippleColor);
337 | }
338 |
339 | public int getRippleColor() {
340 | return rippleColor;
341 | }
342 |
343 | public RippleType getRippleType()
344 | {
345 | return RippleType.values()[rippleType];
346 | }
347 |
348 | /**
349 | * Set Ripple type, default is RippleType.SIMPLE
350 | *
351 | * @param rippleType New Ripple type for next animation
352 | */
353 | public void setRippleType(final RippleType rippleType)
354 | {
355 | this.rippleType = rippleType.ordinal();
356 | }
357 |
358 | public Boolean isCentered()
359 | {
360 | return isCentered;
361 | }
362 |
363 | /**
364 | * Set if ripple animation has to be centered in its parent view or not, default is False
365 | *
366 | * @param isCentered
367 | */
368 | public void setCentered(final Boolean isCentered)
369 | {
370 | this.isCentered = isCentered;
371 | }
372 |
373 | public int getRipplePadding()
374 | {
375 | return ripplePadding;
376 | }
377 |
378 | /**
379 | * Set Ripple padding if you want to avoid some graphic glitch
380 | *
381 | * @param ripplePadding New Ripple padding in pixel, default is 0px
382 | */
383 | public void setRipplePadding(int ripplePadding)
384 | {
385 | this.ripplePadding = ripplePadding;
386 | }
387 |
388 | public Boolean isZooming()
389 | {
390 | return hasToZoom;
391 | }
392 |
393 | /**
394 | * At the end of Ripple effect, the child views has to zoom
395 | *
396 | * @param hasToZoom Do the child views have to zoom ? default is False
397 | */
398 | public void setZooming(Boolean hasToZoom)
399 | {
400 | this.hasToZoom = hasToZoom;
401 | }
402 |
403 | public float getZoomScale()
404 | {
405 | return zoomScale;
406 | }
407 |
408 | /**
409 | * Scale of the end animation
410 | *
411 | * @param zoomScale Value of scale animation, default is 1.03f
412 | */
413 | public void setZoomScale(float zoomScale)
414 | {
415 | this.zoomScale = zoomScale;
416 | }
417 |
418 | public int getZoomDuration()
419 | {
420 | return zoomDuration;
421 | }
422 |
423 | /**
424 | * Duration of the ending animation in ms
425 | *
426 | * @param zoomDuration Duration, default is 200ms
427 | */
428 | public void setZoomDuration(int zoomDuration)
429 | {
430 | this.zoomDuration = zoomDuration;
431 | }
432 |
433 | public int getRippleDuration()
434 | {
435 | return rippleDuration;
436 | }
437 |
438 | /**
439 | * Duration of the Ripple animation in ms
440 | *
441 | * @param rippleDuration Duration, default is 400ms
442 | */
443 | public void setRippleDuration(int rippleDuration)
444 | {
445 | this.rippleDuration = rippleDuration;
446 | }
447 |
448 | public int getFrameRate()
449 | {
450 | return frameRate;
451 | }
452 |
453 | /**
454 | * Set framerate for Ripple animation
455 | *
456 | * @param frameRate New framerate value, default is 10
457 | */
458 | public void setFrameRate(int frameRate)
459 | {
460 | this.frameRate = frameRate;
461 | }
462 |
463 | public int getRippleAlpha()
464 | {
465 | return rippleAlpha;
466 | }
467 |
468 | /**
469 | * Set alpha for ripple effect color
470 | *
471 | * @param rippleAlpha Alpha value between 0 and 255, default is 90
472 | */
473 | public void setRippleAlpha(int rippleAlpha)
474 | {
475 | this.rippleAlpha = rippleAlpha;
476 | }
477 |
478 | public void setOnRippleCompleteListener(OnRippleCompleteListener listener) {
479 | this.onCompletionListener = listener;
480 | }
481 |
482 | /**
483 | * Defines a callback called at the end of the Ripple effect
484 | */
485 | public interface OnRippleCompleteListener {
486 | void onComplete(RippleView rippleView);
487 | }
488 |
489 | public enum RippleType {
490 | SIMPLE(0),
491 | DOUBLE(1),
492 | RECTANGLE(2);
493 |
494 | int type;
495 |
496 | RippleType(int type)
497 | {
498 | this.type = type;
499 | }
500 | }
501 | }
502 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/library/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
27 | #FFFFFF
28 |
--------------------------------------------------------------------------------
/library/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | #Android generated
2 | bin
3 | gen
4 |
5 | #Eclipse
6 | .project
7 | .classpath
8 | .settings
9 |
10 | #IntelliJ IDEA
11 | .idea
12 | *.iml
13 | *.ipr
14 | *.iws
15 | out
16 |
17 | #Gradle
18 | .gradle
19 | build
20 |
21 | #Maven
22 | target
23 | release.properties
24 | pom.xml.*
25 | project.properties
26 |
27 | #Ant
28 | build.xml
29 | local.properties
30 | gradle.properties
31 | proguard.cfg
32 |
33 | #OSX
34 | .DS_Store/
35 |
36 | # Crashlytics
37 | com_crashlytics_export_strings.xml
38 | crashlytics-build.properties
39 | crashlytics.properties
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion '23.0.1'
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName '1.0'
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | lintOptions {
20 | abortOnError false
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | compile project(':library')
27 | compile 'com.android.support:appcompat-v7:23.0.1'
28 | compile 'com.android.support:palette-v7:23.0.1'
29 | compile 'com.android.support:recyclerview-v7:23.0.1'
30 | compile 'com.android.support:support-v4:23.0.1'
31 | compile 'com.squareup.picasso:picasso:2.5.1'
32 | }
33 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\robin.chutaux\Documents\adt\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/com/andexert/rippleeffect/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.andexert.rippleeffect;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/andexert/rippleeffect/CustomAdapter.java:
--------------------------------------------------------------------------------
1 | package com.andexert.rippleeffect;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import java.util.ArrayList;
10 |
11 | /**
12 | * Created by TraeX on 24/10/14.
13 | */
14 | public class CustomAdapter extends RecyclerView.Adapter
15 | {
16 | private final ArrayList textArrayList;
17 | private OnTapListener onTapListener;
18 |
19 | public CustomAdapter()
20 | {
21 | this.textArrayList = new ArrayList();
22 | }
23 |
24 | @Override
25 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i)
26 | {
27 | View v = LayoutInflater.from(viewGroup.getContext())
28 | .inflate(R.layout.row_view, null);
29 |
30 | return new ViewHolder(v);
31 | }
32 |
33 | @Override
34 | public void onBindViewHolder(ViewHolder viewHolder, final int i)
35 | {
36 | viewHolder.itemView.setOnClickListener(new View.OnClickListener()
37 | {
38 | @Override
39 | public void onClick(View v)
40 | {
41 | if (onTapListener != null)
42 | onTapListener.onTapView(i);
43 | }
44 | });
45 | viewHolder.textView.setText(textArrayList.get(i));
46 | }
47 |
48 | @Override
49 | public int getItemCount()
50 | {
51 | return textArrayList.size();
52 | }
53 |
54 | public static class ViewHolder extends RecyclerView.ViewHolder
55 | {
56 | TextView textView;
57 |
58 | public ViewHolder(View v)
59 | {
60 | super(v);
61 | textView = (TextView) v.findViewById(R.id.text);
62 | }
63 | }
64 |
65 | public void updateList(ArrayList stringArrayList)
66 | {
67 | this.textArrayList.clear();
68 | this.textArrayList.addAll(stringArrayList);
69 | this.notifyDataSetChanged();
70 | }
71 |
72 | public void setOnTapListener(OnTapListener onTapListener)
73 | {
74 | this.onTapListener = onTapListener;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/andexert/rippleeffect/CustomListViewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Robin Chutaux
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package com.andexert.rippleeffect;
26 |
27 | import android.content.Context;
28 | import android.view.LayoutInflater;
29 | import android.view.View;
30 | import android.view.ViewGroup;
31 | import android.widget.BaseAdapter;
32 | import android.widget.TextView;
33 |
34 | import java.util.ArrayList;
35 |
36 | /**
37 | * Author : Chutaux Robin
38 | * Date : 1/6/2015
39 | */
40 | public class CustomListViewAdapter extends BaseAdapter
41 | {
42 | private final ArrayList textArrayList;
43 | private final LayoutInflater layoutInflater;
44 |
45 | public CustomListViewAdapter(final Context context)
46 | {
47 | this.layoutInflater = LayoutInflater.from(context);
48 | this.textArrayList = new ArrayList<>();
49 | }
50 |
51 | @Override
52 | public int getCount()
53 | {
54 | return textArrayList.size();
55 | }
56 |
57 | @Override
58 | public String getItem(int position)
59 | {
60 | return textArrayList.get(position);
61 | }
62 |
63 | @Override
64 | public long getItemId(int position)
65 | {
66 | return position;
67 | }
68 |
69 | @Override
70 | public View getView(int position, View convertView, ViewGroup parent)
71 | {
72 | ViewHolder viewHolder;
73 |
74 | if (convertView == null)
75 | {
76 | convertView = layoutInflater.inflate(R.layout.row_view, parent, false);
77 | viewHolder = new ViewHolder(convertView);
78 | convertView.setTag(viewHolder);
79 | }
80 | else
81 | {
82 | viewHolder = (ViewHolder) convertView.getTag();
83 | }
84 |
85 | viewHolder.textView.setText(textArrayList.get(position));
86 |
87 | return convertView;
88 | }
89 |
90 | public void updateList(ArrayList stringArrayList)
91 | {
92 | this.textArrayList.clear();
93 | this.textArrayList.addAll(stringArrayList);
94 | this.notifyDataSetChanged();
95 | }
96 |
97 | private class ViewHolder
98 | {
99 | TextView textView;
100 |
101 | public ViewHolder(View v)
102 | {
103 | textView = (TextView) v.findViewById(R.id.text);
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/andexert/rippleeffect/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.andexert.rippleeffect;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.ActionBarActivity;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.widget.AdapterView;
13 | import android.widget.ListView;
14 | import android.widget.TextView;
15 |
16 | import com.andexert.library.RippleView;
17 |
18 | import java.util.ArrayList;
19 |
20 |
21 | public class MainActivity extends ActionBarActivity
22 | {
23 | private final Boolean isRecyclerview = false;
24 | private ArrayList sourcesArrayList = new ArrayList();
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | if (isRecyclerview)
30 | setContentView(R.layout.activity_main_recycler);
31 | else
32 | setContentView(R.layout.activity_main_list);
33 |
34 | final RippleView rippleView = (RippleView) findViewById(R.id.rect);
35 | final TextView textView = (TextView) findViewById(R.id.rect_child);
36 | final Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
37 |
38 | setSupportActionBar(toolbar);
39 |
40 | rippleView.setOnClickListener(new View.OnClickListener()
41 | {
42 | @Override
43 | public void onClick(View v)
44 | {
45 | Log.e("Sample", "Click Rect !");
46 | }
47 | });
48 | rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
49 | @Override
50 | public void onComplete(RippleView rippleView) {
51 | Log.d("Sample", "Ripple completed");
52 | }
53 | });
54 | textView.setOnClickListener(new View.OnClickListener()
55 | {
56 | @Override
57 | public void onClick(View v)
58 | {
59 | Log.e("Sample", "Click rect child !");
60 | }
61 | });
62 |
63 | sourcesArrayList.add("Samsung");
64 | sourcesArrayList.add("Android");
65 | sourcesArrayList.add("Google");
66 | sourcesArrayList.add("Asus");
67 | sourcesArrayList.add("Apple");
68 | sourcesArrayList.add("Samsung");
69 | sourcesArrayList.add("Android");
70 | sourcesArrayList.add("Google");
71 | sourcesArrayList.add("Asus");
72 | sourcesArrayList.add("Apple");
73 | sourcesArrayList.add("Samsung");
74 | sourcesArrayList.add("Android");
75 | sourcesArrayList.add("Google");
76 | sourcesArrayList.add("Asus");
77 | sourcesArrayList.add("Apple");
78 |
79 |
80 | if (isRecyclerview)
81 | {
82 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
83 | recyclerView.setHasFixedSize(true);
84 | RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
85 | recyclerView.setLayoutManager(layoutManager);
86 |
87 | CustomAdapter customAdapter = new CustomAdapter();
88 | customAdapter.updateList(sourcesArrayList);
89 |
90 | customAdapter.setOnTapListener(new OnTapListener()
91 | {
92 | @Override
93 | public void onTapView(int position)
94 | {
95 | Log.e("MainActivity", "Tap item : " + position);
96 | }
97 | });
98 | recyclerView.setAdapter(customAdapter);
99 | }
100 | else
101 | {
102 | ListView listView = (ListView) findViewById(R.id.listview);
103 | CustomListViewAdapter customListViewAdapter = new CustomListViewAdapter(this);
104 | customListViewAdapter.updateList(sourcesArrayList);
105 | listView.setAdapter(customListViewAdapter);
106 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
107 | {
108 | @Override
109 | public void onItemClick(AdapterView> parent, View view, int position, long id)
110 | {
111 | Log.e("MainActivity", "ListView tap item : " + position);
112 | }
113 | });
114 | }
115 | }
116 |
117 |
118 | @Override
119 | public boolean onCreateOptionsMenu(Menu menu) {
120 | // Inflate the menu; this adds items to the action bar if it is present.
121 | getMenuInflater().inflate(R.menu.main, menu);
122 | return true;
123 | }
124 |
125 | @Override
126 | public boolean onOptionsItemSelected(MenuItem item) {
127 | // Handle action bar item clicks here. The action bar will
128 | // automatically handle clicks on the Home/Up button, so long
129 | // as you specify a parent activity in AndroidManifest.xml.
130 | int id = item.getItemId();
131 |
132 | //noinspection SimplifiableIfStatement
133 | if (id == R.id.action_settings) {
134 | return true;
135 | }
136 |
137 | return super.onOptionsItemSelected(item);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/andexert/rippleeffect/OnTapListener.java:
--------------------------------------------------------------------------------
1 | package com.andexert.rippleeffect;
2 |
3 | /**
4 | * Created by TraeX on 24/10/14.
5 | */
6 | public interface OnTapListener
7 | {
8 | public void onTapView(int position);
9 | }
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/sample/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/sample/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/sample/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/sample/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_profil_plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/traex/RippleEffect/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/sample/src/main/res/drawable/ic_profil_plus.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/selector_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/shape_example.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
27 | -
28 |
29 |
30 |
31 |
32 | -
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main_list.xml:
--------------------------------------------------------------------------------
1 |
24 |
25 |
31 |
32 |
37 |
38 |
41 |
42 |
50 |
51 |
52 |
53 |
60 |
67 |
68 |
69 |
76 |
83 |
84 |
85 |
86 |
87 |
88 |
99 |
100 |
110 |
111 |
112 |
113 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main_recycler.xml:
--------------------------------------------------------------------------------
1 |
24 |
25 |
31 |
32 |
37 |
38 |
41 |
42 |
50 |
51 |
52 |
53 |
60 |
67 |
68 |
69 |
76 |
83 |
84 |
85 |
86 |
87 |
88 |
99 |
100 |
110 |
111 |
112 |
113 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/row_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
21 |
22 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | RippleEffect
5 | Hello world!
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':library', ':sample'
2 |
--------------------------------------------------------------------------------