DotLoader


Source link: https://github.com/bhargavms/DotLoader

DotLoader

First, the gifs!

I am the one with constant Dots:

You can add dots on the fly !

And maybe create some cool animations like this?

(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

Resources

A simple copying external database library for Android.

The goal of this library is to allow your app to support multiple FontFamilies (e.g. lato, roboto, etc.) with their own styles (e.g. normal, bold, italic) in an easily-configurable way.

Gradle plugin for managing android app versionCode and versionName. Auto update versionCode on every git commit.

Helper classes for Requesting Android Runtime Permissions.

Android utils for context and thread.

A Funny ToggleButton for day and night change.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes