A highly configurable library to do loading progress with animated balls

Overview

Loading Balls

Download

A highly configurable library to do loading progress with animated balls for Android

Demo Screenshot

How to use

Custom attributes

lib:path="triangle"

The shape of the movement, available:

*  infinite
*  square
*  triangle
*  circle
*  diamond
*  star
lib:balls="3"

Number of balls used in the animation

lib:movement_cycle_time="1500"

The time which the ball takes to do a complete cicle

lib:enable_size_animation="true"

Enables the size animation in the balls (by default is false)

lib:size_cycle_time="500"

The time it takes to the ball to grow up and decrease the size one time

lib:ball_size="6dp"

Set the balls size

lib:min_ball_size="5dp"
lib:max_ball_size="12dp"

To use with enable_size_animation="true", set the min and the max ball size

lib:ball_colors="@array/colors"

Array of colors for the balls, if there are more balls than colors then repeat color balls

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <color name="ball1">#FFD91C</color>
  <color name="ball2">#FF4B4A</color>
  <color name="ball3">#3D8EFF</color>

  <integer-array name="colors">
    <item>@color/ball1</item>
    <item>@color/ball2</item>
    <item>@color/ball3</item>
  </integer-array>
</resources>

Sample colors array

For Gradle

Add repository

repositories {
  maven {
    url "http://dl.bintray.com/glomadrian/maven"
  }
}

Add dependency

  compile 'com.github.glomadrian:loadingballs:1.1@aar'

Some Samples

Default Infinite shape

Sample

<com.github.glomadrian.loadingballs.BallView
     android:layout_margin="30dp"
     android:layout_width="100dp"
     android:layout_height="100dp"
     lib:balls="3"
     lib:movement_cycle_time="1500"
     lib:enable_size_animation="true"
     lib:size_cycle_time="500"
     lib:min_ball_size="5dp"
     lib:max_ball_size="12dp"
     lib:ball_colors="@array/colors"
     android:layout_gravity="center"
     />

Infinite shape without size animation

Sample

<com.github.glomadrian.loadingballs.BallView
      android:layout_margin="30dp"
      android:layout_width="100dp"
      android:layout_height="100dp"
      lib:balls="3"
      lib:movement_cycle_time="1000"
      lib:enable_size_animation="false"
      lib:ball_colors="@array/colors"
      android:layout_gravity="center"
      />

Infinite shape with 5 balls

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="5"
    lib:movement_cycle_time="1500"
    lib:enable_size_animation="true"
    lib:size_cycle_time="500"
    lib:min_ball_size="5dp"
    lib:max_ball_size="12dp"
    lib:ball_colors="@array/colors"
    android:layout_gravity="center"
    />

Triangle shape with 3 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
       android:layout_margin="30dp"
       android:layout_width="100dp"
       android:layout_height="100dp"
       lib:balls="3"
       lib:movement_cycle_time="1500"
       lib:enable_size_animation="true"
       lib:size_cycle_time="500"
       lib:min_ball_size="5dp"
       lib:max_ball_size="12dp"
       lib:ball_colors="@array/colors"
       lib:path="triangle"
       android:layout_gravity="center"
       />

Triangle shape with 2 balls

Sample

<com.github.glomadrian.loadingballs.BallView
        android:layout_margin="30dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        lib:balls="2"
        lib:movement_cycle_time="800"
        lib:enable_size_animation="false"
        lib:ball_colors="@array/colors"
        lib:path="triangle"
        android:layout_gravity="center"
        />

Square shape with 3 balls

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="3"
    lib:movement_cycle_time="800"
    lib:enable_size_animation="false"
    lib:ball_colors="@array/colors"
    lib:path="square"
    android:layout_gravity="center"
    />

Square shape with 5 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="5"
    lib:movement_cycle_time="1200"
    lib:enable_size_animation="true"
    lib:size_cycle_time="500"
    lib:min_ball_size="5dp"
    lib:max_ball_size="12dp"
    lib:ball_colors="@array/colors"
    lib:path="square"
    android:layout_gravity="center"
    />

Circle shape with 3 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="3"
    lib:movement_cycle_time="1200"
    lib:enable_size_animation="true"
    lib:size_cycle_time="1500"
    lib:min_ball_size="5dp"
    lib:max_ball_size="12dp"
    lib:ball_colors="@array/colors"
    lib:path="circle"
    android:layout_gravity="center"
    />

Circle shape with 2 balls without size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="2"
    lib:movement_cycle_time="700"
    lib:enable_size_animation="false"
    lib:ball_colors="@array/colors"
    lib:path="circle"
    android:layout_gravity="center"
    />

