RubberLoaderView

Additional

Language
Mathematica
Version
v1.1.2 (Dec 29, 2015)
Created
Sep 7, 2015
Updated
May 3, 2017 (Retired)
Owner
Artsiom Grintsevich (greenfrvr)
Contributors
The Gitter Badger (gitter-badger)
Santiago Castro (bryant1410)
Artsiom Grintsevich (greenfrvr)
3
Activity
Badge
Generate
Download
Source code

Advertisement

RubberLoaderView

Version 1.1.2 available!

Android indeterminate loader widget with rubber shape and color animations. Inspired by

Click picture below to watch it in action.

Demo

Downlaod latest demo app from Play Market:

Gradle Dependency

Easily reference the library in your Android projects using this dependency in your module's build.gradle file:

dependencies {
    compile 'com.github.greenfrvr:rubber-loader:1.1.2@aar'
}

Library available on both jCenter and Maven Central, but in case of any issues (library can't be resolved) use Bintray repo.

Add repository to your app's build.gradle file:

repositories {
    maven {
        url 'https://dl.bintray.com/greenfrvr/maven/'
    }
}

This will reference Bintray's Maven repository that contains hashtags widget directly, rather than going through jCenter first.

Customizing

All attributes can be defined in layout .xml file or programmatically. Below is a list of available attributes.

Loader modes

Different loader modes has different animation behaviour. Default mode is normal.

 <attr name="loaderMode" format="enum">
        <enum name="normal" value="0"/>
        <enum name="equal" value="1"/>
        <enum name="centered" value="2"/>
    </attr>
Size

Currently 6 pre-defined sizes are available. Loader with ripple need more space.

Value Sizes Sizes with ripples
EXTRA_TINY 27dp * 12dp 36dp * 36dp
TINY 54dp * 24dp 72dp * 72dp
SMALL (default) 81dp * 36dp 108dp * 108dp
NORMAL 108dp * 48dp 144dp * 144dp
MEDIUM 135dp * 60dp 180dp * 180dp
LARGE 162dp * 72dp 216dp * 216dp
    <attr name="loaderSize" format="enum">
        <enum name="extra_tiny" value="0"/>
        <enum name="tiny" value="1"/>
        <enum name="small" value="2"/>
        <enum name="normal" value="3"/>
        <enum name="medium" value="4"/>
        <enum name="large" value="5"/>
    </attr>
Color

Define 2 colors which will form smooth color transition.

    <attr name="loaderPrimeColor" format="color|reference"/>
    <attr name="loaderExtraColor" format="color|reference"/>
    <attr name="loaderRippleColor" format="color|reference"/>

If you set only loaderPrimeColor, its value will be set to loaderExtraColor, so loader will be filled with solid prime color.

Ripples

Select loaderRippleMode to add ripple animations effect. Default mode is none. Loaders with ripple will have bigger sizes than without them.

 <attr name="loaderRippleMode" format="enum">
        <enum name="none" value="0"/>
        <enum name="normal" value="1"/>
        <enum name="reverse" value="2"/>
        <enum name="cycle" value="3"/>
    </attr>

Usage

There are 2 methods which starts RubberLoaderView animation: RubberLoaderView.startLoading() and RubberLoaderView.startLoading(long delay). To stop RubberLoader animation call RubberLoaderView.stopLoading().

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.

License

 Copyright 2015 greenfrvr

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.