├── .gitignore ├── .travis.yml ├── README.md ├── app ├── .gitignore ├── Screenshots │ ├── sb1.png │ ├── sb2.png │ ├── sb3.png │ └── sb4.png ├── build.gradle ├── dribbble_gif.gif ├── phone_gif.gif ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── pa1pal │ │ └── sendbutton │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── pa1pal │ │ │ └── sendbutton │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ ├── app_icon.png │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── app_icon.png │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── pa1pal │ └── sendbutton │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── pa1pal │ │ └── sendbutton │ │ └── lib │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── pa1pal │ │ │ └── sendbutton │ │ │ └── lib │ │ │ └── SendButton.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── pa1pal │ └── sendbutton │ └── lib │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | /.idea/ 10 | 11 | 12 | # Built application files 13 | *.apk 14 | *.ap_ 15 | 16 | # Files for the Dalvik VM 17 | *.dex 18 | 19 | # Java class files 20 | *.class 21 | 22 | # Generated files 23 | bin/ 24 | gen/ 25 | 26 | # Gradle files 27 | .gradle/ 28 | build/ 29 | 30 | # Local configuration file (sdk path, etc) 31 | local.properties 32 | 33 | # Proguard folder generated by Eclipse 34 | proguard/ 35 | 36 | # Log Files 37 | *.log 38 | 39 | # Android Studio Navigation editor temp files 40 | .navigation/ 41 | 42 | # Android Studio captures folder 43 | captures/ 44 | 45 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 46 | 47 | *.iml 48 | 49 | ## Directory-based project format: 50 | .idea/ 51 | # if you remove the above rule, at least ignore the following: 52 | 53 | # User-specific stuff: 54 | # .idea/workspace.xml 55 | # .idea/tasks.xml 56 | # .idea/dictionaries 57 | # .idea/shelf 58 | 59 | # Sensitive or high-churn files: 60 | # .idea/dataSources.ids 61 | # .idea/dataSources.xml 62 | # .idea/sqlDataSources.xml 63 | # .idea/dynamic.xml 64 | # .idea/uiDesigner.xml 65 | 66 | # Gradle: 67 | # .idea/gradle.xml 68 | # .idea/libraries 69 | 70 | # Mongo Explorer plugin: 71 | # .idea/mongoSettings.xml 72 | 73 | ## File-based project format: 74 | *.ipr 75 | *.iws 76 | 77 | ## Plugin-specific files: 78 | 79 | # IntelliJ 80 | /out/ 81 | 82 | # mpeltonen/sbt-idea plugin 83 | .idea_modules/ 84 | 85 | # JIRA plugin 86 | atlassian-ide-plugin.xml 87 | 88 | # Crashlytics plugin (for Android Studio and IntelliJ) 89 | com_crashlytics_export_strings.xml 90 | crashlytics.properties 91 | crashlytics-build.properties 92 | fabric.properties 93 | 94 | *~* 95 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: android 3 | 4 | branches: 5 | only: 6 | - master 7 | 8 | script: "./gradlew clean assembleDebug" 9 | 10 | android: 11 | components: 12 | - platform-tools 13 | - tools 14 | - build-tools-23.0.2 15 | - android-23 16 | - extra-android-m2repository -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SendButton 2 | [![Build Status](https://travis-ci.org/pa1pal/SendButton.svg?branch=master)](https://travis-ci.org/pa1pal/SendButton) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SendButton-green.svg?style=true)](https://android-arsenal.com/details/1/3039) 3 | 4 | Send Button Custom View for chatting application. 5 | The custom view developed by drawing path over the coordinates of the figure. And the animation done by continously changing the coordinates in one direction. 6 | 7 | ![Phone Screenshot](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/phone_gif.gif) 8 | ![Dribble GIF](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/dribbble_gif.gif) 9 | 10 | This repository is the demo of the original idea by Kirill Semushin on Dribbble : https://dribbble.com/shots/2446891-Send-Button 11 | 12 | # Demo 13 | Demo apk is available in [Releases](https://github.com/pa1pal/SendButton/releases) 14 | 15 | # Usage 16 | 17 | Add dependency 18 | ```gradle 19 | dependencies { 20 | compile 'pa1pal.sendbutton.lib:lib:1.0' 21 | } 22 | ``` 23 | ```xml 24 | xmlns:app="http://schemas.android.com/apk/res-auto" 25 | ``` 26 | 27 | ```xml 28 | 38 | ``` 39 | 40 | # Customization 41 | ## Attributes 42 | ```xml 43 | * Button Color format="color" 44 | * Plane Color format="color" 45 | * ButtonSide format="dimension" 46 | * Border Stroke Width format="integer" 47 | * Plane Stroke Width format="integer" 48 | * Animation type format="enum" 49 | * Duration format="integer" 50 | ``` 51 | ### Examples 52 | ![](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/Screenshots/sb1.png) 53 | ![](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/Screenshots/sb2.png) 54 | ![](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/Screenshots/sb3.png) 55 | ![](https://raw.githubusercontent.com/pa1pal/SendButton/master/app/Screenshots/sb4.png) 56 | 57 | The MIT License 58 | =============== 59 | 60 | Copyright (c) [2016] [Pawan Pal, Devesh Khandelwal] 61 | 62 | Permission is hereby granted, free of charge, to any person obtaining a copy 63 | of this software and associated documentation files (the "Software"), to deal 64 | in the Software without restriction, including without limitation the rights 65 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 66 | copies of the Software, and to permit persons to whom the Software is 67 | furnished to do so, subject to the following conditions: 68 | 69 | The above copyright notice and this permission notice shall be included in all 70 | copies or substantial portions of the Software. 71 | 72 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 73 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 74 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 75 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 76 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 77 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 78 | SOFTWARE. 79 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/Screenshots/sb1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/Screenshots/sb1.png -------------------------------------------------------------------------------- /app/Screenshots/sb2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/Screenshots/sb2.png -------------------------------------------------------------------------------- /app/Screenshots/sb3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/Screenshots/sb3.png -------------------------------------------------------------------------------- /app/Screenshots/sb4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/Screenshots/sb4.png -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | buildToolsVersion "27.0.1" 6 | 7 | defaultConfig { 8 | applicationId "pa1pal.sendbutton" 9 | minSdkVersion 15 10 | targetSdkVersion 27 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:27.0.2' 26 | compile 'com.jakewharton:butterknife:8.8.1' 27 | compile project(':lib') 28 | } 29 | -------------------------------------------------------------------------------- /app/dribbble_gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/dribbble_gif.gif -------------------------------------------------------------------------------- /app/phone_gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/phone_gif.gif -------------------------------------------------------------------------------- /app/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 /Users/pa1pal/Library/Android/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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/pa1pal/sendbutton/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase 10 | { 11 | public ApplicationTest() 12 | { 13 | super(Application.class); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/pa1pal/sendbutton/MainActivity.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import butterknife.BindView; 7 | import butterknife.ButterKnife; 8 | 9 | public class MainActivity extends AppCompatActivity 10 | { 11 | @BindView(R.id.send_button) 12 | pa1pal.sendbutton.lib.SendButton send_button; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) 16 | { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | ButterKnife.bind(this); 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-mdpi/app_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-xhdpi/app_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #F6A10C 7 | #454545 8 | #fff 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SendButton 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/pa1pal/sendbutton/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest 11 | { 12 | @Test 13 | public void addition_isCorrect() throws Exception 14 | { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /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 | maven { 7 | url 'https://maven.google.com/' 8 | name 'Google' 9 | } 10 | } 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:2.2.3' 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | jcenter() 22 | maven { 23 | url 'https://maven.google.com/' 24 | name 'Google' 25 | } 26 | } 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pa1pal/SendButton/99acb16dbdab6519d8d9967faa40527c1ea9d99f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jun 23 18:07:10 IST 2018 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-3.5-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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 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 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.1.1' 25 | compile 'com.jakewharton:butterknife:7.0.1' 26 | } 27 | -------------------------------------------------------------------------------- /lib/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 F:\utils\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 | -------------------------------------------------------------------------------- /lib/src/androidTest/java/pa1pal/sendbutton/lib/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton.lib; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase 10 | { 11 | public ApplicationTest() 12 | { 13 | super(Application.class); 14 | } 15 | } -------------------------------------------------------------------------------- /lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/src/main/java/pa1pal/sendbutton/lib/SendButton.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton.lib; 2 | 3 | import android.animation.ValueAnimator; 4 | import android.content.Context; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Canvas; 7 | import android.graphics.Color; 8 | import android.graphics.Paint; 9 | import android.graphics.Path; 10 | import android.graphics.Point; 11 | import android.graphics.RectF; 12 | import android.support.v4.view.animation.FastOutLinearInInterpolator; 13 | import android.support.v4.view.animation.FastOutSlowInInterpolator; 14 | import android.support.v4.view.animation.LinearOutSlowInInterpolator; 15 | import android.util.AttributeSet; 16 | import android.util.Log; 17 | import android.view.View; 18 | import android.view.animation.AccelerateDecelerateInterpolator; 19 | import android.view.animation.AccelerateInterpolator; 20 | import android.view.animation.AnticipateInterpolator; 21 | import android.view.animation.AnticipateOvershootInterpolator; 22 | import android.view.animation.BounceInterpolator; 23 | import android.view.animation.DecelerateInterpolator; 24 | import android.view.animation.LinearInterpolator; 25 | import android.view.animation.OvershootInterpolator; 26 | 27 | /** 28 | * Created by Pawan Kumar Pal on 14/01/16. 29 | * Modified by Devesh Khandelwal on 18/01/16. 30 | */ 31 | public class SendButton extends View 32 | { 33 | private String LOGTAG = getClass().getSimpleName(); 34 | 35 | int flag = 0; 36 | Point a, b, c, d, e; 37 | Path mOutlinePath, mPlanePath; 38 | int mButtonColor, mButtonSide, mBorderStrokeWidth, mPlaneStrokeWidth, mPlaneColor; 39 | Paint mBackgroundPaint, mPlanePaint; 40 | ValueAnimator mPlaneAnimator; 41 | long mDuration; 42 | AnimationType mAnimationType; 43 | 44 | 45 | public SendButton(Context context, AttributeSet attrs) 46 | { 47 | super(context, attrs); 48 | 49 | TypedArray a = context.getTheme().obtainStyledAttributes( 50 | attrs, 51 | R.styleable.SendButton, 52 | 0, 0); 53 | try 54 | { 55 | mButtonColor = a.getColor(R.styleable.SendButton_buttonColor, Color.WHITE); 56 | mButtonSide = a.getDimensionPixelSize(R.styleable.SendButton_buttonSide, 200); 57 | mBorderStrokeWidth = a.getInteger(R.styleable.SendButton_borderStrokeWidth, 5); 58 | mPlaneStrokeWidth = a.getInteger(R.styleable.SendButton_planeStrokeWidth, 5); 59 | mPlaneColor = a.getColor(R.styleable.SendButton_planeColor, getResources().getColor(R.color.orange)); 60 | mAnimationType = AnimationType.values()[a.getInteger(R.styleable 61 | .SendButton_animationType, 0)]; 62 | mDuration = a.getInteger(R.styleable.SendButton_duration, 3000); 63 | } 64 | catch (Exception e) 65 | { 66 | e.printStackTrace(); 67 | } 68 | finally 69 | { 70 | a.recycle(); 71 | } 72 | 73 | init(); 74 | } 75 | 76 | private void init() 77 | { 78 | mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); 79 | mPlanePaint = new Paint(Paint.ANTI_ALIAS_FLAG); 80 | mBackgroundPaint.setStyle(Paint.Style.STROKE); 81 | mPlanePaint.setStrokeWidth(mPlaneStrokeWidth); 82 | mBackgroundPaint.setStrokeWidth(mBorderStrokeWidth); 83 | mBackgroundPaint.setColor(mButtonColor); 84 | mOutlinePath = new Path(); 85 | mPlanePath = new Path(); 86 | mPlaneAnimator = ValueAnimator.ofInt(0, 75); 87 | mPlaneAnimator.setDuration(mDuration); 88 | mPlaneAnimator.setRepeatMode(ValueAnimator.RESTART); 89 | mPlaneAnimator.setRepeatCount(ValueAnimator.INFINITE); 90 | 91 | switch (mAnimationType) 92 | { 93 | case LINEAR: 94 | mPlaneAnimator.setInterpolator(new LinearInterpolator()); 95 | break; 96 | case ANTICIPATE: 97 | mPlaneAnimator.setInterpolator(new AnticipateInterpolator()); 98 | break; 99 | case ANTICIPATE_OVERSHOOT: 100 | mPlaneAnimator.setInterpolator(new AnticipateOvershootInterpolator()); 101 | break; 102 | case ACCELERATE: 103 | mPlaneAnimator.setInterpolator(new AccelerateInterpolator()); 104 | break; 105 | case ACCELERATE_DECELERATE: 106 | mPlaneAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); 107 | break; 108 | case BOUNCE: 109 | mPlaneAnimator.setInterpolator(new BounceInterpolator()); 110 | break; 111 | case DECELERATE: 112 | mPlaneAnimator.setInterpolator(new DecelerateInterpolator()); 113 | break; 114 | case FASTOUTLINEARIN: 115 | mPlaneAnimator.setInterpolator(new FastOutLinearInInterpolator()); 116 | break; 117 | case FASTOUTSLOWIN: 118 | mPlaneAnimator.setInterpolator(new FastOutSlowInInterpolator()); 119 | break; 120 | case LINEAROUTSLOWIN: 121 | mPlaneAnimator.setInterpolator(new LinearOutSlowInInterpolator()); 122 | break; 123 | case OVERSHOOT: 124 | mPlaneAnimator.setInterpolator(new OvershootInterpolator()); 125 | break; 126 | } 127 | 128 | mPlaneAnimator.start(); 129 | 130 | /** 131 | * The coordinates position calculated by percentage of button side. 132 | */ 133 | a = new Point((mButtonSide * 10) / 100, (mButtonSide * 55) / 100); // Point a : (10% of mButtonSide, 55% of mButtonSide) 134 | b = new Point((mButtonSide * 80) / 100, (mButtonSide * 20) / 100); // Point b : (80% of mButtonSide, 20% of mButtonSide) 135 | c = new Point((mButtonSide * 45) / 100, (mButtonSide * 90) / 100); // Point c : (45% of mButtonSide, 90% of mButtonSide) 136 | d = new Point((mButtonSide * 30) / 100, (mButtonSide * 70) / 100); // Point d : (30% of mButtonSide, 70% of mButtonSide) 137 | e = new Point(mButtonSide / 2, mButtonSide / 2); // Point e : (10% of mButtonSide, 55% of mButtonSide) 138 | 139 | } 140 | 141 | @Override 142 | protected void onDraw(Canvas canvas) 143 | { 144 | super.onDraw(canvas); 145 | mBackgroundPaint.setAlpha(255); 146 | mOutlinePath.addRoundRect(new RectF(0, 0, mButtonSide, mButtonSide), 147 | mButtonSide / 3, mButtonSide / 3, Path.Direction.CCW); 148 | canvas.drawPath(mOutlinePath, mBackgroundPaint); 149 | canvas.clipPath(mOutlinePath); 150 | // for different color of Fill and Stroke, 151 | // first painted in Fill style and then Stroke style with different color 152 | mPlanePaint.setStyle(Paint.Style.FILL); 153 | mPlanePaint.setColor(mPlaneColor); 154 | mPlanePaint.setAlpha(255 - ((int) mPlaneAnimator.getAnimatedValue() * 25) / 10); 155 | translate(); 156 | setPath(); 157 | canvas.drawPath(mPlanePath, mPlanePaint); 158 | mPlanePaint.setStyle(Paint.Style.STROKE); 159 | mPlanePaint.setColor(Color.WHITE); 160 | mPlanePaint.setAlpha(255 - ((int) mPlaneAnimator.getAnimatedValue() * 25) / 10); 161 | canvas.drawPath(mPlanePath, mPlanePaint); 162 | } 163 | 164 | public void setPath() 165 | { 166 | mPlanePath = new Path(); 167 | 168 | mPlanePath.moveTo(a.x, a.y); //Set the starting point to A 169 | mPlanePath.lineTo(a.x, a.y); 170 | mPlanePath.lineTo(b.x, b.y); 171 | mPlanePath.lineTo(c.x, c.y); 172 | mPlanePath.lineTo(d.x, d.y); 173 | mPlanePath.lineTo(e.x, e.y); 174 | mPlanePath.lineTo(d.x, d.y); 175 | mPlanePath.lineTo(a.x, a.y); 176 | } 177 | 178 | private void translate() 179 | { 180 | a.set((mButtonSide * 10) / 100, (mButtonSide * 55) / 100); // Point a : (10% of mButtonSide, 181 | // 55% of mButtonSide) 182 | b.set((mButtonSide * 80) / 100, (mButtonSide * 20) / 100); // Point b : (80% of mButtonSide, 183 | // 20% of mButtonSide) 184 | c.set((mButtonSide * 45) / 100, (mButtonSide * 90) / 100); // Point c : (45% of mButtonSide, 185 | // 90% of mButtonSide) 186 | d.set((mButtonSide * 30) / 100, (mButtonSide * 70) / 100); // Point d : (30% of mButtonSide, 187 | // 70% of mButtonSide) 188 | e.set(mButtonSide / 2, mButtonSide / 2); // Point e : (10% of mButtonSide, 55% of 189 | // mButtonSide) 190 | 191 | 192 | int change = 3 * (int) mPlaneAnimator.getAnimatedValue(); 193 | 194 | Log.i(LOGTAG, "Animated Value: " + change + ", Flag: " + flag++); 195 | 196 | a.x += change; 197 | a.y -= change; 198 | b.x += change; 199 | b.y -= change; 200 | c.x += change; 201 | c.y -= change; 202 | d.x += change; 203 | d.y -= change; 204 | e.x += change; 205 | e.y -= change; 206 | 207 | invalidate(); 208 | 209 | } 210 | 211 | private enum AnimationType 212 | { 213 | LINEAR, 214 | ANTICIPATE, 215 | ANTICIPATE_OVERSHOOT, 216 | ACCELERATE, 217 | ACCELERATE_DECELERATE, 218 | BOUNCE, 219 | DECELERATE, 220 | FASTOUTLINEARIN, 221 | FASTOUTSLOWIN, 222 | LINEAROUTSLOWIN, 223 | OVERSHOOT 224 | } 225 | 226 | } 227 | 228 | -------------------------------------------------------------------------------- /lib/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /lib/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #F6A10C 7 | #454545 8 | #fff 9 | 10 | -------------------------------------------------------------------------------- /lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SendButtonLibrary 3 | 4 | -------------------------------------------------------------------------------- /lib/src/test/java/pa1pal/sendbutton/lib/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package pa1pal.sendbutton.lib; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest 11 | { 12 | @Test 13 | public void addition_isCorrect() throws Exception 14 | { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':lib' 2 | --------------------------------------------------------------------------------