Star shape with 10 balls without size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="10"
    lib:movement_cycle_time="2500"
    lib:enable_size_animation="false"
    lib:ball_colors="@array/colors"
    lib:path="star"
    lib:ball_size="5dp"
    android:layout_gravity="center"
    />

Star shape with 5 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
         android:layout_margin="30dp"
         android:layout_width="100dp"
         android:layout_height="100dp"
         lib:balls="5"
         lib:movement_cycle_time="2500"
         lib:ball_colors="@array/colors"
         lib:path="star"
         lib:ball_size="5dp"
         lib:enable_size_animation="true"
         lib:size_cycle_time="800"
         lib:min_ball_size="5dp"
         lib:max_ball_size="8dp"
         android:layout_gravity="center"
         />

Star shape with 3 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="3"
    lib:movement_cycle_time="2500"
    lib:ball_colors="@array/colors"
    lib:path="star"
    lib:ball_size="5dp"
    lib:enable_size_animation="true"
    lib:size_cycle_time="800"
    lib:min_ball_size="5dp"
    lib:max_ball_size="8dp"
    android:layout_gravity="center"
    />

Diamond shape with 5 balls without size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="5"
    lib:movement_cycle_time="2500"
    lib:ball_colors="@array/colors"
    lib:path="diamond"
    lib:ball_size="6dp"
    android:layout_gravity="center"
    />

Diamond shape with 4 balls and size animation

Sample

<com.github.glomadrian.loadingballs.BallView
         android:layout_margin="30dp"
         android:layout_width="100dp"
         android:layout_height="100dp"
         lib:balls="4"
         lib:movement_cycle_time="2500"
         lib:ball_colors="@array/colors"
         lib:path="diamond"
         lib:ball_size="5dp"
         lib:enable_size_animation="true"
         lib:size_cycle_time="800"
         lib:min_ball_size="5dp"
         lib:max_ball_size="8dp"
         android:layout_gravity="center"
         />

Diamond shape with 10 balls without size animation

Sample

<com.github.glomadrian.loadingballs.BallView
    android:layout_margin="30dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    lib:balls="10"
    lib:movement_cycle_time="2500"
    lib:ball_colors="@array/colors"
    lib:path="diamond"
    lib:ball_size="4dp"
    android:layout_gravity="center"
    />

Developed By

Adrián García Lomas - [email protected]

License

Copyright 2015 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.
Comments
  • Wrong gradle depencency in README

    Wrong gradle depencency in README

    You have a wrong gradle depencency in your readme:

      compile 'com.github.glomadrian:loading-balls:1.1@aar'
    

    It should be (according to your maven repository):

    compile 'com.github.glomadrian:loadingballs:1.1@aar'
    

    -> without the dash between "loading" and "balls".

    bug 
    opened by PatrickMA 2
  • Set Cancelable Flage

    Set Cancelable Flage

    Hi the loader is awesome. Just wanted to add not an issue actually but a suggestion. Can we have setCancelable("false") something like Dialog.

    Thanks, Abhijit

    opened by kuraneabhijit 1
  • Balls don't always respect configurations

    Balls don't always respect configurations

    I have included the balls in the xml of several fragments complete with customization but it only a few of them respect the customization. The other instances default to the configuration that comes with the library, i.e 3 balls of yellow, blue and red color.

    This is my implementation: <com.github.glomadrian.loadingballs.BallView android:id="@+id/ballView" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true" android:layout_gravity="center" android:layout_margin="30dp" lib:ball_colors="@array/color" lib:balls="5" lib:enable_size_animation="true" lib:max_ball_size="12dp" lib:min_ball_size="5dp" lib:movement_cycle_time="1500" lib:size_cycle_time="500" />

    where the array of color has 5 different shades of red.

    opened by osugo 0
  • ClassNotFoundError : BaseInterpolator

    ClassNotFoundError : BaseInterpolator

    Hi,,

    On some devices (eg : my Asus Zenfone 2), using BallView make my app crash (i receive a SIGSERV error). After some researches, i found that the error was due to the usage of BaseInterpolator class that cannot be found. Indeed, this class is only available from API 22, making the app crash. http://developer.android.com/reference/android/view/animation/BaseInterpolator.html

    One solution is to replace the BaseInterpolator reference with Interpolator interface.

    opened by fleficher 0
  • Auto start/stop with visibility change

    Auto start/stop with visibility change

    Could you please add an option to auto start and stop the animations when the visibility changes i.e. start animations when View.VISIBLE otherwise stop animations (both INVISIBLE and GONE)?

    I am trying to to manually start, stop and restart animations but I am getting a lot of NullPointerExceptions because of null ballPathAnimator. The animator is created in the onSizeChanged(...) and that method is not yet called when a Fragment's onResume() is called, thus NPE crash. Automatic start/stop will solve all this troubles. Thank you for this beautiful loading indicator.

    opened by martinflorek 0
  • High CPU use after stopping the animation with size animation enabled

    High CPU use after stopping the animation with size animation enabled

    Calling stop() does not disable the animation fully and takes a lot of CPU. The stop method incorrectly calls start() instead of stop on the ballSizeAnimator:

      public void stop() {
        ballPathAnimator.stop();
        if (sizeAnimationEnabled) {
          ballSizeAnimator.start();
        }
      }
    
    bug 
    opened by martinflorek 1
