Material progress circle around any FloatingActionButton. 100% Guidelines.

Overview

FABProgressCircle

Build Status Android Arsenal Maven Central

Android library to provide a material progress circle around your FloatingActionButton. This component is compatible with any existent FAB.

Demo Screenshot

Demo Screenshot2

Sample app:

Get it on Google Play

Youtube FABProgressCircle video

FABProgressCircle follows material guidelines at 100%. Links to Google samples of this behavior:

How to use

You can use the FABProgressCircle to wrap any existent FAB. Here you have an example wrapping the Google FloatingActionButton from the brand new Design Support Library.

<com.github.jorgecastilloprz.FABProgressCircle
    android:id="@+id/fabProgressCircle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >

  <!-- You can change it with the fab from the library you want to use -->
  <android.support.design.widget.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/ic_upload"
      app:rippleColor="@color/fab_ripple"
      app:elevation="@dimen/fab_elevation"
      app:borderWidth="0dp"
      />

</com.github.jorgecastilloprz.FABProgressCircle>

To show the progress circle, call the show() method into the normal click/touch listener of your fab:

fabView.setOnClickListener(new View.OnClickListener() {
  @Override public void onClick(View view) {
    fabProgressCircle.show();
    startYourAsynchronousJob();
  }
});

The progress animation will be indeterminate at the beginning, as you can't really know how long is the asynchronous call going to take to complete.

IMPORTANT: The animation will start playing everytime the user clicks on the button. Developers should control the potential spam click in their fab buttons, to not allow the users to click on it if the asynchronous task and the progress animation are already running / playing at that very moment. I rather leaving that behavior to every dev using this library.

To play the completion animation, you will need to call:

fabProgressCircle.beginFinalAnimation();

When the completion animation is displayed, the fab gets transformed to its final appearance, and it becomes not clickable anymore. This behavior is intentional. If you want your fab to get clickable again (to be able to repeat the process), check custom attribute app:reusable="true" in the custom attributes list. If something happens to the asynchronous task running (some kind of error), you can always stop the animation by doing:

fabProgressCircle.hide();

For listening to the completion animation, your class needs to implement the FABProgressListener interface:

fabProgressCircle.attachListener(this);

If you do that, the following method call will be dispatched at the right time. The Snackbar creation is just an example:

@Override public void onFABProgressAnimationEnd() {
    Snackbar.make(fabProgressCircle, R.string.cloud_upload_complete, Snackbar.LENGTH_LONG)
        .setAction("Action", null)
        .show();
}

Custom Attributes

Even if i want the component to respect material guidelines, you can customize some parameters to adapt it a little bit for your application UI/UX. Here they are:

  • app:arcColor="@color/progressArcColor": Sets the color for the arc, and for the final aspect of the FAB (after the transform animation).
  • app:arcWidth="@dimen/arcStrokeWidth": Stroke width for the progress circle.
  • app:finalIcon="@drawable/ic_done": By default, this library uses the typical ic_done icon at the end of the animation. Normally i would rather not to change it, but feel free to do it if you need to.
  • app:reusable="true": By default, the FAB gets locked when the final animation finishes. Use this attr to allow using the FAB multiple times. A new fadeout anim will be played after completion, and the component will get reset to it's initial state.
  • app:circleSize="normal" or app:circleSize="mini": Normally you will not use this attribute, as the default size for the circle is the normal one. But if you are working with a mini sized FAB, you will need to use it.
  • app:roundedStroke="true": Use this one to have a rounded stroke on both progress circle heads. You will not really notice the difference for the default arcStrokeWidth, but you will if you are using a higher width to get some cool effects.

Of course, anyone of the custom attrs can be used with resource references (@dimen, @color, @integer ...) or just literal values. Dont forget to add the namespace declaration to your xml file. You can change the namespace name from app to anything you want.

xmlns:app="http://schemas.android.com/apk/res-auto"

Code sample

<com.github.jorgecastilloprz.FABProgressCircle
    android:id="@+id/fabProgressCircle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:arcColor="#00ffff"
    app:arcWidth="7dp"
    app:finalIcon="@drawable/ic_bookmark_complete"
    >

  <android.support.design.widget.FloatingActionButton
      ...
      />

</com.github.jorgecastilloprz.FABProgressCircle>

Remember that the FAB customization / configuration depends on the FAB library, not on this one. This is just a component used to wrap it visually. I created it by this way to make it totally compatible with any fab library you might be using into your app.

Mini Size

Mini size is totally supported, so feel free to use the app:fabSize="mini" custom attribute on the Google FAB, or the corresponding mini custom attribute of the fab library you are using. IMPORTANT: You will need to add the custom attribute app:circleSize="mini" to the FABProgressCircle to get this feature working on properly.

Demo Screenshot3

Supported most used FAB libraries

Known issues

  • Still not compatible with complex fab modes like the FloatingActionsMenu from the futuresimple library. I will work on that as soon as possible.
  • Not tested for makovkastar library hidding / showing mode when attached to some ListView / RecyclerView. But it will pretty much fail (i think).

Pull requests to solve the above stated issues will be very welcome.

Contributions

Feel free to send Pull Requests to this repository if you feel that it lacks some functionality. I will be pleased to accept or discuss about them. However, Material Design guidelines will be required.

Add it to your project

If you are working with gradle, add the dependency to your build.gradle file:

dependencies{
    compile 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
}

if you are working with maven, do it into your pom.xml

<dependency>
    <groupId>com.github.jorgecastilloprz</groupId>
    <artifactId>fabprogresscircle</artifactId>
    <version>1.01</version>
    <type>aar</type>
</dependency>

