r/androiddev • • May 07 '20

Circular Determinate Progress View - A highly customizable progress view with built in animations, gradient support and more

https://gfycat.com/softgargantuancaecilian
308 Upvotes

31 comments sorted by

26

u/[deleted] May 07 '20

https://github.com/owl-93/DeterminateProgressView

Features:

  • Support for solid colors as well as linear, sweep, and radial gradients for both progress bar and text (2 or 3 color gradients)

  • 4 built in formats for text based on progress

  • clockwise or ccw progress direction

  • configurable starting angle

  • progress is in float so decimal based progress is allowed

  • configurable max value

  • optional track

  • highly themeable

  • built in progress animations if desired

  • all visual attributes (except for animations and interpolators) are settable via XML

  • built in Kotlin

6

u/stefanowatches May 07 '20

Nice, but the end points of the progress bar are kind of sharp. Would be nice to add an option to round them off.

17

u/[deleted] May 07 '20

I can add the option to choose the caps for the stroke. Android graphics API provides square, round, and butt (lol) as option for strokes.

That will go in 1.1

3

u/sillyV 5000 line method and going strong May 07 '20

Oh cool. I added a feature request for this. Hopefully I did it the right way

1

u/AD-LB May 07 '20

How does each of them look like?

7

u/tryhardprojects May 07 '20

Looks very promising, can't wait to use it!

3

u/[deleted] May 07 '20

Thanks! Let me know what you think or if you find any bugs

3

u/Thomas_XX May 07 '20

Looks amazing, are you able to move your progress by clicking on the circle area?

3

u/[deleted] May 07 '20

Not as of 1.0 - but I'm planning on adding drag handles for a seekbar version!

Feel free to leave a feature request on GitHub!

1

u/gonemad16 GoneMAD Software May 07 '20

a seekbar version would be awesome. I currently have an option in my music player to display circular album art.. so it would be sweet to be able to swap the horizonal seek bar with a circular one that surrounds the circular art

7

u/DeadlyAlive May 07 '20

I have no use for this as of now, but seems damn epic. Great work.

1

u/[deleted] May 07 '20

Nice work! How long did it take you to implement?

2

u/[deleted] May 07 '20

The core of the view, probably a few hours. The gradients, a day or two, and other things and configuring all the types and xml attrs, and just planning out how I want the view API to be, a day or so. The demo app took the most time almost because I had to come up with ux and a way to configure all possible parts of the view, as well as building the demo app helped me find a few bugs

After code reviewing myself I found a few things id like to optimize and I definitely want to give the docs a thorough second pass as well as add one or two things.

1

u/[deleted] May 07 '20

You made a good job. We need more such free elements. Consider to post it to android-arsenal.com!

1

u/joaoeudes7 May 08 '20

Good! Has support to set color in internal background?

1

u/[deleted] May 08 '20

this view subclasses the view class, so background can be set that way. If you set with a color, it will fill the rectangular area the view takes up. if you need a background color to only fill the area within the progress bar, i recommend using drawable xml resource and simply create an oval shape with the color you need and set that drawable as the progress view background.

I can consider adding a background property to the view if enough people are interested.

1

u/Zhuinden May 08 '20

Oh, that's pretty good! I'll look at it for some inspiration, canvas + gradients is always a bit tricky to put together.

1

u/[deleted] May 08 '20

yeah it certainly can be. I learned a lot along the way while building this

1

u/[deleted] May 07 '20

Nice

1

u/cptReese May 07 '20

If this control apply to show waiting progress(downloading, calculating, etc) it is good to add running glow animation across completed part, for example like in windows: https://youtu.be/2qQgctSi4iY?t=72 but it's not only in windows, a lot progressbar use this effect to show(simulate) that process is not stuck

1

u/AD-LB May 07 '20

Impressive!

1

u/tatocaster deprecated May 07 '20

Awesome!!

1

u/jeevansurendran May 07 '20

This seems really cool. I loved it. The demo is also really cool.

1

u/m00fintops May 08 '20

Looks great! I made something like this back then, because I couldn't find any good circular progress that fits my use case. Not as highly customizable as this tho, I didn't even think to expand it further. Good job.

2

u/[deleted] May 07 '20

[removed] — view removed comment

5

u/[deleted] May 07 '20

Anywhere you want to use a determinate progress bar where you prefer a highly customizeable circular progress indicator as opposed to the barebones straight line one that comes with Android.

Good uses include:

  • count down timers, or any sort of timer or watch

  • download progress

  • alternative for using page indicators for viewpagers

  • buffering or playback indicator

  • anywhere you need to indicate progress

  • could be used in a custom swipe/pulldown to refresh indicator

1

u/[deleted] May 07 '20

[removed] — view removed comment

3

u/[deleted] May 07 '20

Right, but the only circular one that comes with Android is "indeterminate" meaning it just spins and spins and there's no actual quantifiable progress. This one is for indicating measurable progress

Thanks!