Road Runner
[Download](https://api.bintray.com/packages/glomadrian/maven/RoadRunner/images/download.svg)
[Hex.pm](https://img.shields.io/hexpm/l/plug.svg) [Platform](https://img.shields.io/badge/platform-android-green.svg)
[Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RoadRunner-green.svg?style=true)
</br>
Road Runner is a library for android which allow you to make your own loading
animation using a SVG image
## Sample video
[View in Youtube](https://www.youtube.com/watch?v=1ru8vBtywHE)
## Demo Application
#### Road Runner intro
#### Determiante
#### Determiante with value update
#### Material animation with twitter logo
#### TwoWay animation with Github logo
## How to
The library use the standard String path information (only one path) and the original size to works, you need to obtain it using a external tool, the path information look like this:
```
M306.314,58.9801 C275.235,27.9011,224.837,27.9011,193.759,58.9801
L39.0019,213.736 C15.6832,237.055,15.6832,274.838,39.0019,298.158
C58.2219,317.378,87.2116,320.482,109.874,308.007
C112.241,307.888,114.569,306.993,116.38,305.202 L271.136,150.445
C286.675,134.906,286.675,109.717,271.136,94.1779
C255.597,78.6389,230.408,78.6389,214.869,94.1779 L88.2461,220.8
C84.366,224.68,84.366,230.987,88.2461,234.866
C92.1263,238.746,98.4335,238.746,102.313,234.866 L228.935,108.245
C236.715,100.465,249.309,100.465,257.07,108.245
C264.85,116.025,264.85,128.619,257.07,136.379 L109.337,284.111
C93.7979,299.65,68.6085,299.65,53.0694,284.111
C37.5304,268.572,37.5304,243.383,53.0694,227.844 L207.825,73.0468
C231.144,49.7281,268.928,49.7281,292.247,73.0468
C315.566,96.3654,315.566,134.149,292.247,157.469 L151.558,298.158
C147.678,302.038,147.678,308.345,151.558,312.225
C155.438,316.105,161.745,316.105,165.625,312.225 L306.314,171.535
C337.393,140.457,337.393,90.0591,306.314,58.98 Z
```
And the width and height can be found in the svg definition:
```
height="316"
width="512"
```
### Using the view (Samples)
#### Two way
``` xml
```
#### Material
``` xml
```
#### Determinate Two way
``` xml
```
## Custom attributes
### Common
* **movement_direction:** clockwise or counter_clockwise
* **path_color:** color of the painted path
* **stroke_width:** width of the painted path
* **path_data:** String with the path information
* **path_original_width:** The original with defined in the SVG
* **path_original_height:** The original height defined in the SVG
* **animate_on_start:** true or false, init the animation on first paint (true by default)
### Indeterminate
* **path_animation_type:** Select indetermina animation type, can be:
* material
* twoWay
#### Indeterminate Material
* Dont have any custom attributes
#### Indeterminate Two way
* **movement_loop_time:**** Time take to do a complete loop
* **line_size:**\* The size of the base line
* **left_line_animation_time:** Time take to do a complete animation to the left line
* **right_line_animation_time:** Time take to do a complete animation to the right line
* **left_line_max_size:**\* The max size that the left line can research in the animation
* **right_line_max_size:**\* The max size that the right line can research in the animation
* **left_line_animation_start_delay:** Time to wait to start the left line animation (in milliseconds)
* **right_line_animation_start_delay:** Time to wait to start the right line animation (in milliseconds)
\* From 0f to 1f, 1f is all the path
### Determinate
* **min:** Min value for the progress
* **max:** Max value for the progress
* **movement_loop_time:** Time take to do a complete loop
* **movement_line_size:**\* The size of the line
\* From 0f to 1f, 1f is all the path
## Attributions
* Thanks to Jorge Castillo Pérez for his [AndroidFillableLoaders](https://github.com/JorgeCastilloPrz/AndroidFillableLoaders) has been very helpful
For Gradle
---------------------
Add repository
```groovy
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
```
Add dependency
```groovy
compile 'com.github.glomadrian:roadrunner:1.0@aar'
```
Developed By
------------
Adrián García Lomas - <glomadrian@gmail.com>
* [Twitter](https://twitter.com/glomadrian)
* [LinkedIn](https://es.linkedin.com/in/glomadrian )
License
-------
Copyright 2016 Adrián García Lomas
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.