A cool customizable loading animation with Dots

Overview

DotLoader

Release Android Arsenal Awesome

First, the gifs!

I am the one with constant Dots:

Sample Gif

You can add dots on the fly !

Sample Gif

And maybe create some cool animations like this?

Sample Gif

(This sucks but you get the idea :))

How to use.

Adding to your project

Currently only gradle supported

Add to your project level build.gradle's allprojects block like this

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

Next add to your module level (app) build.gradle's dependencies block like this

Check the releases section to get the version name for the latest release (i.e the name to replace X.X.X with)

dependencies {
    compile 'com.github.bhargavms:DotLoader:X.X.X'
}

You're all set, Now you can start using the DotLoader class.

Simple to use!

This works like any other view in android. You use it in your xml file like this

<com.bhargavms.dotloader.DotLoader
    android:id="@+id/text_dot_loader"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:color_array="@array/dot_colors"
    app:dot_radius="4dp"
    app:number_of_dots="3"/>

Now I will explain the 3 custom attributes here,

dot_radius

This is the main metric from which all sizes are calculated, if you were to provide wrap_content for layout_width and layout_height. You can, of course, provide your own height, in which case the animation might look horrible. You can also provide greater width than necessary, but the dots will not spread out to take up width (trust me doesn't look good).

number_of_dots

By default this is 1 (looks ridiculous I know but hey it is your choice!). So just provide the input here for whatever number of dots you want. (you can have a gazzillion, if you can fit in your phone screen xD)

color_array

Ah this is where I made the magic happen! Provide here a reference (like I have in the code above app:color_array="@array/dot_colors") to an array of colors which can be declared like so in your colors.xml file

<array name="dot_colors">
    <item>#03A9F4</item>
    <item>#E65100</item>
    <item>#FFBB00</item>
</array>

What this does is provide the DotLoader instance with a set colors through which the animation iterates over, looks neat don't you think?

OK Now a TIP!!

If you plan to increase the number of dots on the fly, please remember to call requestLayout() on the view, OR provide enough width before hand, then you don't have to call requestLayout() and make things choppy

Increasing and decreasing the DOTS on the fly! HOW?

Now for this the DotLoader class comes with the setNumberOfDots(int numberOfDots) method. Use this to change the number of dots to whatever you want on the fly and see the magic happen. In the demo app, I demonstrate this by changing the number of dots after a set period using the postDelayed() method from the View class.

dotLoader.postDelayed(new Runnable() {
    @Override
    public void run() {
        dotLoader.setNumberOfDots(5);
    }
}, 3000);
This library is heavily inspired by this design of Blake Manzo

Thats it! QuestionS? ask em in the issues section! Oh aren't I forgetting something? Ah License!

LICENSE

Apache 2.0

Comments
  • Problem with loading DotLoader

    Problem with loading DotLoader

    Hi there,

    We have a issue with loading the dot loader. Sometimes it crashes. Can you advise us?

    Cheers, Bratislav

    Platform: android

    OS Version: 5.0.1

    Device: GT-I9500

    RAM Free: 24%

    Disk Free: 22.8%

    #0. Crashed: main: 0 0 0x0000000000000000 at com.bhargavms.dotloader.DotLoader._startAnimation(DotLoader.java:219) at com.bhargavms.dotloader.DotLoader.access$200(DotLoader.java:21) at com.bhargavms.dotloader.DotLoader$2.run(DotLoader.java:196) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

    --

    Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.animation.ValueAnimator.start()' on a null object reference at com.bhargavms.dotloader.DotLoader._startAnimation(DotLoader.java:219) at com.bhargavms.dotloader.DotLoader.access$200(DotLoader.java:21) at com.bhargavms.dotloader.DotLoader$2.run(DotLoader.java:196) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

    opened by bratislavdamnjanovic 25
  • Memory leak with AnimatorListener

    Memory leak with AnimatorListener

    I have found a memory leak using the DotLoader library. I tried with a minimal case (which was a simple activity with a DotLoader) as a test and it happened too, so it seems to be a common issue.

    My simple test case includes a single activity with a layout as follows:

    <LinearLayout
       ...>
    
       <Button
          .../>
    
       <com.bhargavms.dotloader.DotLoader
          .../>
    
    </LinearLayout>
    

    And within the activity, the only thing that I'm doing is firing a new Intent to the same activity when I click the button. Whenever you click the button, the old activity is leaked. I used LeakCanary and I copy a snapshot of the report: device-2017-05-19-144937

    There seems to be something wrong with the AnimatorListeners which are added at createValueAnimatorForDot, but actually I don't know where the exact problem and solution are (maybe the listener shouldn't be instantiated anonymously, so it can be removed later).

    opened by jordicapde 8
  • Two dots always have the same height

    Two dots always have the same height

    I have the strange issue that the 2nd and 3rd two dots are always on the same height. Only happens on my device (OnePlus 3) though. It does not matter how many dots there are, the behaviour is always the same.

    Dependency compile 'com.github.bhargavms:DotLoader:1.0.3'

    Code in XML

    <com.bhargavms.dotloader.DotLoader
                    android:id="@+id/redeem_verify_loader"
                    android:layout_width="wrap_content"
                    android:layout_height="80dp"
                    android:layout_centerInParent="true"
                    app:color_array="@array/redeem_dot_colors"
                    app:dot_radius="10dp"
                    app:number_of_dots="7" />
    
    opened by Brianvdb 3
  • Cant set color_array

    Cant set color_array

    I copies the color array in the colors.xml, but cant use it in app:color_array.

    see my code, copies from your example:

     <com.bhargavms.dotloader.DotLoader
    	        android:id="@+id/postIndicator"
    	        android:layout_width="104dp"
    	        android:layout_height="30dp"
    	        android:minWidth="20dp"
    	        android:layout_gravity="center|right"
    	        android:visibility="visible"
    	        app:color_array="@array/dot_colors"
    	        app:dot_radius="4dp"
    	        app:number_of_dots="3"
    	        android:paddingRight="2dp"
    	        android:layout_weight="0.86"
    	        />
    

    and colors.xml:

    <resources>
    	<array name="dot_colors">
    		<item>#03A9F4</item>
    	</array>
    </resources>
    
    opened by duke1712 2
  • java.lang.NullPointerException

    java.lang.NullPointerException

    FATAL EXCEPTION: main Process: com.example.dkim.starbucksecret, PID: 21165 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.animation.ValueAnimator.start()' on a null object reference at com.bhargavms.dotloader.DotLoader._startAnimation(DotLoader.java:219) at com.bhargavms.dotloader.DotLoader.access$200(DotLoader.java:21) at com.bhargavms.dotloader.DotLoader$2.run(DotLoader.java:196) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    weird I am getting this.

    It was working fine then It just started to happen today.

    Just updated Android Studio and Compile SDK to the latest version but I am not sure if its related.

    The error does not happen in other activity/fragment. only this specific activity I am getting this error.

    Dotloader is set up exactly same way as it is setup in other activity.

    opened by kimkong88 1