Owner
Adrián Lomas
Adrián Lomas
Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.

LoadingDrawable: Android cool animation collection 前言 CircleRotate源码解析 Fish源码解析 LoadingDrawable is some android animations implement of drawable: a li

dinus_developer 4.1k Dec 27, 2022
Android library for showing progress in a highly customizable pie.

ProgressPieView Android library for showing progress in a highly customizable pie. Choose from the broad spectre of styleable elements: ppvStrokeWidth

Filip Puđak 399 Dec 29, 2022
Beautiful progress bar with segments. Highly customizable. Fully written with Jetpack Compose

?? SegmentedProgressBar ?? Beautiful progress bar split into several segments. Highly customizable. Fully written with Jetpack Compose. Why this libra

Stephen Vinouze 90 Dec 15, 2022
An animated circle loading view

Animated Circle Loading View A determiante/indetermiante loading view animation. Based on android-watch-loading-animation by Nils Banner. How it looks

José Luis Martín 1.2k Dec 7, 2022
A customizable, animated progress bar that features rounded corners. This Android library is designed to look great and be simple to use 🎉

RoundedProgressBar Easy, Beautiful, Customizeable The RoundedProgressBar library gives you a wide range of customizable options for making progress ba

null 541 Jan 1, 2023
Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

ValarTech 16 Jul 5, 2022
:barber: [Android Library] Stacked dual progress indicator progress-bar

StackedHorizontalProgressBar Specs Featured in Show some ❤️ Android library with ability to show two progress indicators in one horizontal progress ba

Nishant Srivastava 98 Nov 11, 2022
A progress wheel for android, intended for use instead of the standard progress bar.

Deprecation warning This project is no-longer maintained, and has not been maintained for a few years now. If you're looking for an alternative librar

Todd Davies 2.7k Dec 29, 2022
IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

heyangyang 6 Aug 25, 2022
An Android library providing to realize wave loading effect.

WaveLoadingView WaveLoadingView - An Android library that provides a realistic wave-loading effect. Sample Usage For a working implementation of this

Tang 1.7k Jan 2, 2023
animated blinking loader

BlinkingLoader animated blinking loader Usage :- <app.m4ntis.blinkingloader.BlinkingLoader android:id="@+id/dotLoading1" android:layout_wi

Rajiv Singh 22 Nov 15, 2022
A square animated loader.

SquareLoading Design Design by Divan Raj from Animated Loader How to use 1.Add the dependency dependencies { compile 'io.github.yuweiguocn:S

yuweiguo 309 Apr 25, 2022
Android loading view

Loading Loading is a poject with kinds of Android loading view. Yan can see the wiki for more detail. RotateLoading BookLoading NewtonCradleLoading Us

null 1.2k Jan 1, 2023
Customizable bouncing dots for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

LoadingDots for Android Customizable bouncing dots view for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

Eyal Biran 162 Dec 2, 2022
A wave-like loading drawable

#WaveLoading This library provides a wave loading animation as a Drawable. How to use Add dependency: compile 'com.race604.waveloading:library:1.1.1'

吴晶 1.4k Dec 5, 2022
A loading animation based on Floating Action Button

FAB-Loading A loading animation based on Floating Action Button. Usage Include the LoadingView widget in your view: <io.saeid.fabloading.LoadingView

Saeed Masoumi 689 Oct 14, 2022
Some loading GIF .

Android GifLoadingView This project idea is from Link . Thanks for the idea. I like all the animation in that webpage , but it's so hard to develop al

Roger 1.3k Dec 12, 2022
MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4 v21+)

MaterialLoadingProgressBar MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4

lsjwzh 1.1k Nov 19, 2022
Cool bezier loading view

What's BezierLoadingView ? A cool loading view with Bezier and a smooth circular motion, Demo Features Bezier Circular motion ##Attributes name format

巴掌 828 Oct 10, 2022