Developed By

Add me to Linkedin

License

Copyright 2015 Jorge Castillo Pérez

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
  • BeginAnimation turns FAB into white

    BeginAnimation turns FAB into white

    This is my code

    <com.github.jorgecastilloprz.FABProgressCircle
                android:id="@+id/fabProgressCircle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="15dp"
                android:layout_marginTop="150dp"
                android:visibility="invisible"
                app:arcColor="#ffffff"
                app:finalIcon="@drawable/ic_done"
                app:arcWidth="2dp">
    
                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/file_start"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:fab_colorNormal="@color/accent"
                    fab:fab_colorPressed="@color/accentDark"
                    fab:fab_icon="@drawable/start_lock"
                    fab:fab_size="normal" />
            </com.github.jorgecastilloprz.FABProgressCircle>
    

    When ever I am calling the method, progress.beginAnimation() the entire FAB turns into solid white color. No drawable is put in it to indicate completion.

    Can someone please help to solve this?

    opened by aritraroy 3
  • Remove

    Remove "allowBackup" from AndroidManifest

    There is no reason allowBackup="true" should be set in the AndroidManifest. This will cause the manifest merger build step to fail if an application specifies allowBackup="false".

    opened by bryanstern 1
  • Elevation attribute not working

    Elevation attribute not working

    As the tittle says, the elevation attribute of the Google FAB and FABProgressCircle are not working. If I use the Google FAB alone, the attribute works as expected.

    opened by amiguels 0
  • Add support for custom animation duration

    Add support for custom animation duration

    Add support for custom duration for complete / shrink / grow / rotation animation

    Add setter and getter for property Add option to not show final icon Add option to modify the visibility duration of the final icon

    Move all file in one package to protect access of internal classes Change app gradle to depends on local library project Update README

    opened by kmenager 0
  • fix: Fix complete icon not showing

    fix: Fix complete icon not showing

    Don't set the margins of the complete view in code but instead set size of the complete icon in XML. Content size of a FAB should always be 24dp, regardless of its size.

    Seems like setting the padding does somethings strange. Although you set the padding on all sides, the icons gets moved to the lower right (and out of the view), hence the icon is not visible. Honestly, I don't know why this is happening but setting the size of the icon in XML instead seems like an easy solution. Maybe even easier then setting a padding in code in the first place? Let me know what you think!

    opened by fnberta 0
  • call show and hide in row

    call show and hide in row

    Maybe is bug. I called

    fabProgressCircle.show();
    fabProgressCircle.hide();
    

    its stay show.. xml code :

    <com.github.jorgecastilloprz.FABProgressCircle
            android:id="@+id/fabProgressCircle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end|bottom">
    
            <android.support.design.widget.FloatingActionButton
                android:id="@+id/fab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"
                android:tint="@android:color/white"
                app:reusable="true"
                app:srcCompat="@drawable/ic_arrow_forward_black_24dp" />
    
    </com.github.jorgecastilloprz.FABProgressCircle>
    
    

    any solution?

    opened by marko995 1
Owner
Jorge Castillo
Senior Sofware Engineer @47deg
Jorge Castillo
A circle progress animation view on Android

CircleProgress A Circle Progress View with a rotate animation. Just make for fun. Hope you enjoy it. Quick Look Usage <me.fichardu.circleprogress.Circ

null 814 Dec 27, 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
An Android percentage chart that displays the progress of any single given task or information.

Percentage Chart View A Java-based easy to use and highly adjustable custom view that displays the progress of a single given task. Please feel free t

Rami Jemli 364 Dec 20, 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
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
: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
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 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 material style progress wheel compatible with 2.3

![](https://img.shields.io/badge/Methods and size-106 | 12 KB-e91e63.svg) Material-ish Progress A material style progress wheel compatible with 2.3 Tr

Nico Hormazábal 2.5k Dec 28, 2022
An android library to display a progressbar that goes around an image.

android-square-progressbar First things first This library is setup to work with the Android Studio and Gradle. If you're using the Eclipse environmen

Yannick Signer 1.3k Nov 15, 2022
Android library to display progress like google does in some of his services.

GoogleProgressBar This library is not maintained anymore and there will be no further releases Android library to display different kind of google rel

JPARDOGO 1.3k Dec 27, 2022
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Akexorcist 2.3k Dec 31, 2022
Android fillable progress view working with SVG paths. This is a nice option too if you want to create an interesting branding logo for your app. Based on the iOS project: https://github.com/poolqf/FillableLoaders

Android FillableLoaders Android Open Source library providing an interesting fillable progress view working with SVG paths. This is a nice option too

Jorge Castillo 2k Jan 1, 2023
Android AlertDialog with moving dots progress indicator

Spots progress dialog Android AlertDialog with moving spots progress indicator packed as android library. =========== Usage The library available in m

Maksym Dybarskyi 1.1k Dec 26, 2022
This is beautiful color arc progress bar.

ColorArcProgressBar 中文版 This is a customizable circular progressbar.It can achieve the effect of the QQ health's arc progress with XML. What's more, w

PASSION 928 Dec 6, 2022
Present your progress bars in arc mode with information and total control.

ArcProgressStackView Present your progress bars in arc mode with information and total control. You can check the sample app here. Warn This library i

Basil Miller 249 Sep 10, 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
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Akexorcist 2.3k Jan 7, 2023
Completely customizable progress based loaders drawn using custom CGPaths written in Swift

FillableLoaders Completely customizable progress based loaders drawn using custom CGPaths written in Swift Waves Plain Spike Rounded Demo: Changelog:

Pol Quintana 2.1k Dec 31, 2022