|
1 | | -# rubber-loader |
| 1 | +# RubberLoaderView |
| 2 | + |
| 3 | +Android indeterminate loader widget with rubber shape and color animations. |
| 4 | + |
| 5 | +Click picture below to watch it in action. |
| 6 | + |
| 7 | +[](http://www.youtube.com/watch?v=ixr83xFCRQ0) |
| 8 | + |
| 9 | +## Demo |
| 10 | +Downlaod latest demo app from Play Market: |
| 11 | + |
| 12 | +<a href="https://play.google.com/store/apps/details?id=com.greenfrvr.rubberloader.sample"> |
| 13 | + <img alt="Get it on Google Play" |
| 14 | + src="https://developer.android.com/images/brand/en_generic_rgb_wo_60.png" /> |
| 15 | +</a> |
| 16 | + |
| 17 | +## Gradle Dependency |
| 18 | +[  ](https://bintray.com/greenfrvr/maven/rubber-loader/_latestVersion) |
| 19 | + |
| 20 | +Easily reference the library in your Android projects using this dependency in your module's build.gradle file: |
| 21 | + |
| 22 | +```Gradle |
| 23 | +dependencies { |
| 24 | + compile 'com.github.greenfrvr:rubber-loader:1.0.0@aar' |
| 25 | +} |
| 26 | +``` |
| 27 | +Library available on both jCenter and Maven Central, but in case of any issues (library can't be resolved) use Bintray repo. |
| 28 | + |
| 29 | +Add repository to your app's build.gradle file: |
| 30 | + |
| 31 | +```Gradle |
| 32 | +repositories { |
| 33 | + maven { |
| 34 | + url 'https://dl.bintray.com/greenfrvr/maven/' |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | +This will reference Bintray's Maven repository that contains hashtags widget directly, rather than going through jCenter first. |
| 39 | + |
| 40 | +## Customizing |
| 41 | +All attributes can be defined in layout .xml file or programmatically. Below is a list of available attributes. |
| 42 | + |
| 43 | +##### Size |
| 44 | + |
| 45 | +Currently 6 pre-defined sizes are available. |
| 46 | + |
| 47 | +| Value | Sizes | |
| 48 | +| :------------ |:---------------:| |
| 49 | +| EXTRA_TINY | 24dp * 12dp | |
| 50 | +| TINY | 48dp * 24dp | |
| 51 | +| SMALL (default) | 72dp * 36dp | |
| 52 | +| NORMAL | 96dp * 48dp | |
| 53 | +| MEDIUM | 120dp * 60dp | |
| 54 | +| LARGE | 144dp * 72dp | |
| 55 | + |
| 56 | + |
| 57 | +```xml |
| 58 | + <attr name="loaderSize" format="enum"> |
| 59 | + <enum name="extra_tiny" value="0"/> |
| 60 | + <enum name="tiny" value="1"/> |
| 61 | + <enum name="small" value="2"/> |
| 62 | + <enum name="normal" value="3"/> |
| 63 | + <enum name="medium" value="4"/> |
| 64 | + <enum name="large" value="5"/> |
| 65 | + </attr> |
| 66 | +``` |
| 67 | + |
| 68 | +##### Color |
| 69 | + |
| 70 | +Define 2 colors wich will form smooth color transition. |
| 71 | + |
| 72 | +```xml |
| 73 | + <attr name="loaderPrimeColor" format="color|reference"/> |
| 74 | + <attr name="loaderExtraColor" format="color|reference"/> |
| 75 | +``` |
| 76 | +If you set only `loaderPrimeColor`, its value will be set to `loaderExtraColor`, so loader will be filled with solid prime color. |
| 77 | + |
| 78 | +## Usage |
| 79 | + |
| 80 | +There are 2 methods which starts `RubberLoaderView` animation: `RubberLoaderView.startLoading()` and `RubberLoaderView.startLoading(long delay)` |
| 81 | + |
| 82 | +Also you can set different interpolation functions by calling `RubberLoaderView.setInterpolator(TimeInterpolator interpolator)`. It's highly recommended to use following interpolators: `PulseInterpolator`, `PulseInverseInterpolator` and `LinearInterpolator`. |
| 83 | + |
| 84 | +##License |
| 85 | + |
| 86 | + Copyright 2015 greenfrvr |
| 87 | + |
| 88 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 89 | + you may not use this file except in compliance with the License. |
| 90 | + You may obtain a copy of the License at |
| 91 | + |
| 92 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 93 | + |
| 94 | + Unless required by applicable law or agreed to in writing, software |
| 95 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 96 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 97 | + See the License for the specific language governing permissions and |
| 98 | + limitations under the License. |
0 commit comments