Repository: DevLight-Mobile-Agency/PulseView
Branch: master
Commit: 7a9b73a0d1a0
Files: 27
Total size: 56.6 KB
Directory structure:
gitextract__53hfgjs/
├── .gitignore
├── LICENSE.txt
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── gigamole/
│ │ └── pulseview/
│ │ └── ApplicationTest.java
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── gigamole/
│ │ └── pulseview/
│ │ └── MainActivity.java
│ └── res/
│ ├── layout/
│ │ └── activity_main.xml
│ └── values/
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── library/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── gigamole/
│ │ └── library/
│ │ └── ApplicationTest.java
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── gigamole/
│ │ └── library/
│ │ └── PulseView.java
│ └── res/
│ └── values/
│ ├── attrs.xml
│ └── strings.xml
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
.DS_Store
/build
/captures
/.idea
================================================
FILE: LICENSE.txt
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {2016} {Basil Miller}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MIT License (MIT)
Copyright (c) 2016 Basil Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: README.md
================================================
PulseView
=========
Widget that generates pulsation relative to your icons.
[](http://android-arsenal.com/details/1/3537)
[](https://github.com/DevLight-Mobile-Agency)
[](https://bintray.com/gigamole/maven/pulseview/_latestVersion)
[](https://github.com/DevLight-Mobile-Agency/PulseView/blob/master/LICENSE.txt)
[](https://www.codacy.com/app/gigamole53/PulseView?utm_source=github.com&utm_medium=referral&utm_content=DevLight-Mobile-Agency/PulseView&utm_campaign=Badge_Grade)
You can check the sample app [here](https://github.com/DevLight-Mobile-Agency/PulseView/tree/master/app).
Warn
====
```
This library is not more supported.
If you want to add new feature or fix a bug, grab source code and do it.
If you think your fix or feature would be useful to other developers,
I can add link of your repository to this README file.
Thank you for using our libraries.
```
Download
========
You can download an `.aar` from GitHub's [releases page](https://github.com/DevLight-Mobile-Agency/PulseView/releases).
Or alternatively use Gradle jCenter:
```groovy
dependencies {
repositories {
mavenCentral()
maven {
url 'http://dl.bintray.com/gigamole/maven/'
}
}
compile 'com.github.devlight.pulseview:library:+'
}
```
Gradle Maven Central:
```groovy
compile 'com.github.devlight.pulseview:library:1.0.2'
```
Maven:
```groovy
com.github.devlight.pulseview
library
1.0.2
aar
```
Android SDK Version
=========
`PulseView` requires a minimum SDK version of 11.
Sample
======
Parameters
For `PulseView` you can set such parameters as:
- icon:
at first you need to set icon for `PulseView`.
- icon width and height:
allows you to set size of the icon.
- pulse side measure:
allows you to set pulse side measure. Width or height of `PulseView`.
- pulse count:
allows you to set pulse count.
- pulse spawn period:
allows you to set pulse spawn period.
- pulse alpha:
allows you to set alpha to pulse.
- pulse color:
allows you to set pulse color.
- interpolator:
allows you to set an interpolator for the pulse.
- listener:
allows you to set pulse listener. `onStartPulse()` and `onFinishPulse()` listeners.
Tips
The icon to pulse can be a normal bitmap or a `SVG` file.
In preview mode `PulseView` renders incorrectly because the `Canvas` can`t scale in this mode.
Init
Check out in code init:
```java
final PulseView pulseView = (PulseView) findViewById(R.id.pv);
pulseView.setPulseColor(Color.BLACK);
pulseView.setPulseCount(5);
pulseView.setPulseMeasure(PulseView.PulseMeasure.WIDTH);
pulseView.setIconHeight(200);
pulseView.setIconWidth(200);
pulseView.setIconRes(R.drawable.icon);
pulseView.setPulseAlpha(70);
pulseView.setInterpolator(new LinearInterpolator());
pulseView.setPulseListener(new PulseView.PulseListener(...));
```
To start or finish pulse you need to call methods:
```java
pulseView.startPulse();
pulseView.finishPulse();
```
Other methods can be seen within the sample application.
And `XML` init:
```xml
```
Getting Help
============
To report a specific problem or feature request, [open a new issue on Github](https://github.com/DevLight-Mobile-Agency/PulseView/issues/new).
Credits
=======
|[Greg Wilkinson](https://dribbble.com/gregrwilkinson)|[Thomas Budiman](https://dribbble.com/thebuddyman)|
|:---------------------------------------------------:|:------------------------------------------------:|
|[](https://dribbble.com/shots/2259256-Cel-Fi-Search-Animation)|[](https://dribbble.com/shots/2242921-Find-Nearby-Users-Concept)|
Author
======
Created by [Basil Miller](https://github.com/GIGAMOLE) - [@gigamole](mailto:http://gigamole53@gmail.com)
Company
=======
[](https://www.facebook.com/devlightagency) [](https://twitter.com/DevLightIO) [](https://www.linkedin.com/company/devlight)
[Here](https://github.com/DevLight-Mobile-Agency) you can see open source work developed by Devlight LLC.
This and another works is an exclusive property of Devlight LLC.
If you want to use this library in applications which will be available on Google Play, please report us or author of the library about it.
Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.
You can contact us: info@devlight.io or opensource@devlight.io.
Thanks in advance.
Devlight LLC, 2016
[devlight.io](http://devlight.io)
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.gigamole.pulseview"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.android.support:appcompat-v7:23.3.0'
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Programs\Programming\AndroidStudio\AS_SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: app/src/androidTest/java/com/gigamole/pulseview/ApplicationTest.java
================================================
package com.gigamole.pulseview;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* Testing Fundamentals
*/
public class ApplicationTest extends ApplicationTestCase {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
================================================
FILE: app/src/main/java/com/gigamole/pulseview/MainActivity.java
================================================
package com.gigamole.pulseview;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.gigamole.library.PulseView;
public class MainActivity extends Activity implements
View.OnClickListener,
PulseView.PulseListener {
private PulseView mPulseView;
private int mCounter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initUI();
}
private void initUI() {
mPulseView = (PulseView) findViewById(R.id.pv);
mPulseView.setPulseListener(this);
mPulseView.setOnClickListener(this);
// mPulseView.setPulseColor(Color.BLACK);
// mPulseView.setPulseCount(5);
// mPulseView.setPulseMeasure(PulseView.PulseMeasure.WIDTH);
// mPulseView.setIconHeight(200);
// mPulseView.setIconWidth(200);
// mPulseView.setIconRes(R.drawable.icon);
// mPulseView.setPulseAlpha(70);
// mPulseView.setInterpolator(new LinearInterpolator());
}
@Override
public void onClick(final View v) {
if (mCounter++ % 2 == 0) mPulseView.startPulse();
else mPulseView.finishPulse();
}
@Override
public void onStartPulse() {
// Toast.makeText(MainActivity.this, "Start pulse", Toast.LENGTH_SHORT).show();
}
@Override
public void onFinishPulse() {
// Toast.makeText(MainActivity.this, "Finish pulse", Toast.LENGTH_SHORT).show();
}
}
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
================================================
FILE: app/src/main/res/values/strings.xml
================================================
PulseView
================================================
FILE: app/src/main/res/values/styles.xml
================================================
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1"
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Thu Sep 15 13:36:01 EEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: library/.gitignore
================================================
/build
================================================
FILE: library/build.gradle
================================================
/*
* Copyright (C) 2015 Basil Miller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'com.android.library'
apply plugin: "com.jfrog.bintray"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven'
version = "1.0.2"
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'org.jsoup:jsoup:+'
}
def siteUrl = 'https://github.com/DevLight-Mobile-Agency/PulseView'
def gitUrl = 'https://github.com/DevLight-Mobile-Agency/PulseView.git'
group = "com.github.devlight.pulseview"
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'PulseView'
description = 'Widget that generates pulsation relative to your icons.'
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'gigamole'
name 'Basil Miller'
email 'gigamole53@gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
// it is the name that appears in bintray when logged
name = "pulseview"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
version {
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password") //Optional. The passphrase for GPG signing'
}
// mavenCentralSync {
// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
// user = properties.getProperty("bintray.oss.user") //OSS user token
// password = properties.getProperty("bintray.oss.password") //OSS user password
// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
// }
}
}
}
================================================
FILE: library/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Programs\Programming\AndroidStudio\AS_SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: library/src/androidTest/java/com/gigamole/library/ApplicationTest.java
================================================
package com.gigamole.library;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* Testing Fundamentals
*/
public class ApplicationTest extends ApplicationTestCase {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: library/src/main/AndroidManifest.xml
================================================
================================================
FILE: library/src/main/java/com/gigamole/library/PulseView.java
================================================
package com.gigamole.library;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by GIGAMOLE on 29.04.2016.
*/
@SuppressWarnings("unused")
public class PulseView extends View {
// Default pulse variables
private final static int DEFAULT_PULSE_COUNT = 5;
private final static int DEFAULT_PULSE_SPAWN_PERIOD = 700;
private final static int DEFAULT_PULSE_ALPHA = 70;
private final static int DEFAULT_PULSE_COLOR = Color.DKGRAY;
private final static int DEFAULT_PULSE_MEASURE = PulseMeasure.WIDTH_INDEX;
// Bounds values
private final static float MIN_SCALE = 1.0F;
private final static float MAX_FRACTION = 1.0F;
// Alpha range
private final static float MIN_ALPHA = 0.0F;
private final static float MAX_ALPHA = 255.0F;
// PulseView bounds
private final RectF mBounds = new RectF();
// Icon bitmap and resId
private Bitmap mIconBitmap;
private int mIconRes;
// Pulse models
private final List mPulseModels = new ArrayList<>();
// Pulse measure side. This provide ability to measure pulse size relative to width or height
private PulseMeasure mPulseMeasure;
// Pulse variables
private int mPulseCount;
private long mPulseSpawnPeriod;
private float mPulseAlpha;
private int mPulseColor;
// Icon size variables
private int mIconWidth;
private int mIconHeight;
// Pulse total duration
private float mPulseDuration;
// Pulse destination scale relative to 1.0F fraction time
private float mPulseDestScale;
// Current time in millis
private long mCurrentTime;
// Last spawn time in millis
private long mLastTime;
// Detect whether pulse is started
private boolean mIsPulseStarted;
// Detect whether pulse is need to finish
private boolean mIsFinishPulse;
// Pulse listener
private PulseListener mPulseListener;
// Interpolator for pulse. Choose your favourite
private Interpolator mInterpolator;
// Pulse paint
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG) {
{
setDither(true);
setFilterBitmap(true);
setStyle(Style.FILL);
}
};
public PulseView(final Context context) {
this(context, null);
}
public PulseView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public PulseView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
// Always draw and improve speed
setWillNotDraw(false);
setLayerType(LAYER_TYPE_HARDWARE, null);
// Get attrs
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PulseView);
try {
setIconRes(typedArray.getResourceId(R.styleable.PulseView_pv_icon, 0));
setIconWidth((int) typedArray.getDimension(R.styleable.PulseView_pv_icon_width, 0));
setIconHeight((int) typedArray.getDimension(R.styleable.PulseView_pv_icon_height, 0));
setPulseCount(
typedArray.getInteger(R.styleable.PulseView_pv_count, DEFAULT_PULSE_COUNT)
);
setPulseSpawnPeriod(
typedArray.getInteger(
R.styleable.PulseView_pv_spawn_period, DEFAULT_PULSE_SPAWN_PERIOD
)
);
setPulseAlpha(typedArray.getInteger(R.styleable.PulseView_pv_alpha, DEFAULT_PULSE_ALPHA));
setPulseColor(typedArray.getColor(R.styleable.PulseView_pv_color, DEFAULT_PULSE_COLOR));
setPulseMeasure(
typedArray.getInt(R.styleable.PulseView_pv_measure, DEFAULT_PULSE_MEASURE)
);
// Retrieve interpolator
Interpolator interpolator = null;
try {
final int interpolatorId = typedArray.getResourceId(
R.styleable.PulseView_pv_interpolator, 0
);
interpolator = interpolatorId == 0 ? null :
AnimationUtils.loadInterpolator(context, interpolatorId);
} catch (Resources.NotFoundException exception) {
interpolator = null;
exception.printStackTrace();
} finally {
setInterpolator(interpolator);
}
} finally {
typedArray.recycle();
}
}
public int getIconRes() {
return mIconRes;
}
public Bitmap getIconBitmap() {
return mIconBitmap;
}
// Set icon resId and get bitmap
public void setIconRes(final int iconRes) {
mIconRes = iconRes;
invalidateIcon();
}
public PulseMeasure getPulseMeasure() {
return mPulseMeasure;
}
private void setPulseMeasure(final int index) {
switch (index) {
case PulseMeasure.HEIGHT_INDEX:
setPulseMeasure(PulseMeasure.HEIGHT);
break;
case PulseMeasure.WIDTH_INDEX:
default:
setPulseMeasure(PulseMeasure.WIDTH);
break;
}
}
public void setPulseMeasure(final PulseMeasure pulseMeasure) {
mPulseMeasure = pulseMeasure;
requestLayout();
}
public int getPulseCount() {
return mPulseCount;
}
public void setPulseCount(final int pulseCount) {
mPulseCount = pulseCount;
invalidatePulse();
}
public long getPulseSpawnPeriod() {
return mPulseSpawnPeriod;
}
public void setPulseSpawnPeriod(final long pulseSpawnPeriod) {
mPulseSpawnPeriod = pulseSpawnPeriod;
invalidatePulse();
}
public float getPulseAlpha() {
return mPulseAlpha;
}
@FloatRange
public void setPulseAlpha(@FloatRange(from = MIN_ALPHA, to = MAX_ALPHA) final float pulseAlpha) {
mPulseAlpha = Math.max(MIN_ALPHA, Math.min(pulseAlpha, MAX_ALPHA));
postInvalidate();
}
public int getPulseColor() {
return mPulseColor;
}
public void setPulseColor(final int pulseColor) {
mPulseColor = pulseColor;
// Set color and color filter to fill our icon
mPaint.setColor(pulseColor);
mPaint.setColorFilter(
new PorterDuffColorFilter(pulseColor, PorterDuff.Mode.SRC_IN)
);
postInvalidate();
}
public int getIconWidth() {
return mIconWidth;
}
public void setIconWidth(final int iconWidth) {
mIconWidth = iconWidth;
invalidateIcon();
}
public int getIconHeight() {
return mIconHeight;
}
public void setIconHeight(final int iconHeight) {
mIconHeight = iconHeight;
invalidateIcon();
}
public Interpolator getInterpolator() {
return mInterpolator;
}
public void setInterpolator(final Interpolator interpolator) {
mInterpolator = interpolator == null ? new LinearInterpolator() : interpolator;
}
public PulseListener getPulseListener() {
return mPulseListener;
}
public void setPulseListener(final PulseListener pulseListener) {
mPulseListener = pulseListener;
}
// Start pulse
public void startPulse() {
mIsPulseStarted = true;
mIsFinishPulse = false;
if (mPulseListener != null) mPulseListener.onStartPulse();
postInvalidate();
}
// Finish pulse
public void finishPulse() {
mIsFinishPulse = true;
postInvalidate();
}
// Invalidate icon and get bitmap by icon resId
private void invalidateIcon() {
// You must to set icon resId
if (mIconRes == 0) throw new IllegalArgumentException(
"Icon not found. Please select the icon and set to PulseView"
);
final Drawable iconDrawable = ContextCompat.getDrawable(getContext(), mIconRes);
if (iconDrawable != null) {
// Get width and height of bitmap. If there are is some 0, get original size
final int width = mIconWidth == 0 ? iconDrawable.getIntrinsicWidth() : mIconWidth;
final int height = mIconHeight == 0 ? iconDrawable.getIntrinsicHeight() : mIconHeight;
if (iconDrawable instanceof BitmapDrawable) {
// Create scaled bitmap relative to size from normal image
mIconBitmap = Bitmap.createScaledBitmap(
((BitmapDrawable) iconDrawable).getBitmap(), width, height, true
);
} else {
// Create icon bitmap for other type of resources, especially SVG
mIconBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(mIconBitmap);
iconDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
iconDrawable.draw(canvas);
}
} else // There is somethings wrong with your icon
mIconBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
}
// Invalidate pulse. Need to recalculate dest scale relative to pulse measure and
// detect general pulse duration
private void invalidatePulse() {
mPulseDestScale = mPulseMeasure == PulseMeasure.HEIGHT ?
(mBounds.height() - (float) mIconBitmap.getHeight()) / (float) mIconBitmap.getHeight() :
(mBounds.width() - (float) mIconBitmap.getWidth()) / (float) mIconBitmap.getWidth();
mPulseDuration = mPulseCount * mPulseSpawnPeriod;
postInvalidate();
}
// Restore pulse state according to current time when config changes or view goes out and restore
private void restorePulseState() {
mCurrentTime = System.currentTimeMillis();
mLastTime = mCurrentTime - mPulseSpawnPeriod;
for (int i = 0; i < mPulseModels.size(); i++)
mPulseModels.get(i).setStartTime(mCurrentTime - mPulseSpawnPeriod * i);
postInvalidate();
}
@SuppressLint("DrawAllocation")
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int height = MeasureSpec.getSize(heightMeasureSpec);
// Reset bounds and pulse
mBounds.set(0.0F, 0.0F, width, height);
invalidatePulse();
// Provide pulse preview
if (isInEditMode()) {
for (int i = 0; i < mPulseCount; i++) mPulseModels.add(new PulseModel(0));
restorePulseState();
}
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
// Get center variables of icon
final float bitmapLeft = mBounds.centerX() - (mIconBitmap.getWidth() * 0.5F);
final float bitmapTop = mBounds.centerY() - (mIconBitmap.getHeight() * 0.5F);
// Detect if pulse is started for pulse drawing
if (mIsPulseStarted) {
// Get current time
if (hasWindowFocus()) mCurrentTime = System.currentTimeMillis();
// If view not going to finish, so add new pulse after spawn period
if (!mIsFinishPulse && mCurrentTime > (mLastTime + mPulseSpawnPeriod)) {
mLastTime = mCurrentTime;
// Limit pulse models size to pulse count
if (mPulseModels.size() < mPulseCount)
// We need to set start time of pulse model. Its our start value where we
// can calculate fraction of pulse according to pulse duration
mPulseModels.add(0, new PulseModel(mCurrentTime));
}
// Draw pulse models
for (int i = 0; i < mPulseModels.size(); i++) {
// Get pulse model
final PulseModel pulseModel = mPulseModels.get(i);
// Set pulse fraction in range [0.0F, 1.0F]
pulseModel.setFraction(
(float) (mCurrentTime - pulseModel.getStartTime()) / mPulseDuration
);
// Save canvas for scaling
canvas.save();
// Get pulse scale where min is 1.0F and max is mPulseDestScale
// Interpolator used for some special effects
final float pulseScale = MIN_SCALE +
(mInterpolator.getInterpolation(pulseModel.getFraction()) * mPulseDestScale);
// Scale canvas. Its provide more speed unlike scale icon matrix
canvas.scale(pulseScale, pulseScale, mBounds.centerX(), mBounds.centerY());
// Set pulse alpha. We need alpha for better effect, cause we have pulse models
// like stack so alpha would also stack
mPaint.setAlpha((int) (mPulseAlpha - (pulseModel.getFraction() * mPulseAlpha)));
// Draw icon bitmap pulse and restore canvas to default scale
canvas.drawBitmap(mIconBitmap, bitmapLeft, bitmapTop, mPaint);
canvas.restore();
}
// Detect whether we have filled models and last pulse reached max fraction
if (!mPulseModels.isEmpty() && MAX_FRACTION ==
(float) Math.floor(mPulseModels.get(mPulseModels.size() - 1).getFraction()))
// Remove finished pulse
mPulseModels.remove(mPulseModels.size() - 1);
// If pulses goes to finish and pulse models is empty - finish pulse
if (mIsFinishPulse && mPulseModels.isEmpty()) {
mIsFinishPulse = false;
mIsPulseStarted = false;
if (mPulseListener != null) mPulseListener.onFinishPulse();
}
}
// Draw icon bitmap
canvas.drawBitmap(mIconBitmap, bitmapLeft, bitmapTop, null);
// Invalidate draw for auto refresh
if (hasWindowFocus()) postInvalidate();
}
@Override
protected void onVisibilityChanged(@NonNull final View changedView, final int visibility) {
super.onVisibilityChanged(changedView, visibility);
restorePulseState();
}
@Override
public void onWindowFocusChanged(final boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
// Restore pulse after resume
if (hasWindowFocus) restorePulseState();
}
@Override
public void onRestoreInstanceState(Parcelable state) {
final SavedState savedState = (SavedState) state;
super.onRestoreInstanceState(savedState.getSuperState());
// Clear old models and add last restored
mPulseModels.clear();
mPulseModels.addAll(savedState.mPulseModels);
// Restore variables and pulse
mIsPulseStarted = savedState.mIsPulseStarted;
mIsFinishPulse = savedState.mIsFinishPulse;
restorePulseState();
}
@Override
public Parcelable onSaveInstanceState() {
final Parcelable superState = super.onSaveInstanceState();
final SavedState savedState = new SavedState(superState);
// Save current state of PulseView
savedState.mPulseModels = mPulseModels;
savedState.mIsPulseStarted = mIsPulseStarted;
savedState.mIsFinishPulse = mIsFinishPulse;
return savedState;
}
private static class SavedState extends BaseSavedState {
// SavedState variables
private List mPulseModels;
private boolean mIsPulseStarted;
private boolean mIsFinishPulse;
public SavedState(Parcelable superState) {
super(superState);
}
@SuppressWarnings("unchecked")
private SavedState(Parcel in) {
super(in);
mPulseModels = (List) in.readSerializable();
mIsPulseStarted = in.readByte() != 0;
mIsFinishPulse = in.readByte() != 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeSerializable((Serializable) mPulseModels);
dest.writeByte((byte) (mIsPulseStarted ? 1 : 0));
dest.writeByte((byte) (mIsFinishPulse ? 1 : 0));
}
@SuppressWarnings("UnusedDeclaration")
public static final Creator CREATOR = new Creator() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
private static class PulseModel implements Serializable {
// Start time of pulse model
private long mStartTime;
// Current fraction of pulse model
private float mFraction;
public PulseModel(final long startTime) {
mStartTime = startTime;
}
public long getStartTime() {
return mStartTime;
}
public void setStartTime(final long startTime) {
mStartTime = startTime;
}
public float getFraction() {
return mFraction;
}
public void setFraction(final float fraction) {
mFraction = fraction;
}
}
// Pulse measure
public enum PulseMeasure {
WIDTH, HEIGHT;
private final static int WIDTH_INDEX = 0;
private final static int HEIGHT_INDEX = 1;
}
// Pulse listener. OnStart trigger when we start draw pulse. OnFinish trigger when all of
// pulse models reached their max fraction
public interface PulseListener {
void onStartPulse();
void onFinishPulse();
}
}
================================================
FILE: library/src/main/res/values/attrs.xml
================================================
================================================
FILE: library/src/main/res/values/strings.xml
================================================
PulseView
================================================
FILE: settings.gradle
================================================
include ':app', ':library'