Releases(1.1.1)
Owner
Bhargav Mogra
Passionate coder, with a love for beautiful UI
Bhargav Mogra
Resultat is kotlin.Result with a loading state

What is Résultat? Résultat is a fork of Kotlin Result with a loading state. Why? Because sometimes you start a project based on Kotlin Result and you

null 41 Dec 10, 2022
Quick photo and video camera with a flash, customizable resolution and no ads.

Simple Camera A camera with flash, zoom and no ads. The camera is usable for both photo taking and video recording. You can switch between front and r

Simple Mobile Tools 644 Dec 26, 2022
A simple calendar with events, customizable widgets and no ads.

Simple Calendar A simple calendar with events and a customizable widget. A simple calendar with optional CalDAV synchronization. You can easily create

Simple Mobile Tools 3k Jan 8, 2023
Tweaks - A customizable debug screen to view and edit flags that can be used for development

A customizable debug screen to view and edit flags that can be used for developm

Telefónica 10 Jun 28, 2022
MemoryGame - An Android memory game with customizable options

MemoryGame An Android memory game with customizable options Open source librarie

null 1 Feb 3, 2022
Highly customizable, 1.8.9 Forge Hypixel Duels bot!

What is Duck Dueller? Duck Dueller is a free and open-source Hypixel Duels bot, designed to work for Forge 1.8.9! It is planned to support many modes

null 9 Jan 1, 2023
🪄 This is an animation library with an increasing number of TextViews

CountNumberEvent ?? This is an animation library with an increasing number of TextViews Demo Setup Add it in your root build.gradle at the end of repo

박상선 5 Feb 17, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 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
Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps

Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps. The extension provides handy methods and properties to change the behaviour as well as the appearance of the navigation bar.

Zain Ul Hassan 4 Nov 30, 2022
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 loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Cloudist Technology Co., Ltd. 234 Nov 24, 2022
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
Compose-buttons - A set of Loading animations used in Buttons to convey a "loading" state after the button is clicked.

Loading Buttons A set of Loading animations used in Buttons to convey a "loading" state after the button is clicked. A simple demo application that sh

Brad Ball 16 Jul 5, 2022
Chandrasekar Kuppusamy 799 Nov 14, 2022
A download button with pretty cool animation

ArrowDownloadButton A download button with pretty cool animation, this is an implemention of https://dribbble.com/shots/2012292-Download-Animation Enj

Rongchan Liu 966 Nov 29, 2022