I ran into a crash that was a stupid error on my part, but perhaps could be handled more gracefully by the library or at least be well-documented. If I set a progress value that is outside the range of 0 to max, I get a crash.
I could see perhaps a modification to this library that, when receiving a progress value, floors or ceilings it to the acceptable range. For example, if a progress of 6 is set on a pie view with a max of 4, the effective progress value would become 4. Likewise for negative numbers, if progress is set as -3, then the effective progress for display becomes 0.
If you'd rather not sanitize inputs in that way, I'd suggest either a note about it in the documentation and/or a RuntimeException subclass that is thrown when this occurs, and a throws declaration on the setProgress and setMax signatures.
I ran into a crash that was a stupid error on my part, but perhaps could be handled more gracefully by the library or at least be well-documented. If I set a progress value that is outside the range of
0tomax, I get a crash.I could see perhaps a modification to this library that, when receiving a progress value, floors or ceilings it to the acceptable range. For example, if a progress of
6is set on a pie view with a max of4, the effectiveprogressvalue would become4. Likewise for negative numbers, ifprogressis set as-3, then the effectiveprogressfor display becomes0.If you'd rather not sanitize inputs in that way, I'd suggest either a note about it in the documentation and/or a
RuntimeExceptionsubclass that is thrown when this occurs, and athrowsdeclaration on thesetProgressandsetMaxsignatures.