diff --git a/src/Components/MRActivityIndicatorView.h b/src/Components/MRActivityIndicatorView.h index 59de56d..e0f28da 100644 --- a/src/Components/MRActivityIndicatorView.h +++ b/src/Components/MRActivityIndicatorView.h @@ -22,6 +22,8 @@ #pragma clang diagnostic pop } +@property (nonatomic, assign) float runnerSize; + /** A float value to indicate how thick the line of the activivity indicator is. diff --git a/src/Components/MRActivityIndicatorView.m b/src/Components/MRActivityIndicatorView.m index 8e972df..af1c515 100644 --- a/src/Components/MRActivityIndicatorView.m +++ b/src/Components/MRActivityIndicatorView.m @@ -51,7 +51,8 @@ - (void)commonInit { self.accessibilityLabel = NSLocalizedString(@"Indeterminate Progress", @"Accessibility label for activity indicator view"); self.hidesWhenStopped = YES; - + self.runnerSize = 0.9; + CAShapeLayer *shapeLayer = [CAShapeLayer new]; shapeLayer.borderWidth = 0; shapeLayer.fillColor = UIColor.clearColor.CGColor; @@ -118,11 +119,12 @@ - (void)layoutSubviews { - (UIBezierPath *)layoutPath { const double TWO_M_PI = 2.0*M_PI; double startAngle = 0.75 * TWO_M_PI; - double endAngle = startAngle + TWO_M_PI * 0.9; + double endAngle = startAngle + TWO_M_PI * self.runnerSize; CGFloat width = self.bounds.size.width; + CGFloat lineWidth = self.lineWidth; return [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2.0f, width/2.0f) - radius:width/2.2f + radius:(width - lineWidth)/2.0f startAngle:startAngle endAngle:endAngle clockwise:YES]; @@ -205,7 +207,7 @@ - (void)addAnimation { CABasicAnimation *spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; spinAnimation.toValue = @(1*2*M_PI); spinAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; - spinAnimation.duration = 1.0; + spinAnimation.duration = 1.2; spinAnimation.repeatCount = INFINITY; [self.shapeLayer addAnimation:spinAnimation forKey:MRActivityIndicatorViewSpinAnimationKey]; } diff --git a/src/Components/MRCircularProgressView.m b/src/Components/MRCircularProgressView.m index 293d676..c622e03 100644 --- a/src/Components/MRCircularProgressView.m +++ b/src/Components/MRCircularProgressView.m @@ -199,7 +199,7 @@ - (void)updateLabel:(float)progress { - (void)setProgress:(float)progress animated:(BOOL)animated { if (animated) { - if (ABS(self.progress - progress) < CGFLOAT_MIN) { + if (ABS(self.progress - progress) * 100 < 1) { return; } diff --git a/src/Utils/MRProgressHelper.h b/src/Utils/MRProgressHelper.h index 0213170..398fbf3 100644 --- a/src/Utils/MRProgressHelper.h +++ b/src/Utils/MRProgressHelper.h @@ -37,7 +37,7 @@ static inline CGRect MRCenterCGSizeInCGRect(CGSize innerRectSize, CGRect outerRe } -static inline CGFloat MRRotationForStatusBarOrientation() { +static inline CGFloat MRRotationForStatusBarOrientation() NS_EXTENSION_UNAVAILABLE_IOS("Status bar orientation is not available in extensions.") { UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation; if (orientation == UIInterfaceOrientationLandscapeLeft) { return -M_PI_2;