Git Product home page Git Product logo

loading-dots's Introduction

LoadingDots for Android

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

Features

  • LoadingDots animated view
  • Use in xml
  • Customize dots appearance
  • Customize animation behavior
  • Customize animation duration

Demo

Import

   compile 'com.eyalbira.loadingdots:loading-dots:1.0.2'

Usage

For basic usage, simply add to layout xml:

   <com.eyalbira.loadingdots.LoadingDots
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"/>

To customize, simply use the needed view attributes:

   <com.eyalbira.loadingdots.LoadingDots
           xmlns:app="http://schemas.android.com/apk/res-auto"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"

           app:LoadingDots_auto_play="true"

           app:LoadingDots_dots_color="@android:color/holo_blue_light"
           app:LoadingDots_dots_count="4"
           app:LoadingDots_dots_size="3dp"
           app:LoadingDots_dots_space="1dp"

           app:LoadingDots_loop_duration="800"
           app:LoadingDots_loop_start_delay="100"

           app:LoadingDots_jump_duration="200"
           app:LoadingDots_jump_height="4dp"/>

loading-dots's People

Contributors

bryant1410 avatar eyalbira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

loading-dots's Issues

NullPointerException on ValueAnimator

I've got a NPE when updating the visibility of LoadingDots to Visible.

Stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.animation.ValueAnimator.isRunning()' on a null object reference at com.eyalbira.loadingdots.LoadingDots.startAnimationIfAttached(LoadingDots.java:167) at com.eyalbira.loadingdots.LoadingDots.setVisibility(LoadingDots.java:148)

I have LoadingDots_auto_play=false. I checked the code and found the issue here:
private void startAnimationIfAttached() { if (mIsAttachedToWindow && !mAnimation.isRunning()) { mAnimation.start(); } }

It seems that mAnimation is null when autoplay is false. You've added check whether mAnimation is null anywhere you are invoking methods on it but here :)

Would you consider adding a link to our tutorial to the readme?

Hey @EyalBira, thank you for creating loading-dots, this lib is awesome πŸŽ‰

@MilanVucic and I work with a company called CometChat creating tutorials. We are collaborating on a Kotlin tutorial called "Adding animated typing indicators to your Kotlin chat app" (exact title TBD) and we used loading-dots for the typing indicators!

Here's a snippet:

typingLayout is just a piece of the layout that contains the TextView for showing the people who are typing as well as this neat β€œ3 dots jumping up and down” animation, for which I used this awesome 3rd party library. You can create your own too, but it’s just easier to use this one. If nobody is typing, the layout hides, and if people are typing, we simply format the message to resemble that state :

image_preview

When we publish the tutorial in the coming days, is there any chance we can add a link to the README as a real-world (ish) example of loading-dots?

Fill width with dots

Is there a way to fill the whole width with "dots"? Currently I'm setting the dots by setting app:LoadingDots_dots_count="12" but is there a way to fill the entire remaining space?

Compile version error

The following error started when using sdk version 27:

error: duplicate value for resource 'attr/font' with config ''.

error: resource previously defined here.
Message{kind=ERROR, text=error: resource previously defined here., sources=[gradle/caches/transforms-1/files-1.1/loading-dots-1.0.2.aar/ddd106d4303848c11195e14406b44fa8/res/values/values.xml:4:5-61], original message=, tool name=Optional.of(AAPT)}

Not working in SDK 18?

I'm trying to add this library to a project whose min SDK is 15 and testing it with an old phone with SDK 18 installed the animation does not work at all. The dots appear but there is no movement.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.