diff --git a/catalog/MaterialCatalog/MDCCatalogTiles.m b/catalog/MaterialCatalog/MDCCatalogTiles.m index 87248aed0cc..0c1b808089f 100644 --- a/catalog/MaterialCatalog/MDCCatalogTiles.m +++ b/catalog/MaterialCatalog/MDCCatalogTiles.m @@ -14,10 +14,12 @@ #import -#import "MaterialThemes.h" #import "MDCCatalogTiles.h" +#import "MaterialThemes.h" -UIImage* _Nullable MDCDrawImage(CGRect frame, MDCDrawFunc drawFunc, id colorScheme) { +UIImage* _Nullable MDCDrawImage(CGRect frame, + MDCDrawFunc drawFunc, + id colorScheme) { if (CGRectIsEmpty(frame)) { return nil; } @@ -35,33 +37,82 @@ #pragma clang diagnostic ignored "-Wconversion" void MDCCatalogDrawMDCLogoDark(CGRect frame, id colorScheme) { - UIColor* green = [UIColor colorWithRed: 0 green: 0.902 blue: 0.463 alpha: 1]; - UIColor* lightGreen = [UIColor colorWithRed: 0.698 green: 1 blue: 0.349 alpha: 1]; - UIColor* fillColor = [UIColor colorWithRed: 0.129 green: 0.129 blue: 0.129 alpha: 1]; + UIColor* green = [UIColor colorWithRed:0 green:0.902 blue:0.463 alpha:1]; + UIColor* lightGreen = [UIColor colorWithRed:0.698 green:1 blue:0.349 alpha:1]; + UIColor* fillColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1]; - CGRect logoDarkGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame) + 1, floor((frame.size.width) * 1.00000 + 0.5), floor((frame.size.height - 1) * 1.00000 + 0.5)); + CGRect logoDarkGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame) + 1, + floor((frame.size.width) * 1.00000 + 0.5), + floor((frame.size.height - 1) * 1.00000 + 0.5)); { UIBezierPath* squarePath = [UIBezierPath bezierPath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.00000 * logoDarkGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.00000 * logoDarkGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.00000 * logoDarkGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.00000 * logoDarkGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.00000 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; [squarePath closePath]; [fillColor setFill]; [squarePath fill]; - UIBezierPath* circlePath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(CGRectGetMinX(logoDarkGroup) + floor(logoDarkGroup.size.width * 0.33333 + 0.5), CGRectGetMinY(logoDarkGroup) + floor(logoDarkGroup.size.height * 0.33333 + 0.5), floor(logoDarkGroup.size.width * 1.00000 + 0.5) - floor(logoDarkGroup.size.width * 0.33333 + 0.5), floor(logoDarkGroup.size.height * 1.00000 + 0.5) - floor(logoDarkGroup.size.height * 0.33333 + 0.5))]; + UIBezierPath* circlePath = [UIBezierPath + bezierPathWithOvalInRect:CGRectMake(CGRectGetMinX(logoDarkGroup) + + floor(logoDarkGroup.size.width * 0.33333 + 0.5), + CGRectGetMinY(logoDarkGroup) + + floor(logoDarkGroup.size.height * 0.33333 + 0.5), + floor(logoDarkGroup.size.width * 1.00000 + 0.5) - + floor(logoDarkGroup.size.width * 0.33333 + 0.5), + floor(logoDarkGroup.size.height * 1.00000 + 0.5) - + floor(logoDarkGroup.size.height * 0.33333 + 0.5))]; [lightGreen setFill]; [circlePath fill]; UIBezierPath* intersectionPath = [UIBezierPath bezierPath]; - [intersectionPath moveToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; - [intersectionPath addCurveToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.48257 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.48257 * logoDarkGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; + [intersectionPath + moveToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; + [intersectionPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.48257 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.33333 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.48257 * logoDarkGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.66667 * logoDarkGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoDarkGroup) + 0.66667 * logoDarkGroup.size.width, + CGRectGetMinY(logoDarkGroup) + 0.33333 * logoDarkGroup.size.height)]; [intersectionPath closePath]; [green setFill]; [intersectionPath fill]; @@ -70,32 +121,81 @@ void MDCCatalogDrawMDCLogoDark(CGRect frame, id colorScheme) { void MDCCatalogDrawMDCLogoLight(CGRect frame, id colorScheme) { UIColor* white = [UIColor whiteColor]; - UIColor* green = [UIColor colorWithRed: 0 green: 0.902 blue: 0.463 alpha: 1]; - UIColor* lightGreen = [UIColor colorWithRed: 0.698 green: 1 blue: 0.349 alpha: 1]; + UIColor* green = [UIColor colorWithRed:0 green:0.902 blue:0.463 alpha:1]; + UIColor* lightGreen = [UIColor colorWithRed:0.698 green:1 blue:0.349 alpha:1]; - CGRect logoLightGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), floor((frame.size.width) * 1.00000 + 0.5), floor((frame.size.height) * 1.00000 + 0.5)); + CGRect logoLightGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), + floor((frame.size.width) * 1.00000 + 0.5), + floor((frame.size.height) * 1.00000 + 0.5)); { UIBezierPath* squarePath = [UIBezierPath bezierPath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.00000 * logoLightGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.00000 * logoLightGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.00000 * logoLightGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.00000 * logoLightGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.00000 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; [squarePath closePath]; [white setFill]; [squarePath fill]; - UIBezierPath* circlePath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(CGRectGetMinX(logoLightGroup) + floor(logoLightGroup.size.width * 0.33333 + 0.5), CGRectGetMinY(logoLightGroup) + floor(logoLightGroup.size.height * 0.33333 + 0.5), floor(logoLightGroup.size.width * 1.00000 + 0.5) - floor(logoLightGroup.size.width * 0.33333 + 0.5), floor(logoLightGroup.size.height * 1.00000 + 0.5) - floor(logoLightGroup.size.height * 0.33333 + 0.5))]; + UIBezierPath* circlePath = [UIBezierPath + bezierPathWithOvalInRect:CGRectMake(CGRectGetMinX(logoLightGroup) + + floor(logoLightGroup.size.width * 0.33333 + 0.5), + CGRectGetMinY(logoLightGroup) + + floor(logoLightGroup.size.height * 0.33333 + 0.5), + floor(logoLightGroup.size.width * 1.00000 + 0.5) - + floor(logoLightGroup.size.width * 0.33333 + 0.5), + floor(logoLightGroup.size.height * 1.00000 + 0.5) - + floor(logoLightGroup.size.height * 0.33333 + 0.5))]; [green setFill]; [circlePath fill]; UIBezierPath* intersectionPath = [UIBezierPath bezierPath]; - [intersectionPath moveToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; - [intersectionPath addCurveToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.48257 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.48257 * logoLightGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; - [intersectionPath addLineToPoint: CGPointMake(CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; + [intersectionPath + moveToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; + [intersectionPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.48257 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.33333 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.48257 * logoLightGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.66667 * logoLightGroup.size.height)]; + [intersectionPath + addLineToPoint:CGPointMake( + CGRectGetMinX(logoLightGroup) + 0.66667 * logoLightGroup.size.width, + CGRectGetMinY(logoLightGroup) + 0.33333 * logoLightGroup.size.height)]; [intersectionPath closePath]; [lightGreen setFill]; [intersectionPath fill]; @@ -104,20 +204,136 @@ void MDCCatalogDrawMDCLogoLight(CGRect frame, id colorScheme) void MDCCatalogDrawActivityIndicatorTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect activityIndicatorGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); + CGRect activityIndicatorGroup = + CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, + floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, + floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.95000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.45000 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.92250 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.45000 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.47250 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.72050 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.72050 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.27950 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.90000 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.72050 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.27950 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.27950 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.55000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.05000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.52750 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.10000 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.55000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.07750 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.55000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.02250 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.52750 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.22450 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.22450 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.77550 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.22450 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.50000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.77550 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.77550 * activityIndicatorGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.95000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.45000 * activityIndicatorGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 1.00000 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.47250 * activityIndicatorGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(activityIndicatorGroup) + 0.97750 * activityIndicatorGroup.size.width, CGRectGetMinY(activityIndicatorGroup) + 0.45000 * activityIndicatorGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.95000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.45000 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.92250 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.45000 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.47250 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.72050 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.72050 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.27950 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.90000 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.72050 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.27950 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.27950 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.55000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.05000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.52750 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.10000 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.55000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.07750 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.55000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.02250 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.52750 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.22450 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.22450 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.77550 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.22450 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.50000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.77550 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.77550 * activityIndicatorGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.95000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.45000 * activityIndicatorGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 1.00000 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.47250 * activityIndicatorGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(activityIndicatorGroup) + + 0.97750 * activityIndicatorGroup.size.width, + CGRectGetMinY(activityIndicatorGroup) + + 0.45000 * activityIndicatorGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -126,44 +342,295 @@ void MDCCatalogDrawActivityIndicatorTile(CGRect frame, id colo void MDCCatalogDrawAnimationTimingTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect animationGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect animationGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* ringsBezierPath = [UIBezierPath bezierPath]; - [ringsBezierPath moveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.33900 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.18900 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.51450 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.39750 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.07700 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.18900 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.33900 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.27500 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.22250 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.22200 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.27500 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.65000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.07700 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.39750 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.51450 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.84350 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.15650 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.66100 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.81100 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.48550 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.60250 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.92300 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.81100 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.66100 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.72500 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.77750 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.77800 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.72500 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.92300 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.60250 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.48550 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.15650 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.84350 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height)]; + [ringsBezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.33900 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.18900 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.51450 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.39750 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.07700 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.18900 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.33900 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.27500 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.22250 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.22200 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.27500 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.65000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.07700 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.39750 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.51450 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.84350 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.15650 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.66100 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.81100 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.48550 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 1.00000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.60250 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.92300 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.81100 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.66100 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.72500 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.77750 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.77800 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.72500 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.92300 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.60250 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.48550 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 1.00000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.15650 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.84350 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.00000 * animationGroup.size.height)]; [ringsBezierPath closePath]; - [ringsBezierPath moveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.65000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.21200 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.78800 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.15000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.59400 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.11850 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.54200 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.85000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.15000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.69350 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.30650 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.85000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.45800 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.88150 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.40600 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height)]; + [ringsBezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.65000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.21200 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.78800 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.15000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.10000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.59400 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.11850 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.54200 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.85000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.15000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.69350 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.30650 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.85000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.35000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.45800 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.88150 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.40600 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.90000 * animationGroup.size.height)]; [ringsBezierPath closePath]; - [ringsBezierPath moveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.36200 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.63800 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.30000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.44400 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.26850 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.39200 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.70000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.30000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.54300 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.45650 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.69950 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.60800 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.73150 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.55600 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height)]; + [ringsBezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.36200 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.63800 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.30000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.25000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.44400 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.26850 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.39200 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.70000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.30000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.54300 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.45650 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.69950 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.60800 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.73150 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.55600 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.75000 * animationGroup.size.height)]; [ringsBezierPath closePath]; - [ringsBezierPath moveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.73500 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.58500 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.70850 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.59450 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.68000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.51200 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.48800 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.41500 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.26500 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.32000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.40550 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.29150 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.44150 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.25550 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.47000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.63800 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.36200 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.73500 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.58500 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.53000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.74450 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.55850 * animationGroup.size.height)]; + [ringsBezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.73500 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.58500 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.70850 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.59450 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.68000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.51200 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.60000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.48800 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.41500 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.26500 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.40000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.32000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.40550 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.29150 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.44150 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.25550 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.47000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.63800 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.25000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.36200 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.73500 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.58500 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.75000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.53000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.74450 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.55850 * animationGroup.size.height)]; [ringsBezierPath closePath]; - [ringsBezierPath moveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.15000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.30700 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.69350 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.15050 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.54200 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.11850 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.59350 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.78800 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.21200 * animationGroup.size.height)]; - [ringsBezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.40600 * animationGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(animationGroup) + 0.88150 * animationGroup.size.width, CGRectGetMinY(animationGroup) + 0.45800 * animationGroup.size.height)]; + [ringsBezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.50000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.15000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.30700 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.69350 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.15050 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.65000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.54200 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.11850 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.59350 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.35000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.78800 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.10000 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.21200 * animationGroup.size.height)]; + [ringsBezierPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(animationGroup) + 0.85000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.50000 * animationGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(animationGroup) + 0.90000 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.40600 * animationGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(animationGroup) + 0.88150 * animationGroup.size.width, + CGRectGetMinY(animationGroup) + 0.45800 * animationGroup.size.height)]; [ringsBezierPath closePath]; [fillColor setFill]; [ringsBezierPath fill]; @@ -172,26 +639,58 @@ void MDCCatalogDrawAnimationTimingTile(CGRect frame, id colorS void MDCCatalogDrawAppBarTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect appBarGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), floor((frame.size.width) * 1.00000 + 0.5), floor((frame.size.height) * 1.00000 + 0.5)); + CGRect appBarGroup = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), + floor((frame.size.width) * 1.00000 + 0.5), + floor((frame.size.height) * 1.00000 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 1.00000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 1.00000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 1.00000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 1.00000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 1.00000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 1.00000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 1.00000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 1.00000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.00000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.00000 * appBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.25000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.25000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.25000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.25000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.10000 * appBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.35000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.35000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.35000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.35000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.90000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(appBarGroup) + 0.10000 * appBarGroup.size.width, + CGRectGetMinY(appBarGroup) + 0.90000 * appBarGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -200,40 +699,190 @@ void MDCCatalogDrawAppBarTile(CGRect frame, id colorScheme) { void MDCCatalogDrawBottomAppBarTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect bottomAppBarGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect bottomAppBarGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 1.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.00000 * bottomAppBarGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 1.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.00000 * bottomAppBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.75000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.35700 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.75000 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.50000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.82500 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.38850 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.79500 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.44100 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.82500 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.64300 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.75000 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.55900 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.82500 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.61150 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.79500 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.75000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.75000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.35700 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.75000 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.50000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.82500 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.38850 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.79500 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.44100 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.82500 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.64300 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.75000 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.55900 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.82500 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.61150 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.79500 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.75000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.50000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.72500 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.42500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.45850 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.72500 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.42500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.69150 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.50000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.42500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.60850 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.45850 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.54150 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.60850 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.50000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.72500 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.57500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.69150 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.54150 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.72500 * bottomAppBarGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.50000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.72500 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.42500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.45850 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.72500 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.42500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.69150 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.50000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.42500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.60850 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.45850 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.54150 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.60850 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.50000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.72500 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.57500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.69150 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.54150 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.72500 * bottomAppBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.67500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.50000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.47500 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.67500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.55350 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.59650 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.47500 * bottomAppBarGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.32500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.40350 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.47500 * bottomAppBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.32500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.55350 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.10000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.90000 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomAppBarGroup) + 0.67500 * bottomAppBarGroup.size.width, CGRectGetMinY(bottomAppBarGroup) + 0.65000 * bottomAppBarGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.67500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.50000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.47500 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.67500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.55350 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.59650 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.47500 * bottomAppBarGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.32500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.40350 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.47500 * bottomAppBarGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.32500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.55350 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.10000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.90000 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomAppBarGroup) + + 0.67500 * bottomAppBarGroup.size.width, + CGRectGetMinY(bottomAppBarGroup) + + 0.65000 * bottomAppBarGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -242,26 +891,73 @@ void MDCCatalogDrawBottomAppBarTile(CGRect frame, id colorSche void MDCCatalogDrawBottomNavTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect bottomNavGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect bottomNavGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.00000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.00000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.00000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.00000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.00000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.00000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.00000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.00000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 1.00000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 1.00000 * bottomNavGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.75000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.75000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.75000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.75000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.90000 * bottomNavGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.65000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.65000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.65000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.65000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.10000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake( + CGRectGetMinX(bottomNavGroup) + 0.90000 * bottomNavGroup.size.width, + CGRectGetMinY(bottomNavGroup) + 0.10000 * bottomNavGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -270,22 +966,60 @@ void MDCCatalogDrawBottomNavTile(CGRect frame, id colorScheme) void MDCCatalogDrawBottomSheetTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect bottomSheetGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect bottomSheetGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 1.00000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 1.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 1.00000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 1.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 1.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + 0.00000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.50000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 1.00000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 1.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 1.00000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 1.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.50000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 1.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.00000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.00000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.00000 * bottomSheetGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.90000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.90000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.width, CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(bottomSheetGroup) + 0.10000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + 0.50000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.10000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.10000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.90000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.10000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.90000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.50000 * bottomSheetGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(bottomSheetGroup) + + 0.10000 * bottomSheetGroup.size.width, + CGRectGetMinY(bottomSheetGroup) + + 0.50000 * bottomSheetGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -295,27 +1029,104 @@ void MDCCatalogDrawBottomSheetTile(CGRect frame, id colorSchem void MDCCatalogDrawButtonBarTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; UIColor* fillColor2 = [UIColor whiteColor]; - CGRect buttonBarGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 24, floor((frame.size.width - 8) * 0.89189 + 0.5), floor((frame.size.height - 24) * 0.58621 + 0.5)); + CGRect buttonBarGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 24, + floor((frame.size.width - 8) * 0.89189 + 0.5), + floor((frame.size.height - 24) * 0.58621 + 0.5)); { - UIBezierPath* outlinePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(CGRectGetMinX(buttonBarGroup) + floor(buttonBarGroup.size.width * 0.00000 + 0.5), CGRectGetMinY(buttonBarGroup) + floor(buttonBarGroup.size.height * 0.00000 + 0.5), floor(buttonBarGroup.size.width * 1.00000 + 0.5) - floor(buttonBarGroup.size.width * 0.00000 + 0.5), floor(buttonBarGroup.size.height * 1.00000 + 0.5) - floor(buttonBarGroup.size.height * 0.00000 + 0.5)) cornerRadius: 2]; + UIBezierPath* outlinePath = [UIBezierPath + bezierPathWithRoundedRect:CGRectMake(CGRectGetMinX(buttonBarGroup) + + floor(buttonBarGroup.size.width * 0.00000 + 0.5), + CGRectGetMinY(buttonBarGroup) + + floor(buttonBarGroup.size.height * 0.00000 + 0.5), + floor(buttonBarGroup.size.width * 1.00000 + 0.5) - + floor(buttonBarGroup.size.width * 0.00000 + 0.5), + floor(buttonBarGroup.size.height * 1.00000 + 0.5) - + floor(buttonBarGroup.size.height * 0.00000 + 0.5)) + cornerRadius:2]; [fillColor setFill]; [outlinePath fill]; UIBezierPath* crossPath = [UIBezierPath bezierPath]; - [crossPath moveToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20597 * buttonBarGroup.size.height)]; - [crossPath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.32491 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.39394 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.39394 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; - [crossPath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.67509 * buttonBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height)]; - [crossPath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.67509 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.09091 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.09091 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; - [crossPath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.32491 * buttonBarGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, CGRectGetMinY(buttonBarGroup) + 0.20597 * buttonBarGroup.size.height)]; + [crossPath + moveToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20597 * buttonBarGroup.size.height)]; + [crossPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.32491 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.39394 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.39394 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; + [crossPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.67509 * buttonBarGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height)]; + [crossPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.79412 * buttonBarGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.67509 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.09091 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.54412 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.09091 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.45588 * buttonBarGroup.size.height)]; + [crossPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.32491 * buttonBarGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.21970 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20588 * buttonBarGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonBarGroup) + 0.28030 * buttonBarGroup.size.width, + CGRectGetMinY(buttonBarGroup) + 0.20597 * buttonBarGroup.size.height)]; [crossPath closePath]; [fillColor2 setFill]; [crossPath fill]; @@ -325,38 +1136,154 @@ void MDCCatalogDrawButtonBarTile(CGRect frame, id colorScheme) void MDCCatalogDrawButtonsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect buttonsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect buttonsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* circlePath = [UIBezierPath bezierPath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.22400 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.22400 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.77600 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.22400 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.77600 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.77600 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.22400 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.77600 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height)]; + [circlePath + moveToPoint:CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.22400 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.22400 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.77600 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.22400 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.77600 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 1.00000 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.77600 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 1.00000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.22400 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.77600 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.00000 * buttonsGroup.size.height)]; [circlePath closePath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.27950 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.72050 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.27950 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.27950 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.72050 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.27950 * buttonsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.72050 * buttonsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.72050 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height)]; + [circlePath + moveToPoint:CGPointMake(CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.27950 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.72050 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.10000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.27950 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.27950 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.50000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.72050 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.10000 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.27950 * buttonsGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.50000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.90000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.72050 * buttonsGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.72050 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.90000 * buttonsGroup.size.height)]; [circlePath closePath]; [fillColor setFill]; [circlePath fill]; UIBezierPath* crossPath = [UIBezierPath bezierPath]; - [crossPath moveToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.25000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.25000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.75000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.75000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.75000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.75000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; - [crossPath addLineToPoint: CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; + [crossPath + moveToPoint:CGPointMake(CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.25000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.25000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.45000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.75000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.75000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.75000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.55000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.75000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.45000 * buttonsGroup.size.height)]; + [crossPath + addLineToPoint:CGPointMake( + CGRectGetMinX(buttonsGroup) + 0.55000 * buttonsGroup.size.width, + CGRectGetMinY(buttonsGroup) + 0.25000 * buttonsGroup.size.height)]; [crossPath closePath]; [fillColor setFill]; [crossPath fill]; @@ -365,53 +1292,163 @@ void MDCCatalogDrawButtonsTile(CGRect frame, id colorScheme) { void MDCCatalogDrawCollectionCellsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect collectionCellsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect collectionCellsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* outlinesPath = [UIBezierPath bezierPath]; - [outlinesPath moveToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.30000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.40000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.60000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.70000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.70000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.60000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.40000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.30000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 1.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.00000 * collectionCellsGroup.size.height)]; + [outlinesPath moveToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.30000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.40000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.60000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.70000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.70000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.60000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.40000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.30000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 1.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.00000 * collectionCellsGroup.size.height)]; [outlinesPath closePath]; - [outlinesPath moveToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.70000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.70000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.height)]; + [outlinesPath moveToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.70000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.70000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.height)]; [outlinesPath closePath]; - [outlinesPath moveToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.60000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.60000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.40000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.40000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.60000 * collectionCellsGroup.size.height)]; + [outlinesPath moveToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.60000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.60000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.40000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.40000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.60000 * collectionCellsGroup.size.height)]; [outlinesPath closePath]; - [outlinesPath moveToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.30000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.30000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.10000 * collectionCellsGroup.size.height)]; - [outlinesPath addLineToPoint: CGPointMake(CGRectGetMinX(collectionCellsGroup) + 0.90000 * collectionCellsGroup.size.width, CGRectGetMinY(collectionCellsGroup) + 0.30000 * collectionCellsGroup.size.height)]; + [outlinesPath moveToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.30000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.30000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.10000 * collectionCellsGroup.size.height)]; + [outlinesPath addLineToPoint:CGPointMake(CGRectGetMinX(collectionCellsGroup) + + 0.90000 * collectionCellsGroup.size.width, + CGRectGetMinY(collectionCellsGroup) + + 0.30000 * collectionCellsGroup.size.height)]; [outlinesPath closePath]; [fillColor setFill]; [outlinesPath fill]; - UIBezierPath* bottomSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionCellsGroup) + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), CGRectGetMinY(collectionCellsGroup) + floor(collectionCellsGroup.size.height * 0.75000 + 0.5), floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - floor(collectionCellsGroup.size.width * 0.15000 + 0.5), floor(collectionCellsGroup.size.height * 0.85000 + 0.5) - floor(collectionCellsGroup.size.height * 0.75000 + 0.5))]; + UIBezierPath* bottomSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(collectionCellsGroup) + + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + CGRectGetMinY(collectionCellsGroup) + + floor(collectionCellsGroup.size.height * 0.75000 + 0.5), + floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + floor(collectionCellsGroup.size.height * 0.85000 + 0.5) - + floor(collectionCellsGroup.size.height * 0.75000 + 0.5))]; [fillColor setFill]; [bottomSquarePath fill]; - UIBezierPath* middleSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionCellsGroup) + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), CGRectGetMinY(collectionCellsGroup) + floor(collectionCellsGroup.size.height * 0.45000 + 0.5), floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - floor(collectionCellsGroup.size.width * 0.15000 + 0.5), floor(collectionCellsGroup.size.height * 0.55000 + 0.5) - floor(collectionCellsGroup.size.height * 0.45000 + 0.5))]; + UIBezierPath* middleSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(collectionCellsGroup) + + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + CGRectGetMinY(collectionCellsGroup) + + floor(collectionCellsGroup.size.height * 0.45000 + 0.5), + floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + floor(collectionCellsGroup.size.height * 0.55000 + 0.5) - + floor(collectionCellsGroup.size.height * 0.45000 + 0.5))]; [fillColor setFill]; [middleSquarePath fill]; - UIBezierPath* topSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionCellsGroup) + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), CGRectGetMinY(collectionCellsGroup) + floor(collectionCellsGroup.size.height * 0.15000 + 0.5), floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - floor(collectionCellsGroup.size.width * 0.15000 + 0.5), floor(collectionCellsGroup.size.height * 0.25000 + 0.5) - floor(collectionCellsGroup.size.height * 0.15000 + 0.5))]; + UIBezierPath* topSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(collectionCellsGroup) + + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + CGRectGetMinY(collectionCellsGroup) + + floor(collectionCellsGroup.size.height * 0.15000 + 0.5), + floor(collectionCellsGroup.size.width * 0.25000 + 0.5) - + floor(collectionCellsGroup.size.width * 0.15000 + 0.5), + floor(collectionCellsGroup.size.height * 0.25000 + 0.5) - + floor(collectionCellsGroup.size.height * 0.15000 + 0.5))]; [fillColor setFill]; [topSquarePath fill]; } @@ -419,37 +1456,108 @@ void MDCCatalogDrawCollectionCellsTile(CGRect frame, id colorS void MDCCatalogDrawCollectionsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect collectionsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect collectionsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { - UIBezierPath* topLeftSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionsGroup) + floor(collectionsGroup.size.width * 0.15000 + 0.5), CGRectGetMinY(collectionsGroup) + floor(collectionsGroup.size.height * 0.15000 + 0.5), floor(collectionsGroup.size.width * 0.46825 + 0.04) - floor(collectionsGroup.size.width * 0.15000 + 0.5) + 0.46, floor(collectionsGroup.size.height * 0.46825 + 0.04) - floor(collectionsGroup.size.height * 0.15000 + 0.5) + 0.46)]; + UIBezierPath* topLeftSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(collectionsGroup) + + floor(collectionsGroup.size.width * 0.15000 + 0.5), + CGRectGetMinY(collectionsGroup) + + floor(collectionsGroup.size.height * 0.15000 + 0.5), + floor(collectionsGroup.size.width * 0.46825 + 0.04) - + floor(collectionsGroup.size.width * 0.15000 + 0.5) + 0.46, + floor(collectionsGroup.size.height * 0.46825 + 0.04) - + floor(collectionsGroup.size.height * 0.15000 + 0.5) + + 0.46)]; [fillColor setFill]; [topLeftSquarePath fill]; - UIBezierPath* topRightSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionsGroup) + floor(collectionsGroup.size.width * 0.53175 - 0.04) + 0.54, CGRectGetMinY(collectionsGroup) + floor(collectionsGroup.size.height * 0.15000 + 0.5), floor(collectionsGroup.size.width * 0.85000 + 0.5) - floor(collectionsGroup.size.width * 0.53175 - 0.04) - 0.54, floor(collectionsGroup.size.height * 0.46825 + 0.04) - floor(collectionsGroup.size.height * 0.15000 + 0.5) + 0.46)]; + UIBezierPath* topRightSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake( + CGRectGetMinX(collectionsGroup) + + floor(collectionsGroup.size.width * 0.53175 - 0.04) + 0.54, + CGRectGetMinY(collectionsGroup) + + floor(collectionsGroup.size.height * 0.15000 + 0.5), + floor(collectionsGroup.size.width * 0.85000 + 0.5) - + floor(collectionsGroup.size.width * 0.53175 - 0.04) - 0.54, + floor(collectionsGroup.size.height * 0.46825 + 0.04) - + floor(collectionsGroup.size.height * 0.15000 + 0.5) + 0.46)]; [fillColor setFill]; [topRightSquarePath fill]; - UIBezierPath* bottomRightSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionsGroup) + floor(collectionsGroup.size.width * 0.53175 - 0.04) + 0.54, CGRectGetMinY(collectionsGroup) + floor(collectionsGroup.size.height * 0.53175 - 0.04) + 0.54, floor(collectionsGroup.size.width * 0.85000 + 0.5) - floor(collectionsGroup.size.width * 0.53175 - 0.04) - 0.54, floor(collectionsGroup.size.height * 0.85000 + 0.5) - floor(collectionsGroup.size.height * 0.53175 - 0.04) - 0.54)]; + UIBezierPath* bottomRightSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake( + CGRectGetMinX(collectionsGroup) + + floor(collectionsGroup.size.width * 0.53175 - 0.04) + 0.54, + CGRectGetMinY(collectionsGroup) + + floor(collectionsGroup.size.height * 0.53175 - 0.04) + 0.54, + floor(collectionsGroup.size.width * 0.85000 + 0.5) - + floor(collectionsGroup.size.width * 0.53175 - 0.04) - 0.54, + floor(collectionsGroup.size.height * 0.85000 + 0.5) - + floor(collectionsGroup.size.height * 0.53175 - 0.04) - 0.54)]; [fillColor setFill]; [bottomRightSquarePath fill]; - UIBezierPath* bottomLeftSquarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(collectionsGroup) + floor(collectionsGroup.size.width * 0.15000 + 0.5), CGRectGetMinY(collectionsGroup) + floor(collectionsGroup.size.height * 0.53175 - 0.04) + 0.54, floor(collectionsGroup.size.width * 0.46825 + 0.04) - floor(collectionsGroup.size.width * 0.15000 + 0.5) + 0.46, floor(collectionsGroup.size.height * 0.85000 + 0.5) - floor(collectionsGroup.size.height * 0.53175 - 0.04) - 0.54)]; + UIBezierPath* bottomLeftSquarePath = [UIBezierPath + bezierPathWithRect:CGRectMake( + CGRectGetMinX(collectionsGroup) + + floor(collectionsGroup.size.width * 0.15000 + 0.5), + CGRectGetMinY(collectionsGroup) + + floor(collectionsGroup.size.height * 0.53175 - 0.04) + 0.54, + floor(collectionsGroup.size.width * 0.46825 + 0.04) - + floor(collectionsGroup.size.width * 0.15000 + 0.5) + 0.46, + floor(collectionsGroup.size.height * 0.85000 + 0.5) - + floor(collectionsGroup.size.height * 0.53175 - 0.04) - 0.54)]; [fillColor setFill]; [bottomLeftSquarePath fill]; UIBezierPath* outlinePath = [UIBezierPath bezierPath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.90000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.10000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.90000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.90000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.10000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.90000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.10000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.10000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.90000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.10000 * collectionsGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake( + CGRectGetMinX(collectionsGroup) + 0.90000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + 0.10000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.90000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.90000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.10000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.90000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.10000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.10000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.90000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.10000 * collectionsGroup.size.height)]; [outlinePath closePath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 1.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.00000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.00000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 0.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 1.00000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 1.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 1.00000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 1.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.00000 * collectionsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(collectionsGroup) + 1.00000 * collectionsGroup.size.width, CGRectGetMinY(collectionsGroup) + 0.00000 * collectionsGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake( + CGRectGetMinX(collectionsGroup) + 1.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + 0.00000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.00000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 0.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 1.00000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 1.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 1.00000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 1.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.00000 * collectionsGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(collectionsGroup) + + 1.00000 * collectionsGroup.size.width, + CGRectGetMinY(collectionsGroup) + + 0.00000 * collectionsGroup.size.height)]; [outlinePath closePath]; [fillColor setFill]; [outlinePath fill]; @@ -458,25 +1566,66 @@ void MDCCatalogDrawCollectionsTile(CGRect frame, id colorSchem void MDCCatalogDrawDialogsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect dialogsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect dialogsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { - UIBezierPath* squarePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(dialogsGroup) + floor(dialogsGroup.size.width * 0.25000 + 0.5), CGRectGetMinY(dialogsGroup) + floor(dialogsGroup.size.height * 0.25000 + 0.5), floor(dialogsGroup.size.width * 0.75000 + 0.5) - floor(dialogsGroup.size.width * 0.25000 + 0.5), floor(dialogsGroup.size.height * 0.75000 + 0.5) - floor(dialogsGroup.size.height * 0.25000 + 0.5))]; + UIBezierPath* squarePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(dialogsGroup) + + floor(dialogsGroup.size.width * 0.25000 + 0.5), + CGRectGetMinY(dialogsGroup) + + floor(dialogsGroup.size.height * 0.25000 + 0.5), + floor(dialogsGroup.size.width * 0.75000 + 0.5) - + floor(dialogsGroup.size.width * 0.25000 + 0.5), + floor(dialogsGroup.size.height * 0.75000 + 0.5) - + floor(dialogsGroup.size.height * 0.25000 + 0.5))]; [fillColor setFill]; [squarePath fill]; UIBezierPath* outlinePath = [UIBezierPath bezierPath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.90000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.10000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.90000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.10000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake(CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.90000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.10000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.90000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.10000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.90000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.10000 * dialogsGroup.size.height)]; [outlinePath closePath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 0.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 1.00000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 1.00000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake(CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 0.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 1.00000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 1.00000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(dialogsGroup) + 1.00000 * dialogsGroup.size.width, + CGRectGetMinY(dialogsGroup) + 0.00000 * dialogsGroup.size.height)]; [outlinePath closePath]; [fillColor setFill]; [outlinePath fill]; @@ -485,35 +1634,161 @@ void MDCCatalogDrawDialogsTile(CGRect frame, id colorScheme) { void MDCCatalogDrawFeatureHighlightTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect featureHighlightGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect featureHighlightGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* circlePath = [UIBezierPath bezierPath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.22400 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.22400 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.77600 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.22400 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.77600 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.77600 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 1.00000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.22400 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.77600 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.00000 * featureHighlightGroup.size.height)]; + [circlePath moveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.22400 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.22400 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.77600 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.22400 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.77600 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.77600 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 1.00000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.22400 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.77600 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.00000 * featureHighlightGroup.size.height)]; [circlePath closePath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.27950 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.72050 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.27950 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.27950 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.72050 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.10000 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.27950 * featureHighlightGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.72050 * featureHighlightGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.72050 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.90000 * featureHighlightGroup.size.height)]; + [circlePath moveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.27950 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.72050 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.27950 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.27950 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.72050 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.10000 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.27950 * featureHighlightGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.72050 * featureHighlightGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.72050 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.90000 * featureHighlightGroup.size.height)]; [circlePath closePath]; [fillColor setFill]; [circlePath fill]; UIBezierPath* starPath = [UIBezierPath bezierPath]; - [starPath moveToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.23500 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.57509 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.42062 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.77105 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.43625 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.62151 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.56660 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.66752 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.76188 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.50000 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.65681 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.33248 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.76188 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.37849 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.56660 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.22895 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.43625 * featureHighlightGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(featureHighlightGroup) + 0.42491 * featureHighlightGroup.size.width, CGRectGetMinY(featureHighlightGroup) + 0.42062 * featureHighlightGroup.size.height)]; + [starPath moveToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.23500 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.57509 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.42062 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.77105 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.43625 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.62151 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.56660 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.66752 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.76188 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.50000 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.65681 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.33248 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.76188 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.37849 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.56660 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.22895 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.43625 * featureHighlightGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(featureHighlightGroup) + + 0.42491 * featureHighlightGroup.size.width, + CGRectGetMinY(featureHighlightGroup) + + 0.42062 * featureHighlightGroup.size.height)]; [starPath closePath]; [fillColor setFill]; [starPath fill]; @@ -522,20 +1797,52 @@ void MDCCatalogDrawFeatureHighlightTile(CGRect frame, id color void MDCCatalogDrawFlexibleHeaderTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect flexibleHeaderGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98354 + 0.83) - 0.33, floor((frame.size.height - 1) * 0.98354 + 0.83) - 0.33); + CGRect flexibleHeaderGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98354 + 0.83) - 0.33, + floor((frame.size.height - 1) * 0.98354 + 0.83) - 0.33); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 1.00000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 1.00000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 1.00000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 1.00000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.00000 * flexibleHeaderGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 1.00000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 1.00000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 1.00000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 1.00000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.00000 * flexibleHeaderGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.10000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.10000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.60000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.60000 * flexibleHeaderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.width, CGRectGetMinY(flexibleHeaderGroup) + 0.90000 * flexibleHeaderGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.10000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.10000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.60000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.60000 * flexibleHeaderGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.width, + CGRectGetMinY(flexibleHeaderGroup) + + 0.90000 * flexibleHeaderGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -681,23 +1988,61 @@ void MDCCatalogDrawHeaderStackViewTile(CGRect frame, id colorS void MDCCatalogDrawInkTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect inkGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect inkGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 1.00000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 1.00000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 1.00000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 1.00000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 1.00000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 1.00000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 1.00000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 1.00000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.00000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.00000 * inkGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.10000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.58800 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.10000 * inkGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.22500 * inkGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(inkGroup) + 0.56400 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.13600 * inkGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.17850 * inkGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.77500 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.34950 * inkGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(inkGroup) + 0.65050 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.90000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.41200 * inkGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(inkGroup) + 0.82150 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(inkGroup) + 0.86400 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.43600 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.90000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; + [bezierPath moveToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.10000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.58800 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.10000 * inkGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.22500 * inkGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(inkGroup) + 0.56400 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.13600 * inkGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.17850 * inkGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.77500 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(inkGroup) + 0.55000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.34950 * inkGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(inkGroup) + 0.65050 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.90000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.41200 * inkGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(inkGroup) + 0.82150 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.45000 * inkGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(inkGroup) + 0.86400 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.43600 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.90000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(inkGroup) + 0.10000 * inkGroup.size.width, + CGRectGetMinY(inkGroup) + 0.90000 * inkGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -706,32 +2051,197 @@ void MDCCatalogDrawInkTile(CGRect frame, id colorScheme) { void MDCCatalogDrawMaskedTransitionTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect maskedTransitionsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect maskedTransitionsGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* moonPath = [UIBezierPath bezierPath]; - [moonPath moveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.31400 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.25200 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.49100 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35650 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.10650 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.25000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.32600 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.25100 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.33800 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.25000 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.75000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.57100 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.25000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.75000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.42900 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.74800 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.68600 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.75000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.66200 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.74900 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.67400 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.89350 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.64350 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.50900 * maskedTransitionsGroup.size.height)]; - [moonPath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.15650 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.84350 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.height)]; + [moonPath moveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.31400 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.25200 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.49100 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35650 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.10650 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.25000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.32600 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.25100 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.33800 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.25000 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.75000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.57100 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.25000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.75000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.42900 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.74800 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.68600 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.75000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.66200 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.74900 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.67400 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.89350 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.64350 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.50900 * maskedTransitionsGroup.size.height)]; + [moonPath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.15650 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.84350 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.height)]; [moonPath closePath]; [fillColor setFill]; [moonPath fill]; UIBezierPath* circlePath = [UIBezierPath bezierPath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.30000 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.15650 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.30000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.45650 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.00000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.84350 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.15650 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.70000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.54350 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 1.00000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.70000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.84350 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.30000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.70000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.45650 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.54350 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.30000 * maskedTransitionsGroup.size.height)]; + [circlePath moveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.30000 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.15650 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.30000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.45650 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.00000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.84350 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.15650 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.70000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.54350 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 1.00000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.70000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.84350 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.30000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.70000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.45650 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.54350 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.30000 * maskedTransitionsGroup.size.height)]; [circlePath closePath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.90000 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.10000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.21200 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.90000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.10000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.78800 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.40000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.10000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.51200 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.21200 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.40000 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.60000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.65000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.48800 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.40000 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.60000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.51200 * maskedTransitionsGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.35000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.90000 * maskedTransitionsGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.60000 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.78800 * maskedTransitionsGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + 0.48800 * maskedTransitionsGroup.size.width, CGRectGetMinY(maskedTransitionsGroup) + 0.90000 * maskedTransitionsGroup.size.height)]; + [circlePath moveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.90000 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.10000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.21200 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.90000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.10000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.78800 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.40000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.10000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.51200 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.21200 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.40000 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.60000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.65000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.48800 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.40000 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.60000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.51200 * maskedTransitionsGroup.size.height)]; + [circlePath addCurveToPoint:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.35000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.90000 * maskedTransitionsGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.60000 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.78800 * maskedTransitionsGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(maskedTransitionsGroup) + + 0.48800 * maskedTransitionsGroup.size.width, + CGRectGetMinY(maskedTransitionsGroup) + + 0.90000 * maskedTransitionsGroup.size.height)]; [circlePath closePath]; [fillColor setFill]; [circlePath fill]; @@ -740,36 +2250,118 @@ void MDCCatalogDrawMaskedTransitionTile(CGRect frame, id color void MDCCatalogDrawMiscTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect miscGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); + CGRect miscGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, + floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, + floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.00000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.00000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.00000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.00000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.33000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.87000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.47500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.65000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.84500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.84500 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.47500 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.87000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.33000 * miscGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.00000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.00000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.00000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.00000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.33000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.87000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.47500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.65000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.84500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 1.00000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.84500 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 1.00000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.47500 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.87000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.33000 * miscGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.10000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.10000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.10000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.10000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.44500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.32500 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.32500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.44500 * miscGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.10000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.10000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.10000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.10000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.30500 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.30500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.44500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.32500 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.32500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.44500 * miscGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.40500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.42500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.50000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.50000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.42500 * miscGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.40500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.60000 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.60000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.42500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.50000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.50000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.42500 * miscGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.40500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.53000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.43000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.81500 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.65000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.81500 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.43000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.53000 * miscGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.79000 * miscGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(miscGroup) + 0.79000 * miscGroup.size.width, CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.40500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.53000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.43000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.81500 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.70000 * miscGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.70000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.40500 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.65000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.81500 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.43000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.53000 * miscGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(miscGroup) + 0.65000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(miscGroup) + 0.90000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.79000 * miscGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(miscGroup) + 0.79000 * miscGroup.size.width, + CGRectGetMinY(miscGroup) + 0.90000 * miscGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -939,7 +2531,7 @@ void MDCCatalogDrawNavigationBarTile(CGRect frame, id colorSch NSMutableParagraphStyle* labelStyle = [NSMutableParagraphStyle new]; labelStyle.alignment = NSTextAlignmentCenter; - UIFont *font; + UIFont* font; if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" @@ -1094,60 +2686,362 @@ void MDCCatalogDrawOverlayWindow(CGRect frame, id colorScheme) void MDCCatalogDrawPageControlTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect pageControlGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 34.5, floor((frame.size.width - 8) * 0.89189 + 0.5), floor((frame.size.height - 34.5) * 0.27368 + 0.5)); + CGRect pageControlGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 34.5, + floor((frame.size.width - 8) * 0.89189 + 0.5), + floor((frame.size.height - 34.5) * 0.27368 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.13148 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.11670 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.13148 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.13148 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.11670 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.06549 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.08027 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.06549 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.06549 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.08027 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.13148 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.11670 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.13148 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.13148 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.11670 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.06549 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.08027 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.06549 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.06549 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.08027 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.00000 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.04432 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.00000 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.00000 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.04432 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.19697 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.15265 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.19697 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.19697 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.15265 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.00000 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.04432 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.00000 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.00000 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.04432 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.19697 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.15265 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.19697 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height)]; + [bezierPath addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.19697 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.15265 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; + [bezierPath addLineToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.09848 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; UIBezierPath* bezier2Path = [UIBezierPath bezierPath]; - [bezier2Path moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.39405 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.37928 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.39405 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.39405 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.37928 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.32856 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.34284 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.32856 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.32856 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.34333 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezier2Path + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.39405 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.37928 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.39405 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.39405 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.37928 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.32856 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.34284 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.32856 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.32856 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.34333 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height)]; [bezier2Path closePath]; - [bezier2Path moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.26258 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.30689 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.26258 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.26258 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.30689 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.45955 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.41523 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.45955 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height)]; - [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.45955 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.41572 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezier2Path addLineToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezier2Path + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.26258 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.30689 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.26258 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.26258 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.30689 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.45955 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.41523 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.45955 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height)]; + [bezier2Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.45955 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.41572 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; + [bezier2Path addLineToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.36106 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; [bezier2Path closePath]; [fillColor setFill]; [bezier2Path fill]; UIBezierPath* bezier3Path = [UIBezierPath bezierPath]; - [bezier3Path moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.67193 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.65716 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.67193 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.67193 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.65716 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.60595 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.62072 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.66750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.60595 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.59250 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.60595 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.40750 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.62072 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezier3Path + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.33250 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.67193 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.65716 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.67193 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.67193 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.65716 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.60595 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.62072 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.66750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.60595 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.59250 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.60595 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.40750 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.62072 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.33250 * pageControlGroup.size.height)]; [bezier3Path closePath]; - [bezier3Path moveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.54045 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.58477 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.54045 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.54045 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.58477 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.73742 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.50000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.69311 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 1.00000 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.73742 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.77500 * pageControlGroup.size.height)]; - [bezier3Path addCurveToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.73742 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.22500 * pageControlGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.69311 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; - [bezier3Path addLineToPoint: CGPointMake(CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezier3Path + moveToPoint:CGPointMake( + CGRectGetMinX(pageControlGroup) + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + 0.00000 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.54045 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.58477 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.54045 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.54045 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.58477 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.73742 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.50000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.69311 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 1.00000 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.73742 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.77500 * pageControlGroup.size.height)]; + [bezier3Path addCurveToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.73742 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.22500 * pageControlGroup.size.height) + controlPoint2:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.69311 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; + [bezier3Path addLineToPoint:CGPointMake(CGRectGetMinX(pageControlGroup) + + 0.63894 * pageControlGroup.size.width, + CGRectGetMinY(pageControlGroup) + + 0.00000 * pageControlGroup.size.height)]; [bezier3Path closePath]; [fillColor setFill]; [bezier3Path fill]; - UIBezierPath* ovalPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(CGRectGetMinX(pageControlGroup) + floor(pageControlGroup.size.width * 0.80303 + 0.5), CGRectGetMinY(pageControlGroup) + floor(pageControlGroup.size.height * 0.00000 + 0.5), floor(pageControlGroup.size.width * 1.00000 + 0.5) - floor(pageControlGroup.size.width * 0.80303 + 0.5), floor(pageControlGroup.size.height * 1.00000 + 0.5) - floor(pageControlGroup.size.height * 0.00000 + 0.5))]; + UIBezierPath* ovalPath = [UIBezierPath + bezierPathWithOvalInRect:CGRectMake( + CGRectGetMinX(pageControlGroup) + + floor(pageControlGroup.size.width * 0.80303 + 0.5), + CGRectGetMinY(pageControlGroup) + + floor(pageControlGroup.size.height * 0.00000 + 0.5), + floor(pageControlGroup.size.width * 1.00000 + 0.5) - + floor(pageControlGroup.size.width * 0.80303 + 0.5), + floor(pageControlGroup.size.height * 1.00000 + 0.5) - + floor(pageControlGroup.size.height * 0.00000 + 0.5))]; [fillColor setFill]; [ovalPath fill]; } @@ -1155,35 +3049,144 @@ void MDCCatalogDrawPageControlTile(CGRect frame, id colorSchem void MDCCatalogDrawPalettesTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect palettesGroup = CGRectMake(CGRectGetMinX(frame) + 7.65, CGRectGetMinY(frame) + 7.67, floor((frame.size.width - 7.65) * 0.89688 + 7.82) - 7.32, floor((frame.size.height - 7.67) * 0.85202 + 8.17) - 7.67); + CGRect palettesGroup = CGRectMake(CGRectGetMinX(frame) + 7.65, CGRectGetMinY(frame) + 7.67, + floor((frame.size.width - 7.65) * 0.89688 + 7.82) - 7.32, + floor((frame.size.height - 7.67) * 0.85202 + 8.17) - 7.67); { UIBezierPath* bucketPath = [UIBezierPath bezierPath]; - [bucketPath moveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.52579 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.25869 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.00000 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.17971 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.08316 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.31267 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.22316 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.02474 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.52632 * palettesGroup.size.height)]; - [bucketPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.02474 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.65105 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + -0.00825 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.56105 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + -0.00825 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.61684 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.33217 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.97474 * palettesGroup.size.height)]; - [bucketPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.39165 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.34866 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.99105 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.37016 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height)]; - [bucketPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.45064 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.97421 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.41315 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.43464 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.99105 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.65053 * palettesGroup.size.height)]; - [bucketPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.52579 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.79105 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.61632 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.79105 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.56053 * palettesGroup.size.height)]; + [bucketPath + moveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.52579 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.25869 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.00000 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.17971 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.08316 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.31267 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.22316 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.02474 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.52632 * palettesGroup.size.height)]; + [bucketPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.02474 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.65105 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + -0.00825 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.56105 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + -0.00825 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.61684 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.33217 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.97474 * palettesGroup.size.height)]; + [bucketPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.39165 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.34866 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.99105 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.37016 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height)]; + [bucketPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.45064 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.97421 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.41315 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.43464 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.99105 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.65053 * palettesGroup.size.height)]; + [bucketPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.75806 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.52579 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.79105 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.61632 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.79105 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.56053 * palettesGroup.size.height)]; [bucketPath closePath]; - [bucketPath moveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.12372 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.39115 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.30684 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.65859 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; - [bucketPath addLineToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.12372 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; + [bucketPath + moveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.12372 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.39115 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.30684 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.65859 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; + [bucketPath + addLineToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.12372 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.58842 * palettesGroup.size.height)]; [bucketPath closePath]; [fillColor setFill]; [bucketPath fill]; UIBezierPath* dropPath = [UIBezierPath bezierPath]; - [dropPath moveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height)]; - [dropPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.88526 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.80895 * palettesGroup.size.height)]; - [dropPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.94842 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.83104 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height)]; - [dropPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.88526 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 0.95101 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.94842 * palettesGroup.size.height)]; - [dropPath addCurveToPoint: CGPointMake(CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.80895 * palettesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height)]; + [dropPath moveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height)]; + [dropPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.88526 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.80895 * palettesGroup.size.height)]; + [dropPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.78205 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.94842 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.83104 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height)]; + [dropPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.88526 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.95101 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 1.00000 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.94842 * palettesGroup.size.height)]; + [dropPath + addCurveToPoint:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height) + controlPoint1:CGPointMake( + CGRectGetMinX(palettesGroup) + 1.00000 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.80895 * palettesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(palettesGroup) + 0.89103 * palettesGroup.size.width, + CGRectGetMinY(palettesGroup) + 0.68421 * palettesGroup.size.height)]; [dropPath closePath]; [fillColor setFill]; [dropPath fill]; @@ -1201,8 +3204,9 @@ void MDCCatalogDrawProgressViewTile(CGRect frame, id colorSche CGFloat gradientLocations[] = {0.14, 1}; CGGradientRef gradient = CGGradientCreateWithColors( colorSpace, - (__bridge CFArrayRef) @[ (id)gradientColor.CGColor, - (id)[colorScheme.primaryColor colorWithAlphaComponent:0].CGColor ], + (__bridge CFArrayRef) @[ + (id)gradientColor.CGColor, (id)[colorScheme.primaryColor colorWithAlphaComponent:0].CGColor + ], gradientLocations); CGRect progressViewGroup = CGRectMake(CGRectGetMinX(frame) + 24.5, CGRectGetMinY(frame) + 24, @@ -1212,8 +3216,7 @@ void MDCCatalogDrawProgressViewTile(CGRect frame, id colorSche { CGRect gradientRectangleRect = CGRectMake( CGRectGetMinX(progressViewGroup) + floor(CGRectGetWidth(progressViewGroup) * 0.00000 + 0.5), - CGRectGetMinY(progressViewGroup) + - floor(CGRectGetHeight(progressViewGroup) * 0.30500), + CGRectGetMinY(progressViewGroup) + floor(CGRectGetHeight(progressViewGroup) * 0.30500), floor(CGRectGetWidth(progressViewGroup) * 1.00000 + 0.5) - floor(CGRectGetWidth(progressViewGroup) * 0.00000 + 0.5), floor(CGRectGetHeight(progressViewGroup) * 1.00000 - 0.1) - @@ -1274,32 +3277,68 @@ void MDCCatalogDrawProgressViewTile(CGRect frame, id colorSche void MDCCatalogDrawShadowLayerTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect shadowGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, floor((frame.size.width - 1) * 0.98765 + 0.5), floor((frame.size.height - 1) * 0.98765 + 0.5)); + CGRect shadowGroup = CGRectMake(CGRectGetMinX(frame) + 1, CGRectGetMinY(frame) + 1, + floor((frame.size.width - 1) * 0.98765 + 0.5), + floor((frame.size.height - 1) * 0.98765 + 0.5)); { UIBezierPath* squarePath = [UIBezierPath bezierPath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.80000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 1.00000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.80000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 1.00000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.80000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 1.00000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.80000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 1.00000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.20000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.00000 * shadowGroup.size.height)]; [squarePath closePath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.30000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.30000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.30000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.30000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.70000 * shadowGroup.size.height)]; [squarePath closePath]; [fillColor setFill]; [squarePath fill]; UIBezierPath* cornerPath = [UIBezierPath bezierPath]; - [cornerPath moveToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.00000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.00000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 1.00000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 1.00000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.90000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.90000 * shadowGroup.size.height)]; - [cornerPath addLineToPoint: CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; + [cornerPath + moveToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.00000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.00000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 1.00000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 1.00000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.90000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.90000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.90000 * shadowGroup.size.height)]; + [cornerPath + addLineToPoint:CGPointMake(CGRectGetMinX(shadowGroup) + 0.10000 * shadowGroup.size.width, + CGRectGetMinY(shadowGroup) + 0.10000 * shadowGroup.size.height)]; [cornerPath closePath]; [fillColor setFill]; [cornerPath fill]; @@ -1308,23 +3347,81 @@ void MDCCatalogDrawShadowLayerTile(CGRect frame, id colorSchem void MDCCatalogDrawSliderTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect sliderGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 31, floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, floor((frame.size.height - 31) * 0.39216 + 0.5)); + CGRect sliderGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 31, + floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, + floor((frame.size.height - 31) * 0.39216 + 0.5)); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.15000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 0.06700 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.22333 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.15000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.77667 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 0.06700 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 0.93300 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.77667 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.22333 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 0.93300 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.15000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 0.06700 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.22333 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.15000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 0.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.77667 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 0.06700 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 0.93300 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 1.00000 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.77667 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 1.00000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.22333 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 0.93300 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.00000 * sliderGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.60000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.60000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 0.87750 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.40833 * sliderGroup.size.height)]; - [bezierPath addCurveToPoint: CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.59167 * sliderGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(sliderGroup) + 0.87750 * sliderGroup.size.width, CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.60000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.60000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.50000 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 0.87750 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.33333 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.40833 * sliderGroup.size.height)]; + [bezierPath + addCurveToPoint:CGPointMake(CGRectGetMinX(sliderGroup) + 0.85000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(sliderGroup) + 0.90000 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.59167 * sliderGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(sliderGroup) + 0.87750 * sliderGroup.size.width, + CGRectGetMinY(sliderGroup) + 0.66667 * sliderGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -1333,21 +3430,55 @@ void MDCCatalogDrawSliderTile(CGRect frame, id colorScheme) { void MDCCatalogDrawSnackbarTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect snackbarGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); + CGRect snackbarGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, + floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, + floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); { UIBezierPath* outlinePath = [UIBezierPath bezierPath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.90000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.90000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.10000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.90000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.10000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.10000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.90000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.10000 * snackbarGroup.size.height)]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.00000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.00000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 0.00000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 1.00000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 1.00000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 1.00000 * snackbarGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(snackbarGroup) + 1.00000 * snackbarGroup.size.width, CGRectGetMinY(snackbarGroup) + 0.00000 * snackbarGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.90000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.90000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.10000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.90000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.10000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.10000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.90000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.10000 * snackbarGroup.size.height)]; + [outlinePath + moveToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.00000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.00000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 0.00000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 1.00000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 1.00000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 1.00000 * snackbarGroup.size.height)]; + [outlinePath + addLineToPoint:CGPointMake( + CGRectGetMinX(snackbarGroup) + 1.00000 * snackbarGroup.size.width, + CGRectGetMinY(snackbarGroup) + 0.00000 * snackbarGroup.size.height)]; [fillColor setFill]; [outlinePath fill]; - UIBezierPath* linePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(snackbarGroup) + floor(snackbarGroup.size.width * 0.15500 + 0.17) + 0.33, CGRectGetMinY(snackbarGroup) + floor(snackbarGroup.size.height * 0.75500 + 0.17) + 0.33, floor(snackbarGroup.size.width * 0.84500 + 0.17) - floor(snackbarGroup.size.width * 0.15500 + 0.17), floor(snackbarGroup.size.height * 0.84500 + 0.17) - floor(snackbarGroup.size.height * 0.75500 + 0.17))]; + UIBezierPath* linePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(snackbarGroup) + + floor(snackbarGroup.size.width * 0.15500 + 0.17) + 0.33, + CGRectGetMinY(snackbarGroup) + + floor(snackbarGroup.size.height * 0.75500 + 0.17) + 0.33, + floor(snackbarGroup.size.width * 0.84500 + 0.17) - + floor(snackbarGroup.size.width * 0.15500 + 0.17), + floor(snackbarGroup.size.height * 0.84500 + 0.17) - + floor(snackbarGroup.size.height * 0.75500 + 0.17))]; [fillColor setFill]; [linePath fill]; } @@ -1355,26 +3486,58 @@ void MDCCatalogDrawSnackbarTile(CGRect frame, id colorScheme) void MDCCatalogDrawTabsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect tabBarGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); + CGRect tabBarGroup = CGRectMake(CGRectGetMinX(frame) + 7.67, CGRectGetMinY(frame) + 7.67, + floor((frame.size.width - 7.67) * 0.89686 + 7.83) - 7.33, + floor((frame.size.height - 7.67) * 0.89686 + 7.83) - 7.33); { UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 1.00000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 1.00000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 1.00000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 1.00000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 1.00000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 1.00000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 1.00000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 1.00000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.00000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.00000 * tabBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.10000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.10000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.40000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.40000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.10000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.10000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.40000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.40000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.90000 * tabBarGroup.size.height)]; [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.50000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.50000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.15000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.15000 * tabBarGroup.size.height)]; - [bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; + [bezierPath + moveToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.50000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.50000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.15000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.15000 * tabBarGroup.size.height)]; + [bezierPath + addLineToPoint:CGPointMake(CGRectGetMinX(tabBarGroup) + 0.90000 * tabBarGroup.size.width, + CGRectGetMinY(tabBarGroup) + 0.30000 * tabBarGroup.size.height)]; [bezierPath closePath]; [fillColor setFill]; [bezierPath fill]; @@ -1383,31 +3546,86 @@ void MDCCatalogDrawTabsTile(CGRect frame, id colorScheme) { void MDCCatalogDrawTextFieldTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect textFieldGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 11, floor((frame.size.width - 8) * 0.89189 + 0.5), floor((frame.size.height - 11) * 0.84507 + 0.5)); + CGRect textFieldGroup = CGRectMake(CGRectGetMinX(frame) + 8, CGRectGetMinY(frame) + 11, + floor((frame.size.width - 8) * 0.89189 + 0.5), + floor((frame.size.height - 11) * 0.84507 + 0.5)); { - UIBezierPath* horizontalLinePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(textFieldGroup) + floor(textFieldGroup.size.width * 0.00000 + 0.5), CGRectGetMinY(textFieldGroup) + floor(textFieldGroup.size.height * 0.88333 + 0.5), floor(textFieldGroup.size.width * 1.00000 + 0.5) - floor(textFieldGroup.size.width * 0.00000 + 0.5), floor(textFieldGroup.size.height * 1.00000 + 0.5) - floor(textFieldGroup.size.height * 0.88333 + 0.5))]; + UIBezierPath* horizontalLinePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(textFieldGroup) + + floor(textFieldGroup.size.width * 0.00000 + 0.5), + CGRectGetMinY(textFieldGroup) + + floor(textFieldGroup.size.height * 0.88333 + 0.5), + floor(textFieldGroup.size.width * 1.00000 + 0.5) - + floor(textFieldGroup.size.width * 0.00000 + 0.5), + floor(textFieldGroup.size.height * 1.00000 + 0.5) - + floor(textFieldGroup.size.height * 0.88333 + 0.5))]; [fillColor setFill]; [horizontalLinePath fill]; - UIBezierPath* verticalLinePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(textFieldGroup) + floor(textFieldGroup.size.width * 0.84848 + 0.5), CGRectGetMinY(textFieldGroup) + floor(textFieldGroup.size.height * 0.00000 + 0.5), floor(textFieldGroup.size.width * 0.90909 + 0.5) - floor(textFieldGroup.size.width * 0.84848 + 0.5), floor(textFieldGroup.size.height * 0.78333 + 0.5) - floor(textFieldGroup.size.height * 0.00000 + 0.5))]; + UIBezierPath* verticalLinePath = [UIBezierPath + bezierPathWithRect:CGRectMake(CGRectGetMinX(textFieldGroup) + + floor(textFieldGroup.size.width * 0.84848 + 0.5), + CGRectGetMinY(textFieldGroup) + + floor(textFieldGroup.size.height * 0.00000 + 0.5), + floor(textFieldGroup.size.width * 0.90909 + 0.5) - + floor(textFieldGroup.size.width * 0.84848 + 0.5), + floor(textFieldGroup.size.height * 0.78333 + 0.5) - + floor(textFieldGroup.size.height * 0.00000 + 0.5))]; [fillColor setFill]; [verticalLinePath fill]; UIBezierPath* aPath = [UIBezierPath bezierPath]; - [aPath moveToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.37424 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.09646 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.21010 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.26667 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.61111 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.58232 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.61111 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.63889 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.75253 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.47525 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.37424 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; + [aPath moveToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.37424 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.09646 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.21010 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.26667 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.61111 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.58232 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.61111 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.63889 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.75253 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.77778 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.47525 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.37424 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.00000 * textFieldGroup.size.height)]; [aPath closePath]; - [aPath moveToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.30455 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.42475 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.14833 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.54495 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(textFieldGroup) + 0.30455 * textFieldGroup.size.width, CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; + [aPath moveToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.30455 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.42475 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.14833 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.54495 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; + [aPath + addLineToPoint:CGPointMake( + CGRectGetMinX(textFieldGroup) + 0.30455 * textFieldGroup.size.width, + CGRectGetMinY(textFieldGroup) + 0.50000 * textFieldGroup.size.height)]; [aPath closePath]; [fillColor setFill]; [aPath fill]; @@ -1416,53 +3634,157 @@ void MDCCatalogDrawTextFieldTile(CGRect frame, id colorScheme) void MDCCatalogDrawThemesTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - CGRect themesGroup = CGRectMake(CGRectGetMinX(frame) + 11, CGRectGetMinY(frame) + 8, floor((frame.size.width - 11) * 0.88732 + 0.5), floor((frame.size.height - 8) * 0.89189 + 0.5)); + CGRect themesGroup = CGRectMake(CGRectGetMinX(frame) + 11, CGRectGetMinY(frame) + 8, + floor((frame.size.width - 11) * 0.88732 + 0.5), + floor((frame.size.height - 8) * 0.89189 + 0.5)); { UIBezierPath* trianglePath = [UIBezierPath bezierPath]; - [trianglePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.19394 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.57924 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.35354 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.37261 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.35354 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.19394 * themesGroup.size.height)]; + [trianglePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.19394 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.57924 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.35354 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.37261 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.35354 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.19394 * themesGroup.size.height)]; [trianglePath closePath]; - [trianglePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.18254 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.45455 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76984 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.45455 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; - [trianglePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; + [trianglePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.18254 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.45455 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76984 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.45455 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; + [trianglePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.47619 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.00000 * themesGroup.size.height)]; [trianglePath closePath]; [fillColor setFill]; [trianglePath fill]; UIBezierPath* circlePath = [UIBezierPath bezierPath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.83492 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.70303 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.84242 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.83492 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.68889 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.84242 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.70303 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.68889 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height)]; + [circlePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.83492 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.70303 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.89418 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.84242 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.83492 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.68889 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.89899 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.84242 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.62963 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.70303 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.68889 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64646 * themesGroup.size.height)]; [circlePath closePath]; - [circlePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.63016 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64697 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.89848 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.63016 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 0.89365 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.89848 * themesGroup.size.height)]; - [circlePath addCurveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height) controlPoint1: CGPointMake(CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.64697 * themesGroup.size.height) controlPoint2: CGPointMake(CGRectGetMinX(themesGroup) + 0.89365 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; - [circlePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; + [circlePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.63016 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64697 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.52381 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.89848 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.63016 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.77273 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 0.89365 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 1.00000 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.89848 * themesGroup.size.height)]; + [circlePath + addCurveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height) + controlPoint1:CGPointMake(CGRectGetMinX(themesGroup) + 1.00000 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.64697 * themesGroup.size.height) + controlPoint2:CGPointMake( + CGRectGetMinX(themesGroup) + 0.89365 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; + [circlePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.76190 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.54545 * themesGroup.size.height)]; [circlePath closePath]; [fillColor setFill]; [circlePath fill]; UIBezierPath* squarePath = [UIBezierPath bezierPath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.87500 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.10714 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.87500 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.10714 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.87500 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.10714 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.87500 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.10714 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.32143 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.67045 * themesGroup.size.height)]; [squarePath closePath]; - [squarePath moveToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.00000 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.00000 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.97727 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.97727 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; - [squarePath addLineToPoint: CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; + [squarePath + moveToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.00000 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.00000 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.97727 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.97727 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; + [squarePath + addLineToPoint:CGPointMake(CGRectGetMinX(themesGroup) + 0.42857 * themesGroup.size.width, + CGRectGetMinY(themesGroup) + 0.56818 * themesGroup.size.height)]; [squarePath closePath]; [fillColor setFill]; [squarePath fill]; @@ -1509,42 +3831,42 @@ void MDCCatalogDrawTypographyTile(CGRect frame, id colorScheme [bezier2Path addLineToPoint:CGPointMake(CGRectGetMinX(frame) + 0.54987 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.43155 * CGRectGetHeight(frame))]; [bezier2Path - addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.55341 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.44720 * CGRectGetHeight(frame)) - controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.54987 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.43878 * CGRectGetHeight(frame)) - controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.55105 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.44400 * CGRectGetHeight(frame))]; + addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.55341 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.44720 * CGRectGetHeight(frame)) + controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.54987 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.43878 * CGRectGetHeight(frame)) + controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.55105 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.44400 * CGRectGetHeight(frame))]; [bezier2Path - addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.56602 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame)) - controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.55576 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45041 * CGRectGetHeight(frame)) - controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.55996 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame))]; + addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.56602 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame)) + controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.55576 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45041 * CGRectGetHeight(frame)) + controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.55996 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame))]; [bezier2Path - addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.57827 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45026 * CGRectGetHeight(frame)) - controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.57005 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame)) - controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.57414 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.45143 * CGRectGetHeight(frame))]; + addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.57827 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45026 * CGRectGetHeight(frame)) + controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.57005 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45201 * CGRectGetHeight(frame)) + controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.57414 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.45143 * CGRectGetHeight(frame))]; [bezier2Path addLineToPoint:CGPointMake(CGRectGetMinX(frame) + 0.57827 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.48313 * CGRectGetHeight(frame))]; [bezier2Path - addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.55520 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame)) - controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.57029 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.48581 * CGRectGetHeight(frame)) - controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.56261 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame))]; + addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.55520 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame)) + controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.57029 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.48581 * CGRectGetHeight(frame)) + controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.56261 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame))]; [bezier2Path - addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.51485 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.43313 * CGRectGetHeight(frame)) - controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.52830 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame)) - controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.51485 * CGRectGetWidth(frame), - CGRectGetMinY(frame) + 0.46915 * CGRectGetHeight(frame))]; + addCurveToPoint:CGPointMake(CGRectGetMinX(frame) + 0.51485 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.43313 * CGRectGetHeight(frame)) + controlPoint1:CGPointMake(CGRectGetMinX(frame) + 0.52830 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.48715 * CGRectGetHeight(frame)) + controlPoint2:CGPointMake(CGRectGetMinX(frame) + 0.51485 * CGRectGetWidth(frame), + CGRectGetMinY(frame) + 0.46915 * CGRectGetHeight(frame))]; [bezier2Path addLineToPoint:CGPointMake(CGRectGetMinX(frame) + 0.51485 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.32595 * CGRectGetHeight(frame))]; [bezier2Path addLineToPoint:CGPointMake(CGRectGetMinX(frame) + 0.48919 * CGRectGetWidth(frame), @@ -1564,53 +3886,152 @@ void MDCCatalogDrawTypographyTile(CGRect frame, id colorScheme void MDCCatalogDrawTypographyCustomFontsTile(CGRect frame, id colorScheme) { UIColor* fillColor = colorScheme.primaryColor; - - CGRect typographyCustomFontGroup = CGRectMake(CGRectGetMinX(frame) + 8.02, CGRectGetMinY(frame) + 8, floor((frame.size.width - 8.02) * 0.89213 + 0.5), floor((frame.size.height - 8) * 0.89189 + 0.5)); + + CGRect typographyCustomFontGroup = + CGRectMake(CGRectGetMinX(frame) + 8.02, CGRectGetMinY(frame) + 8, + floor((frame.size.width - 8.02) * 0.89213 + 0.5), + floor((frame.size.height - 8) * 0.89189 + 0.5)); { UIBezierPath* aPath = [UIBezierPath bezierPath]; - [aPath moveToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.45700 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.20350 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.22400 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.79650 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.31950 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.79650 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.36700 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.66950 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.63150 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.66950 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.67900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.79650 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.77450 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.79650 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.54150 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.20350 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.45700 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.20350 * typographyCustomFontGroup.size.height)]; + [aPath moveToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.45700 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.20350 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.22400 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.79650 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.31950 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.79650 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.36700 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.66950 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.63150 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.66950 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.67900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.79650 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.77450 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.79650 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.54150 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.20350 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.45700 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.20350 * typographyCustomFontGroup.size.height)]; [aPath closePath]; - [aPath moveToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.39850 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.58450 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.49900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.31650 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.60000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.58450 * typographyCustomFontGroup.size.height)]; - [aPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.39850 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.58450 * typographyCustomFontGroup.size.height)]; + [aPath moveToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.39850 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.58450 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.49900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.31650 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.60000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.58450 * typographyCustomFontGroup.size.height)]; + [aPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.39850 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.58450 * typographyCustomFontGroup.size.height)]; [aPath closePath]; [fillColor setFill]; [aPath fill]; UIBezierPath* outlinePath = [UIBezierPath bezierPath]; - [outlinePath moveToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.90000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.35000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.90000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.90000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.09900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.90000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.09900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.10000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.64900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.10000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.64900 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.00000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.00000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.00000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.00000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 1.00000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 1.00000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 1.00000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 1.00000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.35000 * typographyCustomFontGroup.size.height)]; - [outlinePath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.90000 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.35000 * typographyCustomFontGroup.size.height)]; + [outlinePath moveToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.90000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.35000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.90000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.90000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.09900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.90000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.09900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.10000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.64900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.10000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.64900 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.00000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.00000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.00000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.00000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 1.00000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 1.00000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 1.00000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 1.00000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.35000 * typographyCustomFontGroup.size.height)]; + [outlinePath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.90000 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.35000 * typographyCustomFontGroup.size.height)]; [outlinePath closePath]; [fillColor setFill]; [outlinePath fill]; UIBezierPath* starPath = [UIBezierPath bezierPath]; - [starPath moveToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.80273 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.04545 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.85094 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.14876 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.95424 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.19697 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.85094 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.24518 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.80273 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.34848 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.75452 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.24518 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.65121 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.19697 * typographyCustomFontGroup.size.height)]; - [starPath addLineToPoint: CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + 0.75452 * typographyCustomFontGroup.size.width, CGRectGetMinY(typographyCustomFontGroup) + 0.14876 * typographyCustomFontGroup.size.height)]; + [starPath moveToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.80273 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.04545 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.85094 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.14876 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.95424 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.19697 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.85094 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.24518 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.80273 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.34848 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.75452 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.24518 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.65121 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.19697 * typographyCustomFontGroup.size.height)]; + [starPath addLineToPoint:CGPointMake(CGRectGetMinX(typographyCustomFontGroup) + + 0.75452 * typographyCustomFontGroup.size.width, + CGRectGetMinY(typographyCustomFontGroup) + + 0.14876 * typographyCustomFontGroup.size.height)]; [starPath closePath]; [fillColor setFill]; [starPath fill]; diff --git a/components/ActionSheet/src/MDCActionSheetController.m b/components/ActionSheet/src/MDCActionSheetController.m index 29bebc3d610..3709c7656ed 100644 --- a/components/ActionSheet/src/MDCActionSheetController.m +++ b/components/ActionSheet/src/MDCActionSheetController.m @@ -34,9 +34,7 @@ @implementation MDCActionSheetAction + (instancetype)actionWithTitle:(NSString *)title image:(UIImage *)image handler:(void (^__nullable)(MDCActionSheetAction *action))handler { - return [[MDCActionSheetAction alloc] initWithTitle:title - image:image - handler:handler]; + return [[MDCActionSheetAction alloc] initWithTitle:title image:image handler:handler]; } - (instancetype)initWithTitle:(NSString *)title @@ -63,7 +61,8 @@ - (id)copyWithZone:(__unused NSZone *)zone { @end @interface MDCActionSheetController () + UITableViewDelegate, + UITableViewDataSource> @property(nonatomic, strong) UITableView *tableView; @property(nonatomic, strong) MDCActionSheetHeaderView *header; @end @@ -100,8 +99,8 @@ - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message { super.modalPresentationStyle = UIModalPresentationCustom; _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _transitionController.trackingScrollView = _tableView; - _tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth - | UIViewAutoresizingFlexibleHeight); + _tableView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _tableView.delegate = self; _tableView.dataSource = self; _tableView.estimatedRowHeight = 56; @@ -211,8 +210,7 @@ - (BOOL)accessibilityPerformEscape { - (void)preferredContentSizeDidChangeForChildContentContainer:(id)container { [super preferredContentSizeDidChangeForChildContentContainer:container]; - [self.presentationController - preferredContentSizeDidChangeForChildContentContainer:self]; + [self.presentationController preferredContentSizeDidChangeForChildContentContainer:self]; } - (UIScrollView *)trackingScrollView { @@ -234,7 +232,7 @@ - (void)setDismissOnBackgroundTap:(BOOL)dismissOnBackgroundTap { /* Disable setter. Always use internal transition controller */ - (void)setTransitioningDelegate: -(__unused id)transitioningDelegate { + (__unused id)transitioningDelegate { NSAssert(NO, @"MDCActionSheetController.transitioningDelegate cannot be changed."); return; } @@ -255,11 +253,12 @@ - (void)updateTable { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MDCActionSheetAction *action = self.actions[indexPath.row]; - [self.presentingViewController dismissViewControllerAnimated:YES completion:^(void){ - if (action.completionHandler) { - action.completionHandler(action); - } - }]; + [self.presentingViewController dismissViewControllerAnimated:YES + completion:^(void) { + if (action.completionHandler) { + action.completionHandler(action); + } + }]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -364,12 +363,12 @@ - (void)mdc_setAdjustsFontForContentSizeCategory:(BOOL)adjusts { } - (void)updateTableFonts { - UIFont *finalActionsFont = _actionFont ?: - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; + UIFont *finalActionsFont = + _actionFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; if (self.mdc_adjustsFontForContentSizeCategory) { - finalActionsFont = - [finalActionsFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline - scaledForDynamicType:self.mdc_adjustsFontForContentSizeCategory]; + finalActionsFont = [finalActionsFont + mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline + scaledForDynamicType:self.mdc_adjustsFontForContentSizeCategory]; } _actionFont = finalActionsFont; [self updateTable]; diff --git a/components/ActionSheet/src/private/MDCActionSheetHeaderView.m b/components/ActionSheet/src/private/MDCActionSheetHeaderView.m index 80b4155c83f..7bd9e83b6b2 100644 --- a/components/ActionSheet/src/private/MDCActionSheetHeaderView.m +++ b/components/ActionSheet/src/private/MDCActionSheetHeaderView.m @@ -152,8 +152,8 @@ - (void)updateFonts { } - (void)updateTitleFont { - UIFont *titleFont = self.titleFont ?: - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; + UIFont *titleFont = + self.titleFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; if (self.mdc_adjustsFontForContentSizeCategory) { self.titleLabel.font = [titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline @@ -165,8 +165,8 @@ - (void)updateTitleFont { } - (void)updateMessageFont { - UIFont *messageFont = self.messageFont ?: - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1]; + UIFont *messageFont = + self.messageFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1]; if (self.mdc_adjustsFontForContentSizeCategory) { self.messageLabel.font = [messageFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 @@ -181,14 +181,14 @@ - (void)updateMessageFont { - (void)mdc_setAdjustsFontForContentSizeCategory:(BOOL)adjusts { _mdc_adjustsFontForContentSizeCategory = adjusts; if (_mdc_adjustsFontForContentSizeCategory) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(updateFonts) - name:UIContentSizeCategoryDidChangeNotification - object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(updateFonts) + name:UIContentSizeCategoryDidChangeNotification + object:nil]; } else { - [[NSNotificationCenter defaultCenter] removeObserver:self - name:UIContentSizeCategoryDidChangeNotification - object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIContentSizeCategoryDidChangeNotification + object:nil]; } [self updateFonts]; } diff --git a/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m b/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m index 7a68fcfabe8..9594c07f22e 100644 --- a/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m +++ b/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m @@ -176,8 +176,8 @@ - (void)setActionFont:(UIFont *)actionFont { } - (void)updateTitleFont { - UIFont *titleFont = _actionFont ?: - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; + UIFont *titleFont = + _actionFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline]; if (self.mdc_adjustsFontForContentSizeCategory) { self.actionLabel.font = [titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline diff --git a/components/ActivityIndicator/src/MDCActivityIndicator.m b/components/ActivityIndicator/src/MDCActivityIndicator.m index 7354f195ea5..ce8ca844928 100644 --- a/components/ActivityIndicator/src/MDCActivityIndicator.m +++ b/components/ActivityIndicator/src/MDCActivityIndicator.m @@ -14,14 +14,14 @@ #import "MDCActivityIndicator.h" -#import #import #import +#import #import "MaterialApplication.h" #import "MaterialPalettes.h" -#import "private/MDCActivityIndicatorMotionSpec.h" #import "private/MDCActivityIndicator+Private.h" +#import "private/MDCActivityIndicatorMotionSpec.h" #import "private/MaterialActivityIndicatorStrings.h" #import "private/MaterialActivityIndicatorStrings_table.h" @@ -248,7 +248,7 @@ - (void)startAnimating { if (!self.window || _backgrounded) { return; } - + [self actuallyStartAnimating]; } @@ -289,7 +289,8 @@ - (void)startAnimatingWithTransition:(nonnull MDCActivityIndicatorTransition *)s [self actuallyStartAnimating]; - self.cycleColorsIndex = self.cycleColors.count > 0 ? cycleStartIndex % self.cycleColors.count : 0; + self.cycleColorsIndex = + self.cycleColors.count > 0 ? cycleStartIndex % self.cycleColors.count : 0; [self applyPropertiesWithoutAnimation:^{ [self updateStrokeColor]; }]; @@ -523,10 +524,8 @@ - (void)setCycleColors:(NSArray *)cycleColors { - (void)addStopAnimation { MDCActivityIndicatorTransition *stopTransition = self.stopTransition; - CGFloat innerRotation = - [[_strokeLayer valueForKeyPath:MDMKeyPathRotation] floatValue]; - CGFloat outerRotation = - [[_outerRotationLayer valueForKeyPath:MDMKeyPathRotation] floatValue]; + CGFloat innerRotation = [[_strokeLayer valueForKeyPath:MDMKeyPathRotation] floatValue]; + CGFloat outerRotation = [[_outerRotationLayer valueForKeyPath:MDMKeyPathRotation] floatValue]; CGFloat totalRotation = (CGFloat)fmod(innerRotation + outerRotation, 2 * M_PI) / (CGFloat)(2 * M_PI); @@ -603,27 +602,29 @@ - (void)addStrokeRotationCycle { [_animator animateWithTiming:timing.outerRotation toLayer:_outerRotationLayer - withValues:@[@(kOuterRotationIncrement * _cycleCount), - @(kOuterRotationIncrement * (_cycleCount + 1))] + withValues:@[ + @(kOuterRotationIncrement * _cycleCount), + @(kOuterRotationIncrement * (_cycleCount + 1)) + ] keyPath:MDMKeyPathRotation]; CGFloat startRotation = _cycleCount * (CGFloat)M_PI; CGFloat endRotation = startRotation + kCycleRotation * (CGFloat)M_PI; [_animator animateWithTiming:timing.innerRotation toLayer:_strokeLayer - withValues:@[@(startRotation), @(endRotation)] + withValues:@[ @(startRotation), @(endRotation) ] keyPath:MDMKeyPathRotation]; [_animator animateWithTiming:timing.strokeStart toLayer:_strokeLayer - withValues:@[@0, @(kStrokeLength)] + withValues:@[ @0, @(kStrokeLength) ] keyPath:MDMKeyPathStrokeStart]; // Ensure the stroke never completely disappears on start by animating from non-zero start and // to a value slightly larger than the strokeStart's final value. [_animator animateWithTiming:timing.strokeEnd toLayer:_strokeLayer - withValues:@[@(_minStrokeDifference), @(kStrokeLength + _minStrokeDifference)] + withValues:@[ @(_minStrokeDifference), @(kStrokeLength + _minStrokeDifference) ] keyPath:MDMKeyPathStrokeEnd]; [CATransaction commit]; @@ -668,8 +669,8 @@ - (void)addTransitionToIndeterminateCycle { CGFloat pointCycleDuration = (CGFloat)MDCActivityIndicatorMotionSpec.pointCycleDuration; CGFloat pointCycleMinimumVariableDuration = (CGFloat)MDCActivityIndicatorMotionSpec.pointCycleMinimumVariableDuration; - CGFloat normalizedDuration = 2 * (targetRotation + _currentProgress) / kSingleCycleRotation * - pointCycleDuration; + CGFloat normalizedDuration = + 2 * (targetRotation + _currentProgress) / kSingleCycleRotation * pointCycleDuration; CGFloat strokeEndTravelDistance = targetRotation - _currentProgress + _minStrokeDifference; CGFloat totalDistance = targetRotation + strokeEndTravelDistance; CGFloat strokeStartDuration = @@ -698,14 +699,14 @@ - (void)addTransitionToIndeterminateCycle { timing.strokeStart.delay = strokeEndDuration; [_animator animateWithTiming:timing.strokeStart toLayer:_strokeLayer - withValues:@[@0, @(targetRotation)] + withValues:@[ @0, @(targetRotation) ] keyPath:MDMKeyPathStrokeStart]; timing.strokeEnd.duration = strokeEndDuration; timing.strokeEnd.delay = 0; [_animator animateWithTiming:timing.strokeEnd toLayer:_strokeLayer - withValues:@[@(_currentProgress), @(targetRotation + _minStrokeDifference)] + withValues:@[ @(_currentProgress), @(targetRotation + _minStrokeDifference) ] keyPath:MDMKeyPathStrokeEnd]; } [CATransaction commit]; @@ -746,7 +747,8 @@ - (void)addTransitionToDeterminateCycle { [CATransaction setCompletionBlock:^{ [self strokeRotationCycleFinishedFromState:MDCActivityIndicatorStateTransitionToDeterminate]; - if ([self.delegate respondsToSelector:@selector(activityIndicatorModeTransitionDidFinish:)]) { + if ([self.delegate + respondsToSelector:@selector(activityIndicatorModeTransitionDidFinish:)]) { [self.delegate activityIndicatorModeTransitionDidFinish:self]; } }]; @@ -763,14 +765,14 @@ - (void)addTransitionToDeterminateCycle { CGFloat endRotation = startRotation + rotationDelta * 2 * (CGFloat)M_PI; [_animator animateWithTiming:spec.innerRotation toLayer:_strokeLayer - withValues:@[@(startRotation), @(endRotation)] + withValues:@[ @(startRotation), @(endRotation) ] keyPath:MDMKeyPathRotation]; _strokeLayer.strokeStart = 0; [_animator animateWithTiming:spec.strokeEnd toLayer:_strokeLayer - withValues:@[@(_minStrokeDifference), @(_currentProgress)] + withValues:@[ @(_minStrokeDifference), @(_currentProgress) ] keyPath:MDMKeyPathStrokeEnd]; } [CATransaction commit]; @@ -800,7 +802,7 @@ - (void)addProgressAnimation { [_animator animateWithTiming:MDCActivityIndicatorMotionSpec.willChangeProgress.strokeEnd toLayer:_strokeLayer - withValues:@[@(_lastProgress), @(_currentProgress)] + withValues:@[ @(_lastProgress), @(_currentProgress) ] keyPath:MDMKeyPathStrokeEnd]; } @@ -912,8 +914,8 @@ - (void)removeAnimations { [_strokeLayer removeAllAnimations]; [_outerRotationLayer removeAllAnimations]; - // Reset current and latest progress, to ensure addProgressAnimationIfRequired adds a progress animation - // when returning from hidden. + // Reset current and latest progress, to ensure addProgressAnimationIfRequired adds a progress + // animation when returning from hidden. _currentProgress = 0; _lastProgress = 0; @@ -931,11 +933,10 @@ + (CGFloat)defaultHeight { static NSArray *s_defaultCycleColors; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - s_defaultCycleColors = - @[ MDCPalette.bluePalette.tint500, - MDCPalette.redPalette.tint500, - MDCPalette.yellowPalette.tint500, - MDCPalette.greenPalette.tint500 ]; + s_defaultCycleColors = @[ + MDCPalette.bluePalette.tint500, MDCPalette.redPalette.tint500, + MDCPalette.yellowPalette.tint500, MDCPalette.greenPalette.tint500 + ]; }); return s_defaultCycleColors; } @@ -967,7 +968,7 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName { // not be in the main .app bundle, but rather in a nested framework, so figure out where we live // and use that as the search location. NSBundle *bundle = [NSBundle bundleForClass:[MDCActivityIndicator class]]; - NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle)resourcePath]; + NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle) resourcePath]; return [resourcePath stringByAppendingPathComponent:bundleName]; } @@ -980,10 +981,8 @@ - (BOOL)isAccessibilityElement { - (NSString *)defaultAccessibilityLabel { MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorAccessibilityLabel; NSString *key = kMaterialActivityIndicatorStringTable[keyIndex]; - return NSLocalizedStringFromTableInBundle(key, - kMaterialActivityIndicatorStringsTableName, - [[self class] bundle], - @"Activity Indicator"); + return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName, + [[self class] bundle], @"Activity Indicator"); } - (NSString *)accessibilityValue { @@ -992,29 +991,24 @@ - (NSString *)accessibilityValue { MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorInProgressAccessibilityValue; NSString *key = kMaterialActivityIndicatorStringTable[keyIndex]; - return NSLocalizedStringFromTableInBundle(key, - kMaterialActivityIndicatorStringsTableName, - [[self class] bundle], - @"In Progress"); + return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName, + [[self class] bundle], @"In Progress"); } else { NSUInteger percentage = (int)(self.progress * 100); MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorProgressCompletedAccessibilityValue; NSString *key = kMaterialActivityIndicatorStringTable[keyIndex]; - NSString *localizedString = NSLocalizedStringFromTableInBundle(key, - kMaterialActivityIndicatorStringsTableName, - [[self class] bundle], - @"{percentage} Percent Complete"); + NSString *localizedString = NSLocalizedStringFromTableInBundle( + key, kMaterialActivityIndicatorStringsTableName, [[self class] bundle], + @"{percentage} Percent Complete"); return [NSString localizedStringWithFormat:localizedString, percentage]; } } else { MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorProgressHaltedAccessibilityValue; NSString *key = kMaterialActivityIndicatorStringTable[keyIndex]; - return NSLocalizedStringFromTableInBundle(key, - kMaterialActivityIndicatorStringsTableName, - [[self class] bundle], - @"Progress Halted"); + return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName, + [[self class] bundle], @"Progress Halted"); } } @@ -1030,6 +1024,6 @@ - (nonnull instancetype)initWithAnimation:(_Nonnull MDCActivityIndicatorAnimatio if (self) { self.animation = animation; } - return self; + return self; } @end diff --git a/components/ActivityIndicator/tests/unit/ActivityIndicatorTests.m b/components/ActivityIndicator/tests/unit/ActivityIndicatorTests.m index ba3f0e7aa83..0c520092926 100644 --- a/components/ActivityIndicator/tests/unit/ActivityIndicatorTests.m +++ b/components/ActivityIndicator/tests/unit/ActivityIndicatorTests.m @@ -94,7 +94,7 @@ - (void)testSetCycleColorsEmptyReturnsDefault { - (void)testSetCycleColorNonEmpty { // Given MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init]; - NSArray *cycleColors = @[[UIColor redColor], [UIColor whiteColor]]; + NSArray *cycleColors = @[ [UIColor redColor], [UIColor whiteColor] ]; // When indicator.cycleColors = cycleColors; @@ -102,7 +102,7 @@ - (void)testSetCycleColorNonEmpty { // Then XCTAssertEqualObjects(indicator.cycleColors, cycleColors, @"With a non-empty array, the |cycleColors| property should override the" - " default value."); + " default value."); } - (void)testSetProgressValue { diff --git a/components/AnimationTiming/src/CAMediaTimingFunction+MDCAnimationTiming.m b/components/AnimationTiming/src/CAMediaTimingFunction+MDCAnimationTiming.m index 26bb1bdf01a..b2f43eea696 100644 --- a/components/AnimationTiming/src/CAMediaTimingFunction+MDCAnimationTiming.m +++ b/components/AnimationTiming/src/CAMediaTimingFunction+MDCAnimationTiming.m @@ -18,6 +18,7 @@ @implementation CAMediaTimingFunction (MDCAnimationTiming) + (CAMediaTimingFunction *)mdc_functionWithType:(MDCAnimationTimingFunction)type { switch (type) { + // clang-format off case MDCAnimationTimingFunctionStandard: return [[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:(float)0.2:1]; case MDCAnimationTimingFunctionDeceleration: @@ -26,6 +27,7 @@ + (CAMediaTimingFunction *)mdc_functionWithType:(MDCAnimationTimingFunction)type return [[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:1:1]; case MDCAnimationTimingFunctionSharp: return [[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:(float)0.6:1]; + // clang-format on } NSAssert(NO, @"Invalid MDCAnimationTimingFunction value %i.", (int)type); // Reasonable default to use in Release mode for garbage input. diff --git a/components/AppBar/examples/AppBarImageryExample.m b/components/AppBar/examples/AppBarImageryExample.m index 14f4c91af32..533de3fae26 100644 --- a/components/AppBar/examples/AppBarImageryExample.m +++ b/components/AppBar/examples/AppBarImageryExample.m @@ -14,8 +14,8 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" +#import "MaterialAppBar.h" @interface AppBarImageryExample : UITableViewController @property(nonatomic, strong) MDCAppBarViewController *appBarViewController; @@ -53,10 +53,10 @@ - (void)viewDidLoad { // Create our custom image view and add it to the header view. UIImageView *imageView = [[UIImageView alloc] - initWithImage: - [UIImage imageNamed:@"mdc_theme" - inBundle:[NSBundle bundleForClass:[AppBarImageryExample class]] - compatibleWithTraitCollection:nil]]; + initWithImage:[UIImage imageNamed:@"mdc_theme" + inBundle:[NSBundle bundleForClass:[AppBarImageryExample + class]] + compatibleWithTraitCollection:nil]]; imageView.frame = self.appBarViewController.headerView.bounds; // Ensure that the image view resizes in reaction to the header view bounds changing. @@ -110,11 +110,13 @@ - (void)viewWillAppear:(BOOL)animated { @implementation AppBarImageryExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { + // clang-format off return @{ - @"breadcrumbs": @[ @"App Bar", @"Imagery" ], - @"primaryDemo": @NO, - @"presentable": @YES + @"breadcrumbs" : @[ @"App Bar", @"Imagery" ], + @"primaryDemo" : @NO, + @"presentable" : @YES }; + // clang-format on } - (BOOL)catalogShouldHideNavigation { @@ -135,8 +137,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { - cell = - [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:@"cell"]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; diff --git a/components/AppBar/examples/AppBarInterfaceBuilderExampleController.m b/components/AppBar/examples/AppBarInterfaceBuilderExampleController.m index 09187de70fb..f039635b2a0 100644 --- a/components/AppBar/examples/AppBarInterfaceBuilderExampleController.m +++ b/components/AppBar/examples/AppBarInterfaceBuilderExampleController.m @@ -14,8 +14,8 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" +#import "MaterialAppBar.h" @interface AppBarInterfaceBuilderExample : UIViewController @@ -65,7 +65,8 @@ - (void)commonAppBarInterfaceBuilderExampleSetup { - (void)viewDidLoad { [super viewDidLoad]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; // Allows us to avoid forwarding events, but means we can't enable shift behaviors. self.appBarViewController.headerView.observesTrackingScrollViewScrollEvents = YES; @@ -87,10 +88,10 @@ @implementation AppBarInterfaceBuilderExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Interface Builder" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"AppBarInterfaceBuilderExampleController" + @"breadcrumbs" : @[ @"App Bar", @"Interface Builder" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"AppBarInterfaceBuilderExampleController" }; } diff --git a/components/AppBar/examples/AppBarModalPresentationExample.m b/components/AppBar/examples/AppBarModalPresentationExample.m index aeecd0bcfa1..91c98aa14f9 100644 --- a/components/AppBar/examples/AppBarModalPresentationExample.m +++ b/components/AppBar/examples/AppBarModalPresentationExample.m @@ -14,8 +14,8 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" +#import "MaterialAppBar.h" @interface AppBarModalPresentationExamplePresented : UITableViewController @property(strong, nonatomic) MDCAppBarViewController *appBarViewController; @@ -57,7 +57,8 @@ - (instancetype)init { - (void)viewDidLoad { [super viewDidLoad]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; // Allows us to avoid forwarding events, but means we can't enable shift behaviors. self.appBarViewController.headerView.observesTrackingScrollViewScrollEvents = YES; @@ -92,8 +93,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { - cell = - [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:@"cell"]; } cell.layoutMargins = UIEdgeInsetsZero; return cell; @@ -129,7 +130,8 @@ - (void)viewDidLoad { target:self action:@selector(presentModal)]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; } - (void)viewWillAppear:(BOOL)animated { @@ -184,9 +186,9 @@ @implementation AppBarModalPresentationExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Modal Presentation" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"App Bar", @"Modal Presentation" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -231,8 +233,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { - cell = - [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:@"cell"]; } cell.layoutMargins = UIEdgeInsetsZero; return cell; diff --git a/components/AppBar/examples/AppBarPresentedExample.m b/components/AppBar/examples/AppBarPresentedExample.m index e6f7faf569a..ad56f6485e6 100644 --- a/components/AppBar/examples/AppBarPresentedExample.m +++ b/components/AppBar/examples/AppBarPresentedExample.m @@ -14,11 +14,11 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" -#import "MaterialButtons.h" +#import "MaterialAppBar.h" #import "MaterialButtons+ButtonThemer.h" +#import "MaterialButtons.h" @interface PresentedDemoViewController : UICollectionViewController @property(nonatomic, strong) MDCAppBarViewController *appBarViewController; @@ -80,7 +80,8 @@ - (void)viewDidLoad { forCellWithReuseIdentifier:@"Cell"]; self.navigationItem.leftBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:@"Dismiss" style:UIBarButtonItemStyleDone + [[UIBarButtonItem alloc] initWithTitle:@"Dismiss" + style:UIBarButtonItemStyleDone target:self action:@selector(dismiss)]; } @@ -104,9 +105,9 @@ - (CGSize)preferredContentSize { - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - UICollectionViewCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; - switch (indexPath.row%3) { + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" + forIndexPath:indexPath]; + switch (indexPath.row % 3) { case 0: cell.backgroundColor = [UIColor colorWithWhite:(CGFloat)0.2 alpha:1]; break; @@ -124,8 +125,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGRect collectionViewFrame = collectionView.frame; return CGSizeMake(collectionViewFrame.size.width / 2 - 14, 40); } @@ -163,14 +164,11 @@ - (void)viewDidLoad { [button setTitle:@"Present Modal App Bar Demo" forState:UIControlStateNormal]; [button sizeToFit]; button.center = self.view.center; - button.frame = - CGRectMake(button.frame.origin.x, - button.center.y - 48 * 2 - buttonMargin, - button.bounds.size.width, - MAX(button.bounds.size.height, 48)); + button.frame = CGRectMake(button.frame.origin.x, button.center.y - 48 * 2 - buttonMargin, + button.bounds.size.width, MAX(button.bounds.size.height, 48)); [button addTarget:self - action:@selector(presentDemo) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(presentDemo) + forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; [MDCContainedButtonThemer applyScheme:buttonScheme toButton:button]; @@ -180,10 +178,8 @@ - (void)viewDidLoad { [popoverButton sizeToFit]; popoverButton.center = self.view.center; popoverButton.frame = - CGRectMake(popoverButton.frame.origin.x, - popoverButton.center.y - 48, - popoverButton.bounds.size.width, - MAX(popoverButton.bounds.size.height, 48)); + CGRectMake(popoverButton.frame.origin.x, popoverButton.center.y - 48, + popoverButton.bounds.size.width, MAX(popoverButton.bounds.size.height, 48)); [popoverButton addTarget:self action:@selector(presentDemoPopover) forControlEvents:UIControlEventTouchUpInside]; @@ -203,7 +199,7 @@ - (void)presentDemoPopover { if (@available(iOS 11.0, *)) { rect = CGRectMake(self.view.bounds.size.width / 2, self.view.safeAreaInsets.top, 1, 1); } - + self.demoViewController.modalPresentationStyle = UIModalPresentationPopover; self.demoViewController.popoverPresentationController.sourceView = self.view; self.demoViewController.popoverPresentationController.sourceRect = rect; @@ -221,9 +217,9 @@ @implementation AppBarPresentedExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Presented" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"Presented" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/AppBar/examples/AppBarSectionHeadersExample.m b/components/AppBar/examples/AppBarSectionHeadersExample.m index 78a099fb471..4168b6a586d 100644 --- a/components/AppBar/examples/AppBarSectionHeadersExample.m +++ b/components/AppBar/examples/AppBarSectionHeadersExample.m @@ -14,8 +14,8 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" +#import "MaterialAppBar.h" @interface AppBarSectionHeadersExample : UITableViewController @@ -55,7 +55,8 @@ - (id)init { - (void)viewDidLoad { [super viewDidLoad]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; // Recommended step: Set the tracking scroll view. self.appBarViewController.headerView.trackingScrollView = self.tableView; @@ -100,9 +101,9 @@ @implementation AppBarSectionHeadersExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"UITableView with section headers" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"UITableView with section headers" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -120,8 +121,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { - cell = - [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:@"cell"]; } cell.textLabel.text = indexPath.section == 0 ? @"Demo" : @"Example"; cell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -136,8 +137,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger return 25; } -- (NSString *)tableView:(UITableView*)tableView -titleForHeaderInSection:(NSInteger)section { +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return section == 0 ? @"D" : @"E"; } @@ -146,4 +146,3 @@ - (NSString *)tableView:(UITableView*)tableView } @end - diff --git a/components/AppBar/examples/AppBarTypicalCollectionViewExample.m b/components/AppBar/examples/AppBarTypicalCollectionViewExample.m index 45b34ca4351..4d4de7c3929 100644 --- a/components/AppBar/examples/AppBarTypicalCollectionViewExample.m +++ b/components/AppBar/examples/AppBarTypicalCollectionViewExample.m @@ -14,9 +14,9 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" @interface AppBarTypicalCollectionViewExample : UICollectionViewController @@ -80,10 +80,10 @@ - (void)viewDidLoad { [self.appBarViewController didMoveToParentViewController:self]; [MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme toAppBarViewController:_appBarViewController]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; } - - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 100; @@ -91,9 +91,9 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - UICollectionViewCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; - switch (indexPath.row%3) { + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" + forIndexPath:indexPath]; + switch (indexPath.row % 3) { case 0: cell.backgroundColor = [UIColor colorWithWhite:(CGFloat)0.2 alpha:1]; break; @@ -111,8 +111,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGRect collectionViewFrame = collectionView.frame; return CGSizeMake(collectionViewFrame.size.width / 2 - 14, 40); } @@ -127,12 +127,10 @@ @implementation AppBarTypicalCollectionViewExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Collection View with App bar" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"Collection View with App bar" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @end - - diff --git a/components/AppBar/examples/AppBarTypicalUseExample.m b/components/AppBar/examples/AppBarTypicalUseExample.m index 82d170bb30e..102f0b850ec 100644 --- a/components/AppBar/examples/AppBarTypicalUseExample.m +++ b/components/AppBar/examples/AppBarTypicalUseExample.m @@ -14,9 +14,9 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" @interface AppBarTypicalUseExample : UITableViewController @@ -110,11 +110,11 @@ @implementation AppBarTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"App Bar" ], - @"description": @"The top app bar displays information and actions relating to " - @"the current view.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"App Bar" ], + @"description" : @"The top app bar displays information and actions relating to " + @"the current view.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -136,8 +136,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { - cell = - [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:@"cell"]; } cell.layoutMargins = UIEdgeInsetsZero; cell.selectionStyle = UITableViewCellSelectionStyleNone; diff --git a/components/AppBar/examples/AppBarWKWebViewLargeContentExample.m b/components/AppBar/examples/AppBarWKWebViewLargeContentExample.m index c5c859935b5..c51e186831a 100644 --- a/components/AppBar/examples/AppBarWKWebViewLargeContentExample.m +++ b/components/AppBar/examples/AppBarWKWebViewLargeContentExample.m @@ -15,9 +15,9 @@ #import #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" // This demonstrates that a WKWebView with large content as the tracking scroll view is able to // scroll as expected, even with the useAdditionalSafeAreaInsetsForWebKitScrollViews flag enabled. @@ -76,7 +76,7 @@ - (void)viewDidLoad { WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config]; [self.view addSubview:webView]; - NSMutableArray *content = [@[@"\n"] mutableCopy]; + NSMutableArray *content = [@[ @"\n" ] mutableCopy]; for (NSInteger ix = 0; ix < 500; ++ix) { [content addObject:@"

Hello

"]; } @@ -87,37 +87,37 @@ - (void)viewDidLoad { // No need to do anything - additionalSafeAreaInsets will inset our content. webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); } else { - webView.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints: - @[[NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.topLayoutGuide - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:0] - ]]; + webView.translatesAutoresizingMaskIntoConstraints = NO; + [NSLayoutConstraint activateConstraints:@[ + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.topLayoutGuide + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0] + ]]; } self.appBar.headerViewController.headerView.trackingScrollView = webView.scrollView; [self.appBar addSubviewsToParent]; @@ -143,9 +143,9 @@ @implementation AppBarWKWebViewLargeContentExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"WKWebView large content" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"App Bar", @"WKWebView large content" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/AppBar/examples/AppBarWKWebViewLargeContentNoBugExample.m b/components/AppBar/examples/AppBarWKWebViewLargeContentNoBugExample.m index db507270aed..2b7aae48394 100644 --- a/components/AppBar/examples/AppBarWKWebViewLargeContentNoBugExample.m +++ b/components/AppBar/examples/AppBarWKWebViewLargeContentNoBugExample.m @@ -15,9 +15,9 @@ #import #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" // This demonstrates that a WKWebView with large content as the tracking scroll view is able to // scroll as expected, even without the useAdditionalSafeAreaInsetsForWebKitScrollViews flag @@ -76,7 +76,7 @@ - (void)viewDidLoad { webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:webView]; - NSMutableArray *content = [@[@"\n"] mutableCopy]; + NSMutableArray *content = [@[ @"\n" ] mutableCopy]; for (NSInteger ix = 0; ix < 500; ++ix) { [content addObject:@"

Hello

"]; } @@ -107,9 +107,9 @@ @implementation AppBarWKWebViewLargeContentNoBugExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"WKWebView large content no bug" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"App Bar", @"WKWebView large content no bug" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/AppBar/examples/AppBarWKWebViewSmallContentBugExample.m b/components/AppBar/examples/AppBarWKWebViewSmallContentBugExample.m index b0a1bd40006..fc8461962fa 100644 --- a/components/AppBar/examples/AppBarWKWebViewSmallContentBugExample.m +++ b/components/AppBar/examples/AppBarWKWebViewSmallContentBugExample.m @@ -15,9 +15,9 @@ #import #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" // This demonstrates a bug when WKWebView's scroll view is the tracking scroll view and the web // view's content is smaller than the screen. Note that the content is scrollable because the @@ -105,9 +105,9 @@ @implementation AppBarWKWebViewSmallContentBugExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"WKWebView small content bug" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"App Bar", @"WKWebView small content bug" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/AppBar/examples/AppBarWKWebViewSmallContentExample.m b/components/AppBar/examples/AppBarWKWebViewSmallContentExample.m index 6a4c2e0aea7..199c045b5ac 100644 --- a/components/AppBar/examples/AppBarWKWebViewSmallContentExample.m +++ b/components/AppBar/examples/AppBarWKWebViewSmallContentExample.m @@ -15,9 +15,9 @@ #import #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" // This demonstrates that a WKWebView with minimal content as the tracking scroll view is not able // to scroll as expected. This requires enabling useAdditionalSafeAreaInsetsForWebKitScrollViews @@ -80,38 +80,38 @@ - (void)viewDidLoad { // No need to do anything - additionalSafeAreaInsets will inset our content. webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); } else { - // Fixes the WKWebView contentSize.height bug pre-iOS 11. - webView.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints: - @[[NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.topLayoutGuide - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:webView - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:0] - ]]; + // Fixes the WKWebView contentSize.height bug pre-iOS 11. + webView.translatesAutoresizingMaskIntoConstraints = NO; + [NSLayoutConstraint activateConstraints:@[ + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.topLayoutGuide + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:webView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0] + ]]; } self.appBar.headerViewController.headerView.trackingScrollView = webView.scrollView; @@ -138,9 +138,9 @@ @implementation AppBarWKWebViewSmallContentExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"WKWebView small content" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"App Bar", @"WKWebView small content" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/AppBar/examples/AppBarWrappedExample.m b/components/AppBar/examples/AppBarWrappedExample.m index defdd859bfc..948df32c17e 100644 --- a/components/AppBar/examples/AppBarWrappedExample.m +++ b/components/AppBar/examples/AppBarWrappedExample.m @@ -14,10 +14,9 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" - +#import "MaterialAppBar.h" @interface WrappedDemoViewController : UIViewController @end @@ -59,15 +58,17 @@ - (void)viewDidLoad { [[MDCAppBarContainerViewController alloc] initWithContentViewController:demoVC]; // Behavioral flags. - MDCAppBarViewController *appBarViewController = self.appBarContainerViewController.appBarViewController; + MDCAppBarViewController *appBarViewController = + self.appBarContainerViewController.appBarViewController; appBarViewController.inferTopSafeAreaInsetFromViewController = YES; appBarViewController.headerView.minMaxHeightIncludesSafeArea = NO; self.appBarContainerViewController.topLayoutGuideAdjustmentEnabled = YES; [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarContainerViewController.appBarViewController]; - [MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme - toAppBarViewController:self.appBarContainerViewController.appBarViewController]; + [MDCAppBarTypographyThemer + applyTypographyScheme:self.typographyScheme + toAppBarViewController:self.appBarContainerViewController.appBarViewController]; // Need to update the status bar style after applying the theme. [self setNeedsStatusBarAppearanceUpdate]; @@ -88,9 +89,9 @@ @implementation AppBarWrappedExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Wrapped" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"Wrapped" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/AppBar/examples/AppBarWrappingUITableViewControllerExample.m b/components/AppBar/examples/AppBarWrappingUITableViewControllerExample.m index aabc65773a2..397bd5d472d 100644 --- a/components/AppBar/examples/AppBarWrappingUITableViewControllerExample.m +++ b/components/AppBar/examples/AppBarWrappingUITableViewControllerExample.m @@ -14,9 +14,9 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" @interface AppBarWrappingUITableViewControllerExample : UIViewController @@ -30,8 +30,7 @@ @implementation AppBarWrappingUITableViewControllerExample - (void)dealloc { // Required for pre-iOS 11 devices because we've enabled observesTrackingScrollViewScrollEvents. - self.appBarContainerViewController.appBarViewController.headerView.trackingScrollView - = nil; + self.appBarContainerViewController.appBarViewController.headerView.trackingScrollView = nil; } - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -54,7 +53,8 @@ - (void)viewDidLoad { [[MDCAppBarContainerViewController alloc] initWithContentViewController:tableViewController]; // Behavioral flags. - MDCAppBarViewController *appBarViewController = self.appBarContainerViewController.appBarViewController; + MDCAppBarViewController *appBarViewController = + self.appBarContainerViewController.appBarViewController; appBarViewController.inferTopSafeAreaInsetFromViewController = YES; appBarViewController.headerView.minMaxHeightIncludesSafeArea = NO; self.appBarContainerViewController.topLayoutGuideAdjustmentEnabled = YES; @@ -73,8 +73,9 @@ - (void)viewDidLoad { [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarContainerViewController.appBarViewController]; - [MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme - toAppBarViewController:self.appBarContainerViewController.appBarViewController]; + [MDCAppBarTypographyThemer + applyTypographyScheme:self.typographyScheme + toAppBarViewController:self.appBarContainerViewController.appBarViewController]; // Need to update the status bar style after applying the theme. [self setNeedsStatusBarAppearanceUpdate]; @@ -109,9 +110,9 @@ @implementation AppBarWrappingUITableViewControllerExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Wrapped table view" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"App Bar", @"Wrapped table view" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/AppBar/src/ColorThemer/MDCAppBarColorThemer.m b/components/AppBar/src/ColorThemer/MDCAppBarColorThemer.m index 2d6100cbf36..08d20604c33 100644 --- a/components/AppBar/src/ColorThemer/MDCAppBarColorThemer.m +++ b/components/AppBar/src/ColorThemer/MDCAppBarColorThemer.m @@ -20,7 +20,7 @@ @implementation MDCAppBarColorThemer + (void)applyColorScheme:(nonnull id)colorScheme - toAppBarViewController:(nonnull MDCAppBarViewController *)appBarViewController { + toAppBarViewController:(nonnull MDCAppBarViewController *)appBarViewController { [MDCFlexibleHeaderColorThemer applySemanticColorScheme:colorScheme toFlexibleHeaderView:appBarViewController.headerView]; [MDCNavigationBarColorThemer applySemanticColorScheme:colorScheme @@ -31,36 +31,33 @@ + (void)applySurfaceVariantWithColorScheme:(nonnull id)colorSc toAppBarViewController:(nonnull MDCAppBarViewController *)appBarViewController { [MDCFlexibleHeaderColorThemer applySurfaceVariantWithColorScheme:colorScheme toFlexibleHeaderView:appBarViewController.headerView]; - [MDCNavigationBarColorThemer applySurfaceVariantWithColorScheme:colorScheme - toNavigationBar: - appBarViewController.navigationBar]; + [MDCNavigationBarColorThemer + applySurfaceVariantWithColorScheme:colorScheme + toNavigationBar:appBarViewController.navigationBar]; } #pragma mark - To be deprecated -+ (void)applySemanticColorScheme:(id)colorScheme - toAppBar:(MDCAppBar *)appBar { ++ (void)applySemanticColorScheme:(id)colorScheme toAppBar:(MDCAppBar *)appBar { [MDCFlexibleHeaderColorThemer applySemanticColorScheme:colorScheme toFlexibleHeaderView:appBar.headerViewController.headerView]; [MDCNavigationBarColorThemer applySemanticColorScheme:colorScheme - toNavigationBar:appBar.navigationBar]; + toNavigationBar:appBar.navigationBar]; } + (void)applySurfaceVariantWithColorScheme:(nonnull id)colorScheme toAppBar:(nonnull MDCAppBar *)appBar { - [MDCFlexibleHeaderColorThemer applySurfaceVariantWithColorScheme:colorScheme - toFlexibleHeaderView: - appBar.headerViewController.headerView]; + [MDCFlexibleHeaderColorThemer + applySurfaceVariantWithColorScheme:colorScheme + toFlexibleHeaderView:appBar.headerViewController.headerView]; [MDCNavigationBarColorThemer applySurfaceVariantWithColorScheme:colorScheme toNavigationBar:appBar.navigationBar]; } -+ (void)applyColorScheme:(id)colorScheme - toAppBar:(MDCAppBar *)appBar { ++ (void)applyColorScheme:(id)colorScheme toAppBar:(MDCAppBar *)appBar { [MDCFlexibleHeaderColorThemer applyColorScheme:colorScheme toMDCFlexibleHeaderController:appBar.headerViewController]; - [MDCNavigationBarColorThemer applyColorScheme:colorScheme - toNavigationBar:appBar.navigationBar]; + [MDCNavigationBarColorThemer applyColorScheme:colorScheme toNavigationBar:appBar.navigationBar]; } @end diff --git a/components/AppBar/src/MDCAppBarContainerViewController.m b/components/AppBar/src/MDCAppBarContainerViewController.m index 7fc0c2234ab..de8411031ef 100644 --- a/components/AppBar/src/MDCAppBarContainerViewController.m +++ b/components/AppBar/src/MDCAppBarContainerViewController.m @@ -85,8 +85,8 @@ - (void)updateTopLayoutGuideBehavior { if (self.topLayoutGuideAdjustmentEnabled) { if ([self isViewLoaded]) { self.contentViewController.view.translatesAutoresizingMaskIntoConstraints = YES; - self.contentViewController.view.autoresizingMask = (UIViewAutoresizingFlexibleWidth - | UIViewAutoresizingFlexibleHeight); + self.contentViewController.view.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); self.contentViewController.view.frame = self.view.bounds; } diff --git a/components/AppBar/src/MDCAppBarNavigationController.m b/components/AppBar/src/MDCAppBarNavigationController.m index 7af2619fa53..3be8d0108d0 100644 --- a/components/AppBar/src/MDCAppBarNavigationController.m +++ b/components/AppBar/src/MDCAppBarNavigationController.m @@ -19,7 +19,7 @@ #import // Light-weight book-keeping associated with any pushed view controller. -@interface MDCAppBarNavigationControllerInfo: NSObject +@interface MDCAppBarNavigationControllerInfo : NSObject @property(nonatomic, strong) MDCAppBar *appBar; @@ -71,7 +71,7 @@ - (UIViewController *)childViewControllerForStatusBarStyle { if (appBar) { return appBar.appBarViewController; } - return child; // Fall back to using the child if we didn't knowingly inject an app bar. + return child; // Fall back to using the child if we didn't knowingly inject an app bar. } // Inject an App Bar, if necessary, when a view controller is pushed. @@ -86,9 +86,9 @@ - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)ani - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated { for (UIViewController *viewController in viewControllers) { - // We call this before invoking super because super immediately queries the pushed view controller - // for things like status bar style, which we want to have rerouted to our flexible header view - // controller. + // We call this before invoking super because super immediately queries the pushed view + // controller for things like status bar style, which we want to have rerouted to our flexible + // header view controller. [self injectAppBarIntoViewController:viewController]; } @@ -119,7 +119,7 @@ - (void)injectAppBarIntoViewController:(UIViewController *)viewController { UIView *viewControllerView = viewController.view; if ([self viewControllerHasFlexibleHeader:viewController]) { - return; // Already has a flexible header (not one we injected, but that's ok). + return; // Already has a flexible header (not one we injected, but that's ok). } // Attempt to infer the tracking scroll view. @@ -162,15 +162,16 @@ - (void)injectAppBarIntoViewController:(UIViewController *)viewController { appBar.appBarViewController.headerView.trackingScrollView = trackingScrollView; - if ([self.delegate respondsToSelector: - @selector(appBarNavigationController:willAddAppBar:asChildOfViewController:)]) { + if ([self.delegate respondsToSelector:@selector + (appBarNavigationController:willAddAppBar:asChildOfViewController:)]) { [self.delegate appBarNavigationController:self willAddAppBar:appBar asChildOfViewController:viewController]; } - if ([self.delegate respondsToSelector: - @selector(appBarNavigationController:willAddAppBarViewController:asChildOfViewController:)]) { + if ([self.delegate + respondsToSelector:@selector(appBarNavigationController: + willAddAppBarViewController:asChildOfViewController:)]) { [self.delegate appBarNavigationController:self willAddAppBarViewController:appBar.appBarViewController asChildOfViewController:viewController]; @@ -214,9 +215,7 @@ - (MDCAppBarNavigationControllerInfo *)infoForViewController:(UIViewController * - (void)setInfo:(MDCAppBarNavigationControllerInfo *)info forViewController:(UIViewController *)viewController { - objc_setAssociatedObject(viewController, - @selector(infoForViewController:), - info, + objc_setAssociatedObject(viewController, @selector(infoForViewController:), info, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -226,10 +225,9 @@ - (MDCAppBar *)appBarForViewController:(UIViewController *)viewController { return [self infoForViewController:viewController].appBar; } -- (MDCAppBarViewController *) - appBarViewControllerForViewController:(UIViewController *)viewController { +- (MDCAppBarViewController *)appBarViewControllerForViewController: + (UIViewController *)viewController { return [self infoForViewController:viewController].appBar.appBarViewController; } @end - diff --git a/components/AppBar/src/MDCAppBarViewController.m b/components/AppBar/src/MDCAppBarViewController.m index 817b272938f..2a7042aa34d 100644 --- a/components/AppBar/src/MDCAppBarViewController.m +++ b/components/AppBar/src/MDCAppBarViewController.m @@ -57,10 +57,10 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { - (void)MDCAppBarViewController_commonInit { // Shadow layer MDCFlexibleHeaderShadowIntensityChangeBlock intensityBlock = - ^(CALayer *_Nonnull shadowLayer, CGFloat intensity) { - CGFloat elevation = MDCShadowElevationAppBar * intensity; - [(MDCShadowLayer *)shadowLayer setElevation:elevation]; - }; + ^(CALayer *_Nonnull shadowLayer, CGFloat intensity) { + CGFloat elevation = MDCShadowElevationAppBar * intensity; + [(MDCShadowLayer *)shadowLayer setElevation:elevation]; + }; [self.headerView setShadowLayer:[MDCShadowLayer layer] intensityDidChangeBlock:intensityBlock]; [self.headerView forwardTouchEventsForView:self.headerStackView]; @@ -139,13 +139,9 @@ - (UIBarButtonItem *)backButtonItem { action:@selector(didTapBackButton:)]; } backBarButtonItem.accessibilityIdentifier = @"back_bar_button"; - NSString *key = - kMaterialAppBarStringTable[kStr_MaterialAppBarBackButtonAccessibilityLabel]; - backBarButtonItem.accessibilityLabel = - NSLocalizedStringFromTableInBundle(key, - kMaterialAppBarStringsTableName, - [[self class] bundle], - @"Back"); + NSString *key = kMaterialAppBarStringTable[kStr_MaterialAppBarBackButtonAccessibilityLabel]; + backBarButtonItem.accessibilityLabel = NSLocalizedStringFromTableInBundle( + key, kMaterialAppBarStringsTableName, [[self class] bundle], @"Back"); return backBarButtonItem; } @@ -166,7 +162,7 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName { // not be in the main .app bundle, but rather in a nested framework, so figure out where we live // and use that as the search location. NSBundle *bundle = [NSBundle bundleForClass:[MDCAppBar class]]; - NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle)resourcePath]; + NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle) resourcePath]; return [resourcePath stringByAppendingPathComponent:bundleName]; } @@ -193,14 +189,13 @@ - (void)viewDidLoad { constant:topMargin]; _verticalConstraint.active = !self.inferTopSafeAreaInsetFromViewController; - _topSafeAreaConstraint = - [NSLayoutConstraint constraintWithItem:self.headerView.topSafeAreaGuide - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.headerStackView - attribute:NSLayoutAttributeTop - multiplier:1 - constant:0]; + _topSafeAreaConstraint = [NSLayoutConstraint constraintWithItem:self.headerView.topSafeAreaGuide + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.headerStackView + attribute:NSLayoutAttributeTop + multiplier:1 + constant:0]; _topSafeAreaConstraint.active = self.inferTopSafeAreaInsetFromViewController; [NSLayoutConstraint constraintWithItem:self.headerStackView @@ -209,7 +204,8 @@ - (void)viewDidLoad { toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1 - constant:0].active = YES; + constant:0] + .active = YES; } - (void)setInferTopSafeAreaInsetFromViewController:(BOOL)inferTopSafeAreaInsetFromViewController { diff --git a/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseSupplemental.m b/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseSupplemental.m index 5a24a64566b..4db4ec6e683 100644 --- a/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseSupplemental.m +++ b/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseSupplemental.m @@ -14,9 +14,9 @@ #import "BottomAppBarTypicalUseSupplemental.h" -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" static NSString *const kCellIdentifier = @"cell"; @@ -31,11 +31,11 @@ @implementation BottomAppBarTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom App Bar", @"Bottom App Bar" ], - @"description": @"A bottom app bar displays navigation and key actions at the " - @"bottom of the screen.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Bottom App Bar", @"Bottom App Bar" ], + @"description" : @"A bottom app bar displays navigation and key actions at the " + @"bottom of the screen.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -72,16 +72,14 @@ @implementation BottomAppBarExampleTableViewController - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { - NSArray *listItems = @[ @"Leading Floating Button", - @"Center Floating Button", - @"Trailing Floating Button", - @"Primary Elevation Floating Button", - @"Secondary Elevation Floating Button", - @"Visible FAB" ]; + NSArray *listItems = @[ + @"Leading Floating Button", @"Center Floating Button", @"Trailing Floating Button", + @"Primary Elevation Floating Button", @"Secondary Elevation Floating Button", @"Visible FAB" + ]; _listItems = listItems; - + self.title = @"Bottom App Bar"; - + _appBarViewController = [[MDCAppBarViewController alloc] init]; [self addChildViewController:_appBarViewController]; } @@ -91,14 +89,16 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibB - (void)viewDidLoad { [super viewDidLoad]; - [MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme toAppBarViewController:_appBarViewController]; - [MDCAppBarColorThemer applyColorScheme:self.colorScheme toAppBarViewController:self.appBarViewController]; - + [MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme + toAppBarViewController:_appBarViewController]; + [MDCAppBarColorThemer applyColorScheme:self.colorScheme + toAppBarViewController:self.appBarViewController]; + self.appBarViewController.headerView.trackingScrollView = self.tableView; - + [self.view addSubview:self.appBarViewController.view]; [self.appBarViewController didMoveToParentViewController:self]; - + self.fabVisibilitySwitch = [[UISwitch alloc] init]; self.fabVisibilitySwitch.on = !self.bottomBarView.floatingButtonHidden; [self.fabVisibilitySwitch addTarget:self @@ -199,7 +199,7 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { if (scrollView == self.appBarViewController.headerView.trackingScrollView) { [self.appBarViewController.headerView - trackingScrollViewDidEndDraggingWillDecelerate:decelerate]; + trackingScrollViewDidEndDraggingWillDecelerate:decelerate]; } } diff --git a/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseViewController.m b/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseViewController.m index 5ecec41eb51..033e4d221e9 100644 --- a/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseViewController.m +++ b/components/BottomAppBar/examples/supplemental/BottomAppBarTypicalUseViewController.m @@ -29,10 +29,8 @@ - (void)commonMDCBottomAppBarViewControllerSetup { - (void)layoutBottomAppBar { CGSize size = [_bottomBarView sizeThatFits:self.view.bounds.size]; - CGRect bottomBarViewFrame = CGRectMake(0, - CGRectGetHeight(self.view.bounds) - size.height, - size.width, - size.height); + CGRect bottomBarViewFrame = + CGRectMake(0, CGRectGetHeight(self.view.bounds) - size.height, size.width, size.height); _bottomBarView.frame = bottomBarViewFrame; } @@ -41,7 +39,6 @@ - (void)viewDidLoad { [self commonMDCBottomAppBarViewControllerSetup]; } - - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; [self layoutBottomAppBar]; diff --git a/components/BottomAppBar/src/MDCBottomAppBarView.m b/components/BottomAppBar/src/MDCBottomAppBarView.m index d976ea507a9..e6b49f8debe 100644 --- a/components/BottomAppBar/src/MDCBottomAppBarView.m +++ b/components/BottomAppBar/src/MDCBottomAppBarView.m @@ -78,8 +78,7 @@ - (void)commonMDCBottomAppBarViewInit { kMDCBottomAppBarViewFloatingButtonCenterToNavigationBarTopOffset; [self addSubview:self.cutView]; - self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleLeftMargin | + self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin); self.layoutDirection = self.mdf_effectiveUserInterfaceLayoutDirection; @@ -178,7 +177,7 @@ - (void)cutBottomAppBarViewAnimated:(BOOL)animated { } } -- (void)healBottomAppBarViewAnimated:(BOOL)animated { +- (void)healBottomAppBarViewAnimated:(BOOL)animated { CGPathRef pathWithoutCut = [self.bottomBarLayer pathFromRect:self.bounds floatingButton:self.floatingButton navigationBarFrame:self.navBar.frame @@ -219,7 +218,8 @@ - (void)moveFloatingButtonCenterAnimated:(BOOL)animated { self.floatingButton.center = endPoint; } -- (void)showBarButtonItemsWithFloatingButtonPosition:(MDCBottomAppBarFloatingButtonPosition)floatingButtonPosition { +- (void)showBarButtonItemsWithFloatingButtonPosition: + (MDCBottomAppBarFloatingButtonPosition)floatingButtonPosition { switch (floatingButtonPosition) { case MDCBottomAppBarFloatingButtonPositionCenter: [self.navBar setLeadingBarButtonItems:_leadingBarButtonItems]; @@ -256,7 +256,6 @@ - (void)layoutSubviews { - (UIEdgeInsets)mdc_safeAreaInsets { UIEdgeInsets insets = UIEdgeInsetsZero; if (@available(iOS 11.0, *)) { - // Accommodate insets for iPhone X. insets = self.safeAreaInsets; } @@ -271,7 +270,6 @@ - (CGSize)sizeThatFits:(CGSize)size { } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { - // Make sure the floating button can always be tapped. BOOL contains = CGRectContainsPoint(self.floatingButton.frame, point); if (contains) { @@ -364,9 +362,10 @@ - (void)setFloatingButtonHidden:(BOOL)floatingButtonHidden animated:(BOOL)animat _floatingButtonHidden = floatingButtonHidden; if (floatingButtonHidden) { [self healBottomAppBarViewAnimated:animated]; - [_floatingButton collapse:animated completion:^{ - self.floatingButton.hidden = YES; - }]; + [_floatingButton collapse:animated + completion:^{ + self.floatingButton.hidden = YES; + }]; } else { _floatingButton.hidden = NO; [self cutBottomAppBarViewAnimated:animated]; diff --git a/components/BottomAppBar/src/private/MDCBottomAppBarLayer.m b/components/BottomAppBar/src/private/MDCBottomAppBarLayer.m index 2b4ef65728c..e58a7f0d1b0 100644 --- a/components/BottomAppBar/src/private/MDCBottomAppBarLayer.m +++ b/components/BottomAppBar/src/private/MDCBottomAppBarLayer.m @@ -14,8 +14,8 @@ #import "MDCBottomAppBarLayer.h" -#import "MaterialMath.h" #import "MDCBottomAppBarAttributes.h" +#import "MaterialMath.h" @interface MDCBottomAppBarLayer (PathGenerators) - (UIBezierPath *)drawWithPathToCut:(UIBezierPath *)bottomBarPath diff --git a/components/BottomNavigation/examples/BottomNavigationTypicalUseExample.m b/components/BottomNavigation/examples/BottomNavigationTypicalUseExample.m index 85c21385dfa..efc23473e0a 100644 --- a/components/BottomNavigation/examples/BottomNavigationTypicalUseExample.m +++ b/components/BottomNavigation/examples/BottomNavigationTypicalUseExample.m @@ -16,10 +16,10 @@ #import "BottomNavigationTypicalUseSupplemental.h" -#import "MaterialBottomNavigation.h" -#import "MaterialPalettes.h" #import "MaterialBottomNavigation+ColorThemer.h" #import "MaterialBottomNavigation+TypographyThemer.h" +#import "MaterialBottomNavigation.h" +#import "MaterialPalettes.h" @interface BottomNavigationTypicalUseExample () @@ -41,34 +41,28 @@ - (id)init { } - (void)commonBottomNavigationTypicalUseExampleViewDidLoad { - _bottomNavBar = [[MDCBottomNavigationBar alloc] initWithFrame:CGRectZero]; _bottomNavBar.titleVisibility = MDCBottomNavigationBarTitleVisibilitySelected; _bottomNavBar.alignment = MDCBottomNavigationBarAlignmentJustifiedAdjacentTitles; _bottomNavBar.delegate = self; [self.view addSubview:_bottomNavBar]; - UITabBarItem *tabBarItem1 = - [[UITabBarItem alloc] initWithTitle:@"Home" - image:[UIImage imageNamed:@"Home"] - tag:0]; - UITabBarItem *tabBarItem2 = - [[UITabBarItem alloc] initWithTitle:@"Messages" - image:[UIImage imageNamed:@"Email"] - tag:0]; - UITabBarItem *tabBarItem3 = - [[UITabBarItem alloc] initWithTitle:@"Favorites" - image:[UIImage imageNamed:@"Favorite"] - tag:0]; - UITabBarItem *tabBarItem4 = - [[UITabBarItem alloc] initWithTitle:@"Search" - image:[UIImage imageNamed:@"Search"] - tag:0]; + UITabBarItem *tabBarItem1 = [[UITabBarItem alloc] initWithTitle:@"Home" + image:[UIImage imageNamed:@"Home"] + tag:0]; + UITabBarItem *tabBarItem2 = [[UITabBarItem alloc] initWithTitle:@"Messages" + image:[UIImage imageNamed:@"Email"] + tag:0]; + UITabBarItem *tabBarItem3 = [[UITabBarItem alloc] initWithTitle:@"Favorites" + image:[UIImage imageNamed:@"Favorite"] + tag:0]; + UITabBarItem *tabBarItem4 = [[UITabBarItem alloc] initWithTitle:@"Search" + image:[UIImage imageNamed:@"Search"] + tag:0]; tabBarItem4.badgeValue = @"88"; - UITabBarItem *tabBarItem5 = - [[UITabBarItem alloc] initWithTitle:@"Birthday" - image:[UIImage imageNamed:@"Cake"] - tag:0]; + UITabBarItem *tabBarItem5 = [[UITabBarItem alloc] initWithTitle:@"Birthday" + image:[UIImage imageNamed:@"Cake"] + tag:0]; tabBarItem5.badgeValue = @"999+"; #if defined(__IPHONE_10_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0) #pragma clang diagnostic push @@ -94,10 +88,8 @@ - (void)commonBottomNavigationTypicalUseExampleViewDidLoad { - (void)layoutBottomNavBar { CGSize size = [_bottomNavBar sizeThatFits:self.view.bounds.size]; - CGRect bottomNavBarFrame = CGRectMake(0, - CGRectGetHeight(self.view.bounds) - size.height, - size.width, - size.height); + CGRect bottomNavBarFrame = + CGRectMake(0, CGRectGetHeight(self.view.bounds) - size.height, size.width, size.height); _bottomNavBar.frame = bottomNavBarFrame; } @@ -130,7 +122,6 @@ - (void)viewWillAppear:(BOOL)animated { } - (void)updateBadgeItemCount { - // Example of badge with increasing count. if (!self.badgeCount) { self.badgeCount = 0; diff --git a/components/BottomNavigation/examples/supplemental/BottomNavigationTypicalUseSupplemental.m b/components/BottomNavigation/examples/supplemental/BottomNavigationTypicalUseSupplemental.m index f01f234ed8e..7ce03f674b3 100644 --- a/components/BottomNavigation/examples/supplemental/BottomNavigationTypicalUseSupplemental.m +++ b/components/BottomNavigation/examples/supplemental/BottomNavigationTypicalUseSupplemental.m @@ -20,11 +20,11 @@ @implementation BottomNavigationTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Navigation", @"Bottom Navigation" ], - @"description": @"Bottom navigation bars allow movement between primary destinations in " - @"an app.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Bottom Navigation", @"Bottom Navigation" ], + @"description" : @"Bottom navigation bars allow movement between primary destinations in " + @"an app.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/BottomNavigation/src/MDCBottomNavigationBar.m b/components/BottomNavigation/src/MDCBottomNavigationBar.m index d349efd4df9..eef160f5f01 100644 --- a/components/BottomNavigation/src/MDCBottomNavigationBar.m +++ b/components/BottomNavigation/src/MDCBottomNavigationBar.m @@ -11,8 +11,8 @@ // 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. -#import #import +#import #import "MDCBottomNavigationBar.h" @@ -22,9 +22,9 @@ #import "MaterialShadowElevations.h" #import "MaterialShadowLayer.h" #import "MaterialTypography.h" +#import "private/MDCBottomNavigationItemView.h" #import "private/MaterialBottomNavigationStrings.h" #import "private/MaterialBottomNavigationStrings_table.h" -#import "private/MDCBottomNavigationItemView.h" // The Bundle for string resources. static NSString *const kMaterialBottomNavigationBundle = @"MaterialBottomNavigation.bundle"; @@ -35,8 +35,7 @@ static const CGFloat kMDCBottomNavigationBarItemsHorizontalMargin = 12; static NSString *const kMDCBottomNavigationBarBadgeColorString = @"badgeColor"; static NSString *const kMDCBottomNavigationBarBadgeValueString = @"badgeValue"; -static NSString *const kMDCBottomNavigationBarAccessibilityValueString = - @"accessibilityValue"; +static NSString *const kMDCBottomNavigationBarAccessibilityValueString = @"accessibilityValue"; static NSString *const kMDCBottomNavigationBarImageString = @"image"; static NSString *const kMDCBottomNavigationBarSelectedImageString = @"selectedImage"; // TODO: - Change to NSKeyValueChangeNewKey @@ -49,7 +48,6 @@ static NSString *const kMDCBottomNavigationBarOfAnnouncement = @"of"; - @interface MDCBottomNavigationBar () @property(nonatomic, assign) BOOL itemsDistributed; @@ -104,8 +102,8 @@ - (void)commonMDCBottomNavigationBarInit { } _maxLandscapeClusterContainerWidth = kMDCBottomNavigationBarLandscapeContainerWidth; _containerView = [[UIView alloc] initWithFrame:CGRectZero]; - _containerView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin); + _containerView.autoresizingMask = + (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin); _containerView.clipsToBounds = YES; [self addSubview:_containerView]; #if defined(__IPHONE_10_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0) @@ -218,8 +216,7 @@ - (void)layoutItemViews { if (layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight) { itemView.frame = CGRectMake(i * itemWidth, 0, itemWidth, navBarHeight); } else { - itemView.frame = - CGRectMake(navBarWidth - (i + 1) * itemWidth, 0, itemWidth, navBarHeight); + itemView.frame = CGRectMake(navBarWidth - (i + 1) * itemWidth, 0, itemWidth, navBarHeight); } } } @@ -278,18 +275,15 @@ - (void)removeObserversFromTabBarItems { @try { [item removeObserver:self forKeyPath:kMDCBottomNavigationBarBadgeColorString]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarBadgeValueString]; - [item removeObserver:self - forKeyPath:kMDCBottomNavigationBarAccessibilityValueString]; + [item removeObserver:self forKeyPath:kMDCBottomNavigationBarAccessibilityValueString]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarImageString]; - [item removeObserver:self - forKeyPath:kMDCBottomNavigationBarSelectedImageString]; + [item removeObserver:self forKeyPath:kMDCBottomNavigationBarSelectedImageString]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarTitleString]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarAccessibilityIdentifier]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarAccessibilityLabel]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarAccessibilityHint]; [item removeObserver:self forKeyPath:kMDCBottomNavigationBarIsAccessibilityElement]; - } - @catch (NSException *exception) { + } @catch (NSException *exception) { if (exception) { // No need to do anything if there are no observers. } @@ -299,7 +293,7 @@ - (void)removeObserversFromTabBarItems { - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object - change:(NSDictionary *)change + change:(NSDictionary *)change context:(void *)context { if (!context) { NSInteger selectedItemNum = 0; @@ -313,8 +307,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath MDCBottomNavigationItemView *itemView = _itemViews[selectedItemNum]; if ([keyPath isEqualToString:kMDCBottomNavigationBarBadgeColorString]) { itemView.badgeColor = change[kMDCBottomNavigationBarNewString]; - } else if ([keyPath - isEqualToString:kMDCBottomNavigationBarAccessibilityValueString]) { + } else if ([keyPath isEqualToString:kMDCBottomNavigationBarAccessibilityValueString]) { itemView.accessibilityValue = change[NSKeyValueChangeNewKey]; } else if ([keyPath isEqualToString:kMDCBottomNavigationBarBadgeValueString]) { itemView.badgeValue = change[kMDCBottomNavigationBarNewString]; @@ -361,8 +354,8 @@ - (UIView *)viewForItem:(UITabBarItem *)item { - (void)didTouchDownButton:(UIButton *)button { MDCBottomNavigationItemView *itemView = (MDCBottomNavigationItemView *)button.superview; - CGPoint centerPoint = CGPointMake(CGRectGetMidX(itemView.inkView.bounds), - CGRectGetMidY(itemView.inkView.bounds)); + CGPoint centerPoint = + CGPointMake(CGRectGetMidX(itemView.inkView.bounds), CGRectGetMidY(itemView.inkView.bounds)); [itemView.inkView startTouchBeganAnimationAtPoint:centerPoint completion:nil]; } @@ -439,14 +432,11 @@ - (void)setItems:(NSArray *)items { [self.inkControllers addObject:controller]; if (self.shouldPretendToBeATabBar) { - NSString *key = kMaterialBottomNavigationStringTable[ - kStr_MaterialBottomNavigationItemCountAccessibilityHint - ]; - NSString *itemOfTotalString = - NSLocalizedStringFromTableInBundle(key, - kMaterialBottomNavigationStringsTableName, - [[self class] bundle], - kMDCBottomNavigationBarOfString); + NSString *key = kMaterialBottomNavigationStringTable + [kStr_MaterialBottomNavigationItemCountAccessibilityHint]; + NSString *itemOfTotalString = NSLocalizedStringFromTableInBundle( + key, kMaterialBottomNavigationStringsTableName, [[self class] bundle], + kMDCBottomNavigationBarOfString); NSString *localizedPosition = [NSString localizedStringWithFormat:itemOfTotalString, (i + 1), (int)items.count]; itemView.button.accessibilityHint = localizedPosition; diff --git a/components/BottomNavigation/src/private/MDCBottomNavigationItemBadge.m b/components/BottomNavigation/src/private/MDCBottomNavigationItemBadge.m index 5ef507fa34a..a0b9cdadbac 100644 --- a/components/BottomNavigation/src/private/MDCBottomNavigationItemBadge.m +++ b/components/BottomNavigation/src/private/MDCBottomNavigationItemBadge.m @@ -72,9 +72,7 @@ - (void)sizeBadge { if (_badgeCircleWidth < _badgeCircleHeight) { _badgeCircleWidth = _badgeCircleHeight; } - self.frame = CGRectMake(CGRectGetMinX(self.frame), - CGRectGetMinY(self.frame), - _badgeCircleWidth, + self.frame = CGRectMake(CGRectGetMinX(self.frame), CGRectGetMinY(self.frame), _badgeCircleWidth, _badgeCircleHeight); self.badgeValueLabel.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); diff --git a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m index 2537e7c3b9f..351d0611c2b 100644 --- a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m +++ b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m @@ -17,10 +17,10 @@ #import +#import "MDCBottomNavigationItemBadge.h" #import "MaterialBottomNavigationStrings.h" #import "MaterialBottomNavigationStrings_table.h" #import "MaterialMath.h" -#import "MDCBottomNavigationItemBadge.h" static const CGFloat MDCBottomNavigationItemViewInkOpacity = (CGFloat)0.150; static const CGFloat MDCBottomNavigationItemViewTitleFontSize = 12; @@ -100,7 +100,6 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { } - (void)commonMDCBottomNavigationItemViewInit { - if (!_selectedItemTintColor) { _selectedItemTintColor = [UIColor blackColor]; } @@ -123,7 +122,6 @@ - (void)commonMDCBottomNavigationItemViewInit { _label.textColor = _selectedItemTitleColor; _label.isAccessibilityElement = NO; [self addSubview:_label]; - } if (!_badge) { @@ -138,7 +136,8 @@ - (void)commonMDCBottomNavigationItemViewInit { if (!_inkView) { _inkView = [[MDCInkView alloc] initWithFrame:self.bounds]; - _inkView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + _inkView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _inkView.usesLegacyInkRipple = NO; _inkView.clipsToBounds = NO; [self addSubview:_inkView]; @@ -158,8 +157,8 @@ - (void)layoutSubviews { [super layoutSubviews]; [self.label sizeToFit]; - CGSize labelSize = CGSizeMake(CGRectGetWidth(self.label.bounds), - CGRectGetHeight(self.label.bounds)); + CGSize labelSize = + CGSizeMake(CGRectGetWidth(self.label.bounds), CGRectGetHeight(self.label.bounds)); CGFloat maxWidth = CGRectGetWidth(self.bounds); self.label.frame = CGRectMake(0, 0, MIN(maxWidth, labelSize.width), labelSize.height); self.inkView.maxRippleRadius = @@ -191,11 +190,13 @@ - (void)centerLayoutAnimated:(BOOL)animated { CGPointMake(centerX, centerY - totalContentHeight / 2 + iconHeight / 2); self.label.center = CGPointMake(centerX, centerY + totalContentHeight / 2 - labelHeight / 2); if (animated) { - [UIView animateWithDuration:kMDCBottomNavigationItemViewTransitionDuration animations:^(void) { - self.iconImageView.center = iconImageViewCenter; - self.badge.center = - [self badgeCenterFromIconFrame:CGRectStandardize(self.iconImageView.frame) isRTL:isRTL]; - }]; + [UIView animateWithDuration:kMDCBottomNavigationItemViewTransitionDuration + animations:^(void) { + self.iconImageView.center = iconImageViewCenter; + self.badge.center = [self + badgeCenterFromIconFrame:CGRectStandardize(self.iconImageView.frame) + isRTL:isRTL]; + }]; } else { self.iconImageView.center = iconImageViewCenter; self.badge.center = [self badgeCenterFromIconFrame:CGRectStandardize(self.iconImageView.frame) @@ -260,13 +261,11 @@ - (NSString *)accessibilityLabelWithTitle:(NSString *)title { } if (self.shouldPretendToBeATab) { - NSString *key = - kMaterialBottomNavigationStringTable[kStr_MaterialBottomNavigationTabElementAccessibilityLabel]; - NSString *tabString = - NSLocalizedStringFromTableInBundle(key, - kMaterialBottomNavigationStringsTableName, - [[self class] bundle], - kMDCBottomNavigationItemViewTabString); + NSString *key = kMaterialBottomNavigationStringTable + [kStr_MaterialBottomNavigationTabElementAccessibilityLabel]; + NSString *tabString = NSLocalizedStringFromTableInBundle( + key, kMaterialBottomNavigationStringsTableName, [[self class] bundle], + kMDCBottomNavigationItemViewTabString); [labelComponents addObject:tabString]; } @@ -320,7 +319,6 @@ - (void)setSelectedItemTintColor:(UIColor *)selectedItemTintColor { } self.inkView.inkColor = [self.selectedItemTintColor colorWithAlphaComponent:MDCBottomNavigationItemViewInkOpacity]; - } - (void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor { @@ -362,13 +360,13 @@ - (void)setBadgeValue:(NSString *)badgeValue { - (void)setImage:(UIImage *)image { _image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; self.iconImageView.image = _image; - self.iconImageView.tintColor = (self.selected) ? self.selectedItemTintColor - : self.unselectedItemTintColor; + self.iconImageView.tintColor = + (self.selected) ? self.selectedItemTintColor : self.unselectedItemTintColor; [self.iconImageView sizeToFit]; } --(void)setSelectedImage:(UIImage *)selectedImage { - _selectedImage = [selectedImage imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate]; +- (void)setSelectedImage:(UIImage *)selectedImage { + _selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; self.iconImageView.image = _selectedImage; self.iconImageView.tintColor = self.selectedItemTintColor; [self.iconImageView sizeToFit]; @@ -380,7 +378,7 @@ - (void)setTitle:(NSString *)title { self.button.accessibilityLabel = [self accessibilityLabelWithTitle:_title]; } --(void)setTitleVisibility:(MDCBottomNavigationBarTitleVisibility)titleVisibility { +- (void)setTitleVisibility:(MDCBottomNavigationBarTitleVisibility)titleVisibility { _titleVisibility = titleVisibility; [self updateLabelVisibility]; } @@ -391,7 +389,7 @@ - (void)setItemTitleFont:(UIFont *)itemTitleFont { [self setNeedsLayout]; } --(void)setAccessibilityValue:(NSString *)accessibilityValue { +- (void)setAccessibilityValue:(NSString *)accessibilityValue { [super setAccessibilityValue:accessibilityValue]; self.button.accessibilityValue = accessibilityValue; } @@ -400,11 +398,11 @@ - (NSString *)accessibilityValue { return self.button.accessibilityValue; } --(void)setAccessibilityIdentifier:(NSString *)accessibilityIdentifier { +- (void)setAccessibilityIdentifier:(NSString *)accessibilityIdentifier { self.button.accessibilityIdentifier = accessibilityIdentifier; } --(NSString *)accessibilityIdentifier { +- (NSString *)accessibilityIdentifier { return self.button.accessibilityIdentifier; } diff --git a/components/BottomNavigation/tests/unit/BottomNavigationBarColorThemerTests.m b/components/BottomNavigation/tests/unit/BottomNavigationBarColorThemerTests.m index 61599c02710..cc109e431a5 100644 --- a/components/BottomNavigation/tests/unit/BottomNavigationBarColorThemerTests.m +++ b/components/BottomNavigation/tests/unit/BottomNavigationBarColorThemerTests.m @@ -13,12 +13,12 @@ // limitations under the License. #import +#import "../../src/private/MDCBottomNavigationItemView.h" #import "MaterialBottomNavigation+ColorThemer.h" -#import "MaterialColorScheme.h" #import "MaterialBottomNavigation.h" -#import "../../src/private/MDCBottomNavigationItemView.h" +#import "MaterialColorScheme.h" -@interface FakeColorScheme : NSObject +@interface FakeColorScheme : NSObject @property(nonatomic, strong) UIColor *primaryColor; @end @implementation FakeColorScheme @@ -42,10 +42,10 @@ - (void)testColorScheming { colorScheme.onPrimaryColor = [UIColor blueColor]; UITabBarItem *item = [[UITabBarItem alloc] init]; MDCBottomNavigationBar *bottomNavigationBar = [[MDCBottomNavigationBar alloc] init]; - [bottomNavigationBar setItems:@[item]]; + [bottomNavigationBar setItems:@[ item ]]; bottomNavigationBar.barTintColor = [UIColor greenColor]; bottomNavigationBar.selectedItemTintColor = [UIColor yellowColor]; - + // When [MDCBottomNavigationBarColorThemer applySemanticColorScheme:colorScheme toBottomNavigation:bottomNavigationBar]; diff --git a/components/BottomNavigation/tests/unit/BottomNavigationTests.m b/components/BottomNavigation/tests/unit/BottomNavigationTests.m index edb392dca6e..6b6e8202940 100644 --- a/components/BottomNavigation/tests/unit/BottomNavigationTests.m +++ b/components/BottomNavigation/tests/unit/BottomNavigationTests.m @@ -62,7 +62,7 @@ - (void)testItemTitleFontAppliesToNewItems { // When self.bottomNavBar.itemTitleFont = [UIFont systemFontOfSize:31]; - self.bottomNavBar.items = @[item1, item2]; + self.bottomNavBar.items = @[ item1, item2 ]; // Then for (MDCBottomNavigationItemView *item in self.bottomNavBar.itemViews) { @@ -76,7 +76,7 @@ - (void)testItemTitleFontAppliesToExistingItems { UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; // When - self.bottomNavBar.items = @[item1, item2]; + self.bottomNavBar.items = @[ item1, item2 ]; self.bottomNavBar.itemTitleFont = [UIFont systemFontOfSize:31]; // Then @@ -85,22 +85,22 @@ - (void)testItemTitleFontAppliesToExistingItems { } } --(void)testItemReset { +- (void)testItemReset { // Given UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"1" image:nil tag:0]; UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; UITabBarItem *item3 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; // When - self.bottomNavBar.items = @[item1, item2]; - self.bottomNavBar.items = @[item1, item2, item3]; + self.bottomNavBar.items = @[ item1, item2 ]; + self.bottomNavBar.items = @[ item1, item2, item3 ]; // Then NSUInteger tabsCount = 3; XCTAssertEqual(self.bottomNavBar.itemViews.count, tabsCount); } --(void)testFramesAfterReset { +- (void)testFramesAfterReset { // Given UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"1" image:nil tag:0]; UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:1]; @@ -109,23 +109,23 @@ -(void)testFramesAfterReset { self.bottomNavBar.frame = CGRectMake(0, 0, 320, 56); // When - self.bottomNavBar.items = @[item1, item2]; - self.bottomNavBar.items = @[item1, item2, item3]; + self.bottomNavBar.items = @[ item1, item2 ]; + self.bottomNavBar.items = @[ item1, item2, item3 ]; [self.bottomNavBar layoutIfNeeded]; // Then XCTAssertFalse(CGRectEqualToRect(self.bottomNavBar.itemViews[0].frame, CGRectZero)); } --(void)testSelectedItemAfterReset { +- (void)testSelectedItemAfterReset { // Given UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"1" image:nil tag:0]; UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; UITabBarItem *item3 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; // When - self.bottomNavBar.items = @[item1, item2]; - self.bottomNavBar.items = @[item1, item2, item3]; + self.bottomNavBar.items = @[ item1, item2 ]; + self.bottomNavBar.items = @[ item1, item2, item3 ]; // Then XCTAssertNil(self.bottomNavBar.selectedItem); @@ -134,9 +134,7 @@ -(void)testSelectedItemAfterReset { - (void)testAccessibilityIdentifier { NSString *oldIdentifier = @"oldIdentifier"; NSString *newIdentifier = @"newIdentifier"; - UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Home" - image:nil - tag:0]; + UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:nil tag:0]; tabBarItem.accessibilityIdentifier = oldIdentifier; MDCBottomNavigationBar *bar = [[MDCBottomNavigationBar alloc] init]; bar.items = @[ tabBarItem ]; @@ -229,10 +227,10 @@ - (void)testIsAccessibilityElementValueChanged { XCTAssert(bar.itemViews.firstObject.isAccessibilityElement); } --(void)testTitleVisibility { +- (void)testTitleVisibility { UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"1" image:nil tag:0]; UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; - self.bottomNavBar.items = @[item1, item2]; + self.bottomNavBar.items = @[ item1, item2 ]; self.bottomNavBar.titleVisibility = MDCBottomNavigationBarTitleVisibilityNever; for (MDCBottomNavigationItemView *itemView in self.bottomNavBar.itemViews) { XCTAssert(itemView.label.isHidden); diff --git a/components/BottomNavigation/tests/unit/BottomNavigationTypographyThemerTests.m b/components/BottomNavigation/tests/unit/BottomNavigationTypographyThemerTests.m index 6cd6fd1579c..0b65a87f845 100644 --- a/components/BottomNavigation/tests/unit/BottomNavigationTypographyThemerTests.m +++ b/components/BottomNavigation/tests/unit/BottomNavigationTypographyThemerTests.m @@ -28,7 +28,7 @@ - (void)testTypogrpahyThemer { UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"1" image:nil tag:0]; UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"2" image:nil tag:0]; bottomBar.itemTitleFont = [UIFont systemFontOfSize:31]; - bottomBar.items = @[item1, item2]; + bottomBar.items = @[ item1, item2 ]; [MDCBottomNavigationBarTypographyThemer applyTypographyScheme:typographyScheme toBottomNavigationBar:bottomBar]; diff --git a/components/BottomSheet/examples/BottomSheetAutolayoutSafeAreaExample.m b/components/BottomSheet/examples/BottomSheetAutolayoutSafeAreaExample.m index 416f6b39dab..2822cb3f0bb 100644 --- a/components/BottomSheet/examples/BottomSheetAutolayoutSafeAreaExample.m +++ b/components/BottomSheet/examples/BottomSheetAutolayoutSafeAreaExample.m @@ -14,9 +14,9 @@ #import +#import "MaterialApplication.h" #import "MaterialBottomSheet.h" #import "supplemental/BottomSheetSupplemental.h" -#import "MaterialApplication.h" static const CGFloat kSafeContentHeight = 150; static const CGFloat kSafeContentWidth = 300; @@ -122,8 +122,7 @@ - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; CGPoint origin = CGRectStandardize(self.withinSafeAreaView.frame).origin; UIWindow *keyWindow = [UIApplication mdc_safeSharedApplication].keyWindow; - CGPoint safeAreaViewAbsoluteOrigin = [keyWindow convertPoint:origin - fromView:self.view]; + CGPoint safeAreaViewAbsoluteOrigin = [keyWindow convertPoint:origin fromView:self.view]; CGFloat safeAreaBottomAbsoluteY = safeAreaViewAbsoluteOrigin.y + CGRectStandardize(self.withinSafeAreaView.bounds).size.height; CGFloat safeAreaBottomInset = diff --git a/components/BottomSheet/examples/BottomSheetShapedExample.m b/components/BottomSheet/examples/BottomSheetShapedExample.m index 60609589f99..92fd184f97f 100644 --- a/components/BottomSheet/examples/BottomSheetShapedExample.m +++ b/components/BottomSheet/examples/BottomSheetShapedExample.m @@ -14,14 +14,14 @@ #import -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" #import "MaterialBottomSheet.h" -#import "MaterialShapes.h" #import "MaterialShapeLibrary.h" -#import "supplemental/BottomSheetDummyStaticViewController.h" +#import "MaterialShapes.h" #import "supplemental/BottomSheetDummyCollectionViewController.h" +#import "supplemental/BottomSheetDummyStaticViewController.h" #import "supplemental/BottomSheetSupplemental.h" @implementation BottomSheetShapedExample @@ -34,8 +34,7 @@ - (void)presentBottomSheet { MDCAppBarContainerViewController *container = [[MDCAppBarContainerViewController alloc] initWithContentViewController:viewController]; container.preferredContentSize = CGSizeMake(500, 200); - container.appBarViewController.headerView.trackingScrollView = - viewController.collectionView; + container.appBarViewController.headerView.trackingScrollView = viewController.collectionView; container.topLayoutGuideAdjustmentEnabled = YES; [MDCAppBarColorThemer applyColorScheme:self.colorScheme diff --git a/components/BottomSheet/examples/BottomSheetTypicalUseExample.m b/components/BottomSheet/examples/BottomSheetTypicalUseExample.m index 22115a301b9..4fc1c34b8d1 100644 --- a/components/BottomSheet/examples/BottomSheetTypicalUseExample.m +++ b/components/BottomSheet/examples/BottomSheetTypicalUseExample.m @@ -44,8 +44,7 @@ - (void)presentBottomSheet { MDCAppBarContainerViewController *container = [[MDCAppBarContainerViewController alloc] initWithContentViewController:viewController]; container.preferredContentSize = CGSizeMake(500, 200); - container.appBarViewController.headerView.trackingScrollView = - viewController.collectionView; + container.appBarViewController.headerView.trackingScrollView = viewController.collectionView; container.topLayoutGuideAdjustmentEnabled = YES; [MDCAppBarColorThemer applyColorScheme:self.colorScheme diff --git a/components/BottomSheet/examples/supplemental/BottomSheetDummyCollectionViewController.m b/components/BottomSheet/examples/supplemental/BottomSheetDummyCollectionViewController.m index 938e016741d..d6605a401d9 100644 --- a/components/BottomSheet/examples/supplemental/BottomSheetDummyCollectionViewController.m +++ b/components/BottomSheet/examples/supplemental/BottomSheetDummyCollectionViewController.m @@ -61,8 +61,8 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSString *reuseIdent = NSStringFromClass([DummyCollectionViewCell class]); - DummyCollectionViewCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdent forIndexPath:indexPath]; + DummyCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdent + forIndexPath:indexPath]; cell.backgroundColor = [UIColor colorWithWhite:(indexPath.row % 2) * (CGFloat)0.2 + (CGFloat)0.8 alpha:1]; return cell; diff --git a/components/BottomSheet/examples/supplemental/BottomSheetPresenterViewController.m b/components/BottomSheet/examples/supplemental/BottomSheetPresenterViewController.m index abe1e699c21..f35ec791e51 100644 --- a/components/BottomSheet/examples/supplemental/BottomSheetPresenterViewController.m +++ b/components/BottomSheet/examples/supplemental/BottomSheetPresenterViewController.m @@ -34,11 +34,11 @@ - (void)viewDidLoad { _button = [[MDCButton alloc] initWithFrame:CGRectZero]; [_button setTitle:@"Show Bottom Sheet" forState:UIControlStateNormal]; _button.autoresizingMask = - UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; [_button addTarget:self - action:@selector(presentBottomSheet) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(presentBottomSheet) + forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:_button]; } diff --git a/components/BottomSheet/examples/supplemental/BottomSheetSupplemental.m b/components/BottomSheet/examples/supplemental/BottomSheetSupplemental.m index ff505f5a6ae..b4a01a9bcbf 100644 --- a/components/BottomSheet/examples/supplemental/BottomSheetSupplemental.m +++ b/components/BottomSheet/examples/supplemental/BottomSheetSupplemental.m @@ -18,9 +18,9 @@ @implementation BottomSheetAutolayoutExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Autolayout Content" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Autolayout Content" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -30,9 +30,9 @@ @implementation BottomSheetAutolayoutSafeAreaExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Autolayout Safe Area Content" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Autolayout Safe Area Content" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -58,9 +58,9 @@ @implementation BottomSheetShortCollectionExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Collection View (Short)" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Collection View (Short)" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -70,9 +70,9 @@ @implementation BottomSheetSimpleExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Static Content" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Static Content" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -82,9 +82,9 @@ @implementation BottomSheetTallExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Preferred Content Size" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Preferred Content Size" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -94,11 +94,11 @@ @implementation BottomSheetTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Bottom Sheet" ], - @"description": @"Bottom sheets are surfaces anchored to the bottom of the screen " - @"containing supplementary content, actions, or navigation.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Bottom Sheet" ], + @"description" : @"Bottom sheets are surfaces anchored to the bottom of the screen " + @"containing supplementary content, actions, or navigation.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -108,9 +108,9 @@ @implementation BottomSheetShapedExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Bottom Sheet", @"Shaped Bottom Sheet" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Bottom Sheet", @"Shaped Bottom Sheet" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/BottomSheet/src/MDCBottomSheetController.m b/components/BottomSheet/src/MDCBottomSheetController.m index 9f07668fc28..a2142b6f209 100644 --- a/components/BottomSheet/src/MDCBottomSheetController.m +++ b/components/BottomSheet/src/MDCBottomSheetController.m @@ -82,9 +82,11 @@ - (BOOL)accessibilityPerformEscape { return NO; } __weak __typeof(self) weakSelf = self; - [self dismissViewControllerAnimated:YES completion:^{ - [weakSelf.delegate bottomSheetControllerDidDismissBottomSheet:weakSelf]; - }]; + [self + dismissViewControllerAnimated:YES + completion:^{ + [weakSelf.delegate bottomSheetControllerDidDismissBottomSheet:weakSelf]; + }]; return YES; } @@ -140,8 +142,7 @@ - (void)bottomSheetWillChangeState:(MDCBottomSheetPresentationController *)botto return nil; } -- (void)setShapeGenerator:(id)shapeGenerator - forState:(MDCSheetState)state { +- (void)setShapeGenerator:(id)shapeGenerator forState:(MDCSheetState)state { _shapeGenerators[@(state)] = shapeGenerator; [self updateShapeGenerator]; @@ -153,7 +154,7 @@ - (void)updateShapeGenerator { self.view.shapeGenerator = shapeGenerator; if (shapeGenerator != nil) { self.contentViewController.view.layer.mask = - ((MDCShapedShadowLayer *)self.view.layer).shapeLayer; + ((MDCShapedShadowLayer *)self.view.layer).shapeLayer; } else { self.contentViewController.view.layer.mask = nil; } diff --git a/components/BottomSheet/src/MDCBottomSheetPresentationController.m b/components/BottomSheet/src/MDCBottomSheetPresentationController.m index 92d73e4c50f..3a292553d73 100644 --- a/components/BottomSheet/src/MDCBottomSheetPresentationController.m +++ b/components/BottomSheet/src/MDCBottomSheetPresentationController.m @@ -118,22 +118,24 @@ - (void)presentationTransitionWillBegin { [self updatePreferredSheetHeight]; // Add tap handler to dismiss the sheet. - UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self - action: - @selector(dismissPresentedControllerIfNecessary:)]; + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] + initWithTarget:self + action:@selector(dismissPresentedControllerIfNecessary:)]; tapGesture.cancelsTouchesInView = NO; containerView.userInteractionEnabled = YES; [containerView addGestureRecognizer:tapGesture]; - id transitionCoordinator = + id transitionCoordinator = [[self presentingViewController] transitionCoordinator]; // Fade in the dimming view during the transition. _dimmingView.alpha = 0.0; - [transitionCoordinator animateAlongsideTransition: - ^(__unused id context) { + [transitionCoordinator + animateAlongsideTransition:^( + __unused id context) { self->_dimmingView.alpha = 1.0; - } completion:nil]; + } + completion:nil]; } - (void)presentationTransitionDidEnd:(BOOL)completed { @@ -143,13 +145,15 @@ - (void)presentationTransitionDidEnd:(BOOL)completed { } - (void)dismissalTransitionWillBegin { - id transitionCoordinator = - [[self presentingViewController] transitionCoordinator]; + id transitionCoordinator = + [[self presentingViewController] transitionCoordinator]; - [transitionCoordinator animateAlongsideTransition: - ^(__unused id context) { + [transitionCoordinator + animateAlongsideTransition:^( + __unused id context) { self->_dimmingView.alpha = 0.0; - } completion:nil]; + } + completion:nil]; } - (void)dismissalTransitionDidEnd:(BOOL)completed { @@ -166,7 +170,7 @@ - (void)preferredContentSizeDidChangeForChildContentContainer:(id)coordinator { + withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [coordinator @@ -212,8 +216,8 @@ - (void)dismissPresentedControllerIfNecessary:(UITapGestureRecognizer *)tapRecog [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; id strongDelegate = self.delegate; - if ([strongDelegate respondsToSelector: - @selector(bottomSheetPresentationControllerDidDismissBottomSheet:)]) { + if ([strongDelegate + respondsToSelector:@selector(bottomSheetPresentationControllerDidDismissBottomSheet:)]) { [strongDelegate bottomSheetPresentationControllerDidDismissBottomSheet:self]; } } @@ -276,8 +280,8 @@ - (void)sheetContainerViewDidHide:(nonnull __unused MDCSheetContainerView *)cont [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; id strongDelegate = self.delegate; - if ([strongDelegate respondsToSelector: - @selector(bottomSheetPresentationControllerDidDismissBottomSheet:)]) { + if ([strongDelegate + respondsToSelector:@selector(bottomSheetPresentationControllerDidDismissBottomSheet:)]) { [strongDelegate bottomSheetPresentationControllerDidDismissBottomSheet:self]; } } @@ -285,8 +289,7 @@ - (void)sheetContainerViewDidHide:(nonnull __unused MDCSheetContainerView *)cont - (void)sheetContainerViewWillChangeState:(nonnull MDCSheetContainerView *)containerView sheetState:(MDCSheetState)sheetState { id strongDelegate = self.delegate; - if ([strongDelegate respondsToSelector: - @selector(bottomSheetWillChangeState:sheetState:)]) { + if ([strongDelegate respondsToSelector:@selector(bottomSheetWillChangeState:sheetState:)]) { [strongDelegate bottomSheetWillChangeState:self sheetState:sheetState]; } } diff --git a/components/BottomSheet/src/MDCBottomSheetTransitionController.m b/components/BottomSheet/src/MDCBottomSheetTransitionController.m index e5a9aa56b29..593bc905e5a 100644 --- a/components/BottomSheet/src/MDCBottomSheetTransitionController.m +++ b/components/BottomSheet/src/MDCBottomSheetTransitionController.m @@ -59,26 +59,26 @@ - (instancetype)init { return presentationController; } -- (nullable id ) +- (nullable id) animationControllerForPresentedController:(__unused UIViewController *)presented presentingController:(__unused UIViewController *)presenting sourceController:(__unused UIViewController *)source { return self; } -- (id) - animationControllerForDismissedController:(__unused UIViewController *)dismissed { +- (id)animationControllerForDismissedController: + (__unused UIViewController *)dismissed { return self; } #pragma mark - UIViewControllerAnimatedTransitioning - (NSTimeInterval)transitionDuration: - (nullable __unused id )transitionContext { + (nullable __unused id)transitionContext { return MDCBottomSheetTransitionDuration; } -- (void)animateTransition:(id )transitionContext { +- (void)animateTransition:(id)transitionContext { // If a view in the transitionContext is nil, it likely hasn't been loaded by its ViewController // yet. Ask for it directly to initiate a loadView on the ViewController. UIViewController *fromViewController = @@ -89,8 +89,8 @@ - (void)animateTransition:(id )transitionC } UIViewController *toViewController = - [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; - UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; + [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; if (toView == nil) { toView = toViewController.view; } @@ -121,23 +121,23 @@ - (void)animateTransition:(id )transitionC UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState; [UIView animateWithDuration:transitionDuration - delay:0.0 - options:options - animations:^{ - animatingView.frame = finalFrame; - } - completion:^(__unused BOOL finished) { - // If we're dismissing, remove the presented view from the hierarchy - if (!presenting) { - [fromView removeFromSuperview]; - } - - // From ADC : UIViewControllerContextTransitioning - // When you do create transition animations, always call the - // completeTransition: from an appropriate completion block to let UIKit know - // when all of your animations have finished. - [transitionContext completeTransition:YES]; - }]; + delay:0.0 + options:options + animations:^{ + animatingView.frame = finalFrame; + } + completion:^(__unused BOOL finished) { + // If we're dismissing, remove the presented view from the hierarchy + if (!presenting) { + [fromView removeFromSuperview]; + } + + // From ADC : UIViewControllerContextTransitioning + // When you do create transition animations, always call the + // completeTransition: from an appropriate completion block to let UIKit know + // when all of your animations have finished. + [transitionContext completeTransition:YES]; + }]; } - (CGRect)frameOfPresentedViewController:(UIViewController *)presentedViewController diff --git a/components/BottomSheet/src/private/MDCDraggableView.m b/components/BottomSheet/src/private/MDCDraggableView.m index daa5409a656..e4664c85d4a 100644 --- a/components/BottomSheet/src/private/MDCDraggableView.m +++ b/components/BottomSheet/src/private/MDCDraggableView.m @@ -23,7 +23,7 @@ static void CancelGestureRecognizer(UIGestureRecognizer *gesture) { } } -@interface MDCDraggableView () +@interface MDCDraggableView () @property(nonatomic) UIPanGestureRecognizer *dragRecognizer; @property(nonatomic, strong) UIScrollView *scrollView; @end diff --git a/components/BottomSheet/src/private/MDCSheetBehavior.m b/components/BottomSheet/src/private/MDCSheetBehavior.m index 400fd300488..a1105c0a15d 100644 --- a/components/BottomSheet/src/private/MDCSheetBehavior.m +++ b/components/BottomSheet/src/private/MDCSheetBehavior.m @@ -17,12 +17,12 @@ @interface MDCSheetBehavior () @property(nonatomic) UIAttachmentBehavior *attachmentBehavior; @property(nonatomic) UIDynamicItemBehavior *itemBehavior; -@property(nonatomic) id item; +@property(nonatomic) id item; @end @implementation MDCSheetBehavior -- (instancetype)initWithItem:(id )item { +- (instancetype)initWithItem:(id)item { self = [super init]; if (self) { _item = item; @@ -33,7 +33,7 @@ - (instancetype)initWithItem:(id )item { _attachmentBehavior.length = 0; [self addChildBehavior:_attachmentBehavior]; - _itemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[self.item]]; + _itemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[ self.item ]]; _itemBehavior.density = 100; _itemBehavior.resistance = 10; [self addChildBehavior:_itemBehavior]; @@ -49,8 +49,8 @@ - (void)setTargetPoint:(CGPoint)targetPoint { - (void)setVelocity:(CGPoint)velocity { _velocity = velocity; CGPoint currentVelocity = [self.itemBehavior linearVelocityForItem:self.item]; - CGPoint velocityDelta = CGPointMake(velocity.x - currentVelocity.x, - velocity.y - currentVelocity.y); + CGPoint velocityDelta = + CGPointMake(velocity.x - currentVelocity.x, velocity.y - currentVelocity.y); [self.itemBehavior addLinearVelocity:velocityDelta forItem:self.item]; } diff --git a/components/BottomSheet/src/private/MDCSheetContainerView.m b/components/BottomSheet/src/private/MDCSheetContainerView.m index 8e9e54dfd69..f3f5ec15f2c 100644 --- a/components/BottomSheet/src/private/MDCSheetContainerView.m +++ b/components/BottomSheet/src/private/MDCSheetContainerView.m @@ -14,9 +14,9 @@ #import "MDCSheetContainerView.h" -#import "MaterialKeyboardWatcher.h" #import "MDCDraggableView.h" #import "MDCSheetBehavior.h" +#import "MaterialKeyboardWatcher.h" // KVO key for monitoring the content size for the content view if it is a scrollview. static NSString *kContentSizeKey = nil; @@ -94,10 +94,10 @@ - (instancetype)initWithFrame:(CGRect)frame for (NSString *name in notificationNames) { [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(keyboardStateChangedWithNotification:) - name:name - object:nil]; + addObserver:self + selector:@selector(keyboardStateChangedWithNotification:) + name:name + object:nil]; } // Since we handle the SafeAreaInsets ourselves through the contentInset property, we disable @@ -237,8 +237,8 @@ - (void)updateSheetFrame { - (void)updateSheetState { CGFloat currentSheetHeight = CGRectGetMaxY(self.bounds) - CGRectGetMinY(self.sheet.frame); - self.sheetState = (currentSheetHeight >= [self maximumSheetHeight] ? - MDCSheetStateExtended : MDCSheetStatePreferred); + self.sheetState = (currentSheetHeight >= [self maximumSheetHeight] ? MDCSheetStateExtended + : MDCSheetStatePreferred); } // Returns |preferredSheetHeight|, truncated as necessary, so that it never exceeds the height of @@ -259,7 +259,8 @@ - (CGFloat)maximumSheetHeight { boundsHeight -= self.safeAreaInsets.top; } CGFloat scrollViewContentHeight = self.sheet.scrollView.contentInset.top + - self.sheet.scrollView.contentSize.height + self.sheet.scrollView.contentInset.bottom; + self.sheet.scrollView.contentSize.height + + self.sheet.scrollView.contentInset.bottom; // If we have a scrollview, the sheet should never get taller than its content height. if (scrollViewContentHeight > 0) { @@ -289,7 +290,7 @@ - (CGPoint)targetPoint { CGFloat midX = CGRectGetMidX(bounds); CGFloat bottomY = CGRectGetMaxY(bounds) - keyboardOffset; - switch(self.sheetState) { + switch (self.sheetState) { case MDCSheetStatePreferred: return CGPointMake(midX, bottomY - [self truncatedPreferredSheetHeight]); case MDCSheetStateExtended: @@ -330,7 +331,7 @@ - (BOOL)draggableView:(__unused MDCDraggableView *)view shouldBeginDraggingWithVelocity:(CGPoint)velocity { [self updateSheetState]; - switch(self.sheetState) { + switch (self.sheetState) { case MDCSheetStatePreferred: return YES; case MDCSheetStateExtended: { @@ -343,7 +344,7 @@ - (BOOL)draggableView:(__unused MDCDraggableView *)view } else { // Allow dragging in any direction if the content is not scrollable. CGFloat contentHeight = scrollView.contentInset.top + scrollView.contentSize.height + - scrollView.contentInset.bottom; + scrollView.contentInset.bottom; return (CGRectGetHeight(scrollView.bounds) >= contentHeight); } } diff --git a/components/ButtonBar/examples/ButtonBarCustomizedFontExample.m b/components/ButtonBar/examples/ButtonBarCustomizedFontExample.m index 87e7b635493..711605db1cd 100644 --- a/components/ButtonBar/examples/ButtonBarCustomizedFontExample.m +++ b/components/ButtonBar/examples/ButtonBarCustomizedFontExample.m @@ -97,11 +97,10 @@ @implementation ButtonBarCustomizedFontExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Button Bar", @"Button Bar (Customized)" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Button Bar", @"Button Bar (Customized)" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @end - diff --git a/components/ButtonBar/examples/ButtonBarIconExample.m b/components/ButtonBar/examples/ButtonBarIconExample.m index 231f8833794..30a99c2f910 100644 --- a/components/ButtonBar/examples/ButtonBarIconExample.m +++ b/components/ButtonBar/examples/ButtonBarIconExample.m @@ -82,9 +82,9 @@ @implementation ButtonBarIconExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Button Bar", @"Button Bar (Icons)" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Button Bar", @"Button Bar (Icons)" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/ButtonBar/examples/ButtonBarTypicalUseExample.m b/components/ButtonBar/examples/ButtonBarTypicalUseExample.m index e73a70fee27..ce071fbd60e 100644 --- a/components/ButtonBar/examples/ButtonBarTypicalUseExample.m +++ b/components/ButtonBar/examples/ButtonBarTypicalUseExample.m @@ -93,11 +93,11 @@ @implementation ButtonBarTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Button Bar", @"Button Bar" ], - @"description": @"The Button Bar is a view that represents a list of UIBarButtonItems as " - @"horizontally-aligned buttons.", - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Button Bar", @"Button Bar" ], + @"description" : @"The Button Bar is a view that represents a list of UIBarButtonItems as " + @"horizontally-aligned buttons.", + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/ButtonBar/src/ColorThemer/MDCButtonBarColorThemer.m b/components/ButtonBar/src/ColorThemer/MDCButtonBarColorThemer.m index 8da32da3bb5..52d8cbe8a8c 100644 --- a/components/ButtonBar/src/ColorThemer/MDCButtonBarColorThemer.m +++ b/components/ButtonBar/src/ColorThemer/MDCButtonBarColorThemer.m @@ -22,8 +22,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme buttonBar.tintColor = colorScheme.onPrimaryColor; } -+ (void)applyColorScheme:(id)colorScheme - toButtonBar:(MDCButtonBar *)buttonBar { ++ (void)applyColorScheme:(id)colorScheme toButtonBar:(MDCButtonBar *)buttonBar { buttonBar.backgroundColor = colorScheme.primaryColor; } diff --git a/components/ButtonBar/src/MDCButtonBar.m b/components/ButtonBar/src/MDCButtonBar.m index ca86faea7a2..f975e4a78ac 100644 --- a/components/ButtonBar/src/MDCButtonBar.m +++ b/components/ButtonBar/src/MDCButtonBar.m @@ -216,31 +216,30 @@ - (void)updateButtonsWithInkColor:(UIColor *)inkColor { } NSMutableArray *views = [NSMutableArray array]; - [barButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem *item, - NSUInteger idx, - __unused BOOL *stop) { - MDCBarButtonItemLayoutHints hints = MDCBarButtonItemLayoutHintsNone; - if (idx == 0) { - hints |= MDCBarButtonItemLayoutHintsIsFirstButton; - } - if (idx == [barButtonItems count] - 1) { - hints |= MDCBarButtonItemLayoutHintsIsLastButton; - } - UIView *view = [self->_defaultBuilder buttonBar:self viewForItem:item layoutHints:hints]; - if (!view) { - return; - } + [barButtonItems + enumerateObjectsUsingBlock:^(UIBarButtonItem *item, NSUInteger idx, __unused BOOL *stop) { + MDCBarButtonItemLayoutHints hints = MDCBarButtonItemLayoutHintsNone; + if (idx == 0) { + hints |= MDCBarButtonItemLayoutHintsIsFirstButton; + } + if (idx == [barButtonItems count] - 1) { + hints |= MDCBarButtonItemLayoutHintsIsLastButton; + } + UIView *view = [self->_defaultBuilder buttonBar:self viewForItem:item layoutHints:hints]; + if (!view) { + return; + } - [view sizeToFit]; - if (item.width > 0) { - CGRect frame = view.frame; - frame.size.width = item.width; - view.frame = frame; - } + [view sizeToFit]; + if (item.width > 0) { + CGRect frame = view.frame; + frame.size.width = item.width; + view.frame = frame; + } - [self addSubview:view]; - [views addObject:view]; - }]; + [self addSubview:view]; + [views addObject:view]; + }]; return views; } @@ -272,8 +271,8 @@ - (void)observeValueForKeyPath:(NSString *)keyPath } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(accessibilityHint))]) { button.accessibilityHint = newValue; - } else if ([keyPath isEqualToString: - NSStringFromSelector(@selector(accessibilityIdentifier))]) { + } else if ([keyPath + isEqualToString:NSStringFromSelector(@selector(accessibilityIdentifier))]) { button.accessibilityIdentifier = newValue; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(accessibilityLabel))]) { @@ -398,12 +397,9 @@ - (void)setItems:(NSArray *)items { NSStringFromSelector(@selector(accessibilityHint)), NSStringFromSelector(@selector(accessibilityIdentifier)), NSStringFromSelector(@selector(accessibilityLabel)), - NSStringFromSelector(@selector(accessibilityValue)), - kEnabledSelector, - NSStringFromSelector(@selector(image)), - NSStringFromSelector(@selector(tag)), - NSStringFromSelector(@selector(tintColor)), - NSStringFromSelector(@selector(title)) + NSStringFromSelector(@selector(accessibilityValue)), kEnabledSelector, + NSStringFromSelector(@selector(image)), NSStringFromSelector(@selector(tag)), + NSStringFromSelector(@selector(tintColor)), NSStringFromSelector(@selector(title)) ]; // Remove old observers diff --git a/components/ButtonBar/src/TypographyThemer/MDCButtonBarTypographyThemer.m b/components/ButtonBar/src/TypographyThemer/MDCButtonBarTypographyThemer.m index 126c823e2fd..0c6b2978f7d 100644 --- a/components/ButtonBar/src/TypographyThemer/MDCButtonBarTypographyThemer.m +++ b/components/ButtonBar/src/TypographyThemer/MDCButtonBarTypographyThemer.m @@ -17,9 +17,9 @@ @implementation MDCButtonBarTypographyThemer + (void)applyTypographyScheme:(nonnull id)typographyScheme - toButtonBar:(nonnull MDCButtonBar *)buttonBar { + toButtonBar:(nonnull MDCButtonBar *)buttonBar { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [buttonBar setButtonsTitleFont:nil forState:state]; } diff --git a/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m b/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m index a9dc7f51761..0680fdbe30f 100644 --- a/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m +++ b/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m @@ -14,12 +14,12 @@ #import "MDCAppBarButtonBarBuilder.h" -#import #import +#import -#import "MaterialButtons.h" -#import "MDCButtonBarButton.h" #import "MDCButtonBar+Private.h" +#import "MDCButtonBarButton.h" +#import "MaterialButtons.h" // Additional insets for the left-most or right-most items. static const CGFloat kEdgeButtonAdditionalMarginPhone = 4; @@ -156,8 +156,8 @@ - (UIView *)buttonBar:(MDCButtonBar *)buttonBar layoutPosition:buttonBar.layoutPosition layoutHints:layoutHints layoutDirection:[buttonBar mdf_effectiveUserInterfaceLayoutDirection] - userInterfaceIdiom:[self usePadInsetsForButtonBar:buttonBar] ? - UIUserInterfaceIdiomPad : UIUserInterfaceIdiomPhone]; + userInterfaceIdiom:[self usePadInsetsForButtonBar:buttonBar] ? UIUserInterfaceIdiomPad + : UIUserInterfaceIdiomPhone]; button.contentEdgeInsets = contentInsets; button.enabled = buttonItem.enabled; @@ -192,9 +192,9 @@ + (UIEdgeInsets)contentInsetsForButton:(MDCButton *)button CGFloat additionalInset = (isPad ? kEdgeButtonAdditionalMarginPad : kEdgeButtonAdditionalMarginPhone); BOOL isFirstButton = (layoutHints & MDCBarButtonItemLayoutHintsIsFirstButton) == - MDCBarButtonItemLayoutHintsIsFirstButton; + MDCBarButtonItemLayoutHintsIsFirstButton; BOOL isLastButton = (layoutHints & MDCBarButtonItemLayoutHintsIsLastButton) == - MDCBarButtonItemLayoutHintsIsLastButton; + MDCBarButtonItemLayoutHintsIsLastButton; if (isFirstButton && layoutPosition == MDCButtonBarLayoutPositionLeading) { // Left-most button in LTR, and right-most button in RTL. if (layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight) { @@ -275,15 +275,15 @@ - (void)updateButton:(UIButton *)button // UIBarButtonItem's appearance proxy values don't appear to come "for free" like they do with // typical UIView instances, so we're attempting to recreate the behavior here. - NSArray *appearanceProxies = @[ [item.class appearance] ]; + NSArray *appearanceProxies = @ [[item.class appearance]]; for (UIBarButtonItem *appearance in appearanceProxies) { [attributes addEntriesFromDictionary:[appearance titleTextAttributesForState:state]]; } [attributes addEntriesFromDictionary:[item titleTextAttributesForState:state]]; if ([attributes count] > 0) { - [button - setAttributedTitle:[[NSAttributedString alloc] initWithString:title attributes:attributes] - forState:state]; + [button setAttributedTitle:[[NSAttributedString alloc] initWithString:title + attributes:attributes] + forState:state]; } } else { [button setTitle:title forState:state]; diff --git a/components/ButtonBar/src/private/MDCButtonBarButton.m b/components/ButtonBar/src/private/MDCButtonBarButton.m index 262049e008a..dd5bbd88375 100644 --- a/components/ButtonBar/src/private/MDCButtonBarButton.m +++ b/components/ButtonBar/src/private/MDCButtonBarButton.m @@ -47,4 +47,3 @@ - (void)setTitleFont:(nullable UIFont *)font forState:(UIControlState)state { } @end - diff --git a/components/ButtonBar/tests/unit/ButtonBarBuilderTests.m b/components/ButtonBar/tests/unit/ButtonBarBuilderTests.m index f29d9362bfd..d6f6b8e03d2 100644 --- a/components/ButtonBar/tests/unit/ButtonBarBuilderTests.m +++ b/components/ButtonBar/tests/unit/ButtonBarBuilderTests.m @@ -139,19 +139,19 @@ - (void)testContentInsetsMirroredForTrailing { layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight userInterfaceIdiom:UIUserInterfaceIdiomPhone]; - + UIEdgeInsets insetsLastLeading = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; UIEdgeInsets insetsLastTrailing = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionTrailing - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionTrailing + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; // Then XCTAssertEqual(insetsFirstLeading.left, insetsFirstTrailing.right); @@ -167,29 +167,29 @@ - (void)testContentInsetsEqualForTitleAndImageButtonIdiomPhone { // When UIEdgeInsets imageInsetsFirst = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; UIEdgeInsets titleInsetsFirst = - [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; UIEdgeInsets imageInsetsLast = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; UIEdgeInsets titleInsetsLast = - [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPhone]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPhone]; // Then XCTAssertEqual(imageInsetsFirst.left, titleInsetsFirst.left); @@ -207,29 +207,29 @@ - (void)testContentInsetsEqualForTitleAndImageButtonIdiomPad { // When UIEdgeInsets imageInsetsFirst = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPad]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPad]; UIEdgeInsets titleInsetsFirst = - [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPad]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsFirstButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPad]; UIEdgeInsets imageInsetsLast = - [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPad]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:imageButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPad]; UIEdgeInsets titleInsetsLast = - [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton - layoutPosition:MDCButtonBarLayoutPositionLeading - layoutHints:MDCBarButtonItemLayoutHintsIsLastButton - layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight - userInterfaceIdiom:UIUserInterfaceIdiomPad]; + [MDCAppBarButtonBarBuilder contentInsetsForButton:titleButton + layoutPosition:MDCButtonBarLayoutPositionLeading + layoutHints:MDCBarButtonItemLayoutHintsIsLastButton + layoutDirection:UIUserInterfaceLayoutDirectionLeftToRight + userInterfaceIdiom:UIUserInterfaceIdiomPad]; // Then XCTAssertEqual(imageInsetsFirst.left, titleInsetsFirst.left); diff --git a/components/Buttons/examples/ButtonsContentEdgeInsetsExample.m b/components/Buttons/examples/ButtonsContentEdgeInsetsExample.m index a2450a2f422..b9889526a2f 100644 --- a/components/Buttons/examples/ButtonsContentEdgeInsetsExample.m +++ b/components/Buttons/examples/ButtonsContentEdgeInsetsExample.m @@ -32,10 +32,10 @@ @implementation ButtonsContentEdgeInsetsExample + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Buttons", @"Buttons (Content Edge Insets)" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"ButtonsContentEdgeInsets", + @"breadcrumbs" : @[ @"Buttons", @"Buttons (Content Edge Insets)" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"ButtonsContentEdgeInsets", }; } diff --git a/components/Buttons/examples/ButtonsShapesExampleViewController.m b/components/Buttons/examples/ButtonsShapesExampleViewController.m index 626434ae45b..87c4fd955be 100644 --- a/components/Buttons/examples/ButtonsShapesExampleViewController.m +++ b/components/Buttons/examples/ButtonsShapesExampleViewController.m @@ -74,15 +74,14 @@ - (void)viewDidLoad { plusImage = [plusImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [containedButton setImage:plusImage forState:UIControlStateNormal]; - MDCRectangleShapeGenerator *raisedShapeGenerator = - [[MDCRectangleShapeGenerator alloc] init]; + MDCRectangleShapeGenerator *raisedShapeGenerator = [[MDCRectangleShapeGenerator alloc] init]; [raisedShapeGenerator setCorners:[[MDCCutCornerTreatment alloc] initWithCut:8]]; containedButton.shapeGenerator = raisedShapeGenerator; [containedButton sizeToFit]; [containedButton addTarget:self - action:@selector(didTap:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(didTap:) + forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:containedButton]; // Disabled raised button @@ -100,8 +99,8 @@ - (void)viewDidLoad { [disabledContainedButton sizeToFit]; [disabledContainedButton addTarget:self - action:@selector(didTap:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(didTap:) + forControlEvents:UIControlEventTouchUpInside]; [disabledContainedButton setEnabled:NO]; [self.view addSubview:disabledContainedButton]; @@ -127,8 +126,7 @@ - (void)viewDidLoad { [MDCButtonTypographyThemer applyTypographyScheme:self.typographyScheme toButton:strokedButton]; [MDCButtonColorThemer applySemanticColorScheme:self.colorScheme toButton:strokedButton]; - MDCSlantedRectShapeGenerator *strokedShapeGenerator = - [[MDCSlantedRectShapeGenerator alloc] init]; + MDCSlantedRectShapeGenerator *strokedShapeGenerator = [[MDCSlantedRectShapeGenerator alloc] init]; strokedShapeGenerator.slant = 10; strokedButton.shapeGenerator = strokedShapeGenerator; @@ -144,22 +142,22 @@ - (void)viewDidLoad { [disabledStrokedButton setTitle:@"Button" forState:UIControlStateNormal]; [MDCButtonTypographyThemer applyTypographyScheme:self.typographyScheme toButton:disabledStrokedButton]; - [MDCButtonColorThemer applySemanticColorScheme:self.colorScheme - toButton:disabledStrokedButton]; + [MDCButtonColorThemer applySemanticColorScheme:self.colorScheme toButton:disabledStrokedButton]; MDCRectangleShapeGenerator *disabledStrokedShapeGenerator = [[MDCRectangleShapeGenerator alloc] init]; - [disabledStrokedShapeGenerator setTopEdge: - [[MDCTriangleEdgeTreatment alloc] initWithSize:5 style:MDCTriangleEdgeStyleCut]]; + [disabledStrokedShapeGenerator + setTopEdge:[[MDCTriangleEdgeTreatment alloc] initWithSize:5 style:MDCTriangleEdgeStyleCut]]; [disabledStrokedShapeGenerator setTopLeftCorner:[[MDCCutCornerTreatment alloc] initWithCut:10]]; - [disabledStrokedShapeGenerator setTopRightCorner: - [[MDCCurvedCornerTreatment alloc] initWithSize:CGSizeMake(5, 20)]]; - [disabledStrokedShapeGenerator setBottomEdge: - [[MDCTriangleEdgeTreatment alloc] initWithSize:5 style:MDCTriangleEdgeStyleHandle]]; - [disabledStrokedShapeGenerator setBottomRightCorner: - [[MDCCutCornerTreatment alloc] initWithCut:5]]; - [disabledStrokedShapeGenerator setBottomLeftCorner: - [[MDCCurvedCornerTreatment alloc] initWithSize:CGSizeMake(10, 5)]]; + [disabledStrokedShapeGenerator + setTopRightCorner:[[MDCCurvedCornerTreatment alloc] initWithSize:CGSizeMake(5, 20)]]; + [disabledStrokedShapeGenerator + setBottomEdge:[[MDCTriangleEdgeTreatment alloc] initWithSize:5 + style:MDCTriangleEdgeStyleHandle]]; + [disabledStrokedShapeGenerator + setBottomRightCorner:[[MDCCutCornerTreatment alloc] initWithCut:5]]; + [disabledStrokedShapeGenerator + setBottomLeftCorner:[[MDCCurvedCornerTreatment alloc] initWithSize:CGSizeMake(10, 5)]]; disabledStrokedButton.shapeGenerator = disabledStrokedShapeGenerator; [disabledStrokedButton sizeToFit]; @@ -190,8 +188,8 @@ - (void)viewDidLoad { [self.view addSubview:self.floatingButton]; self.buttons = @[ - containedButton, disabledContainedButton, flatButton, strokedButton, - disabledStrokedButton, self.floatingButton + containedButton, disabledContainedButton, flatButton, strokedButton, disabledStrokedButton, + self.floatingButton ]; [self setupShapeExampleViews]; diff --git a/components/Buttons/examples/ButtonsTypicalUseExampleViewController.m b/components/Buttons/examples/ButtonsTypicalUseExampleViewController.m index 683b158cb2b..ddce0dfa69d 100644 --- a/components/Buttons/examples/ButtonsTypicalUseExampleViewController.m +++ b/components/Buttons/examples/ButtonsTypicalUseExampleViewController.m @@ -105,9 +105,8 @@ - (void)viewDidLoad { MIN(0, -(kMinimumAccessibleButtonSize.height - CGRectGetHeight(textButton.bounds)) / 2); CGFloat textButtonHorizontalInset = MIN(0, -(kMinimumAccessibleButtonSize.width - CGRectGetWidth(textButton.bounds)) / 2); - textButton.hitAreaInsets = - UIEdgeInsetsMake(textButtonVerticalInset, textButtonHorizontalInset, - textButtonVerticalInset, textButtonHorizontalInset); + textButton.hitAreaInsets = UIEdgeInsetsMake(textButtonVerticalInset, textButtonHorizontalInset, + textButtonVerticalInset, textButtonHorizontalInset); [textButton addTarget:self action:@selector(didTap:) forControlEvents:UIControlEventTouchUpInside]; @@ -139,8 +138,8 @@ - (void)viewDidLoad { UIEdgeInsetsMake(outlineButtonVerticalInset, outlineButtonHorizontalInset, outlineButtonVerticalInset, outlineButtonHorizontalInset); [outlinedButton addTarget:self - action:@selector(didTap:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(didTap:) + forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:outlinedButton]; // Disabled outlined button @@ -172,7 +171,7 @@ - (void)viewDidLoad { self.buttons = @[ containedButton, disabledContainedButton, textButton, disabledTextButton, outlinedButton, - disabledOutlinedButton,self.floatingButton + disabledOutlinedButton, self.floatingButton ]; [self setupExampleViews]; diff --git a/components/Buttons/examples/FloatingButtonExampleViewController.m b/components/Buttons/examples/FloatingButtonExampleViewController.m index c403cbd0b43..129d8ef5191 100644 --- a/components/Buttons/examples/FloatingButtonExampleViewController.m +++ b/components/Buttons/examples/FloatingButtonExampleViewController.m @@ -105,9 +105,9 @@ - (void)viewDidLayoutSubviews { [self.miniFloatingButton sizeToFit]; CGFloat totalUsedHeight = self.iPadLabel.intrinsicContentSize.height + - self.miniFloatingButton.intrinsicContentSize.height + - self.defaultFloatingButton.intrinsicContentSize.height + - self.largeIconFloatingButton.intrinsicContentSize.height; + self.miniFloatingButton.intrinsicContentSize.height + + self.defaultFloatingButton.intrinsicContentSize.height + + self.largeIconFloatingButton.intrinsicContentSize.height; CGRect bounds = self.view.bounds; if (totalUsedHeight > CGRectGetHeight(bounds)) { @@ -130,9 +130,8 @@ - (void)viewDidLayoutSubviews { } if (!self.iPadLabel.hidden) { - self.iPadLabel.center = - CGPointMake(CGRectGetMidX(bounds), - viewYOffset + self.iPadLabel.intrinsicContentSize.height / 2); + self.iPadLabel.center = CGPointMake( + CGRectGetMidX(bounds), viewYOffset + self.iPadLabel.intrinsicContentSize.height / 2); viewYOffset += self.iPadLabel.intrinsicContentSize.height + interViewSpacing; } @@ -184,13 +183,16 @@ - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection UITraitCollection *currentTraits = self.traitCollection; BOOL sizeClassChanged = currentTraits.horizontalSizeClass != newCollection.horizontalSizeClass || - currentTraits.verticalSizeClass != newCollection.verticalSizeClass; + currentTraits.verticalSizeClass != newCollection.verticalSizeClass; if (sizeClassChanged) { BOOL isRegularRegular = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular && - newCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular; - [coordinator animateAlongsideTransition:^(id _Nonnull context) { - [self updateFloatingButtonsWhenSizeClassIsRegularRegular:isRegularRegular]; - } completion:nil]; + newCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular; + [coordinator + animateAlongsideTransition:^( + id _Nonnull context) { + [self updateFloatingButtonsWhenSizeClassIsRegularRegular:isRegularRegular]; + } + completion:nil]; } } @@ -198,9 +200,9 @@ - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Buttons", @"Floating Action Button" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Buttons", @"Floating Action Button" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m index 669d99c6265..5513b136ac9 100644 --- a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m +++ b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m @@ -30,24 +30,23 @@ @implementation ButtonsTypicalUseExampleViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Buttons", @"Buttons" ], - @"description": @"Buttons allow users to take actions, and make choices, with a single tap." - @"\nA floating action button (FAB) represents the primary action of a screen.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Buttons", @"Buttons" ], + @"description" : @"Buttons allow users to take actions, and make choices, with a single tap." + @"\nA floating action button (FAB) represents the primary action of a screen.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @end - @implementation ButtonsShapesExampleViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Buttons", @"Shaped Buttons" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Buttons", @"Shaped Buttons" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -72,15 +71,12 @@ - (CGRect)contentBounds { void (^preiOS11Behavior)(void) = ^{ CGRect safeAreaBounds; - CGRectDivide(bounds, - &safeAreaBounds, - &contentBounds, - self.topLayoutGuide.length, + CGRectDivide(bounds, &safeAreaBounds, &contentBounds, self.topLayoutGuide.length, CGRectMinYEdge); }; if (@available(iOS 11.0, *)) { - UIEdgeInsets safeAreaInsets = self.view.safeAreaInsets; - contentBounds = UIEdgeInsetsInsetRect(bounds, safeAreaInsets); + UIEdgeInsets safeAreaInsets = self.view.safeAreaInsets; + contentBounds = UIEdgeInsetsInsetRect(bounds, safeAreaInsets); } else { preiOS11Behavior(); } @@ -140,10 +136,9 @@ - (void)layoutButtonsInRange:(NSRange)range around:(CGFloat)centerX { for (NSUInteger i = range.location; i < NSMaxRange(range); i++) { MDCButton *button = self.buttons[i]; UILabel *label = self.labels[i]; - button.center = MDCRoundCenterWithBoundsAndScale(CGPointMake(button.center.x, - button.center.y + verticalCenterY), - button.bounds, - self.view.window.screen.scale); + button.center = MDCRoundCenterWithBoundsAndScale( + CGPointMake(button.center.x, button.center.y + verticalCenterY), button.bounds, + self.view.window.screen.scale); CGFloat labelWidth = CGRectGetWidth(label.bounds); CGFloat labelHeight = CGRectGetHeight(label.bounds); @@ -154,16 +149,19 @@ - (void)layoutButtonsInRange:(NSRange)range around:(CGFloat)centerX { label.center = CGPointMake(CGRectGetMidX(alignedFrame), CGRectGetMidY(alignedFrame)); label.bounds = (CGRect){label.bounds.origin, alignedFrame.size}; - // Adjust the label's center and bounds so it doesn't exceed the safe area on the left side of the screen, the situation that - // button exceeds the safe area on the right side is not considered yet + // Adjust the label's center and bounds so it doesn't exceed the safe area on the left side of + // the screen, the situation that button exceeds the safe area on the right side is not + // considered yet CGFloat labelOriginX = label.center.x - label.bounds.size.width / 2; if (labelOriginX < contentBounds.origin.x) { CGFloat labelXOffset = contentBounds.origin.x - labelOriginX; CGFloat maxLabelWidth = label.bounds.size.width - labelXOffset; label.numberOfLines = 0; CGSize newSizeToFitLabel = [label sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)]; - label.center = CGPointMake(centerX - newSizeToFitLabel.width / 2 - kViewOffsetToCenter, label.center.y); - label.bounds = CGRectMake(label.center.x - newSizeToFitLabel.width / 2, label.center.y, newSizeToFitLabel.width, newSizeToFitLabel.height); + label.center = + CGPointMake(centerX - newSizeToFitLabel.width / 2 - kViewOffsetToCenter, label.center.y); + label.bounds = CGRectMake(label.center.x - newSizeToFitLabel.width / 2, label.center.y, + newSizeToFitLabel.width, newSizeToFitLabel.height); label.textAlignment = NSTextAlignmentRight; } } diff --git a/components/Buttons/src/ButtonThemer/MDCContainedButtonThemer.m b/components/Buttons/src/ButtonThemer/MDCContainedButtonThemer.m index 11e4a0e6605..cd56da37482 100644 --- a/components/Buttons/src/ButtonThemer/MDCContainedButtonThemer.m +++ b/components/Buttons/src/ButtonThemer/MDCContainedButtonThemer.m @@ -20,8 +20,7 @@ @implementation MDCContainedButtonThemer -+ (void)applyScheme:(nonnull id)scheme - toButton:(nonnull MDCButton *)button { ++ (void)applyScheme:(nonnull id)scheme toButton:(nonnull MDCButton *)button { [MDCContainedButtonColorThemer applySemanticColorScheme:scheme.colorScheme toButton:button]; [MDCButtonShapeThemer applyShapeScheme:scheme.shapeScheme toButton:button]; [MDCButtonTypographyThemer applyTypographyScheme:scheme.typographyScheme toButton:button]; @@ -33,4 +32,3 @@ + (void)applyScheme:(nonnull id)scheme } @end - diff --git a/components/Buttons/src/ButtonThemer/MDCOutlinedButtonThemer.m b/components/Buttons/src/ButtonThemer/MDCOutlinedButtonThemer.m index 21cf274f63b..f725c759620 100644 --- a/components/Buttons/src/ButtonThemer/MDCOutlinedButtonThemer.m +++ b/components/Buttons/src/ButtonThemer/MDCOutlinedButtonThemer.m @@ -20,17 +20,15 @@ @implementation MDCOutlinedButtonThemer -+ (void)applyScheme:(nonnull id)scheme - toButton:(nonnull MDCButton *)button { ++ (void)applyScheme:(nonnull id)scheme toButton:(nonnull MDCButton *)button { [MDCOutlinedButtonColorThemer applySemanticColorScheme:scheme.colorScheme toButton:button]; [MDCButtonShapeThemer applyShapeScheme:scheme.shapeScheme toButton:button]; [MDCButtonTypographyThemer applyTypographyScheme:scheme.typographyScheme toButton:button]; button.minimumSize = CGSizeMake(0, scheme.minimumHeight); button.layer.cornerRadius = scheme.cornerRadius; - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBorderWidth:1 forState:state]; } diff --git a/components/Buttons/src/ButtonThemer/MDCTextButtonThemer.m b/components/Buttons/src/ButtonThemer/MDCTextButtonThemer.m index 3b32801ef33..919c95b0833 100644 --- a/components/Buttons/src/ButtonThemer/MDCTextButtonThemer.m +++ b/components/Buttons/src/ButtonThemer/MDCTextButtonThemer.m @@ -20,8 +20,7 @@ @implementation MDCTextButtonThemer -+ (void)applyScheme:(nonnull id)scheme - toButton:(nonnull MDCButton *)button { ++ (void)applyScheme:(nonnull id)scheme toButton:(nonnull MDCButton *)button { [MDCTextButtonColorThemer applySemanticColorScheme:scheme.colorScheme toButton:button]; [MDCButtonShapeThemer applyShapeScheme:scheme.shapeScheme toButton:button]; [MDCButtonTypographyThemer applyTypographyScheme:scheme.typographyScheme toButton:button]; @@ -30,4 +29,3 @@ + (void)applyScheme:(nonnull id)scheme } @end - diff --git a/components/Buttons/src/ColorThemer/MDCButtonColorThemer.m b/components/Buttons/src/ColorThemer/MDCButtonColorThemer.m index 152f0119e21..2cc2fd227d1 100644 --- a/components/Buttons/src/ColorThemer/MDCButtonColorThemer.m +++ b/components/Buttons/src/ColorThemer/MDCButtonColorThemer.m @@ -38,7 +38,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForButtonTheming:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBackgroundColor:nil forState:state]; [button setTitleColor:nil forState:state]; @@ -50,8 +50,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme [MDCContainedButtonColorThemer applySemanticColorScheme:colorScheme toButton:raisedButton]; } -+ (void)applyColorScheme:(id)colorScheme - toButton:(MDCButton *)button { ++ (void)applyColorScheme:(id)colorScheme toButton:(MDCButton *)button { [button setBackgroundColor:colorScheme.primaryColor forState:UIControlStateNormal]; if ([colorScheme respondsToSelector:@selector(primaryLightColor)]) { [button setBackgroundColor:colorScheme.primaryLightColor forState:UIControlStateDisabled]; diff --git a/components/Buttons/src/ColorThemer/MDCContainedButtonColorThemer.m b/components/Buttons/src/ColorThemer/MDCContainedButtonColorThemer.m index 08680576fec..1cf00ade740 100644 --- a/components/Buttons/src/ColorThemer/MDCContainedButtonColorThemer.m +++ b/components/Buttons/src/ColorThemer/MDCContainedButtonColorThemer.m @@ -34,7 +34,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForButtonTheming:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBackgroundColor:nil forState:state]; [button setTitleColor:nil forState:state]; diff --git a/components/Buttons/src/ColorThemer/MDCFloatingButtonColorThemer.m b/components/Buttons/src/ColorThemer/MDCFloatingButtonColorThemer.m index 1d0ab54ae33..142560e2827 100644 --- a/components/Buttons/src/ColorThemer/MDCFloatingButtonColorThemer.m +++ b/components/Buttons/src/ColorThemer/MDCFloatingButtonColorThemer.m @@ -28,7 +28,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForButtonTheming:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBackgroundColor:nil forState:state]; [button setTitleColor:nil forState:state]; diff --git a/components/Buttons/src/ColorThemer/MDCOutlinedButtonColorThemer.m b/components/Buttons/src/ColorThemer/MDCOutlinedButtonColorThemer.m index 57c2ba1f1d3..8365f854600 100644 --- a/components/Buttons/src/ColorThemer/MDCOutlinedButtonColorThemer.m +++ b/components/Buttons/src/ColorThemer/MDCOutlinedButtonColorThemer.m @@ -31,7 +31,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForButtonTheming:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBackgroundColor:nil forState:state]; [button setTitleColor:nil forState:state]; diff --git a/components/Buttons/src/ColorThemer/MDCTextButtonColorThemer.m b/components/Buttons/src/ColorThemer/MDCTextButtonColorThemer.m index 72240e8544c..f6bbd41da21 100644 --- a/components/Buttons/src/ColorThemer/MDCTextButtonColorThemer.m +++ b/components/Buttons/src/ColorThemer/MDCTextButtonColorThemer.m @@ -33,7 +33,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForButtonTheming:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setBackgroundColor:nil forState:state]; [button setTitleColor:nil forState:state]; diff --git a/components/Buttons/src/MDCFloatingButton+Animation.m b/components/Buttons/src/MDCFloatingButton+Animation.m index 51fac0db14d..bd534fd4157 100644 --- a/components/Buttons/src/MDCFloatingButton+Animation.m +++ b/components/Buttons/src/MDCFloatingButton+Animation.m @@ -129,15 +129,20 @@ - (void)expand:(BOOL)animated completion:(void (^_Nullable)(void))completion { presentationLayer.transform, CATransform3DMakeScale(0, 0, 1))] : nil; + + // clang-format off + CAMediaTimingFunction *iconScaleTimingFunction = + [[CAMediaTimingFunction alloc] initWithControlPoints:0:0:(float)0.2:1]; + // clang-format on CABasicAnimation *iconScaleAnimation = [MDCFloatingButton animationWithKeypath:@"transform" toValue:[NSValue valueWithCATransform3D:iconPresentationLayer.transform] fromValue:fromValue - timingFunction:[[CAMediaTimingFunction alloc] - initWithControlPoints:0:0:(float)0.2:1] + timingFunction:iconScaleTimingFunction fillMode:kCAFillModeBoth duration:kMDCFloatingButtonEnterIconDuration beginOffset:kMDCFloatingButtonEnterIconOffset]; + [self.imageView.layer addAnimation:iconScaleAnimation forKey:kMDCFloatingButtonTransformKey]; } @@ -184,12 +189,16 @@ - (void)collapse:(BOOL)animated completion:(void (^_Nullable)(void))completion { self.layer.transform, [MDCFloatingButton collapseTransform])] fromValue:nil + // clang-format off timingFunction:[[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:1:1] + // clang-format on fillMode:kCAFillModeForwards duration:kMDCFloatingButtonExitDuration beginOffset:0]; + [self.layer addAnimation:overallScaleAnimation forKey:kMDCFloatingButtonTransformKey]; + // clang-format off CABasicAnimation *iconScaleAnimation = [MDCFloatingButton animationWithKeypath:@"transform" toValue:[NSValue @@ -197,7 +206,9 @@ - (void)collapse:(BOOL)animated completion:(void (^_Nullable)(void))completion { self.imageView.layer.transform, [MDCFloatingButton collapseTransform])] fromValue:nil + // clang-format off timingFunction:[[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:1:1] + // clang-format on fillMode:kCAFillModeForwards duration:kMDCFloatingButtonExitIconDuration beginOffset:kMDCFloatingButtonExitIconOffset]; diff --git a/components/Buttons/src/MDCFloatingButton.m b/components/Buttons/src/MDCFloatingButton.m index aa792b23d1c..c916a8cea81 100644 --- a/components/Buttons/src/MDCFloatingButton.m +++ b/components/Buttons/src/MDCFloatingButton.m @@ -26,17 +26,21 @@ @interface MDCFloatingButton () -@property(nonatomic, readonly) NSMutableDictionary *> *shapeToModeToMinimumSize; +@property(nonatomic, readonly) + NSMutableDictionary *> + *shapeToModeToMinimumSize; -@property(nonatomic, readonly) NSMutableDictionary *> *shapeToModeToMaximumSize; +@property(nonatomic, readonly) + NSMutableDictionary *> + *shapeToModeToMaximumSize; -@property(nonatomic, readonly) NSMutableDictionary *> *shapeToModeToContentEdgeInsets; +@property(nonatomic, readonly) + NSMutableDictionary *> + *shapeToModeToContentEdgeInsets; -@property(nonatomic, readonly) NSMutableDictionary *> *shapeToModeToHitAreaInsets; +@property(nonatomic, readonly) + NSMutableDictionary *> + *shapeToModeToHitAreaInsets; @end @@ -105,58 +109,55 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { - (void)commonMDCFloatingButtonInit { _imageTitleSpace = MDCFloatingButtonDefaultImageTitleSpace; - const CGSize miniNormalSize = CGSizeMake(MDCFloatingButtonMiniDimension, - MDCFloatingButtonMiniDimension); - const CGSize defaultNormalSize = CGSizeMake(MDCFloatingButtonDefaultDimension, - MDCFloatingButtonDefaultDimension); + const CGSize miniNormalSize = + CGSizeMake(MDCFloatingButtonMiniDimension, MDCFloatingButtonMiniDimension); + const CGSize defaultNormalSize = + CGSizeMake(MDCFloatingButtonDefaultDimension, MDCFloatingButtonDefaultDimension); const CGSize defaultExpandedMinimumSize = CGSizeMake(0, 48); const CGSize defaultExpandedMaximumSize = CGSizeMake(328, 0); // Minimum size values for different shape + mode combinations NSMutableDictionary *miniShapeMinimumSizeDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:miniNormalSize] - } mutableCopy]; - NSMutableDictionary *defaultShapeMinimumSizeDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:defaultNormalSize], - @(MDCFloatingButtonModeExpanded) : [NSValue valueWithCGSize:defaultExpandedMinimumSize], - } mutableCopy]; - _shapeToModeToMinimumSize = - [@{ @(MDCFloatingButtonShapeMini) : miniShapeMinimumSizeDictionary, - @(MDCFloatingButtonShapeDefault) : defaultShapeMinimumSizeDictionary, - } mutableCopy]; + [@{@(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:miniNormalSize]} mutableCopy]; + NSMutableDictionary *defaultShapeMinimumSizeDictionary = [@{ + @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:defaultNormalSize], + @(MDCFloatingButtonModeExpanded) : [NSValue valueWithCGSize:defaultExpandedMinimumSize], + } mutableCopy]; + _shapeToModeToMinimumSize = [@{ + @(MDCFloatingButtonShapeMini) : miniShapeMinimumSizeDictionary, + @(MDCFloatingButtonShapeDefault) : defaultShapeMinimumSizeDictionary, + } mutableCopy]; // Maximum size values for different shape + mode combinations NSMutableDictionary *miniShapeMaximumSizeDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:miniNormalSize] - } mutableCopy]; - NSMutableDictionary *defaultShapeMaximumSizeDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:defaultNormalSize], - @(MDCFloatingButtonModeExpanded) : [NSValue valueWithCGSize:defaultExpandedMaximumSize], - } mutableCopy]; - _shapeToModeToMaximumSize = - [@{ @(MDCFloatingButtonShapeMini) : miniShapeMaximumSizeDictionary, - @(MDCFloatingButtonShapeDefault) : defaultShapeMaximumSizeDictionary, - } mutableCopy]; + [@{@(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:miniNormalSize]} mutableCopy]; + NSMutableDictionary *defaultShapeMaximumSizeDictionary = [@{ + @(MDCFloatingButtonModeNormal) : [NSValue valueWithCGSize:defaultNormalSize], + @(MDCFloatingButtonModeExpanded) : [NSValue valueWithCGSize:defaultExpandedMaximumSize], + } mutableCopy]; + _shapeToModeToMaximumSize = [@{ + @(MDCFloatingButtonShapeMini) : miniShapeMaximumSizeDictionary, + @(MDCFloatingButtonShapeDefault) : defaultShapeMaximumSizeDictionary, + } mutableCopy]; // Content edge insets values for different shape + mode combinations // .mini shape, .normal mode const UIEdgeInsets miniNormalContentInsets = UIEdgeInsetsMake(8, 8, 8, 8); NSMutableDictionary *miniShapeContentEdgeInsetsDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithUIEdgeInsets:miniNormalContentInsets] - } mutableCopy]; + [@{@(MDCFloatingButtonModeNormal) : [NSValue valueWithUIEdgeInsets:miniNormalContentInsets]} + mutableCopy]; _shapeToModeToContentEdgeInsets = - [@{ @(MDCFloatingButtonShapeMini) : miniShapeContentEdgeInsetsDictionary - } mutableCopy]; + [@{@(MDCFloatingButtonShapeMini) : miniShapeContentEdgeInsetsDictionary} mutableCopy]; // Hit area insets values for different shape + mode combinations // .mini shape, .normal mode const UIEdgeInsets miniNormalHitAreaInset = UIEdgeInsetsMake(-4, -4, -4, -4); - NSMutableDictionary *miniShapeHitAreaInsetsDictionary = - [@{ @(MDCFloatingButtonModeNormal) : [NSValue valueWithUIEdgeInsets:miniNormalHitAreaInset], - } mutableCopy]; - _shapeToModeToHitAreaInsets = - [@{ @(MDCFloatingButtonShapeMini) : miniShapeHitAreaInsetsDictionary, - } mutableCopy]; + NSMutableDictionary *miniShapeHitAreaInsetsDictionary = [@{ + @(MDCFloatingButtonModeNormal) : [NSValue valueWithUIEdgeInsets:miniNormalHitAreaInset], + } mutableCopy]; + _shapeToModeToHitAreaInsets = [@{ + @(MDCFloatingButtonShapeMini) : miniShapeHitAreaInsetsDictionary, + } mutableCopy]; } #pragma mark - UIView @@ -180,11 +181,12 @@ - (CGSize)intrinsicContentSizeForModeExpanded { const CGSize intrinsicImageSize = [self.imageView sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; CGFloat intrinsicWidth = intrinsicTitleSize.width + intrinsicImageSize.width + - self.imageTitleSpace + internalLayoutInsets.left + internalLayoutInsets.right + - self.contentEdgeInsets.left + self.contentEdgeInsets.right; + self.imageTitleSpace + internalLayoutInsets.left + + internalLayoutInsets.right + self.contentEdgeInsets.left + + self.contentEdgeInsets.right; CGFloat intrinsicHeight = MAX(intrinsicTitleSize.height, intrinsicImageSize.height) + - self.contentEdgeInsets.top + self.contentEdgeInsets.bottom + internalLayoutInsets.top + - internalLayoutInsets.bottom; + self.contentEdgeInsets.top + self.contentEdgeInsets.bottom + + internalLayoutInsets.top + internalLayoutInsets.bottom; return CGSizeMake(intrinsicWidth, intrinsicHeight); } @@ -229,7 +231,7 @@ - (void)layoutSubviews { self.layer.cornerRadius = CGRectGetHeight(self.bounds) / 2; [super layoutSubviews]; - if (self.mode == MDCFloatingButtonModeNormal) { + if (self.mode == MDCFloatingButtonModeNormal) { return; } @@ -252,12 +254,10 @@ - (void)layoutSubviews { BOOL isLeadingIcon = self.imageLocation == MDCFloatingButtonImageLocationLeading; UIEdgeInsets adjustedLayoutInsets = - isLeadingIcon ? internalLayoutInsets - : MDFInsetsFlippedHorizontally(internalLayoutInsets); + isLeadingIcon ? internalLayoutInsets : MDFInsetsFlippedHorizontally(internalLayoutInsets); - const CGRect insetBounds = UIEdgeInsetsInsetRect(UIEdgeInsetsInsetRect(self.bounds, - adjustedLayoutInsets), - self.contentEdgeInsets); + const CGRect insetBounds = UIEdgeInsetsInsetRect( + UIEdgeInsetsInsetRect(self.bounds, adjustedLayoutInsets), self.contentEdgeInsets); const CGFloat imageViewWidth = CGRectGetWidth(self.imageView.bounds); const CGFloat boundsCenterY = CGRectGetMidY(insetBounds); @@ -281,8 +281,8 @@ - (void)layoutSubviews { // If we are RTL with a trailing image, the image goes on the left. if ((isLTR && isLeadingIcon) || (!isLTR && !isLeadingIcon)) { const CGFloat imageCenterX = CGRectGetMinX(insetBounds) + (imageViewWidth / 2); - const CGFloat titleCenterX = CGRectGetMaxX(insetBounds) - titleWidthAvailable + - (titleSize.width / 2); + const CGFloat titleCenterX = + CGRectGetMaxX(insetBounds) - titleWidthAvailable + (titleSize.width / 2); titleCenter = CGPointMake(titleCenterX, boundsCenterY); imageCenter = CGPointMake(imageCenterX, boundsCenterY); } @@ -290,8 +290,8 @@ - (void)layoutSubviews { // If we are RTL with a leading image, the image goes on the right. else { const CGFloat imageCenterX = CGRectGetMaxX(insetBounds) - (imageViewWidth / 2); - const CGFloat titleCenterX = CGRectGetMinX(insetBounds) + titleWidthAvailable - - (titleSize.width / 2); + const CGFloat titleCenterX = + CGRectGetMinX(insetBounds) + titleWidthAvailable - (titleSize.width / 2); imageCenter = CGPointMake(imageCenterX, boundsCenterY); titleCenter = CGPointMake(titleCenterX, boundsCenterY); } @@ -330,7 +330,7 @@ - (void)setMinimumSize:(CGSize)size - (CGSize)minimumSizeForMode:(MDCFloatingButtonMode)mode { NSMutableDictionary *modeToMinimumSize = self.shapeToModeToMinimumSize[@(_shape)]; - if(!modeToMinimumSize) { + if (!modeToMinimumSize) { return CGSizeZero; } diff --git a/components/Buttons/src/TitleColorAccessibilityMutator/MDCButtonTitleColorAccessibilityMutator.m b/components/Buttons/src/TitleColorAccessibilityMutator/MDCButtonTitleColorAccessibilityMutator.m index 093f6c38819..25340701a5a 100644 --- a/components/Buttons/src/TitleColorAccessibilityMutator/MDCButtonTitleColorAccessibilityMutator.m +++ b/components/Buttons/src/TitleColorAccessibilityMutator/MDCButtonTitleColorAccessibilityMutator.m @@ -23,7 +23,7 @@ @implementation MDCButtonTitleColorAccessibilityMutator + (void)changeTitleColorOfButton:(MDCButton *)button { // This ensures title colors will be accessible against the buttons backgrounds. UIControlState allControlStates = UIControlStateNormal | UIControlStateHighlighted | - UIControlStateDisabled | UIControlStateSelected; + UIControlStateDisabled | UIControlStateSelected; MDFTextAccessibilityOptions options = 0; if ([MDFTextAccessibility isLargeForContrastRatios:button.titleLabel.font]) { options = MDFTextAccessibilityOptionsLargeFont; @@ -54,5 +54,4 @@ + (BOOL)isTransparentColor:(UIColor *)color { return !color || [color isEqual:[UIColor clearColor]] || CGColorGetAlpha(color.CGColor) == 0; } - @end diff --git a/components/Buttons/src/TypographyThemer/MDCButtonTypographyThemer.m b/components/Buttons/src/TypographyThemer/MDCButtonTypographyThemer.m index 8e93032b8bb..9a4936ec164 100644 --- a/components/Buttons/src/TypographyThemer/MDCButtonTypographyThemer.m +++ b/components/Buttons/src/TypographyThemer/MDCButtonTypographyThemer.m @@ -19,7 +19,7 @@ @implementation MDCButtonTypographyThemer + (void)applyTypographyScheme:(nonnull id)typographyScheme toButton:(nonnull MDCButton *)button { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [button setTitleFont:nil forState:state]; } diff --git a/components/Buttons/tests/unit/ButtonInterfaceBuilderCompatibilityTests.m b/components/Buttons/tests/unit/ButtonInterfaceBuilderCompatibilityTests.m index b39f64f988b..de9340d2f94 100644 --- a/components/Buttons/tests/unit/ButtonInterfaceBuilderCompatibilityTests.m +++ b/components/Buttons/tests/unit/ButtonInterfaceBuilderCompatibilityTests.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import #import +#import #import "supplemental/ButtonTestView.h" @@ -36,7 +36,6 @@ - (void)testFontRestoredFromNib { // Then XCTAssertEqualObjects(buttonFont, [UIFont systemFontOfSize:40]); XCTAssertEqualObjects(buttonColor, [UIColor blackColor]); - } @end diff --git a/components/Buttons/tests/unit/ButtonSubclassingTests.m b/components/Buttons/tests/unit/ButtonSubclassingTests.m index 48f4b71a0e4..d4f73496b0a 100644 --- a/components/Buttons/tests/unit/ButtonSubclassingTests.m +++ b/components/Buttons/tests/unit/ButtonSubclassingTests.m @@ -14,10 +14,10 @@ #import +#import "MDCButton+Subclassing.h" #import "MaterialButtons.h" #import "MaterialShadowElevations.h" #import "MaterialTypography.h" -#import "MDCButton+Subclassing.h" static const UIEdgeInsets ButtonTestContentEdgeInsets = {1, 2, 3, 4}; static const CGFloat ButtonTestCornerRadius = (CGFloat)1.234; @@ -43,8 +43,8 @@ - (void)testSubclassContentEdgeInsets { MDCButton *button = [[ButtonSubclass alloc] init]; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(ButtonTestContentEdgeInsets, - button.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(ButtonTestContentEdgeInsets, button.contentEdgeInsets)); } - (void)testAssignedContentEdgeInsets { @@ -53,8 +53,8 @@ - (void)testAssignedContentEdgeInsets { button.contentEdgeInsets = ButtonTestContentEdgeInsets; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(ButtonTestContentEdgeInsets, - button.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(ButtonTestContentEdgeInsets, button.contentEdgeInsets)); } - (void)testAssignedCornerRadius { diff --git a/components/Buttons/tests/unit/ButtonThemerTests.m b/components/Buttons/tests/unit/ButtonThemerTests.m index 683e2ac28e1..df85f98cf1f 100644 --- a/components/Buttons/tests/unit/ButtonThemerTests.m +++ b/components/Buttons/tests/unit/ButtonThemerTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialButtons.h" #import "MaterialButtons+ButtonThemer.h" +#import "MaterialButtons.h" #import "MaterialColorScheme.h" #import "MaterialPalettes.h" #import "MaterialTypographyScheme.h" @@ -78,8 +78,7 @@ - (void)testOutlinedButtonThemer { [scheme.colorScheme.primaryColor colorWithAlphaComponent:(CGFloat)0.16]); XCTAssertEqualObjects([button borderColorForState:UIControlStateNormal], [scheme.colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.12]); - XCTAssertEqualObjects([button borderColorForState:UIControlStateDisabled], - nil); + XCTAssertEqualObjects([button borderColorForState:UIControlStateDisabled], nil); // Typography XCTAssertEqualObjects([button titleFontForState:UIControlStateNormal], diff --git a/components/Buttons/tests/unit/ButtonTitleColorAccessibilityMutatorTests.m b/components/Buttons/tests/unit/ButtonTitleColorAccessibilityMutatorTests.m index 963346e2788..48b1582fed7 100644 --- a/components/Buttons/tests/unit/ButtonTitleColorAccessibilityMutatorTests.m +++ b/components/Buttons/tests/unit/ButtonTitleColorAccessibilityMutatorTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialButtons.h" #import "MaterialButtons+TitleColorAccessibilityMutator.h" +#import "MaterialButtons.h" // A value greater than the largest value created by combining normal values of UIControlState. // This is a complete hack, but UIControlState doesn't expose anything useful here. @@ -25,9 +25,11 @@ static const UIControlState kUIControlStateDisabledHighlighted = UIControlStateHighlighted | UIControlStateDisabled; -static NSArray *testColors(){ - return @[[UIColor whiteColor], [UIColor blackColor], [UIColor redColor], [UIColor orangeColor], - [UIColor greenColor], [UIColor blueColor], [UIColor grayColor]]; +static NSArray *testColors() { + return @[ + [UIColor whiteColor], [UIColor blackColor], [UIColor redColor], [UIColor orangeColor], + [UIColor greenColor], [UIColor blueColor], [UIColor grayColor] + ]; } static NSString *controlStateDescription(UIControlState controlState); @@ -63,7 +65,7 @@ - (void)testMutateChangesTextColor { } - (void)testMutateKeepsAccessibleTextColor { - NSDictionary* colors = @{ [UIColor redColor]: [UIColor blackColor]}; + NSDictionary *colors = @{[UIColor redColor] : [UIColor blackColor]}; for (UIColor *color in colors) { for (NSUInteger controlState = 0; controlState <= kNumUIControlStates; ++controlState) { if (controlState & kUIControlStateDisabledHighlighted) { diff --git a/components/Buttons/tests/unit/ButtonTypographyThemerTests.m b/components/Buttons/tests/unit/ButtonTypographyThemerTests.m index fb86943bd55..4c1f8c4a3b3 100644 --- a/components/Buttons/tests/unit/ButtonTypographyThemerTests.m +++ b/components/Buttons/tests/unit/ButtonTypographyThemerTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialButtons.h" #import "MaterialButtons+TypographyThemer.h" +#import "MaterialButtons.h" @interface ButtonTypographyThemerTests : XCTestCase @end @@ -38,14 +38,12 @@ - (void)testButtonTypographyThemer { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if ([button titleFontForState:state] != nil) { XCTAssertEqual([button titleFontForState:state], typographyScheme.button); } } - } - @end diff --git a/components/Buttons/tests/unit/ButtonsColorThemerTests.m b/components/Buttons/tests/unit/ButtonsColorThemerTests.m index ed534136564..3085142fac9 100644 --- a/components/Buttons/tests/unit/ButtonsColorThemerTests.m +++ b/components/Buttons/tests/unit/ButtonsColorThemerTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialButtons.h" #import "MaterialButtons+ColorThemer.h" +#import "MaterialButtons.h" static const CGFloat kEpsilonAccuracy = (CGFloat)0.001; @@ -43,7 +43,7 @@ - (void)testTextButtonColorThemer { XCTAssertEqualObjects([button titleColorForState:UIControlStateDisabled], [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.38]); NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state == UIControlStateDisabled) { continue; // This state is manually checked above. @@ -75,7 +75,7 @@ - (void)testContainedButtonColorThemer { XCTAssertEqualObjects([button titleColorForState:UIControlStateDisabled], [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.38]); NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state == UIControlStateDisabled) { continue; // This state is manually checked above. @@ -110,7 +110,7 @@ - (void)testMDCButtonColorThemer { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state != UIControlStateDisabled) { if ([button titleColorForState:state] != nil) { @@ -153,7 +153,7 @@ - (void)testMDCFlatButtonColorThemer { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state != UIControlStateDisabled) { if ([button titleColorForState:state] != nil) { @@ -197,7 +197,7 @@ - (void)testMDCRaisedButtonColorThemer { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state != UIControlStateDisabled) { if ([button titleColorForState:state] != nil) { @@ -236,10 +236,10 @@ - (void)testMDCFloatingButtonColorThemer { NSUInteger maximumStateValue = UIControlStateSelected | UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { - XCTAssertEqualObjects([button backgroundColorForState:state], colorScheme.secondaryColor, - @"Background color (%@) is not equal to (%@) for state (%lu).", - [button backgroundColorForState:state], colorScheme.secondaryColor, - (unsigned long)state); + XCTAssertEqualObjects([button backgroundColorForState:state], colorScheme.secondaryColor, + @"Background color (%@) is not equal to (%@) for state (%lu).", + [button backgroundColorForState:state], colorScheme.secondaryColor, + (unsigned long)state); XCTAssertEqualObjects([button imageTintColorForState:state], colorScheme.onSecondaryColor, @"Image tint color (%@) is not equal to (%@) for state (%lu).", [button imageTintColorForState:state], colorScheme.onSecondaryColor, diff --git a/components/Buttons/tests/unit/ButtonsCustomFontTest.m b/components/Buttons/tests/unit/ButtonsCustomFontTest.m index 2d48a2a986b..12d0189f4b3 100644 --- a/components/Buttons/tests/unit/ButtonsCustomFontTest.m +++ b/components/Buttons/tests/unit/ButtonsCustomFontTest.m @@ -54,8 +54,7 @@ - (void)testUnsetCustomFontTitle { UIFont *finalTitleFont = [button titleFontForState:UIControlStateNormal]; // Then - XCTAssert(finalTitleFont == nil, - @"titleLabel font should be nil"); + XCTAssert(finalTitleFont == nil, @"titleLabel font should be nil"); } @end diff --git a/components/Buttons/tests/unit/ButtonsTests.m b/components/Buttons/tests/unit/ButtonsTests.m index ef06af67399..f2dc3d9de21 100644 --- a/components/Buttons/tests/unit/ButtonsTests.m +++ b/components/Buttons/tests/unit/ButtonsTests.m @@ -16,8 +16,8 @@ #import "MaterialButtons.h" #import "MaterialShadowElevations.h" -#import "MaterialShapes.h" #import "MaterialShadowLayer.h" +#import "MaterialShapes.h" #import "MaterialTypography.h" static const CGFloat kEpsilonAccuracy = (CGFloat)0.001; @@ -219,8 +219,7 @@ - (void)testSetElevationOnlyUpdatesCurrentState { TestButton *highlightedButton = [[TestButton alloc] init]; XCTAssertEqualWithAccuracy([selectedButton elevationForState:UIControlStateNormal], - [selectedButton elevationForState:UIControlStateHighlighted], - 0.0001, + [selectedButton elevationForState:UIControlStateHighlighted], 0.0001, @"This test assumes that .normal and .highlighted start with the same " "elevation values."); @@ -235,8 +234,7 @@ - (void)testSetElevationOnlyUpdatesCurrentState { [highlightedButton setElevation:75 forState:UIControlStateNormal]; // Then - XCTAssertEqual(selectedButton.shadowLayer.elevationAssignmentCount, - selectedButtonElevationCount, + XCTAssertEqual(selectedButton.shadowLayer.elevationAssignmentCount, selectedButtonElevationCount, @"Updating an unrelated elevation should not update the layer elevation."); XCTAssertEqual(highlightedButtonElevationCount + 1, highlightedButton.shadowLayer.elevationAssignmentCount, diff --git a/components/Buttons/tests/unit/FloatingButtonTests.m b/components/Buttons/tests/unit/FloatingButtonTests.m index 0de0ea0fe11..c5f1e4689fe 100644 --- a/components/Buttons/tests/unit/FloatingButtonTests.m +++ b/components/Buttons/tests/unit/FloatingButtonTests.m @@ -89,8 +89,8 @@ - (void)testDefaultHitAreaInsetsValues { // Then XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, defaultButtonNormal.hitAreaInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, - defaultButtonExpanded.hitAreaInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, defaultButtonExpanded.hitAreaInsets)); XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(-4, -4, -4, -4), miniButtonNormal.hitAreaInsets)); XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, miniButtonExpanded.hitAreaInsets)); @@ -98,7 +98,7 @@ - (void)testDefaultHitAreaInsetsValues { - (void)testSetHitAreaInsetsForShapeInNormalMode { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape defaultButton.mode = MDCFloatingButtonModeExpanded; MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -110,20 +110,20 @@ - (void)testSetHitAreaInsetsForShapeInNormalMode { inMode:MDCFloatingButtonModeNormal]; defaultButton.mode = MDCFloatingButtonModeNormal; [miniButton setHitAreaInsets:UIEdgeInsetsMake(9, 8, 7, 6) - forShape:MDCFloatingButtonShapeMini - inMode:MDCFloatingButtonModeNormal]; + forShape:MDCFloatingButtonShapeMini + inMode:MDCFloatingButtonModeNormal]; miniButton.mode = MDCFloatingButtonModeNormal; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), - defaultButton.hitAreaInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), - miniButton.hitAreaInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), defaultButton.hitAreaInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), miniButton.hitAreaInsets)); } - (void)testSetHitAreaInsetsForShapeInExpandedMode { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -138,15 +138,15 @@ - (void)testSetHitAreaInsetsForShapeInExpandedMode { miniButton.mode = MDCFloatingButtonModeExpanded; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), - defaultButton.hitAreaInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), - miniButton.hitAreaInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), defaultButton.hitAreaInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), miniButton.hitAreaInsets)); } - (void)testChangingHitAreaInsetsWontTriggerResizing { // Given - FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape + FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape [button reset]; // When @@ -177,19 +177,19 @@ - (void)testDefaultContentEdgeInsetsValues { miniButtonExpanded.mode = MDCFloatingButtonModeExpanded; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, - defaultButtonNormal.contentEdgeInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, - defaultButtonExpanded.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, defaultButtonNormal.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, defaultButtonExpanded.contentEdgeInsets)); XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(8, 8, 8, 8), miniButtonNormal.contentEdgeInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, - miniButtonExpanded.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, miniButtonExpanded.contentEdgeInsets)); } - (void)testSetContentEdgeInsetsForShapeInNormalMode { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape defaultButton.mode = MDCFloatingButtonModeExpanded; MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -206,15 +206,15 @@ - (void)testSetContentEdgeInsetsForShapeInNormalMode { miniButton.mode = MDCFloatingButtonModeNormal; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), - defaultButton.contentEdgeInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), - miniButton.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), defaultButton.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), miniButton.contentEdgeInsets)); } - (void)testSetContentEdgeInsetsForShapeInExpandedMode { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -229,15 +229,15 @@ - (void)testSetContentEdgeInsetsForShapeInExpandedMode { miniButton.mode = MDCFloatingButtonModeExpanded; // Then - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), - defaultButton.contentEdgeInsets)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), - miniButton.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(1, 2, 3, 4), defaultButton.contentEdgeInsets)); + XCTAssertTrue( + UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(9, 8, 7, 6), miniButton.contentEdgeInsets)); } - (void)testSettingContentEdgeInsetsInvalidatesIntrinsicContentSize { // Given - FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape + FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape [button reset]; // When @@ -256,7 +256,7 @@ - (void)testSettingContentEdgeInsetsInvalidatesIntrinsicContentSize { - (void)testDefaultMaximumSizeForShapeInNormalModeSizeToFit { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape [defaultButton setTitle:@"a very long title" forState:UIControlStateNormal]; MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -289,7 +289,7 @@ - (void)testDefaultMaximumSizeForShapeInExpandedModeSizeToFit { - (void)testSetMaximumSizeForShapeInModeNormal { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape [defaultButton setTitle:@"a very long title" forState:UIControlStateNormal]; defaultButton.mode = MDCFloatingButtonModeExpanded; MDCFloatingButton *miniButton = @@ -316,7 +316,7 @@ - (void)testSetMaximumSizeForShapeInModeNormal { - (void)testSetMaximumSizeForShapeInModeExpanded { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape [defaultButton setTitle:@"An even longer title that should require more than 328 points to render" forState:UIControlStateNormal]; MDCFloatingButton *miniButton = @@ -343,7 +343,7 @@ - (void)testSetMaximumSizeForShapeInModeExpanded { - (void)testSettingMaximumSizeInvalidatesIntrinsicContentSize { // Given - FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape + FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape [button reset]; // When @@ -393,7 +393,7 @@ - (void)testDefaultMinimumSizeForShapeInExpandedModeSizeToFit { - (void)testSetMinimumSizeForShapeInModeNormal { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape defaultButton.mode = MDCFloatingButtonModeExpanded; MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -427,7 +427,7 @@ - (void)testSetMinimumSizeForShapeInModeNormal { - (void)testSetMinimumSizeForShapeInModeExpanded { // Given - MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *defaultButton = [[MDCFloatingButton alloc] init]; // Default shape MDCFloatingButton *miniButton = [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeMini]; @@ -453,7 +453,7 @@ - (void)testSetMinimumSizeForShapeInModeExpanded { - (void)testSettingMinimumSizeInvalidatesIntrinsicContentSize { // Given - FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape + FakeFloatingButton *button = [[FakeFloatingButton alloc] init]; // Default shape [button reset]; // When @@ -498,7 +498,7 @@ - (void)testExpandedLayout { - (void)testExpandedLayoutShortTitle { // Given MDCFloatingButton *button = - [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeDefault]; + [[MDCFloatingButton alloc] initWithFrame:CGRectZero shape:MDCFloatingButtonShapeDefault]; button.mode = MDCFloatingButtonModeExpanded; [button setTitle:@"A" forState:UIControlStateNormal]; [button setImage:fakeImage() forState:UIControlStateNormal]; @@ -539,7 +539,7 @@ - (void)testExpandedLayoutWithImageLocationTrailing { // Then CGRect imageFrame = button.imageView.frame; CGRect titleFrame = button.titleLabel.frame; - XCTAssertEqualWithAccuracy(CGRectGetMaxX(imageFrame), CGRectGetWidth(button.bounds)-16, 1); + XCTAssertEqualWithAccuracy(CGRectGetMaxX(imageFrame), CGRectGetWidth(button.bounds) - 16, 1); XCTAssertEqualWithAccuracy(CGRectGetMinX(titleFrame), 24, 1); XCTAssertEqualWithAccuracy(CGRectGetMinX(imageFrame), CGRectGetMaxX(titleFrame) + button.imageTitleSpace, 1); @@ -577,7 +577,7 @@ - (void)testExpandedLayoutWithNonZeroContentEdgeInsets { - (void)testExpandedLayoutBehaviorIsIdempotent { // Given - MDCFloatingButton *button = [[MDCFloatingButton alloc] init]; // Default shape + MDCFloatingButton *button = [[MDCFloatingButton alloc] init]; // Default shape button.mode = MDCFloatingButtonModeExpanded; [button setTitle:@"Title" forState:UIControlStateNormal]; [button setImage:fakeImage() forState:UIControlStateNormal]; @@ -599,7 +599,6 @@ - (void)testExpandedLayoutBehaviorIsIdempotent { @"Title frames are not equal.\nExpected: %@\nReceived: %@", NSStringFromCGRect(originalTitleFrame), NSStringFromCGRect(button.titleLabel.frame)); - } - (void)testDefaultElevationsForState { @@ -650,7 +649,9 @@ - (void)testCollapseExpandRestoresTransform { } // This test is flaky. -// :0: error: -[FloatingButtonsTests testCollapseExpandAnimatedRestoresTransform] : Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "Expand animation complete". +// :0: error: -[FloatingButtonsTests testCollapseExpandAnimatedRestoresTransform] : +// Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "Expand +// animation complete". - (void)disabled_testCollapseExpandAnimatedRestoresTransform { // Given MDCFloatingButton *button = [[MDCFloatingButton alloc] init]; diff --git a/components/Buttons/tests/unit/RaisedButtonTests.m b/components/Buttons/tests/unit/RaisedButtonTests.m index b7708d3c4cb..fd69690e45a 100644 --- a/components/Buttons/tests/unit/RaisedButtonTests.m +++ b/components/Buttons/tests/unit/RaisedButtonTests.m @@ -34,5 +34,4 @@ - (void)testDefaultElevationsForState { XCTAssertEqual([button elevationForState:UIControlStateDisabled], MDCShadowElevationNone); } - @end diff --git a/components/Cards/examples/CardsCollectionExample.m b/components/Cards/examples/CardsCollectionExample.m index d1f263bdbb7..e65e9544130 100644 --- a/components/Cards/examples/CardsCollectionExample.m +++ b/components/Cards/examples/CardsCollectionExample.m @@ -68,8 +68,8 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MDCCardCollectionCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:kReusableIdentifierItem - forIndexPath:indexPath]; + [collectionView dequeueReusableCellWithReuseIdentifier:kReusableIdentifierItem + forIndexPath:indexPath]; [cell setBackgroundColor:[UIColor colorWithRed:107 / (CGFloat)255 green:63 / (CGFloat)255 blue:238 / (CGFloat)255 @@ -80,8 +80,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView #pragma mark - - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout *)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGFloat cardSize = (self.view.bounds.size.width / 3) - 12; return CGSizeMake(cardSize, cardSize); } @@ -93,26 +93,26 @@ - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView } - (CGFloat)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout -minimumLineSpacingForSectionAtIndex:(NSInteger)section { + layout:(UICollectionViewLayout *)collectionViewLayout + minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 8; } - (CGFloat)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout -minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { + layout:(UICollectionViewLayout *)collectionViewLayout + minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 8; } #pragma mark - Reordering - (void)collectionView:(UICollectionView *)collectionView - moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath - toIndexPath:(NSIndexPath *)destinationIndexPath { + moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath + toIndexPath:(NSIndexPath *)destinationIndexPath { } - (BOOL)collectionView:(UICollectionView *)collectionView -canMoveItemAtIndexPath:(NSIndexPath *)indexPath { + canMoveItemAtIndexPath:(NSIndexPath *)indexPath { return YES; } @@ -120,9 +120,9 @@ - (BOOL)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Cards", @"Collection Card Cells" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Cards", @"Collection Card Cells" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Cards/examples/CardsCollectionTintingExample.m b/components/Cards/examples/CardsCollectionTintingExample.m index 7ba573fdea8..64e293abd83 100644 --- a/components/Cards/examples/CardsCollectionTintingExample.m +++ b/components/Cards/examples/CardsCollectionTintingExample.m @@ -52,7 +52,6 @@ - (void)viewDidLoad { // Register cell classes [self.collectionView registerClass:[CardTintExampleCell class] forCellWithReuseIdentifier:kReusableIdentifierItem]; - } #pragma mark @@ -79,8 +78,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView #pragma mark - - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout *)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGFloat cardSize = (self.view.bounds.size.width / 3) - 12; return CGSizeMake(cardSize, cardSize); } @@ -92,14 +91,14 @@ - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView } - (CGFloat)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout -minimumLineSpacingForSectionAtIndex:(NSInteger)section { + layout:(UICollectionViewLayout *)collectionViewLayout + minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 8; } - (CGFloat)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout -minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { + layout:(UICollectionViewLayout *)collectionViewLayout + minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 8; } @@ -107,9 +106,9 @@ - (CGFloat)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Cards", @"Collection Card Tinting" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Cards", @"Collection Card Tinting" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Cards/examples/supplemental/CardTintExampleCell.m b/components/Cards/examples/supplemental/CardTintExampleCell.m index 6642aad05a7..55b75b87068 100644 --- a/components/Cards/examples/supplemental/CardTintExampleCell.m +++ b/components/Cards/examples/supplemental/CardTintExampleCell.m @@ -16,8 +16,7 @@ @implementation CardTintExampleCell -- (instancetype)initWithFrame:(CGRect)frame -{ +- (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; @@ -39,7 +38,8 @@ - (instancetype)initWithFrame:(CGRect)frame - (void)layoutSubviews { [super layoutSubviews]; _switchView.center = CGPointMake(self.contentView.center.x, _switchView.bounds.size.height); - _sliderView.center = CGPointMake(self.contentView.center.x, self.bounds.size.height - _sliderView.bounds.size.height); + _sliderView.center = CGPointMake(self.contentView.center.x, + self.bounds.size.height - _sliderView.bounds.size.height); } @end diff --git a/components/Cards/src/CardThemer/MDCCardScheme.m b/components/Cards/src/CardThemer/MDCCardScheme.m index 9480a42c838..84a9d41d831 100644 --- a/components/Cards/src/CardThemer/MDCCardScheme.m +++ b/components/Cards/src/CardThemer/MDCCardScheme.m @@ -26,4 +26,3 @@ - (instancetype)init { return self; } @end - diff --git a/components/Cards/src/CardThemer/MDCCardThemer.m b/components/Cards/src/CardThemer/MDCCardThemer.m index 18bfdc0aaa1..bea89a7e10a 100644 --- a/components/Cards/src/CardThemer/MDCCardThemer.m +++ b/components/Cards/src/CardThemer/MDCCardThemer.m @@ -24,8 +24,7 @@ @implementation MDCCardThemer -+ (void)applyScheme:(nonnull id)scheme - toCard:(nonnull MDCCard *)card { ++ (void)applyScheme:(nonnull id)scheme toCard:(nonnull MDCCard *)card { [card setShadowElevation:kNormalElevation forState:UIControlStateNormal]; [card setShadowElevation:kHighlightedElevation forState:UIControlStateHighlighted]; card.interactable = YES; @@ -45,9 +44,8 @@ + (void)applyScheme:(nonnull id)scheme + (void)applyOutlinedVariantWithScheme:(nonnull id)scheme toCard:(nonnull MDCCard *)card { - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [card setBorderWidth:kBorderWidth forState:state]; [card setShadowElevation:0 forState:state]; @@ -70,4 +68,3 @@ + (void)applyOutlinedVariantWithScheme:(nonnull id)scheme } @end - diff --git a/components/Cards/src/ColorThemer/MDCCardsColorThemer.m b/components/Cards/src/ColorThemer/MDCCardsColorThemer.m index 10726a0ad82..741e5505817 100644 --- a/components/Cards/src/ColorThemer/MDCCardsColorThemer.m +++ b/components/Cards/src/ColorThemer/MDCCardsColorThemer.m @@ -30,13 +30,12 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)applyOutlinedVariantWithColorScheme:(nonnull id)colorScheme toCard:(nonnull MDCCard *)card { - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [card setBorderColor:nil forState:state]; } - + card.backgroundColor = colorScheme.surfaceColor; UIColor *borderColor = [colorScheme.onSurfaceColor colorWithAlphaComponent:kStrokeVariantBorderOpacity]; @@ -45,13 +44,12 @@ + (void)applyOutlinedVariantWithColorScheme:(nonnull id)colorS + (void)applyOutlinedVariantWithColorScheme:(id)colorScheme toCardCell:(MDCCardCollectionCell *)cardCell { - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [cardCell setBorderColor:nil forState:state]; } - + cardCell.backgroundColor = colorScheme.surfaceColor; UIColor *borderColor = [colorScheme.onSurfaceColor colorWithAlphaComponent:kStrokeVariantBorderOpacity]; diff --git a/components/Cards/src/MDCCard.m b/components/Cards/src/MDCCard.m index 22d777a0611..38eb54ee157 100644 --- a/components/Cards/src/MDCCard.m +++ b/components/Cards/src/MDCCard.m @@ -63,8 +63,8 @@ - (void)commonMDCCardInit { if (_inkView == nil) { _inkView = [[MDCInkView alloc] initWithFrame:self.bounds]; - _inkView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleHeight); + _inkView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _inkView.usesLegacyInkRipple = NO; _inkView.layer.zPosition = FLT_MAX; [self addSubview:_inkView]; diff --git a/components/Cards/src/MDCCardCollectionCell.m b/components/Cards/src/MDCCardCollectionCell.m index 3945067e6e9..3a7ca22e8cf 100644 --- a/components/Cards/src/MDCCardCollectionCell.m +++ b/components/Cards/src/MDCCardCollectionCell.m @@ -14,8 +14,8 @@ #import "MDCCardCollectionCell.h" -#import "MaterialMath.h" #import "MaterialIcons+ic_check_circle.h" +#import "MaterialMath.h" #import "MaterialShapes.h" static const CGFloat MDCCardCellCornerRadiusDefault = 4; @@ -30,7 +30,7 @@ @interface MDCCardCollectionCell () @property(nonatomic, readonly, strong) MDCShapedShadowLayer *layer; @end -@implementation MDCCardCollectionCell { +@implementation MDCCardCollectionCell { NSMutableDictionary *_shadowElevations; NSMutableDictionary *_shadowColors; NSMutableDictionary *_borderWidths; @@ -72,7 +72,8 @@ - (instancetype)initWithFrame:(CGRect)frame { - (void)commonMDCCardCollectionCellInit { if (_inkView == nil) { _inkView = [[MDCInkView alloc] initWithFrame:self.bounds]; - _inkView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + _inkView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _inkView.usesLegacyInkRipple = NO; _inkView.layer.zPosition = FLT_MAX; [self addSubview:_inkView]; @@ -82,8 +83,8 @@ - (void)commonMDCCardCollectionCellInit { _selectedImageView = [[UIImageView alloc] init]; _selectedImageView.layer.zPosition = _inkView.layer.zPosition - 1; _selectedImageView.autoresizingMask = - (UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin); + (UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | + UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin); [self.contentView addSubview:_selectedImageView]; _selectedImageView.hidden = YES; } @@ -168,17 +169,13 @@ - (void)setState:(MDCCardCellState)state animated:(BOOL)animated { [self.inkView startTouchBeganAnimationAtPoint:_lastTouch completion:nil]; } else { [self.inkView cancelAllAnimationsAnimated:NO]; - [self.inkView startTouchBeganAtPoint:self.center - animated:NO - withCompletion:nil]; + [self.inkView startTouchBeganAtPoint:self.center animated:NO withCompletion:nil]; } } break; } case MDCCardCellStateNormal: { - [self.inkView startTouchEndAtPoint:_lastTouch - animated:animated - withCompletion:nil]; + [self.inkView startTouchEndAtPoint:_lastTouch animated:animated withCompletion:nil]; break; } case MDCCardCellStateHighlighted: { @@ -379,33 +376,32 @@ - (void)updateImageAlignment { switch (verticalImageAlignment) { case MDCCardCellVerticalImageAlignmentTop: yAlignment = - MDCCardCellSelectedImagePadding + CGRectGetHeight(self.selectedImageView.frame)/2; + MDCCardCellSelectedImagePadding + CGRectGetHeight(self.selectedImageView.frame) / 2; break; case MDCCardCellVerticalImageAlignmentCenter: - yAlignment = CGRectGetHeight(self.bounds)/2; + yAlignment = CGRectGetHeight(self.bounds) / 2; break; case MDCCardCellVerticalImageAlignmentBottom: yAlignment = CGRectGetHeight(self.bounds) - MDCCardCellSelectedImagePadding - - CGRectGetHeight(self.selectedImageView.frame)/2; + CGRectGetHeight(self.selectedImageView.frame) / 2; break; } switch (horizontalImageAlignment) { case MDCCardCellHorizontalImageAlignmentLeft: xAlignment = - MDCCardCellSelectedImagePadding + CGRectGetWidth(self.selectedImageView.frame)/2; + MDCCardCellSelectedImagePadding + CGRectGetWidth(self.selectedImageView.frame) / 2; break; case MDCCardCellHorizontalImageAlignmentCenter: - xAlignment = CGRectGetWidth(self.bounds)/2; + xAlignment = CGRectGetWidth(self.bounds) / 2; break; case MDCCardCellHorizontalImageAlignmentRight: xAlignment = CGRectGetWidth(self.bounds) - MDCCardCellSelectedImagePadding - - CGRectGetWidth(self.selectedImageView.frame)/2; + CGRectGetWidth(self.selectedImageView.frame) / 2; break; } - self.selectedImageView.center = CGPointMake(xAlignment, - yAlignment); + self.selectedImageView.center = CGPointMake(xAlignment, yAlignment); } - (void)setImageTintColor:(UIColor *)imageTintColor forState:(MDCCardCellState)state { diff --git a/components/Cards/src/UICollectionViewController+MDCCardReordering.m b/components/Cards/src/UICollectionViewController+MDCCardReordering.m index d7ca5f4b1a1..8359e2ea8b4 100644 --- a/components/Cards/src/UICollectionViewController+MDCCardReordering.m +++ b/components/Cards/src/UICollectionViewController+MDCCardReordering.m @@ -14,12 +14,11 @@ #import "UICollectionViewController+MDCCardReordering.h" -#import "MaterialInk.h" #import "MDCCardCollectionCell.h" +#import "MaterialInk.h" @implementation UICollectionViewController (MDCCardReordering) - - (void)mdc_setupCardReordering { UILongPressGestureRecognizer *longGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:nil]; diff --git a/components/Cards/tests/unit/MDCCardTests.m b/components/Cards/tests/unit/MDCCardTests.m index e4a809b9d9a..7781f486991 100644 --- a/components/Cards/tests/unit/MDCCardTests.m +++ b/components/Cards/tests/unit/MDCCardTests.m @@ -55,8 +55,7 @@ - (void)testShadowElevationForCard { - (void)testShadowColorForCard { XCTAssertEqual(((MDCShadowLayer *)self.card.layer).shadowColor, [UIColor blackColor].CGColor); - XCTAssertEqual([self.card shadowColorForState:UIControlStateNormal], - [UIColor blackColor]); + XCTAssertEqual([self.card shadowColorForState:UIControlStateNormal], [UIColor blackColor]); [self.card setShadowColor:[UIColor blueColor] forState:UIControlStateNormal]; XCTAssertEqual(((MDCShadowLayer *)self.card.layer).shadowColor, [UIColor blueColor].CGColor); [self.card setShadowColor:[UIColor greenColor] forState:UIControlStateHighlighted]; @@ -139,9 +138,8 @@ - (void)testCellSelectAndUnselect { XCTAssertEqual(((CAShapeLayer *)self.cell.inkView.layer.sublayers.lastObject).fillColor, self.cell.inkView.inkColor.CGColor); XCTAssert( - CGRectEqualToRect( - (((CAShapeLayer *)self.cell.inkView.layer.sublayers.firstObject).frame), - self.cell.inkView.layer.bounds)); + CGRectEqualToRect((((CAShapeLayer *)self.cell.inkView.layer.sublayers.firstObject).frame), + self.cell.inkView.layer.bounds)); self.cell.selected = NO; XCTAssertEqual(((MDCShadowLayer *)self.cell.layer).elevation, 1); XCTAssertEqual(self.cell.cornerRadius, 4); @@ -198,8 +196,7 @@ - (void)testShadowElevationForCell { - (void)testShadowColorForCell { XCTAssertEqual(((MDCShadowLayer *)self.cell.layer).shadowColor, [UIColor blackColor].CGColor); - XCTAssertEqual([self.cell shadowColorForState:MDCCardCellStateNormal], - [UIColor blackColor]); + XCTAssertEqual([self.cell shadowColorForState:MDCCardCellStateNormal], [UIColor blackColor]); [self.cell setShadowColor:[UIColor blueColor] forState:MDCCardCellStateNormal]; XCTAssertEqual(((MDCShadowLayer *)self.cell.layer).shadowColor, [UIColor blueColor].CGColor); [self.cell setShadowColor:[UIColor greenColor] forState:MDCCardCellStateHighlighted]; @@ -299,12 +296,12 @@ - (void)testSettingImageForCell { - (void)testSettingImageTintColorForCell { XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateNormal], nil); [self.cell setImageTintColor:[UIColor blueColor] forState:MDCCardCellStateNormal]; - XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateNormal], - [UIColor blueColor]); + XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateNormal], [UIColor blueColor]); [self.cell setImageTintColor:[UIColor greenColor] forState:MDCCardCellStateHighlighted]; [self.cell setImageTintColor:[UIColor redColor] forState:MDCCardCellStateSelected]; XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateNormal], [UIColor blueColor]); - XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateHighlighted], [UIColor greenColor]); + XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateHighlighted], + [UIColor greenColor]); XCTAssertEqual([self.cell imageTintColorForState:MDCCardCellStateSelected], [UIColor redColor]); UIColor *color = [self.cell imageTintColorForState:MDCCardCellStateHighlighted]; [self.cell setImageTintColor:[UIColor blueColor] forState:MDCCardCellStateHighlighted]; @@ -329,7 +326,7 @@ - (void)testSettingHorizontalImageAlignmentForCell { XCTAssertEqual([self.cell horizontalImageAlignmentForState:MDCCardCellStateSelected], MDCCardCellHorizontalImageAlignmentRight); MDCCardCellHorizontalImageAlignment alignment = - [self.cell horizontalImageAlignmentForState:MDCCardCellStateHighlighted]; + [self.cell horizontalImageAlignmentForState:MDCCardCellStateHighlighted]; [self.cell setHorizontalImageAlignment:MDCCardCellHorizontalImageAlignmentLeft forState:MDCCardCellStateHighlighted]; XCTAssertNotEqual(alignment, @@ -344,9 +341,9 @@ - (void)testSettingVerticalImageAlignmentForCell { XCTAssertEqual([self.cell verticalImageAlignmentForState:MDCCardCellStateNormal], MDCCardCellVerticalImageAlignmentBottom); [self.cell setVerticalImageAlignment:MDCCardCellVerticalImageAlignmentCenter - forState:MDCCardCellStateHighlighted]; + forState:MDCCardCellStateHighlighted]; [self.cell setVerticalImageAlignment:MDCCardCellVerticalImageAlignmentTop - forState:MDCCardCellStateSelected]; + forState:MDCCardCellStateSelected]; XCTAssertEqual([self.cell verticalImageAlignmentForState:MDCCardCellStateNormal], MDCCardCellVerticalImageAlignmentBottom); XCTAssertEqual([self.cell verticalImageAlignmentForState:MDCCardCellStateHighlighted], @@ -354,9 +351,9 @@ - (void)testSettingVerticalImageAlignmentForCell { XCTAssertEqual([self.cell verticalImageAlignmentForState:MDCCardCellStateSelected], MDCCardCellVerticalImageAlignmentTop); MDCCardCellVerticalImageAlignment alignment = - [self.cell verticalImageAlignmentForState:MDCCardCellStateHighlighted]; + [self.cell verticalImageAlignmentForState:MDCCardCellStateHighlighted]; [self.cell setVerticalImageAlignment:MDCCardCellVerticalImageAlignmentBottom - forState:MDCCardCellStateHighlighted]; + forState:MDCCardCellStateHighlighted]; XCTAssertNotEqual(alignment, [self.cell verticalImageAlignmentForState:MDCCardCellStateHighlighted]); } diff --git a/components/Chips/examples/ChipsActionExampleViewController.m b/components/Chips/examples/ChipsActionExampleViewController.m index 2aae2518d21..7faf3711f29 100644 --- a/components/Chips/examples/ChipsActionExampleViewController.m +++ b/components/Chips/examples/ChipsActionExampleViewController.m @@ -51,7 +51,6 @@ - (void)loadView { MDCChipCollectionViewFlowLayout *layout = [[MDCChipCollectionViewFlowLayout alloc] init]; layout.minimumInteritemSpacing = 10; - // Action chips should allow single selection, collection view default is based on single // selection. Note that MDCChipCollectionViewCell manages the state of the chip accordingly. _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; @@ -101,7 +100,6 @@ - (void)switchStyle { } } - - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; @@ -132,7 +130,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection return cell; } -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)collectionView:(UICollectionView *)collectionView + didSelectItemAtIndexPath:(NSIndexPath *)indexPath { // For action chips, we never want the chip to stay in selected state. // Other possible apporaches would be relying on theming or Customizing collectionViewCell // selected state. @@ -140,12 +139,11 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa // Do the action related to the chip [self setTitle:[NSString stringWithFormat:@"Action %d", (int)indexPath.row]]; - } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { _sizingChip.titleLabel.text = self.titles[indexPath.row]; return [_sizingChip sizeThatFits:collectionView.bounds.size]; } @@ -153,14 +151,13 @@ - (CGSize)collectionView:(UICollectionView *)collectionView - (NSArray *)titles { if (!_titles) { _titles = @[ - @"Change Title to Action 0", - @"Change Title to Action 1", - @"Change Title to Action 2", - @"Change Title to Action 3", - ]; + @"Change Title to Action 0", + @"Change Title to Action 1", + @"Change Title to Action 2", + @"Change Title to Action 3", + ]; } return _titles; } @end - diff --git a/components/Chips/examples/ChipsChoiceExampleViewController.m b/components/Chips/examples/ChipsChoiceExampleViewController.m index e95c88b29a7..4267dc2504c 100644 --- a/components/Chips/examples/ChipsChoiceExampleViewController.m +++ b/components/Chips/examples/ChipsChoiceExampleViewController.m @@ -84,7 +84,6 @@ - (void)viewDidLoad { action:@selector(switchStyle)]; } - - (void)switchStyle { self.outlined = !self.isOutlined; NSString *buttonTitle = self.isOutlined ? @"Filled Style" : @"Outlined Style"; @@ -130,9 +129,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { // The size of the chip depends on title here. self.sizingChip.titleLabel.text = self.titles[indexPath.row]; return [self.sizingChip sizeThatFits:collectionView.bounds.size]; diff --git a/components/Chips/examples/ChipsCollectionExampleViewController.m b/components/Chips/examples/ChipsCollectionExampleViewController.m index 40eba55fb8c..a2c21d0ae41 100644 --- a/components/Chips/examples/ChipsCollectionExampleViewController.m +++ b/components/Chips/examples/ChipsCollectionExampleViewController.m @@ -56,38 +56,12 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection - (NSArray *)titles { if (!_titles) { _titles = @[ - @"Truffaut", - @"Farm-to-table", - @"XOXO", - @"Chillwave", - @"Fanny", - @"Pack", - @"Master", - @"Cleanse", - @"Small", - @"Batch", - @"Church-key", - @"Biodiesel", - @"Subway", - @"Tile", - @"Gentrify", - @"Humblebrag", - @"Drinking", - @"Vinegar", - @"Godard", - @"Pug", - @"Marfa", - @"Poutine", - @"Jianbing", - @"Fashion", - @"Axe", - @"Banjo", - @"Vegan", - @"Taxidermy", - @"Portland", - @"Irony", - @"Gastropub", - @"Truffaut" + @"Truffaut", @"Farm-to-table", @"XOXO", @"Chillwave", @"Fanny", @"Pack", + @"Master", @"Cleanse", @"Small", @"Batch", @"Church-key", @"Biodiesel", + @"Subway", @"Tile", @"Gentrify", @"Humblebrag", @"Drinking", @"Vinegar", + @"Godard", @"Pug", @"Marfa", @"Poutine", @"Jianbing", @"Fashion", + @"Axe", @"Banjo", @"Vegan", @"Taxidermy", @"Portland", @"Irony", + @"Gastropub", @"Truffaut" ]; } return _titles; diff --git a/components/Chips/examples/ChipsCustomizedExampleViewController.m b/components/Chips/examples/ChipsCustomizedExampleViewController.m index bf7dae59773..4cab6edbdc8 100644 --- a/components/Chips/examples/ChipsCustomizedExampleViewController.m +++ b/components/Chips/examples/ChipsCustomizedExampleViewController.m @@ -90,8 +90,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { NSArray *selectedPaths = [collectionView indexPathsForSelectedItems]; _sizingChip.selected = [selectedPaths containsObject:indexPath]; _sizingChip.titleLabel.text = self.titles[indexPath.row]; @@ -129,4 +129,3 @@ - (NSArray *)titles { } @end - diff --git a/components/Chips/examples/ChipsFilterAnimatedExampleViewController.m b/components/Chips/examples/ChipsFilterAnimatedExampleViewController.m index e31e848b539..1d8b780d5bd 100644 --- a/components/Chips/examples/ChipsFilterAnimatedExampleViewController.m +++ b/components/Chips/examples/ChipsFilterAnimatedExampleViewController.m @@ -21,4 +21,3 @@ - (BOOL)shouldAnimateResize { } @end - diff --git a/components/Chips/examples/ChipsFilterExampleViewController.m b/components/Chips/examples/ChipsFilterExampleViewController.m index 4021bcff53b..98c1d9060f9 100644 --- a/components/Chips/examples/ChipsFilterExampleViewController.m +++ b/components/Chips/examples/ChipsFilterExampleViewController.m @@ -139,8 +139,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { // The size of the chip depends on title, image and selection state. _sizingChip.selected = [_selectedIndecies containsObject:indexPath]; _sizingChip.titleLabel.text = self.titles[indexPath.row]; @@ -165,18 +165,18 @@ - (void)collectionView:(UICollectionView *)collectionView - (NSArray *)titles { if (!_titles) { _titles = @[ - @"Doorman", - @"Elevator", - @"Garage Parking", - @"Gym", - @"Laundry in Building", - @"Green Building", - @"Parking Available", - @"Pets Allowed", - @"Pied-a-Terre Allowed", - @"Swimming Pool", - @"Smoke-free", - ]; + @"Doorman", + @"Elevator", + @"Garage Parking", + @"Gym", + @"Laundry in Building", + @"Green Building", + @"Parking Available", + @"Pets Allowed", + @"Pied-a-Terre Allowed", + @"Swimming Pool", + @"Smoke-free", + ]; } return _titles; } @@ -186,4 +186,3 @@ - (BOOL)shouldAnimateResize { } @end - diff --git a/components/Chips/examples/ChipsInputExampleViewController.m b/components/Chips/examples/ChipsInputExampleViewController.m index c014d1c5ca8..399dd2e0bb4 100644 --- a/components/Chips/examples/ChipsInputExampleViewController.m +++ b/components/Chips/examples/ChipsInputExampleViewController.m @@ -74,7 +74,7 @@ - (void)chipFieldHeightDidChange:(MDCChipField *)chipField { - (void)chipField:(MDCChipField *)chipField didAddChip:(MDCChipView *)chip { // Every other chip is stroked - if (chipField.chips.count%2) { + if (chipField.chips.count % 2) { [chip applyOutlinedThemeWithScheme:[self containerScheme]]; } else { [chip applyThemeWithScheme:[self containerScheme]]; diff --git a/components/Chips/examples/ChipsShapingExampleViewController.m b/components/Chips/examples/ChipsShapingExampleViewController.m index 34c4e4a7ba7..16ccd6d66d0 100644 --- a/components/Chips/examples/ChipsShapingExampleViewController.m +++ b/components/Chips/examples/ChipsShapingExampleViewController.m @@ -22,7 +22,7 @@ #import "MaterialSlider+ColorThemer.h" #import "MaterialSlider.h" -@interface ChipsShapingExampleViewController() +@interface ChipsShapingExampleViewController () @property(nonatomic, strong) MDCSemanticColorScheme *colorScheme; @property(nonatomic, strong) MDCShapeScheme *shapeScheme; @property(nonatomic, strong) MDCTypographyScheme *typographyScheme; @@ -96,15 +96,10 @@ - (void)viewWillLayoutSubviews { CGSize sliderSize = [_cornerSlider sizeThatFits:self.view.bounds.size]; _cornerSlider.frame = CGRectMake(20, 140, self.view.bounds.size.width - 40, sliderSize.height); - _cornerSlider.frame = - CGRectMake(20, - 140 + sliderSize.height + 20, - self.view.bounds.size.width - 40, - sliderSize.height); + _cornerSlider.frame = CGRectMake(20, 140 + sliderSize.height + 20, + self.view.bounds.size.width - 40, sliderSize.height); _cornerStyleControl.frame = - CGRectMake(20, - CGRectGetMaxY(_cornerSlider.frame) + 20, - self.view.bounds.size.width - 40, + CGRectMake(20, CGRectGetMaxY(_cornerSlider.frame) + 20, self.view.bounds.size.width - 40, _cornerStyleControl.frame.size.height); [self cornerSliderChanged:_cornerSlider]; diff --git a/components/Chips/examples/ChipsSizingExampleViewController.m b/components/Chips/examples/ChipsSizingExampleViewController.m index 1522f4f597c..3ffe4b98ed4 100644 --- a/components/Chips/examples/ChipsSizingExampleViewController.m +++ b/components/Chips/examples/ChipsSizingExampleViewController.m @@ -36,7 +36,7 @@ - (void)viewDidLoad { [self.view addSubview:_chipView]; CGSize chipSize = [_chipView sizeThatFits:self.view.bounds.size]; - _chipView.frame = (CGRect) { CGPointMake(20, 20), chipSize }; + _chipView.frame = (CGRect){CGPointMake(20, 20), chipSize}; _widthSlider = [[MDCSlider alloc] initWithFrame:CGRectZero]; _widthSlider.maximumValue = 200; @@ -54,7 +54,8 @@ - (void)viewDidLoad { forControlEvents:UIControlEventValueChanged]; [self.view addSubview:_heightSlider]; - _horizontalAlignmentControl = [[UISegmentedControl alloc] initWithItems:@[ @"Default", @"Centered" ]]; + _horizontalAlignmentControl = + [[UISegmentedControl alloc] initWithItems:@[ @"Default", @"Centered" ]]; _horizontalAlignmentControl.selectedSegmentIndex = 0; [_horizontalAlignmentControl addTarget:self action:@selector(horizontalAlignmentChanged:) @@ -67,10 +68,11 @@ - (void)viewWillLayoutSubviews { CGSize sliderSize = [_widthSlider sizeThatFits:self.view.bounds.size]; _widthSlider.frame = CGRectMake(20, 140, self.view.bounds.size.width - 40, sliderSize.height); - _heightSlider.frame = - CGRectMake(20, 140 + sliderSize.height + 20, self.view.bounds.size.width - 40, sliderSize.height); + _heightSlider.frame = CGRectMake(20, 140 + sliderSize.height + 20, + self.view.bounds.size.width - 40, sliderSize.height); _horizontalAlignmentControl.frame = - CGRectMake(20, CGRectGetMaxY(_heightSlider.frame) + 20, self.view.bounds.size.width - 40, _horizontalAlignmentControl.frame.size.height); + CGRectMake(20, CGRectGetMaxY(_heightSlider.frame) + 20, self.view.bounds.size.width - 40, + _horizontalAlignmentControl.frame.size.height); } - (void)widthSliderChanged:(MDCSlider *)slider { @@ -89,8 +91,8 @@ - (void)heightSliderChanged:(MDCSlider *)slider { - (void)horizontalAlignmentChanged:(UISegmentedControl *)segmentedControl { UIControlContentHorizontalAlignment alignment = (segmentedControl.selectedSegmentIndex == 0) - ? UIControlContentHorizontalAlignmentFill - : UIControlContentHorizontalAlignmentCenter; + ? UIControlContentHorizontalAlignmentFill + : UIControlContentHorizontalAlignmentCenter; _chipView.contentHorizontalAlignment = alignment; [_chipView layoutIfNeeded]; } diff --git a/components/Chips/examples/ChipsTypicalUseViewController.m b/components/Chips/examples/ChipsTypicalUseViewController.m index e5fb71ce60e..342ec70d0f6 100644 --- a/components/Chips/examples/ChipsTypicalUseViewController.m +++ b/components/Chips/examples/ChipsTypicalUseViewController.m @@ -45,8 +45,7 @@ - (void)dealloc { - (void)viewDidLoad { [super viewDidLoad]; - [MDCChipViewTypographyThemer applyTypographyScheme:self.typographyScheme - toChipView:_sizingChip]; + [MDCChipViewTypographyThemer applyTypographyScheme:self.typographyScheme toChipView:_sizingChip]; [MDCChipViewShapeThemer applyShapeScheme:self.shapeScheme toChipView:_sizingChip]; if (@available(iOS 11.0, *)) { @@ -65,9 +64,9 @@ - (void)viewDidLoad { target:self action:@selector(clearSelected)]; - NSDictionary *enabledAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; + NSDictionary *enabledAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; NSDictionary *disabledAttributes = - @{NSForegroundColorAttributeName: [UIColor colorWithWhite:1 alpha:0.75]}; + @{NSForegroundColorAttributeName : [UIColor colorWithWhite:1 alpha:0.75]}; [self.navigationItem.rightBarButtonItem setTitleTextAttributes:enabledAttributes forState:UIControlStateNormal]; [self.navigationItem.rightBarButtonItem setTitleTextAttributes:disabledAttributes @@ -128,8 +127,8 @@ - (void)collectionView:(UICollectionView *)collectionView } - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout*)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { NSArray *selectedPaths = [collectionView indexPathsForSelectedItems]; _sizingChip.selected = [selectedPaths containsObject:indexPath]; diff --git a/components/Chips/examples/supplemental/ChipsExamplesSupplemental.m b/components/Chips/examples/supplemental/ChipsExamplesSupplemental.m index c5aba6c3e96..b1f66801051 100644 --- a/components/Chips/examples/supplemental/ChipsExamplesSupplemental.m +++ b/components/Chips/examples/supplemental/ChipsExamplesSupplemental.m @@ -74,9 +74,9 @@ @implementation ChipsChoiceExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Choice" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Chips", @"Choice" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -89,9 +89,9 @@ @implementation ChipsActionExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Action" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Chips", @"Action" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -104,9 +104,9 @@ @implementation ChipsCollectionExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Collections" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Chips", @"Collections" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -116,9 +116,9 @@ @implementation ChipsCustomizedExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Customized" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Chips", @"Customized" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -132,9 +132,9 @@ @implementation ChipsFilterExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Filter" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Chips", @"Filter" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -148,9 +148,9 @@ @implementation ChipsFilterAnimatedExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Filter Animated" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Chips", @"Filter Animated" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -167,9 +167,9 @@ @implementation ChipsInputExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Input" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Chips", @"Input" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -179,9 +179,9 @@ @implementation ChipsSizingExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Sizing" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Chips", @"Sizing" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -199,10 +199,10 @@ @implementation ChipsTypicalUseViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Chips" ], - @"description": @"Chips are compact elements that represent an input, attribute, or action.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Chips", @"Chips" ], + @"description" : @"Chips are compact elements that represent an input, attribute, or action.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -216,9 +216,9 @@ @implementation ChipsShapingExampleViewController (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Chips", @"Shaped Chip" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Chips", @"Shaped Chip" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Chips/src/ChipThemer/MDCChipViewThemer.m b/components/Chips/src/ChipThemer/MDCChipViewThemer.m index ba5414292e4..df98dbd7179 100644 --- a/components/Chips/src/ChipThemer/MDCChipViewThemer.m +++ b/components/Chips/src/ChipThemer/MDCChipViewThemer.m @@ -20,11 +20,9 @@ @implementation MDCChipViewThemer -+ (void)applyScheme:(nonnull id)scheme - toChipView:(nonnull MDCChipView *)chip { - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; ++ (void)applyScheme:(nonnull id)scheme toChipView:(nonnull MDCChipView *)chip { + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [chip setBorderWidth:0 forState:state]; } @@ -35,9 +33,8 @@ + (void)applyScheme:(nonnull id)scheme + (void)applyOutlinedVariantWithScheme:(nonnull id)scheme toChipView:(nonnull MDCChipView *)chip { - NSUInteger maximumStateValue = - UIControlStateNormal | UIControlStateSelected | UIControlStateHighlighted | - UIControlStateDisabled; + NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [chip setBorderWidth:1 forState:state]; } @@ -47,5 +44,3 @@ + (void)applyOutlinedVariantWithScheme:(nonnull id)scheme } @end - - diff --git a/components/Chips/src/ColorThemer/MDCChipViewColorThemer.m b/components/Chips/src/ColorThemer/MDCChipViewColorThemer.m index bf8e527657e..2cb77287626 100644 --- a/components/Chips/src/ColorThemer/MDCChipViewColorThemer.m +++ b/components/Chips/src/ColorThemer/MDCChipViewColorThemer.m @@ -23,18 +23,14 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme UIColor *onSurface87Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.87]; UIColor *onSurface16Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.16]; - UIColor *backgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *selectedBackgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:backgroundColor]; - UIColor *textColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:backgroundColor]; - UIColor *selectedTextColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:selectedBackgroundColor]; + UIColor *backgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *selectedBackgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:backgroundColor]; + UIColor *textColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:backgroundColor]; + UIColor *selectedTextColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:selectedBackgroundColor]; [chipView setInkColor:onSurface16Opacity forState:UIControlStateNormal]; [chipView setTitleColor:textColor forState:UIControlStateNormal]; @@ -55,18 +51,14 @@ + (void)applyOutlinedVariantWithColorScheme:(nonnull id)colorS UIColor *onSurface12Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.12]; UIColor *onSurface87Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.87]; UIColor *onSurface16Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.16]; - UIColor *selectedBackgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *borderColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *textColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *selectedTextColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:selectedBackgroundColor]; + UIColor *selectedBackgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *borderColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *textColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *selectedTextColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:selectedBackgroundColor]; [chipView setInkColor:onSurface16Opacity forState:UIControlStateNormal]; [chipView setTitleColor:textColor forState:UIControlStateNormal]; @@ -91,18 +83,14 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme UIColor *onSurface12Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.12]; UIColor *onSurface87Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.87]; UIColor *onSurface16Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.16]; - UIColor *selectedBackgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *borderColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *textColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:colorScheme.surfaceColor]; - UIColor *selectedTextColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:selectedBackgroundColor]; + UIColor *selectedBackgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *borderColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *textColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:colorScheme.surfaceColor]; + UIColor *selectedTextColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:selectedBackgroundColor]; [strokedChipView setInkColor:onSurface16Opacity forState:UIControlStateNormal]; [strokedChipView setTitleColor:textColor forState:UIControlStateNormal]; @@ -124,7 +112,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme + (void)resetUIControlStatesForChipTheming:(nonnull MDCChipView *)chipView { NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [chipView setBackgroundColor:nil forState:state]; [chipView setTitleColor:nil forState:state]; diff --git a/components/Chips/src/MDCChipCollectionViewCell.m b/components/Chips/src/MDCChipCollectionViewCell.m index 7505ad957b0..1c03041b26b 100644 --- a/components/Chips/src/MDCChipCollectionViewCell.m +++ b/components/Chips/src/MDCChipCollectionViewCell.m @@ -48,10 +48,11 @@ - (void)layoutSubviews { } if (animated) { - [UIView animateWithDuration:0.25 animations:^{ - self.chipView.frame = self.bounds; - [self.chipView layoutIfNeeded]; - }]; + [UIView animateWithDuration:0.25 + animations:^{ + self.chipView.frame = self.bounds; + [self.chipView layoutIfNeeded]; + }]; } else { _chipView.frame = self.bounds; } diff --git a/components/Chips/src/MDCChipCollectionViewFlowLayout.m b/components/Chips/src/MDCChipCollectionViewFlowLayout.m index cde8441c6df..cd4abba6958 100644 --- a/components/Chips/src/MDCChipCollectionViewFlowLayout.m +++ b/components/Chips/src/MDCChipCollectionViewFlowLayout.m @@ -17,17 +17,12 @@ /* Left aligns one rect to another with a given padding */ static inline CGRect CGRectLeftAlignToRect(CGRect rect, CGRect staticRect, CGFloat padding) { - return CGRectMake(CGRectGetMaxX(staticRect) + padding, - CGRectGetMinY(rect), - CGRectGetWidth(rect), + return CGRectMake(CGRectGetMaxX(staticRect) + padding, CGRectGetMinY(rect), CGRectGetWidth(rect), CGRectGetHeight(rect)); } static inline CGRect CGRectLeftAlign(CGRect rect) { - return CGRectMake(0, - CGRectGetMinY(rect), - CGRectGetWidth(rect), - CGRectGetHeight(rect)); + return CGRectMake(0, CGRectGetMinY(rect), CGRectGetWidth(rect), CGRectGetHeight(rect)); } @implementation MDCChipCollectionViewFlowLayout diff --git a/components/Chips/src/MDCChipField.m b/components/Chips/src/MDCChipField.m index dd4024642c7..a200f28ec59 100644 --- a/components/Chips/src/MDCChipField.m +++ b/components/Chips/src/MDCChipField.m @@ -19,8 +19,8 @@ #import "MaterialMath.h" #import "MaterialTextFields.h" -NSString * const MDCEmptyTextString = @""; -NSString * const MDCChipDelimiterSpace = @" "; +NSString *const MDCEmptyTextString = @""; +NSString *const MDCChipDelimiterSpace = @" "; static const CGFloat MDCChipFieldHorizontalInset = 15; static const CGFloat MDCChipFieldVerticalInset = 8; @@ -68,7 +68,8 @@ - (void)deleteBackward { } } -#if MDC_CHIPFIELD_PRIVATE_API_BUG_FIX && !(defined(__IPHONE_8_3) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_3)) +#if MDC_CHIPFIELD_PRIVATE_API_BUG_FIX && \ + !(defined(__IPHONE_8_3) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_3)) // WARNING: This is a private method, see the warning in MDCChipField.h. // This is only compiled if you explicitly defined MDC_CHIPFIELD_PRIVATE_API_BUG_FIX yourself, and @@ -76,8 +77,10 @@ - (void)deleteBackward { - (BOOL)keyboardInputShouldDelete:(UITextField *)textField { BOOL shouldDelete = YES; if ([UITextField instancesRespondToSelector:_cmd]) { + // clang-format off BOOL (*keyboardInputShouldDelete)(id, SEL, UITextField *) = - (BOOL (*)(id, SEL, UITextField *))[UITextField instanceMethodForSelector:_cmd]; + (BOOL(*)(id, SEL, UITextField *))[UITextField instanceMethodForSelector:_cmd]; + // clang-format on if (keyboardInputShouldDelete) { shouldDelete = keyboardInputShouldDelete(self, _cmd, textField); NSOperatingSystemVersion minimumVersion = {8, 0, 0}; @@ -99,10 +102,8 @@ - (BOOL)keyboardInputShouldDelete:(UITextField *)textField { - (CGRect)accessibilityFrame { CGRect frame = [super accessibilityFrame]; - return CGRectMake(frame.origin.x + self.textInsets.left, - frame.origin.y, - frame.size.width - self.textInsets.left, - frame.size.height); + return CGRectMake(frame.origin.x + self.textInsets.left, frame.origin.y, + frame.size.width - self.textInsets.left, frame.size.height); } @end @@ -223,14 +224,13 @@ - (CGSize)intrinsicContentSize { - (CGSize)sizeThatFits:(CGSize)size { NSArray *chipFrames = [self chipFramesForSize:size]; CGRect lastChipFrame = [chipFrames.lastObject CGRectValue]; - CGRect textFieldFrame = [self frameForTextFieldForLastChipFrame:lastChipFrame - chipFieldSize:size]; + CGRect textFieldFrame = [self frameForTextFieldForLastChipFrame:lastChipFrame chipFieldSize:size]; // Calculate the required size off the text field. // To properly apply bottom inset: Calculate what would be the height if there were a chip // instead of the text field. Then add the bottom inset. CGFloat height = CGRectGetMaxY(textFieldFrame) + self.contentEdgeInsets.bottom + - (self.chipHeight - textFieldFrame.size.height) / 2; + (self.chipHeight - textFieldFrame.size.height) / 2; CGFloat width = MAX(size.width, self.minTextFieldWidth); return CGSizeMake(width, height); @@ -611,8 +611,7 @@ - (void)textFieldDidChange { [self createNewChipWithTextField:self.textField delimiter:MDCChipFieldDelimiterSpace]; if ([self.delegate respondsToSelector:@selector(chipField:didChangeInput:)]) { - [self.delegate chipField:self - didChangeInput:[self.textField.text copy]]; + [self.delegate chipField:self didChangeInput:[self.textField.text copy]]; } } @@ -621,15 +620,15 @@ - (void)textFieldDidChange { - (void)removeChipSubview:(MDCChipView *)chip { [chip removeFromSuperview]; [chip removeTarget:chip.superview - action:@selector(chipTapped:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(chipTapped:) + forControlEvents:UIControlEventTouchUpInside]; } - (void)addChipSubview:(MDCChipView *)chip { if (chip.superview != self) { [chip addTarget:self - action:@selector(chipTapped:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(chipTapped:) + forControlEvents:UIControlEventTouchUpInside]; [self addSubview:chip]; } } @@ -684,8 +683,7 @@ - (BOOL)isTextFieldEmpty { } CGFloat currentOriginY = self.contentEdgeInsets.top + (row * (self.chipHeight + MDCChipFieldVerticalMargin)); - CGRect chipFrame = - CGRectMake(currentOriginX, currentOriginY, chipSize.width, chipSize.height); + CGRect chipFrame = CGRectMake(currentOriginX, currentOriginY, chipSize.width, chipSize.height); [chipFrames addObject:[NSValue valueWithCGRect:chipFrame]]; currentOriginX = CGRectGetMaxX(chipFrame) + MDCChipFieldHorizontalMargin; } @@ -707,7 +705,7 @@ - (CGRect)frameForTextFieldForLastChipFrame:(CGRect)lastChipFrame } CGFloat availableWidth = chipFieldSize.width - self.contentEdgeInsets.right - - CGRectGetMaxX(lastChipFrame) - MDCChipFieldHorizontalMargin; + CGRectGetMaxX(lastChipFrame) - MDCChipFieldHorizontalMargin; CGFloat placeholderDesiredWidth = [self placeholderDesiredWidth]; if (availableWidth < placeholderDesiredWidth) { // The text field doesn't fit on the line with the last chip. @@ -727,7 +725,9 @@ - (CGFloat)placeholderDesiredWidth { CGRect placeholderDesiredRect = [placeholder boundingRectWithSize:CGRectStandardize(self.bounds).size options:NSStringDrawingUsesLineFragmentOrigin - attributes:@{ NSFontAttributeName : placeholderFont, } + attributes:@{ + NSFontAttributeName : placeholderFont, + } context:nil]; return MAX(CGRectGetWidth(placeholderDesiredRect), self.minTextFieldWidth); } @@ -741,7 +741,7 @@ - (UIEdgeInsets)textInsets:(UIEdgeInsets)defaultInsets { } CGFloat availableWidth = CGRectGetWidth(self.bounds) - self.contentEdgeInsets.right - - CGRectGetMaxX(lastChipFrame) - MDCChipFieldHorizontalMargin; + CGRectGetMaxX(lastChipFrame) - MDCChipFieldHorizontalMargin; CGFloat leftInset = MDCChipFieldIndent; if (!CGRectIsEmpty(lastChipFrame) && availableWidth >= [self placeholderDesiredWidth]) { diff --git a/components/Chips/src/MDCChipView.m b/components/Chips/src/MDCChipView.m index 322ffd8de4a..0e10694e881 100644 --- a/components/Chips/src/MDCChipView.m +++ b/components/Chips/src/MDCChipView.m @@ -18,8 +18,8 @@ #import "MaterialInk.h" #import "MaterialMath.h" -#import "MaterialShadowLayer.h" #import "MaterialShadowElevations.h" +#import "MaterialShadowLayer.h" #import "MaterialShapes.h" #import "MaterialTypography.h" @@ -73,11 +73,8 @@ static CGRect CGRectVerticallyCentered(CGRect rect, return CGRectOffset(rect, 0, yValue); } -static inline CGRect MDCChipBuildFrame(UIEdgeInsets insets, - CGSize size, - CGFloat xOffset, - CGFloat chipHeight, - CGFloat pixelScale) { +static inline CGRect MDCChipBuildFrame( + UIEdgeInsets insets, CGSize size, CGFloat xOffset, CGFloat chipHeight, CGFloat pixelScale) { CGRect frame = CGRectMake(xOffset + insets.left, insets.top, size.width, size.height); return CGRectVerticallyCentered(frame, insets, chipHeight, pixelScale); } @@ -201,11 +198,11 @@ - (instancetype)initWithFrame:(CGRect)frame { // Because this is not exposed externally, we can't use -touchesMoved: to calculate when to // change ink state. So instead we fall back on adding target/actions for these specific events. [self addTarget:self - action:@selector(touchDragEnter:forEvent:) - forControlEvents:UIControlEventTouchDragEnter]; + action:@selector(touchDragEnter:forEvent:) + forControlEvents:UIControlEventTouchDragEnter]; [self addTarget:self - action:@selector(touchDragExit:forEvent:) - forControlEvents:UIControlEventTouchDragExit]; + action:@selector(touchDragExit:forEvent:) + forControlEvents:UIControlEventTouchDragExit]; self.layer.elevation = [self elevationForState:UIControlStateNormal]; self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill; @@ -460,9 +457,9 @@ - (void)updateTitleFont { if (customTitleFont) { // If we are automatically adjusting for Dynamic Type resize the font based on the text style if (_mdc_adjustsFontForContentSizeCategory) { - self.titleLabel.font = - [customTitleFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + self.titleLabel.font = [customTitleFont + mdc_fontSizedForMaterialTextStyle:kTitleTextStyle + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { self.titleLabel.font = customTitleFont; } @@ -477,9 +474,9 @@ - (void)updateTitleFont { } else { // There is a custom font loader, retrieve the font and scale it. UIFont *customTypographyFont = [MDCTypography buttonFont]; - _titleLabel.font = - [customTypographyFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + _titleLabel.font = [customTypographyFont + mdc_fontSizedForMaterialTextStyle:kTitleTextStyle + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } } else { // If we are using the default (system) font loader, retrieve the @@ -501,8 +498,8 @@ - (void)updateTitleColor { } - (void)updateAccessibility { - - // Clearing and then adding the relevant traits based on current the state (while accommodating concurrent states). + // Clearing and then adding the relevant traits based on current the state (while accommodating + // concurrent states). self.accessibilityTraits &= ~(UIAccessibilityTraitSelected | UIAccessibilityTraitNotEnabled); if ((self.state & UIControlStateSelected) == UIControlStateSelected) { @@ -589,8 +586,7 @@ - (void)layoutSubviews { // Handle RTL if (self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { for (UIView *subview in self.subviews) { - CGRect flippedRect = - MDFRectFlippedHorizontally(subview.frame, CGRectGetWidth(self.bounds)); + CGRect flippedRect = MDFRectFlippedHorizontally(subview.frame, CGRectGetWidth(self.bounds)); subview.frame = flippedRect; } } @@ -615,8 +611,9 @@ - (CGRect)contentRect { maxImageWidth = [self sizeForImageView:self.imageView maxSize:maxContentSize].width; } if (self.showSelectedImageView) { - maxImageWidth = MAX( - maxImageWidth, [self sizeForImageView:self.selectedImageView maxSize:maxContentSize].width); + maxImageWidth = + MAX(maxImageWidth, + [self sizeForImageView:self.selectedImageView maxSize:maxContentSize].width); } neededContentWidth += maxImageWidth + UIEdgeInsetsHorizontal(self.imagePadding); } @@ -652,11 +649,8 @@ - (CGRect)frameForImageView:(UIImageView *)imageView visible:(BOOL)visible { CGRect frame = CGRectMake(CGRectGetMinX(self.contentRect), CGRectGetMidY(self.contentRect), 0, 0); if (visible) { CGSize selectedSize = [self sizeForImageView:imageView maxSize:self.contentRect.size]; - frame = MDCChipBuildFrame(_imagePadding, - selectedSize, - CGRectGetMinX(self.contentRect), - CGRectGetHeight(self.frame), - self.pixelScale); + frame = MDCChipBuildFrame(_imagePadding, selectedSize, CGRectGetMinX(self.contentRect), + CGRectGetHeight(self.frame), self.pixelScale); } return frame; } @@ -672,10 +666,7 @@ - (CGRect)accessoryViewFrame { size = [self sizeForAccessoryViewWithMaxSize:self.contentRect.size]; } CGFloat xOffset = CGRectGetMaxX(self.contentRect) - size.width - _accessoryPadding.right; - return MDCChipBuildFrame(_accessoryPadding, - size, - xOffset, - CGRectGetHeight(self.frame), + return MDCChipBuildFrame(_accessoryPadding, size, xOffset, CGRectGetHeight(self.frame), self.pixelScale); } @@ -686,11 +677,12 @@ - (CGSize)sizeForAccessoryViewWithMaxSize:(CGSize)maxSize { - (CGRect)titleLabelFrame { CGRect imageFrame = CGRectUnion(_imageView.frame, _selectedImageView.frame); - CGFloat maximumTitleWidth = CGRectGetWidth(self.contentRect) - CGRectGetWidth(imageFrame) - - UIEdgeInsetsHorizontal(_titlePadding) + UIEdgeInsetsHorizontal(_imagePadding); + CGFloat maximumTitleWidth = CGRectGetWidth(self.contentRect) - CGRectGetWidth(imageFrame) - + UIEdgeInsetsHorizontal(_titlePadding) + + UIEdgeInsetsHorizontal(_imagePadding); if (self.showAccessoryView) { - maximumTitleWidth -= CGRectGetWidth(_accessoryView.frame) + - UIEdgeInsetsHorizontal(_accessoryPadding); + maximumTitleWidth -= + CGRectGetWidth(_accessoryView.frame) + UIEdgeInsetsHorizontal(_accessoryPadding); } CGFloat maximumTitleHeight = CGRectGetHeight(self.contentRect) - UIEdgeInsetsVertical(_titlePadding); @@ -699,10 +691,7 @@ - (CGRect)titleLabelFrame { titleSize.width = MAX(0, maximumTitleWidth); CGFloat imageRightEdge = CGRectGetMaxX(imageFrame) + _imagePadding.right; - return MDCChipBuildFrame(_titlePadding, - titleSize, - imageRightEdge, - CGRectGetHeight(self.frame), + return MDCChipBuildFrame(_titlePadding, titleSize, imageRightEdge, CGRectGetHeight(self.frame), self.pixelScale); } @@ -716,8 +705,8 @@ - (CGSize)sizeThatFits:(CGSize)size { CGSize selectedSize = CGSizeZero; if (self.showImageView) { - imageSize = CGSizeExpandWithInsets([_imageView sizeThatFits:imagePaddedSize], - self.imagePadding); + imageSize = + CGSizeExpandWithInsets([_imageView sizeThatFits:imagePaddedSize], self.imagePadding); } if (self.showSelectedImageView) { selectedSize = CGSizeExpandWithInsets([_selectedImageView sizeThatFits:imagePaddedSize], diff --git a/components/Chips/tests/unit/ChipAccessibilityTests.m b/components/Chips/tests/unit/ChipAccessibilityTests.m index b83702d35e8..9476e08dc5c 100644 --- a/components/Chips/tests/unit/ChipAccessibilityTests.m +++ b/components/Chips/tests/unit/ChipAccessibilityTests.m @@ -37,51 +37,68 @@ - (void)testAccessibilityLabel { NSString *chipLabel = @"Test1"; [chip.titleLabel setText:chipLabel]; XCTAssertTrue(chip.isAccessibilityElement, @"Chip view should be the accessibility element"); - XCTAssertEqual(chip.accessibilityLabel, chipLabel, @"Chip accessibility label should be: [%@]", chipLabel); + XCTAssertEqual(chip.accessibilityLabel, chipLabel, @"Chip accessibility label should be: [%@]", + chipLabel); } - (void)testAccessibleEnabledState { chip.enabled = YES; - XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, UIAccessibilityTraitNotEnabled, @"Chip accessibility should be enabled"); + XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, + UIAccessibilityTraitNotEnabled, @"Chip accessibility should be enabled"); chip.selected = YES; chip.highlighted = YES; - XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, UIAccessibilityTraitNotEnabled, @"Chip accessibility should be enabled when selected & highlighted"); + XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, + UIAccessibilityTraitNotEnabled, + @"Chip accessibility should be enabled when selected & highlighted"); } - (void)testAccessibleDisabledState { chip.enabled = NO; - XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, UIAccessibilityTraitNotEnabled, @"Chip accessibility should be disabled"); + XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, + UIAccessibilityTraitNotEnabled, @"Chip accessibility should be disabled"); chip.selected = YES; chip.highlighted = YES; - XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, UIAccessibilityTraitNotEnabled, @"Chip accessibility should be disabled when selected & highlighted"); + XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitNotEnabled, + UIAccessibilityTraitNotEnabled, + @"Chip accessibility should be disabled when selected & highlighted"); } - (void)testAccessibleSelectedState { chip.selected = YES; - XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be selected"); + XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, @"Chip accessibility should be selected"); chip.enabled = YES; chip.highlighted = YES; - XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be selected when enabled & highlighted"); + XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, + @"Chip accessibility should be selected when enabled & highlighted"); chip.enabled = NO; chip.highlighted = YES; - XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be selected when disabled & highlighted"); + XCTAssertEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, + @"Chip accessibility should be selected when disabled & highlighted"); } - (void)testAccessibleDeselectedState { chip.selected = NO; - XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be de-selected"); + XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, @"Chip accessibility should be de-selected"); chip.enabled = YES; chip.highlighted = YES; - XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be de-selected when enabled & highlighted"); + XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, + @"Chip accessibility should be de-selected when enabled & highlighted"); chip.enabled = NO; chip.highlighted = YES; - XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, UIAccessibilityTraitSelected, @"Chip accessibility should be de-selected when disabled & highlighted"); + XCTAssertNotEqual(chip.accessibilityTraits & UIAccessibilityTraitSelected, + UIAccessibilityTraitSelected, + @"Chip accessibility should be de-selected when disabled & highlighted"); } - (void)testAccessibilityLabel_default { diff --git a/components/Chips/tests/unit/ChipViewColorThemerTests.m b/components/Chips/tests/unit/ChipViewColorThemerTests.m index f0b99f8bd3b..8241410d616 100644 --- a/components/Chips/tests/unit/ChipViewColorThemerTests.m +++ b/components/Chips/tests/unit/ChipViewColorThemerTests.m @@ -14,13 +14,13 @@ #import -#import "MaterialChips.h" #import "MaterialChips+ColorThemer.h" +#import "MaterialChips.h" @interface ChipViewColorThemerTests : XCTestCase -@property (nonatomic, strong) MDCChipView *chip; -@property (nonatomic, strong) MDCSemanticColorScheme *colorScheme; +@property(nonatomic, strong) MDCChipView *chip; +@property(nonatomic, strong) MDCSemanticColorScheme *colorScheme; @end @@ -46,18 +46,14 @@ - (void)testInputChipViewColorThemer { UIColor *onSurface16Opacity = [self.colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.16]; - UIColor *backgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:self.colorScheme.surfaceColor]; - UIColor *selectedBackgroundColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:backgroundColor]; - UIColor *textColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:backgroundColor]; - UIColor *selectedTextColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:selectedBackgroundColor]; + UIColor *backgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:self.colorScheme.surfaceColor]; + UIColor *selectedBackgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:backgroundColor]; + UIColor *textColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:backgroundColor]; + UIColor *selectedTextColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:selectedBackgroundColor]; XCTAssertEqualObjects([self.chip inkColorForState:UIControlStateNormal], onSurface16Opacity); XCTAssertEqualObjects([self.chip titleColorForState:UIControlStateNormal], textColor); @@ -83,15 +79,12 @@ - (void)testStrokedChipViewColorThemer { UIColor *selectedBackgroundColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity withBackgroundColor:self.colorScheme.surfaceColor]; - UIColor *borderColor = - [MDCSemanticColorScheme blendColor:onSurface12Opacity - withBackgroundColor:self.colorScheme.surfaceColor]; - UIColor *textColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:self.colorScheme.surfaceColor]; - UIColor *selectedTextColor = - [MDCSemanticColorScheme blendColor:onSurface87Opacity - withBackgroundColor:selectedBackgroundColor]; + UIColor *borderColor = [MDCSemanticColorScheme blendColor:onSurface12Opacity + withBackgroundColor:self.colorScheme.surfaceColor]; + UIColor *textColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:self.colorScheme.surfaceColor]; + UIColor *selectedTextColor = [MDCSemanticColorScheme blendColor:onSurface87Opacity + withBackgroundColor:selectedBackgroundColor]; XCTAssertEqualObjects([self.chip borderColorForState:UIControlStateNormal], borderColor); XCTAssertEqualObjects([self.chip borderColorForState:UIControlStateSelected], diff --git a/components/Chips/tests/unit/ChipViewFontThemerTests.m b/components/Chips/tests/unit/ChipViewFontThemerTests.m index ff280a20681..39f2699a8b3 100644 --- a/components/Chips/tests/unit/ChipViewFontThemerTests.m +++ b/components/Chips/tests/unit/ChipViewFontThemerTests.m @@ -14,9 +14,9 @@ #import -#import "MaterialThemes.h" -#import "MaterialChips.h" #import "MaterialChips+FontThemer.h" +#import "MaterialChips.h" +#import "MaterialThemes.h" @interface ChipViewFontThemerTests : XCTestCase diff --git a/components/Chips/tests/unit/ChipViewTypographyThemerTests.m b/components/Chips/tests/unit/ChipViewTypographyThemerTests.m index 7fffd7925f5..bdcea4e387d 100644 --- a/components/Chips/tests/unit/ChipViewTypographyThemerTests.m +++ b/components/Chips/tests/unit/ChipViewTypographyThemerTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialChips.h" #import "MaterialChips+TypographyThemer.h" +#import "MaterialChips.h" @interface ChipViewTypographyThemerTests : XCTestCase diff --git a/components/Chips/tests/unit/ChipsTests.m b/components/Chips/tests/unit/ChipsTests.m index 25f3411d5d4..34bbd7270a8 100644 --- a/components/Chips/tests/unit/ChipsTests.m +++ b/components/Chips/tests/unit/ChipsTests.m @@ -114,8 +114,7 @@ - (void)testDefaults { XCTAssertNil([chip borderColorForState:state]); XCTAssertNil([chip inkColorForState:state]); XCTAssertEqualWithAccuracy([chip borderWidthForState:state], 0, 0.001); - XCTAssertEqualObjects([chip shadowColorForState:state], - [UIColor colorWithWhite:0 alpha:1]); + XCTAssertEqualObjects([chip shadowColorForState:state], [UIColor colorWithWhite:0 alpha:1]); if (state != UIControlStateDisabled) { XCTAssertEqualObjects([chip titleColorForState:state], normalTitleColor); } @@ -162,8 +161,8 @@ - (void)testMinimumSizeWithSizeToFit { 0.001); XCTAssertEqualWithAccuracy(CGRectGetWidth(chipWithMinimumHeightAndWidth.bounds), minimumDimension, 0.001); - XCTAssertEqualWithAccuracy(CGRectGetHeight(chipWithMinimumHeightAndWidth.bounds), minimumDimension, - 0.001); + XCTAssertEqualWithAccuracy(CGRectGetHeight(chipWithMinimumHeightAndWidth.bounds), + minimumDimension, 0.001); } - (void)testMinimumSizeWithIntrinsicContentSize { @@ -260,38 +259,36 @@ - (void)testPointInsideWithCustomHitAreaInsets { XCTAssertTrue([chip pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left, CGRectGetMinY(chipBounds) + hitAreaInsets.top) withEvent:nil]); - XCTAssertFalse([chip pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left - - delta, - CGRectGetMinY(chipBounds) + hitAreaInsets.top - - delta) - withEvent:nil]); + XCTAssertFalse([chip + pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left - delta, + CGRectGetMinY(chipBounds) + hitAreaInsets.top - delta) + withEvent:nil]); // Top-right corner - XCTAssertTrue([chip pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right - - delta, - CGRectGetMinY(chipBounds) + hitAreaInsets.top) - withEvent:nil]); - XCTAssertFalse([chip pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right, - CGRectGetMinY(chipBounds) + hitAreaInsets.top - - delta) - withEvent:nil]); + XCTAssertTrue([chip + pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right - delta, + CGRectGetMinY(chipBounds) + hitAreaInsets.top) + withEvent:nil]); + XCTAssertFalse([chip + pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right, + CGRectGetMinY(chipBounds) + hitAreaInsets.top - delta) + withEvent:nil]); // Bottom-left corner - XCTAssertTrue([chip pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left, - CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom - - delta) - withEvent:nil]); - XCTAssertFalse([chip pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left - - delta, - CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom) - withEvent:nil]); + XCTAssertTrue([chip + pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left, + CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom - delta) + withEvent:nil]); + XCTAssertFalse([chip + pointInside:CGPointMake(CGRectGetMinX(chipBounds) + hitAreaInsets.left - delta, + CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom) + withEvent:nil]); // Bottom-right corner - XCTAssertTrue([chip pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right - - delta, - CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom - - delta) - withEvent:nil]); + XCTAssertTrue([chip + pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right - delta, + CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom - delta) + withEvent:nil]); XCTAssertFalse([chip pointInside:CGPointMake(CGRectGetMaxX(chipBounds) - hitAreaInsets.right, CGRectGetMaxY(chipBounds) - hitAreaInsets.bottom) - withEvent:nil]); + withEvent:nil]); } - (void)testRemoveChipsManually { diff --git a/components/CollectionCells/examples/CollectionCellsLayoutExample.m b/components/CollectionCells/examples/CollectionCellsLayoutExample.m index 4bbe6619be9..03664d68aa1 100644 --- a/components/CollectionCells/examples/CollectionCellsLayoutExample.m +++ b/components/CollectionCells/examples/CollectionCellsLayoutExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionCellsLayoutExample.h" +#import "MaterialTypography.h" @interface SimpleModel : NSObject @property(nonatomic, strong, nullable) NSString *text; @@ -152,8 +152,9 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell.accessoryType = MDCCollectionViewCellAccessoryCheckmark; } if (model.circle) { - cell.imageView.image = - [self imageWithSize:CGSizeMake(40, 40) color:HEXCOLOR(0x80CBC4) cornerRadius:20]; + cell.imageView.image = [self imageWithSize:CGSizeMake(40, 40) + color:HEXCOLOR(0x80CBC4) + cornerRadius:20]; } return cell; @@ -229,9 +230,9 @@ - (UIImage *)imageWithSize:(CGSize)size color:(UIColor *)color cornerRadius:(CGF + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collection Cells", @"Cell Layout Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collection Cells", @"Cell Layout Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/CollectionCells/examples/CollectionCellsTextExample.m b/components/CollectionCells/examples/CollectionCellsTextExample.m index ae4c5cc1a96..a8ec7f787c4 100644 --- a/components/CollectionCells/examples/CollectionCellsTextExample.m +++ b/components/CollectionCells/examples/CollectionCellsTextExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionCellsTextExample.h" +#import "MaterialTypography.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; static NSString *const kExampleDetailText = @@ -107,12 +107,13 @@ - (CGFloat)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collection Cells", @"Cell Text Example" ], - @"description": @"Material Collection Cells enables a native collection view cell to have " - @"Material design layout and styling. It also provides editing and extensive customization " - @"capabilities.", - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collection Cells", @"Cell Text Example" ], + @"description" : + @"Material Collection Cells enables a native collection view cell to have " + @"Material design layout and styling. It also provides editing and extensive customization " + @"capabilities.", + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/CollectionCells/examples/CollectionCellsTextWithImageController.m b/components/CollectionCells/examples/CollectionCellsTextWithImageController.m index 29eb418c064..3506ba82e34 100644 --- a/components/CollectionCells/examples/CollectionCellsTextWithImageController.m +++ b/components/CollectionCells/examples/CollectionCellsTextWithImageController.m @@ -47,13 +47,15 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView if (indexPath.item % 3 == 2) { NSBundle *bundle = [NSBundle bundleForClass:[CollectionCellsTextWithImageController class]]; - UIImage *cellImage = - [UIImage imageNamed:@"SixtyThreexSixtyThree" inBundle:bundle compatibleWithTraitCollection:nil]; + UIImage *cellImage = [UIImage imageNamed:@"SixtyThreexSixtyThree" + inBundle:bundle + compatibleWithTraitCollection:nil]; cell.imageView.image = cellImage; } else if (indexPath.item % 3 == 1) { NSBundle *bundle = [NSBundle bundleForClass:[CollectionCellsTextWithImageController class]]; - UIImage *cellImage = - [UIImage imageNamed:@"FortyxForty" inBundle:bundle compatibleWithTraitCollection:nil]; + UIImage *cellImage = [UIImage imageNamed:@"FortyxForty" + inBundle:bundle + compatibleWithTraitCollection:nil]; cell.imageView.image = cellImage; } else { cell.imageView.image = nil; @@ -73,9 +75,9 @@ - (CGFloat)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collection Cells", @"Cell Text with Image Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collection Cells", @"Cell Text with Image Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/CollectionCells/src/MDCCollectionViewCell.m b/components/CollectionCells/src/MDCCollectionViewCell.m index fdf19816273..208bb91d63b 100644 --- a/components/CollectionCells/src/MDCCollectionViewCell.m +++ b/components/CollectionCells/src/MDCCollectionViewCell.m @@ -148,17 +148,22 @@ - (void)layoutSubviews { break; } self->_editingReorderImageView.alpha = self->_attr.shouldShowReorderStateMask ? 1 : 0; - self->_editingReorderImageView.transform = self->_attr.shouldShowReorderStateMask ? - CGAffineTransformMakeTranslation(txReorderTransform, 0) : CGAffineTransformIdentity; + self->_editingReorderImageView.transform = + self->_attr.shouldShowReorderStateMask + ? CGAffineTransformMakeTranslation(txReorderTransform, 0) + : CGAffineTransformIdentity; self->_editingSelectorImageView.alpha = self->_attr.shouldShowSelectorStateMask ? 1 : 0; - self->_editingSelectorImageView.transform = self->_attr.shouldShowSelectorStateMask ? - CGAffineTransformMakeTranslation(txSelectorTransform, 0) : CGAffineTransformIdentity; + self->_editingSelectorImageView.transform = + self->_attr.shouldShowSelectorStateMask + ? CGAffineTransformMakeTranslation(txSelectorTransform, 0) + : CGAffineTransformIdentity; self.accessoryView.alpha = self->_attr.shouldShowSelectorStateMask ? 0 : 1; - self->_accessoryInset.right = self->_attr.shouldShowSelectorStateMask - ? kAccessoryInsetDefault.right + kEditingControlAppearanceOffset - : kAccessoryInsetDefault.right; + self->_accessoryInset.right = + self->_attr.shouldShowSelectorStateMask + ? kAccessoryInsetDefault.right + kEditingControlAppearanceOffset + : kAccessoryInsetDefault.right; }; // Animate editing controls. @@ -207,10 +212,10 @@ - (void)layoutForegroundSubviews { // If necessary flip subviews for RTL. if (self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { - _accessoryView.frame = MDFRectFlippedHorizontally(_accessoryView.frame, - CGRectGetWidth(self.bounds)); - self.contentView.frame = MDFRectFlippedHorizontally(self.contentView.frame, - CGRectGetWidth(self.bounds)); + _accessoryView.frame = + MDFRectFlippedHorizontally(_accessoryView.frame, CGRectGetWidth(self.bounds)); + self.contentView.frame = + MDFRectFlippedHorizontally(self.contentView.frame, CGRectGetWidth(self.bounds)); } } @@ -529,8 +534,8 @@ - (NSString *)accessibilityHint { + (NSString *)localizedStringWithKey:(NSString *)key { NSBundle *containingBundle = [NSBundle bundleForClass:self]; - NSURL *resourceBundleURL = - [containingBundle URLForResource:kResourceBundleName withExtension:@"bundle"]; + NSURL *resourceBundleURL = [containingBundle URLForResource:kResourceBundleName + withExtension:@"bundle"]; NSBundle *resourceBundle = [NSBundle bundleWithURL:resourceBundleURL]; return [resourceBundle localizedStringForKey:key value:nil table:kStringTableName]; } diff --git a/components/CollectionCells/src/MDCCollectionViewTextCell.m b/components/CollectionCells/src/MDCCollectionViewTextCell.m index 30361243f06..755cf3d633c 100644 --- a/components/CollectionCells/src/MDCCollectionViewTextCell.m +++ b/components/CollectionCells/src/MDCCollectionViewTextCell.m @@ -56,8 +56,8 @@ static inline CGFloat CellDefaultDetailTextFontOpacity(void) { // Cell padding leading/trailing. static const CGFloat kCellTextNoImagePaddingLeading = 16; static const CGFloat kCellTextNoImagePaddingTrailing = 16; -static const CGFloat kCellTextWithImagePaddingLeading = kCellImagePaddingLeading + kImageSize + - kCellTextNoImagePaddingLeading; +static const CGFloat kCellTextWithImagePaddingLeading = + kCellImagePaddingLeading + kImageSize + kCellTextNoImagePaddingLeading; // Returns the closest pixel-aligned value higher than |value|, taking the scale factor into // account. At a scale of 1, equivalent to Ceil(). @@ -122,9 +122,8 @@ - (void)resetMDCCollectionViewTextCellLabelProperties { - (void)commonMDCCollectionViewTextCellInit { _contentWrapper = [[UIView alloc] initWithFrame:self.contentView.bounds]; _contentWrapper.autoresizingMask = - UIViewAutoresizingFlexibleWidth | - MDFTrailingMarginAutoresizingMaskForLayoutDirection( - self.mdf_effectiveUserInterfaceLayoutDirection); + UIViewAutoresizingFlexibleWidth | MDFTrailingMarginAutoresizingMaskForLayoutDirection( + self.mdf_effectiveUserInterfaceLayoutDirection); _contentWrapper.clipsToBounds = YES; [self.contentView addSubview:_contentWrapper]; @@ -254,9 +253,9 @@ - (void)applyMetrics { - (CGSize)frameSizeForLabel:(UILabel *)label { CGFloat width = CGRectGetWidth(_contentWrapper.bounds); - CGFloat height = - [label textRectForBounds:_contentWrapper.bounds limitedToNumberOfLines:label.numberOfLines] - .size.height; + CGFloat height = [label textRectForBounds:_contentWrapper.bounds + limitedToNumberOfLines:label.numberOfLines] + .size.height; return CGSizeMake(width, height); } diff --git a/components/Collections/examples/CollectionsALaCarteExample.m b/components/Collections/examples/CollectionsALaCarteExample.m index 101f2f7c6d7..a7368a75180 100644 --- a/components/Collections/examples/CollectionsALaCarteExample.m +++ b/components/Collections/examples/CollectionsALaCarteExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionsALaCarteExample.h" +#import "MaterialTypography.h" static const NSInteger kSectionCount = 10; static const NSInteger kSectionItemCount = 5; @@ -47,7 +47,7 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi */ @implementation CollectionsALaCarteExample { CustomCollectionView *_customCollectionView; - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -125,9 +125,9 @@ - (void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Collections À la carte" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Collections À la carte" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsAppearanceAnimationExample.m b/components/Collections/examples/CollectionsAppearanceAnimationExample.m index 4bc6208b262..ea8589cc294 100644 --- a/components/Collections/examples/CollectionsAppearanceAnimationExample.m +++ b/components/Collections/examples/CollectionsAppearanceAnimationExample.m @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionsAppearanceAnimationExample.h" +#import "MaterialTypography.h" static const NSInteger kSectionCount = 10; static const NSInteger kSectionItemCount = 5; static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsAppearanceAnimationExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -70,9 +70,9 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Appearance Animation Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Appearance Animation Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsCellAccessoryExample.m b/components/Collections/examples/CollectionsCellAccessoryExample.m index d53b48c0a62..ed369d2fdb0 100644 --- a/components/Collections/examples/CollectionsCellAccessoryExample.m +++ b/components/Collections/examples/CollectionsCellAccessoryExample.m @@ -18,7 +18,7 @@ @implementation CollectionsCellAccessoryExample { NSArray *_accessoryTypes; - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -111,9 +111,9 @@ - (void)didSwitch:(id)sender { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Accessory Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Accessory Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsCellColorExample.m b/components/Collections/examples/CollectionsCellColorExample.m index aa4f40c08ee..c53dc145b95 100644 --- a/components/Collections/examples/CollectionsCellColorExample.m +++ b/components/Collections/examples/CollectionsCellColorExample.m @@ -17,7 +17,7 @@ static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsCellColorExample { - NSMutableArray *_content; + NSMutableArray *_content; NSArray *_cellBackgroundColors; } @@ -79,9 +79,9 @@ - (UIColor *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Color Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Color Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsCellSeparatorExample.m b/components/Collections/examples/CollectionsCellSeparatorExample.m index b889bdd61ce..28710bd2e79 100644 --- a/components/Collections/examples/CollectionsCellSeparatorExample.m +++ b/components/Collections/examples/CollectionsCellSeparatorExample.m @@ -19,7 +19,7 @@ static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsCellSeparatorExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -123,9 +123,9 @@ - (BOOL)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Separator Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Separator Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsContainerExample.m b/components/Collections/examples/CollectionsContainerExample.m index ec0e0de8f36..9077664e59f 100644 --- a/components/Collections/examples/CollectionsContainerExample.m +++ b/components/Collections/examples/CollectionsContainerExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialCollections.h" #import "supplemental/CollectionsContainerExample.h" +#import "MaterialCollections.h" static const NSInteger kSectionCount = 2; static const NSInteger kSectionItemCount = 2; @@ -21,7 +21,7 @@ @implementation CollectionsContainerExample { MDCCollectionViewController *_collectionsController; - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -86,9 +86,9 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Collections in a Container" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Collections in a Container" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsEditingExample.m b/components/Collections/examples/CollectionsEditingExample.m index 9261f8ffe89..c8bfa7e18ee 100644 --- a/components/Collections/examples/CollectionsEditingExample.m +++ b/components/Collections/examples/CollectionsEditingExample.m @@ -20,7 +20,7 @@ static NSString *const HEADER_REUSE_IDENTIFIER = @"EditingExampleHeader"; @implementation CollectionsEditingExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -166,9 +166,9 @@ - (CGSize)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Editing Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Editing Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsEmptySections.m b/components/Collections/examples/CollectionsEmptySections.m index ccc6aa0953e..5a6ee214d03 100644 --- a/components/Collections/examples/CollectionsEmptySections.m +++ b/components/Collections/examples/CollectionsEmptySections.m @@ -23,7 +23,7 @@ @interface CollectionsEmptySectionsController : MDCCollectionViewController @end @implementation CollectionsEmptySectionsController { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -134,9 +134,9 @@ - (BOOL)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Empty Section Demo" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Empty Section Demo" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsGridExample.m b/components/Collections/examples/CollectionsGridExample.m index ef1e8eee7e6..9bb5f895640 100644 --- a/components/Collections/examples/CollectionsGridExample.m +++ b/components/Collections/examples/CollectionsGridExample.m @@ -19,7 +19,7 @@ static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsGridExample { - NSMutableArray *_content; + NSMutableArray *_content; UIAlertController *_actionController; } @@ -149,9 +149,9 @@ - (void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Grid Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Grid Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsHeaderFooterExample.m b/components/Collections/examples/CollectionsHeaderFooterExample.m index d6d8d446be2..bf4522eedca 100644 --- a/components/Collections/examples/CollectionsHeaderFooterExample.m +++ b/components/Collections/examples/CollectionsHeaderFooterExample.m @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionsHeaderFooterExample.h" +#import "MaterialTypography.h" static const NSInteger kSectionCount = 3; static const NSInteger kSectionItemCount = 2; static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsHeaderFooterExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -131,9 +131,9 @@ - (BOOL)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Header / Footer Demo" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Header / Footer Demo" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsInkExample.m b/components/Collections/examples/CollectionsInkExample.m index 9e2993d83a5..71058466065 100644 --- a/components/Collections/examples/CollectionsInkExample.m +++ b/components/Collections/examples/CollectionsInkExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialPalettes.h" #import "supplemental/CollectionsInkExample.h" +#import "MaterialPalettes.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @@ -80,9 +80,9 @@ - (UIColor *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Ink Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Ink Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsInlayExample.m b/components/Collections/examples/CollectionsInlayExample.m index cd87bf3736b..0f1c8bf1349 100644 --- a/components/Collections/examples/CollectionsInlayExample.m +++ b/components/Collections/examples/CollectionsInlayExample.m @@ -68,9 +68,9 @@ - (void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Inlay Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Inlay Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsSimpleDemo.m b/components/Collections/examples/CollectionsSimpleDemo.m index f87548eb38e..6f02b119741 100644 --- a/components/Collections/examples/CollectionsSimpleDemo.m +++ b/components/Collections/examples/CollectionsSimpleDemo.m @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTypography.h" #import "supplemental/CollectionsSimpleDemo.h" +#import "MaterialTypography.h" static const NSInteger kSectionCount = 10; static const NSInteger kSectionItemCount = 5; static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsSimpleDemo { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -70,12 +70,13 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Simple Demo" ], - @"description": @"Material Collections enables a native collection view controller to have " - @"Material design layout and styling. It also provides editing and extensive customization " - @"capabilities.", - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Simple Demo" ], + @"description" : + @"Material Collections enables a native collection view controller to have " + @"Material design layout and styling. It also provides editing and extensive customization " + @"capabilities.", + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsStoryboardExample.m b/components/Collections/examples/CollectionsStoryboardExample.m index 85149ecf89b..b5a82877a4a 100644 --- a/components/Collections/examples/CollectionsStoryboardExample.m +++ b/components/Collections/examples/CollectionsStoryboardExample.m @@ -23,7 +23,7 @@ @interface CollectionStoryboardExampleCell : UICollectionViewCell @end @implementation CollectionsStoryboardExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -70,10 +70,10 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Storyboard Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"CollectionsStoryboardExample" + @"breadcrumbs" : @[ @"Collections", @"Storyboard Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"CollectionsStoryboardExample" }; } diff --git a/components/Collections/examples/CollectionsSwipeToDismissRowExample.m b/components/Collections/examples/CollectionsSwipeToDismissRowExample.m index 9ab63f5752b..16aa580f1fa 100644 --- a/components/Collections/examples/CollectionsSwipeToDismissRowExample.m +++ b/components/Collections/examples/CollectionsSwipeToDismissRowExample.m @@ -19,7 +19,7 @@ static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsSwipeToDismissRowExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -95,9 +95,9 @@ - (void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Swipe-To-Dismiss-Row Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Swipe-To-Dismiss-Row Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m b/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m index f68beb30f59..3d045c2af0c 100644 --- a/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m +++ b/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m @@ -19,7 +19,7 @@ static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @implementation CollectionsSwipeToDismissSectionExample { - NSMutableArray *_content; + NSMutableArray *_content; } - (void)viewDidLoad { @@ -94,9 +94,9 @@ - (void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Swipe-To-Dismiss-Section Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Swipe-To-Dismiss-Section Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/examples/supplemental/CollectionsEditingManyCellsExampleSupplemental.m b/components/Collections/examples/supplemental/CollectionsEditingManyCellsExampleSupplemental.m index 584abd74eec..d57a0673ed1 100644 --- a/components/Collections/examples/supplemental/CollectionsEditingManyCellsExampleSupplemental.m +++ b/components/Collections/examples/supplemental/CollectionsEditingManyCellsExampleSupplemental.m @@ -20,9 +20,9 @@ @implementation CollectionsEditingManyCellsExample (Supplemental) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Cell Editing Example (1000+)" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Cell Editing Example (1000+)" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -39,9 +39,9 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - MDCCollectionViewTextCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:kCollectionsEditingManyCellsCellIdentifierItem - forIndexPath:indexPath]; + MDCCollectionViewTextCell *cell = [collectionView + dequeueReusableCellWithReuseIdentifier:kCollectionsEditingManyCellsCellIdentifierItem + forIndexPath:indexPath]; cell.textLabel.text = self.content[indexPath.section][indexPath.item]; return cell; } @@ -51,16 +51,16 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView atIndexPath:(NSIndexPath *)indexPath { // If you have defined your own supplementary views, deque them here if ([kind isEqualToString:UICollectionElementKindSectionHeader]) { - MDCCollectionViewTextCell *sectionHeader = - [collectionView dequeueReusableSupplementaryViewOfKind:kind - withReuseIdentifier:kCollectionsEditingManyCellsHeaderReuseIdentifier - forIndexPath:indexPath]; + MDCCollectionViewTextCell *sectionHeader = [collectionView + dequeueReusableSupplementaryViewOfKind:kind + withReuseIdentifier:kCollectionsEditingManyCellsHeaderReuseIdentifier + forIndexPath:indexPath]; NSAssert(sectionHeader != nil, @"Unable to dequeue SupplementaryView"); if ([kind isEqualToString:UICollectionElementKindSectionHeader]) { sectionHeader.textLabel.text = - [NSString stringWithFormat:@"Section %lu Header", (long)indexPath.section]; + [NSString stringWithFormat:@"Section %lu Header", (long)indexPath.section]; } return sectionHeader; @@ -68,8 +68,8 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView // Otherwise, pass the kind to super to let MDCCollectionViewController handle the request return [super collectionView:collectionView -viewForSupplementaryElementOfKind:kind - atIndexPath:indexPath]; + viewForSupplementaryElementOfKind:kind + atIndexPath:indexPath]; } #pragma mark - @@ -87,7 +87,7 @@ - (BOOL)collectionViewAllowsSwipeToDismissItem:(UICollectionView *)collectionVie } - (void)collectionView:(UICollectionView *)collectionView -willDeleteItemsAtIndexPaths:(NSArray *)indexPaths { + willDeleteItemsAtIndexPaths:(NSArray *)indexPaths { // First sort reverse order then remove. This is done because when we delete an index path the // higher rows shift down, altering the index paths of those that we would like to delete in the // next iteration of this loop. @@ -98,8 +98,8 @@ - (void)collectionView:(UICollectionView *)collectionView } - (void)collectionView:(UICollectionView *)collectionView -willMoveItemAtIndexPath:(NSIndexPath *)indexPath - toIndexPath:(NSIndexPath *)newIndexPath { + willMoveItemAtIndexPath:(NSIndexPath *)indexPath + toIndexPath:(NSIndexPath *)newIndexPath { if (indexPath.section == newIndexPath.section) { // Exchange data within same section. [self.content[indexPath.section] exchangeObjectAtIndex:indexPath.item @@ -116,8 +116,8 @@ - (void)collectionView:(UICollectionView *)collectionView #pragma mark UICollectionViewFlowLayoutDelegate - (CGSize)collectionView:(UICollectionView *)collectionView - layout:(UICollectionViewLayout *)collectionViewLayout -referenceSizeForHeaderInSection:(NSInteger)section { + layout:(UICollectionViewLayout *)collectionViewLayout + referenceSizeForHeaderInSection:(NSInteger)section { return CGSizeMake(collectionView.bounds.size.width, MDCCellDefaultOneLineHeight); } diff --git a/components/Collections/examples/supplemental/CollectionsSectionInsetsExampleSupplemental.m b/components/Collections/examples/supplemental/CollectionsSectionInsetsExampleSupplemental.m index aa5e9e78663..380510c1be3 100644 --- a/components/Collections/examples/supplemental/CollectionsSectionInsetsExampleSupplemental.m +++ b/components/Collections/examples/supplemental/CollectionsSectionInsetsExampleSupplemental.m @@ -55,9 +55,9 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Collections", @"Custom Section Insets" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Collections", @"Custom Section Insets" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Collections/src/MDCCollectionViewController.m b/components/Collections/src/MDCCollectionViewController.m index acbcb18a59b..07ded09eed7 100644 --- a/components/Collections/src/MDCCollectionViewController.m +++ b/components/Collections/src/MDCCollectionViewController.m @@ -223,8 +223,8 @@ - (CGSize)sizeWithAttribute:(UICollectionViewLayoutAttributes *)attr height = [_styler.delegate collectionView:collectionView cellHeightAtIndexPath:attr.indexPath]; } - CGFloat width = - [self cellWidthAtSectionIndex:attr.indexPath.section collectionView:collectionView]; + CGFloat width = [self cellWidthAtSectionIndex:attr.indexPath.section + collectionView:collectionView]; return CGSizeMake(width, height); } @@ -232,7 +232,7 @@ - (CGSize)sizeWithAttribute:(UICollectionViewLayoutAttributes *)attr - (CGFloat)cellWidthAtSectionIndex:(NSInteger)section collectionView:(UICollectionView *)collectionView { UIEdgeInsets contentInset = collectionView.contentInset; -// On the iPhone X, we need to use the offset which might take into account the safe area. + // On the iPhone X, we need to use the offset which might take into account the safe area. if (@available(iOS 11.0, *)) { contentInset = collectionView.adjustedContentInset; } @@ -265,8 +265,8 @@ - (UIEdgeInsets)insetsAtSectionIndex:(NSInteger)section insets.left = inset; insets.right = inset; if (@available(iOS 11.0, *)) { - if (collectionView.contentInsetAdjustmentBehavior - == UIScrollViewContentInsetAdjustmentAlways) { + if (collectionView.contentInsetAdjustmentBehavior == + UIScrollViewContentInsetAdjustmentAlways) { // We don't need section insets if there are already safe area insets. insets.left = MAX(0, insets.left - collectionView.safeAreaInsets.left); insets.right = MAX(0, insets.right - collectionView.safeAreaInsets.right); @@ -292,8 +292,8 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath BOOL nextCellIsInlaid = NO; BOOL hasSectionHeader = NO; - if ([self - respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)]) { + if ([self respondsToSelector:@selector(collectionView: + layout:referenceSizeForHeaderInSection:)]) { CGSize headerSize = [self collectionView:collectionView layout:collectionView.collectionViewLayout referenceSizeForHeaderInSection:indexPath.section]; @@ -301,8 +301,8 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath } BOOL hasSectionFooter = NO; - if ([self - respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)]) { + if ([self respondsToSelector:@selector(collectionView: + layout:referenceSizeForFooterInSection:)]) { CGSize footerSize = [self collectionView:collectionView layout:_collectionViewLayout referenceSizeForFooterInSection:indexPath.section]; @@ -311,8 +311,8 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath // Check if previous cell is inlaid. if (indexPath.item > 0 || hasSectionHeader) { - NSIndexPath *prevIndexPath = - [NSIndexPath indexPathForItem:(indexPath.item - 1) inSection:indexPath.section]; + NSIndexPath *prevIndexPath = [NSIndexPath indexPathForItem:(indexPath.item - 1) + inSection:indexPath.section]; prevCellIsInlaid = [_styler isItemInlaidAtIndexPath:prevIndexPath]; inlayInsets.top = prevCellIsInlaid ? inset / 2 : inset; } @@ -320,8 +320,8 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath // Check if next cell is inlaid. if (indexPath.item < [collectionView numberOfItemsInSection:indexPath.section] - 1 || hasSectionFooter) { - NSIndexPath *nextIndexPath = - [NSIndexPath indexPathForItem:(indexPath.item + 1) inSection:indexPath.section]; + NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:(indexPath.item + 1) + inSection:indexPath.section]; nextCellIsInlaid = [_styler isItemInlaidAtIndexPath:nextIndexPath]; inlayInsets.bottom = nextCellIsInlaid ? inset / 2 : inset; } @@ -345,8 +345,7 @@ - (CGFloat)cellWidthAtSectionIndex:(NSInteger)section { if (@available(iOS 11.0, *)) { contentInset = self.collectionView.adjustedContentInset; } - CGFloat bounds = CGRectGetWidth( - UIEdgeInsetsInsetRect(self.collectionView.bounds, contentInset)); + CGFloat bounds = CGRectGetWidth(UIEdgeInsetsInsetRect(self.collectionView.bounds, contentInset)); UIEdgeInsets sectionInsets = [self collectionView:self.collectionView layout:self.collectionView.collectionViewLayout insetForSectionAtIndex:section]; @@ -381,8 +380,8 @@ - (MDCInkView *)inkTouchController:(MDCInkTouchController *)inkTouchController UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath]; MDCInkView *ink = nil; - if ([_styler.delegate - respondsToSelector:@selector(collectionView:inkTouchController:inkViewAtIndexPath:)]) { + if ([_styler.delegate respondsToSelector:@selector(collectionView: + inkTouchController:inkViewAtIndexPath:)]) { return [_styler.delegate collectionView:self.collectionView inkTouchController:inkTouchController inkViewAtIndexPath:indexPath]; @@ -458,8 +457,8 @@ - (void)collectionView:(UICollectionView *)collectionView // Update ink color if necessary. if ([_styler.delegate respondsToSelector:@selector(collectionView:inkColorAtIndexPath:)]) { - inkView.inkColor = - [_styler.delegate collectionView:collectionView inkColorAtIndexPath:indexPath]; + inkView.inkColor = [_styler.delegate collectionView:collectionView + inkColorAtIndexPath:indexPath]; if (!inkView.inkColor) { inkView.inkColor = inkView.defaultInkColor; } @@ -519,8 +518,8 @@ - (BOOL)collectionViewAllowsEditing:(__unused UICollectionView *)collectionView - (void)collectionViewWillBeginEditing:(__unused UICollectionView *)collectionView { if (self.currentlyActiveInk) { - MDCInkView *activeInkView = - [self inkTouchController:_inkTouchController inkViewAtTouchLocation:_inkTouchLocation]; + MDCInkView *activeInkView = [self inkTouchController:_inkTouchController + inkViewAtTouchLocation:_inkTouchLocation]; [activeInkView startTouchEndedAnimationAtPoint:_inkTouchLocation completion:nil]; } // Inlay all items. diff --git a/components/Collections/src/MDCCollectionViewFlowLayout.m b/components/Collections/src/MDCCollectionViewFlowLayout.m index 75369366120..4b724533348 100644 --- a/components/Collections/src/MDCCollectionViewFlowLayout.m +++ b/components/Collections/src/MDCCollectionViewFlowLayout.m @@ -90,7 +90,7 @@ - (void)commonMDCCollectionViewFlowLayoutInit { #pragma mark - UICollectionViewLayout (SubclassingHooks) - (NSArray<__kindof UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect: - (CGRect)rect { + (CGRect)rect { // If performing appearance animation, increase bounds height in order to retrieve additional // offscreen attributes needed during animation. rect = [self boundsForAppearanceAnimationWithInitialBounds:rect]; @@ -273,7 +273,7 @@ - (void)finalizeCollectionViewUpdates { } - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath: - (NSIndexPath *)itemIndexPath { + (NSIndexPath *)itemIndexPath { UICollectionViewLayoutAttributes *attr = [[super initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath] copy]; // Adding new section or item. @@ -305,7 +305,7 @@ - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtI } - (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath: - (NSIndexPath *)itemIndexPath { + (NSIndexPath *)itemIndexPath { UICollectionViewLayoutAttributes *attr = [[super finalLayoutAttributesForDisappearingItemAtIndexPath:itemIndexPath] copy]; // Deleting section or item. @@ -339,7 +339,7 @@ - (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAt #pragma mark - Header/Footer Caching - (void)storeSupplementaryViewsWithAttributes: - (NSArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { + (NSArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { _headerSections = [NSMutableIndexSet indexSet]; _footerSections = [NSMutableIndexSet indexSet]; @@ -392,7 +392,7 @@ - (MDCCollectionViewLayoutAttributes *)updateAttribute:(MDCCollectionViewLayoutA } - (MDCCollectionViewLayoutAttributes *)updateSupplementaryViewAttribute: - (MDCCollectionViewLayoutAttributes *)attr { + (MDCCollectionViewLayoutAttributes *)attr { // In vertical scrolling, supplementary views only respect their height and ignore their width // value. The opposite is true for horizontal scrolling. Therefore we must manually set insets // on both the backgroundView and contentView in order to match the insets of the collection @@ -451,7 +451,7 @@ - (UIEdgeInsets)insetsAtSectionIndex:(NSInteger)section { } - (MDCCollectionViewOrdinalPosition)ordinalPositionForListElementWithAttribute: - (MDCCollectionViewLayoutAttributes *)attr { + (MDCCollectionViewLayoutAttributes *)attr { // Returns the ordinal position of cells and supplementary views within a list layout. This is // used to determine the layout attributes applied to their styling. MDCCollectionViewOrdinalPosition position = 0; @@ -464,15 +464,15 @@ - (MDCCollectionViewOrdinalPosition)ordinalPositionForListElementWithAttribute: BOOL hasSectionItems = [self numberOfItemsInSection:indexPath.section] > 0; BOOL hidesHeaderBackground = NO; - if ([self.styler.delegate - respondsToSelector:@selector(collectionView:shouldHideHeaderBackgroundForSection:)]) { + if ([self.styler.delegate respondsToSelector:@selector(collectionView: + shouldHideHeaderBackgroundForSection:)]) { hidesHeaderBackground = [self.styler.delegate collectionView:self.styler.collectionView shouldHideHeaderBackgroundForSection:indexPath.section]; } BOOL hidesFooterBackground = NO; - if ([self.styler.delegate - respondsToSelector:@selector(collectionView:shouldHideFooterBackgroundForSection:)]) { + if ([self.styler.delegate respondsToSelector:@selector(collectionView: + shouldHideFooterBackgroundForSection:)]) { hidesFooterBackground = [self.styler.delegate collectionView:self.styler.collectionView shouldHideFooterBackgroundForSection:indexPath.section]; } @@ -504,7 +504,7 @@ - (MDCCollectionViewOrdinalPosition)ordinalPositionForListElementWithAttribute: } - (MDCCollectionViewOrdinalPosition)ordinalPositionForGridElementWithAttribute: - (MDCCollectionViewLayoutAttributes *)attr { + (MDCCollectionViewLayoutAttributes *)attr { // Returns the ordinal position of cells and supplementary views within a grid layout. This is // used to determine the layout attributes applied to their styling. MDCCollectionViewOrdinalPosition position = 0; @@ -552,8 +552,8 @@ - (void)updateCellStateMaskWithAttribute:(MDCCollectionViewLayoutAttributes *)at (id)self.collectionView.dataSource; // Check if delegate can select during editing. - if ([editingDelegate respondsToSelector:@selector - (collectionView:canSelectItemDuringEditingAtIndexPath:)]) { + if ([editingDelegate respondsToSelector:@selector(collectionView: + canSelectItemDuringEditingAtIndexPath:)]) { attr.shouldShowSelectorStateMask = [editingDelegate collectionView:self.collectionView canSelectItemDuringEditingAtIndexPath:attr.indexPath]; } @@ -648,7 +648,7 @@ - (void)hideAttributeIfNecessary:(MDCCollectionViewLayoutAttributes *)attr { } - (void)addInfoBarAttributesIfNecessary: - (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { + (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { if (self.editor.isEditing && [attributes count] > 0) { NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; @@ -668,7 +668,7 @@ - (void)addInfoBarAttributesIfNecessary: } - (void)addDecorationViewIfNecessary: - (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { + (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { // If necessary, adds a decoration view to a section drawn below its items. This will only happen // for a grid layout when it is either A) grouped-style or B) card-style with zero padding. When // this happens, the background for those items will not be drawn, and instead this decoration @@ -735,7 +735,7 @@ - (CGRect)boundsForAppearanceAnimationWithInitialBounds:(CGRect)initialBounds { } - (void)beginCellAppearanceAnimationIfNecessary: - (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { + (NSMutableArray<__kindof UICollectionViewLayoutAttributes *> *)attributes { // Here we want to assign a delay to each attribute such that the animation will fade-in from the // top downwards in a staggered manner. However, the array of attributes we receive here are not // in the correct order and must be sorted and re-ordered to properly assign these delays. diff --git a/components/Collections/src/private/MDCCollectionInfoBarView.m b/components/Collections/src/private/MDCCollectionInfoBarView.m index a1fada9da09..d76045b2d11 100644 --- a/components/Collections/src/private/MDCCollectionInfoBarView.m +++ b/components/Collections/src/private/MDCCollectionInfoBarView.m @@ -80,8 +80,8 @@ - (void)commonMDCCollectionInfoBarViewInit { [self addSubview:_backgroundView]; - _tapGesture = - [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + _tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self + action:@selector(handleTapGesture:)]; [_backgroundView addGestureRecognizer:_tapGesture]; } @@ -89,17 +89,18 @@ - (void)layoutSubviews { [super layoutSubviews]; UIEdgeInsets collectionViewSafeAreaInsets = UIEdgeInsetsZero; - if (@available(iOS 11.0, *)) { - if (self.superview) { - collectionViewSafeAreaInsets = self.superview.safeAreaInsets; - } + if (@available(iOS 11.0, *)) { + if (self.superview) { + collectionViewSafeAreaInsets = self.superview.safeAreaInsets; } - CGFloat leftInset = MAX(MDCCollectionInfoBarLabelHorizontalPadding, - collectionViewSafeAreaInsets.left); - CGFloat rightInset = MAX(MDCCollectionInfoBarLabelHorizontalPadding, - collectionViewSafeAreaInsets.right); - CGFloat height = [_kind isEqualToString:MDCCollectionInfoBarKindHeader] ? - MDCCollectionInfoBarHeaderHeight : MDCCollectionInfoBarFooterHeight; + } + CGFloat leftInset = + MAX(MDCCollectionInfoBarLabelHorizontalPadding, collectionViewSafeAreaInsets.left); + CGFloat rightInset = + MAX(MDCCollectionInfoBarLabelHorizontalPadding, collectionViewSafeAreaInsets.right); + CGFloat height = [_kind isEqualToString:MDCCollectionInfoBarKindHeader] + ? MDCCollectionInfoBarHeaderHeight + : MDCCollectionInfoBarFooterHeight; _titleLabel.frame = CGRectMake(leftInset, 0, CGRectGetWidth(self.bounds) - (leftInset + rightInset), height); @@ -207,7 +208,8 @@ - (void)showAnimated:(BOOL)animated { self.userInteractionEnabled = self.allowsTap; // Notify delegate. - if ([self.delegate respondsToSelector:@selector(infoBar:didShowAnimated:willAutoDismiss:)]) { + if ([self.delegate respondsToSelector:@selector(infoBar: + didShowAnimated:willAutoDismiss:)]) { [self.delegate infoBar:self didShowAnimated:animated willAutoDismiss:[self shouldAutoDismiss]]; @@ -236,10 +238,11 @@ - (void)dismissAnimated:(BOOL)animated { self.backgroundView.hidden = YES; // Notify delegate. - if ([self.delegate respondsToSelector:@selector(infoBar:didDismissAnimated:didAutoDismiss:)]) { + if ([self.delegate respondsToSelector:@selector(infoBar: + didDismissAnimated:didAutoDismiss:)]) { [self.delegate infoBar:self - didDismissAnimated:animated - didAutoDismiss:[self shouldAutoDismiss]]; + didDismissAnimated:animated + didAutoDismiss:[self shouldAutoDismiss]]; } }]; } diff --git a/components/Collections/src/private/MDCCollectionStringResources.m b/components/Collections/src/private/MDCCollectionStringResources.m index 6b12ad8c74c..e7bb3ef3e22 100644 --- a/components/Collections/src/private/MDCCollectionStringResources.m +++ b/components/Collections/src/private/MDCCollectionStringResources.m @@ -64,7 +64,7 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName { // not be in the main .app bundle, but rather in a nested framework, so figure out where we live // and use that as the search location. NSBundle *bundle = [NSBundle bundleForClass:[MDCCollectionStringResources class]]; - NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle)resourcePath]; + NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle) resourcePath]; return [resourcePath stringByAppendingPathComponent:bundleName]; } @end diff --git a/components/Collections/src/private/MDCCollectionViewEditor.m b/components/Collections/src/private/MDCCollectionViewEditor.m index c60d8b60207..1c2578d5146 100644 --- a/components/Collections/src/private/MDCCollectionViewEditor.m +++ b/components/Collections/src/private/MDCCollectionViewEditor.m @@ -380,8 +380,8 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)recognizer { } // Notify delegate dragging has began. - if ([_delegate - respondsToSelector:@selector(collectionView:willBeginDraggingItemAtIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + willBeginDraggingItemAtIndexPath:)]) { [_delegate collectionView:_collectionView willBeginDraggingItemAtIndexPath:_reorderingCellIndexPath]; } @@ -405,8 +405,8 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)recognizer { void (^completionBlock)(BOOL finished) = ^(__unused BOOL finished) { // Notify delegate dragging has finished. - if ([self.delegate - respondsToSelector:@selector(collectionView:didEndDraggingItemAtIndexPath:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + didEndDraggingItemAtIndexPath:)]) { [self.delegate collectionView:self.collectionView didEndDraggingItemAtIndexPath:self->_reorderingCellIndexPath]; } @@ -467,24 +467,24 @@ - (void)panToReorderWithRecognizer:(UIPanGestureRecognizer *)recognizer { } // Check delegate for permission to move item. - if ([_delegate - respondsToSelector:@selector(collectionView:canMoveItemAtIndexPath:toIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + canMoveItemAtIndexPath:toIndexPath:)]) { if ([_delegate collectionView:_collectionView canMoveItemAtIndexPath:previousIndexPath toIndexPath:newIndexPath]) { _reorderingCellIndexPath = newIndexPath; // Notify delegate that item will move. - if ([_delegate respondsToSelector:@selector - (collectionView:willMoveItemAtIndexPath:toIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + willMoveItemAtIndexPath:toIndexPath:)]) { [_delegate collectionView:_collectionView willMoveItemAtIndexPath:previousIndexPath toIndexPath:newIndexPath]; } // Notify delegate item did move. - if ([_delegate - respondsToSelector:@selector(collectionView:didMoveItemAtIndexPath:toIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + didMoveItemAtIndexPath:toIndexPath:)]) { [_delegate collectionView:_collectionView didMoveItemAtIndexPath:previousIndexPath toIndexPath:newIndexPath]; @@ -533,8 +533,8 @@ - (void)panToDismissWithRecognizer:(UIPanGestureRecognizer *)recognizer { if ([_delegate collectionView:_collectionView canSwipeToDismissSection:_dismissingSection]) { // Notify delegate. - if ([_delegate - respondsToSelector:@selector(collectionView:willBeginSwipeToDismissSection:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + willBeginSwipeToDismissSection:)]) { [_delegate collectionView:_collectionView willBeginSwipeToDismissSection:_dismissingSection]; } @@ -692,8 +692,8 @@ - (void)animateFinalItemDismissalToTranslationX:(CGFloat)translationX { // Notify delegate of dismissed item. if (_dismissingCellIndexPath) { - if ([_delegate - respondsToSelector:@selector(collectionView:didEndSwipeToDismissItemAtIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + didEndSwipeToDismissItemAtIndexPath:)]) { [_delegate collectionView:_collectionView didEndSwipeToDismissItemAtIndexPath:_dismissingCellIndexPath]; } @@ -762,8 +762,8 @@ - (void)cancelPanningItem { // Notify delegate of panned index path cancellation. if (_dismissingCellIndexPath) { - if ([_delegate - respondsToSelector:@selector(collectionView:didCancelSwipeToDismissItemAtIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + didCancelSwipeToDismissItemAtIndexPath:)]) { [_delegate collectionView:_collectionView didCancelSwipeToDismissItemAtIndexPath:_dismissingCellIndexPath]; } diff --git a/components/Collections/src/private/MDCCollectionViewStyler.m b/components/Collections/src/private/MDCCollectionViewStyler.m index 359dfde6f2b..58873c7a5d0 100644 --- a/components/Collections/src/private/MDCCollectionViewStyler.m +++ b/components/Collections/src/private/MDCCollectionViewStyler.m @@ -258,20 +258,20 @@ - (BOOL)shouldHideSeparatorForCellLayoutAttributes:(MDCCollectionViewLayoutAttri BOOL isSectionFooter = [attr.representedElementKind isEqualToString:UICollectionElementKindSectionFooter]; if (isCell) { - if ([self.delegate - respondsToSelector:@selector(collectionView:shouldHideItemSeparatorAtIndexPath:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + shouldHideItemSeparatorAtIndexPath:)]) { shouldHideSeparator = [self.delegate collectionView:_collectionView shouldHideItemSeparatorAtIndexPath:indexPath]; } } else if (isSectionHeader) { - if ([self.delegate - respondsToSelector:@selector(collectionView:shouldHideHeaderSeparatorForSection:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + shouldHideHeaderSeparatorForSection:)]) { shouldHideSeparator = [self.delegate collectionView:_collectionView shouldHideHeaderSeparatorForSection:indexPath.section]; } } else if (isSectionFooter) { - if ([self.delegate - respondsToSelector:@selector(collectionView:shouldHideFooterSeparatorForSection:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + shouldHideFooterSeparatorForSection:)]) { shouldHideSeparator = [self.delegate collectionView:_collectionView shouldHideFooterSeparatorForSection:indexPath.section]; } @@ -282,7 +282,7 @@ - (BOOL)shouldHideSeparatorForCellLayoutAttributes:(MDCCollectionViewLayoutAttri #pragma mark - Public - (UIEdgeInsets)backgroundImageViewOutsetsForCellWithAttribute: - (MDCCollectionViewLayoutAttributes *)attr { + (MDCCollectionViewLayoutAttributes *)attr { // Inset contentView to allow for shadowed borders in cards. UIEdgeInsets insets = UIEdgeInsetsZero; @@ -334,8 +334,8 @@ - (void)setCellStyle:(MDCCollectionViewCellStyle)cellStyle animated:(BOOL)animat - (MDCCollectionViewCellStyle)cellStyleAtSectionIndex:(NSInteger)section { MDCCollectionViewCellStyle cellStyle = self.cellStyle; - if (self.delegate && - [self.delegate respondsToSelector:@selector(collectionView:cellStyleForSection:)]) { + if (self.delegate && [self.delegate respondsToSelector:@selector(collectionView: + cellStyleForSection:)]) { cellStyle = [self.delegate collectionView:_collectionView cellStyleForSection:section]; } return cellStyle; @@ -359,8 +359,8 @@ - (void)applyInlayToItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)anim } void (^completionBlock)(BOOL finished) = ^(__unused BOOL finished) { - if ([self.delegate - respondsToSelector:@selector(collectionView:didApplyInlayToItemAtIndexPaths:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + didApplyInlayToItemAtIndexPaths:)]) { [self.delegate collectionView:self.collectionView didApplyInlayToItemAtIndexPaths:@[ indexPath ]]; } @@ -376,8 +376,8 @@ - (void)removeInlayFromItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)a [_inlaidIndexPathSet removeObject:indexPath]; void (^completionBlock)(BOOL finished) = ^(__unused BOOL finished) { - if ([self.delegate - respondsToSelector:@selector(collectionView:didRemoveInlayFromItemAtIndexPaths:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + didRemoveInlayFromItemAtIndexPaths:)]) { [self.delegate collectionView:self.collectionView didRemoveInlayFromItemAtIndexPaths:@[ indexPath ]]; } @@ -398,8 +398,8 @@ - (void)applyInlayToAllItemsAnimated:(BOOL)animated { } void (^completionBlock)(BOOL finished) = ^(__unused BOOL finished) { - if ([self.delegate - respondsToSelector:@selector(collectionView:didApplyInlayToItemAtIndexPaths:)]) { + if ([self.delegate respondsToSelector:@selector(collectionView: + didApplyInlayToItemAtIndexPaths:)]) { [self.delegate collectionView:self.collectionView didApplyInlayToItemAtIndexPaths:[self.inlaidIndexPathSet allObjects]]; } @@ -415,9 +415,10 @@ - (void)removeInlayFromAllItemsAnimated:(BOOL)animated { [_inlaidIndexPathSet removeAllObjects]; void (^completionBlock)(BOOL finished) = ^(__unused BOOL finished) { - if ([self.delegate - respondsToSelector:@selector(collectionView:didRemoveInlayFromItemAtIndexPaths:)]) { - [self.delegate collectionView:self.collectionView didRemoveInlayFromItemAtIndexPaths:indexPaths]; + if ([self.delegate respondsToSelector:@selector(collectionView: + didRemoveInlayFromItemAtIndexPaths:)]) { + [self.delegate collectionView:self.collectionView + didRemoveInlayFromItemAtIndexPaths:indexPaths]; } }; @@ -514,8 +515,8 @@ - (UIImage *)backgroundImageForCellLayoutAttributes:(MDCCollectionViewLayoutAttr // If no-background section header, return nil image. BOOL hidesHeaderBackground = NO; - if ([_delegate - respondsToSelector:@selector(collectionView:shouldHideHeaderBackgroundForSection:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + shouldHideHeaderBackgroundForSection:)]) { hidesHeaderBackground = [_delegate collectionView:_collectionView shouldHideHeaderBackgroundForSection:attr.indexPath.section]; } @@ -525,8 +526,8 @@ - (UIImage *)backgroundImageForCellLayoutAttributes:(MDCCollectionViewLayoutAttr // If no-background section footer, return nil image. BOOL hidesFooterBackground = NO; - if ([_delegate - respondsToSelector:@selector(collectionView:shouldHideFooterBackgroundForSection:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + shouldHideFooterBackgroundForSection:)]) { hidesFooterBackground = [_delegate collectionView:_collectionView shouldHideFooterBackgroundForSection:attr.indexPath.section]; } @@ -536,8 +537,8 @@ - (UIImage *)backgroundImageForCellLayoutAttributes:(MDCCollectionViewLayoutAttr // If no-background section item, return nil image. BOOL hidesBackground = NO; - if ([_delegate - respondsToSelector:@selector(collectionView:shouldHideItemBackgroundAtIndexPath:)]) { + if ([_delegate respondsToSelector:@selector(collectionView: + shouldHideItemBackgroundAtIndexPath:)]) { hidesBackground = [_delegate collectionView:_collectionView shouldHideItemBackgroundAtIndexPath:attr.indexPath]; } @@ -561,8 +562,8 @@ - (UIImage *)backgroundImageForCellLayoutAttributes:(MDCCollectionViewLayoutAttr // Get cell color. UIColor *backgroundColor = _cellBackgroundColor; if ([_delegate respondsToSelector:@selector(collectionView:cellBackgroundColorAtIndexPath:)]) { - UIColor *customBackgroundColor = - [_delegate collectionView:_collectionView cellBackgroundColorAtIndexPath:attr.indexPath]; + UIColor *customBackgroundColor = [_delegate collectionView:_collectionView + cellBackgroundColorAtIndexPath:attr.indexPath]; if (customBackgroundColor) { backgroundColor = customBackgroundColor; } diff --git a/components/Collections/tests/unit/MDCCollectionViewFlowLayoutTests.m b/components/Collections/tests/unit/MDCCollectionViewFlowLayoutTests.m index b585e21849e..e597cb09eef 100644 --- a/components/Collections/tests/unit/MDCCollectionViewFlowLayoutTests.m +++ b/components/Collections/tests/unit/MDCCollectionViewFlowLayoutTests.m @@ -60,8 +60,8 @@ - (void)testPrepareForCollectionViewUpdatesInsertSection { // Given MDCCollectionViewFlowLayout *layout = [[MDCCollectionViewFlowLayout alloc] init]; - UICollectionView *collectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero + collectionViewLayout:layout]; collectionView.dataSource = self; NSMutableArray *updates = [NSMutableArray array]; FakeUICollectionViewUpdateItem *section1Update = [[FakeUICollectionViewUpdateItem alloc] init]; @@ -108,8 +108,8 @@ - (void)testPrepareForCollectionViewUpdatesInsertItem { // Given MDCCollectionViewFlowLayout *layout = [[MDCCollectionViewFlowLayout alloc] init]; - UICollectionView *collectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero + collectionViewLayout:layout]; collectionView.dataSource = self; NSMutableArray *updates = [NSMutableArray array]; FakeUICollectionViewUpdateItem *section0Update = [[FakeUICollectionViewUpdateItem alloc] init]; @@ -167,8 +167,8 @@ - (void)testPrepareForCollectionViewUpdatesInsertItem { - (void)testPrepareForCollectionViewUpdatesDeleteSection { // Given MDCCollectionViewFlowLayout *layout = [[MDCCollectionViewFlowLayout alloc] init]; - UICollectionView *collectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero + collectionViewLayout:layout]; collectionView.dataSource = self; NSMutableArray *updates = [NSMutableArray array]; FakeUICollectionViewUpdateItem *section1Update = [[FakeUICollectionViewUpdateItem alloc] init]; @@ -202,8 +202,8 @@ - (void)testPrepareForCollectionViewUpdatesDeleteSection { - (void)testPrepareForCollectionViewUpdatesDeleteItem { // Given MDCCollectionViewFlowLayout *layout = [[MDCCollectionViewFlowLayout alloc] init]; - UICollectionView *collectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero + collectionViewLayout:layout]; collectionView.dataSource = self; NSMutableArray *updates = [NSMutableArray array]; FakeUICollectionViewUpdateItem *section1Update = [[FakeUICollectionViewUpdateItem alloc] init]; diff --git a/components/Dialogs/src/ColorThemer/MDCAlertColorThemer.m b/components/Dialogs/src/ColorThemer/MDCAlertColorThemer.m index aab888e17bb..ace7eaff2f2 100644 --- a/components/Dialogs/src/ColorThemer/MDCAlertColorThemer.m +++ b/components/Dialogs/src/ColorThemer/MDCAlertColorThemer.m @@ -47,13 +47,15 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme } + (void)applyColorScheme:(id)colorScheme { - #if defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0 - [[MDCButton appearanceWhenContainedInInstancesOfClasses:@[[MDCAlertController class]]] - setTitleColor:colorScheme.primaryColor forState:UIControlStateNormal]; - #else +#if defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0 + [[MDCButton appearanceWhenContainedInInstancesOfClasses:@ [[MDCAlertController class]]] + setTitleColor:colorScheme.primaryColor + forState:UIControlStateNormal]; +#else [[MDCButton appearanceWhenContainedIn:[MDCAlertController class], nil] - setTitleColor:colorScheme.primaryColor forState:UIControlStateNormal]; - #endif + setTitleColor:colorScheme.primaryColor + forState:UIControlStateNormal]; +#endif } @end diff --git a/components/Dialogs/src/MDCAlertController.m b/components/Dialogs/src/MDCAlertController.m index dffe3b709a8..1d6fcf70fc5 100644 --- a/components/Dialogs/src/MDCAlertController.m +++ b/components/Dialogs/src/MDCAlertController.m @@ -84,7 +84,6 @@ - (nonnull instancetype)initWithTitle:(nullable NSString *)title @end @implementation MDCAlertController { - // This is because title is overlapping with view controller title, However Apple alertController // redefines title as well. NSString *_alertTitle; @@ -94,11 +93,10 @@ @implementation MDCAlertController { BOOL _mdc_adjustsFontForContentSizeCategory; } - + (instancetype)alertControllerWithTitle:(nullable NSString *)alertTitle message:(nullable NSString *)message { - MDCAlertController *alertController = - [[MDCAlertController alloc] initWithTitle:alertTitle message:message]; + MDCAlertController *alertController = [[MDCAlertController alloc] initWithTitle:alertTitle + message:message]; return alertController; } @@ -143,7 +141,6 @@ - (void)setTitle:(NSString *)title { self.alertView.titleLabel.text = title; self.preferredContentSize = [self.alertView calculatePreferredContentSizeForBounds:CGRectInfinite.size]; - } } @@ -323,11 +320,12 @@ - (void)actionButtonPressed:(id)button { // We call our action.completionHandler after we dismiss the existing alert in case the handler // also presents a view controller. Otherwise we get a warning about presenting on a controller // which is already presenting. - [self.presentingViewController dismissViewControllerAnimated:YES completion:^(void){ - if (action.completionHandler) { - action.completionHandler(action); - } - }]; + [self.presentingViewController dismissViewControllerAnimated:YES + completion:^(void) { + if (action.completionHandler) { + action.completionHandler(action); + } + }]; } #pragma mark - UIViewController @@ -355,12 +353,9 @@ - (void)viewDidLoad { NSString *key = kMaterialDialogsStringTable[kStr_MaterialDialogsPresentedAccessibilityAnnouncement]; - NSString *announcement = NSLocalizedStringFromTableInBundle(key, - kMaterialDialogsStringsTableName, - [[self class] bundle], - @"Alert"); - UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, - announcement); + NSString *announcement = NSLocalizedStringFromTableInBundle(key, kMaterialDialogsStringsTableName, + [[self class] bundle], @"Alert"); + UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, announcement); } - (void)setupAlertView { @@ -403,8 +398,8 @@ - (void)viewDidLayoutSubviews { if (CGRectGetWidth(self.view.bounds) != _previousLayoutSize.width || CGRectGetHeight(self.view.bounds) != _previousLayoutSize.height) { CGSize currentPreferredContentSize = self.preferredContentSize; - CGSize calculatedPreferredContentSize = - [self.alertView calculatePreferredContentSizeForBounds:CGRectStandardize(self.alertView.bounds).size]; + CGSize calculatedPreferredContentSize = [self.alertView + calculatePreferredContentSizeForBounds:CGRectStandardize(self.alertView.bounds).size]; if (!CGSizeEqualToSize(currentPreferredContentSize, calculatedPreferredContentSize)) { // NOTE: Setting the preferredContentSize can lead to a change to self.view.bounds. @@ -460,13 +455,14 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [coordinator animateAlongsideTransition: - ^(__unused id _Nonnull context) { + [coordinator + animateAlongsideTransition:^( + __unused id _Nonnull context) { // Reset preferredContentSize on viewWIllTransition to take advantage of additional width self.preferredContentSize = [self.alertView calculatePreferredContentSizeForBounds:CGRectInfinite.size]; } - completion:nil]; + completion:nil]; } #pragma mark - UIAccessibilityAction diff --git a/components/Dialogs/src/MDCDialogPresentationController.m b/components/Dialogs/src/MDCDialogPresentationController.m index 052b3e84c4b..4ae961a3b93 100644 --- a/components/Dialogs/src/MDCDialogPresentationController.m +++ b/components/Dialogs/src/MDCDialogPresentationController.m @@ -85,8 +85,8 @@ - (instancetype)initWithPresentedViewController:(UIViewController *)presentedVie _dimmingView = [[UIView alloc] initWithFrame:CGRectZero]; _dimmingView.backgroundColor = [UIColor colorWithWhite:0 alpha:(CGFloat)0.32]; _dimmingView.alpha = 0; - _dismissGestureRecognizer = - [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss:)]; + _dismissGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self + action:@selector(dismiss:)]; [_dimmingView addGestureRecognizer:_dismissGestureRecognizer]; _trackingView = [[MDCDialogShadowedView alloc] init]; @@ -121,7 +121,8 @@ - (CGRect)frameOfPresentedViewInContainerView { containerSafeAreaInsets.bottom = MAX(containerSafeAreaInsets.bottom, keyboardHeight); // Area that the presented dialog can use. - CGRect standardPresentableBounds = UIEdgeInsetsInsetRect(containerBounds, containerSafeAreaInsets); + CGRect standardPresentableBounds = + UIEdgeInsetsInsetRect(containerBounds, containerSafeAreaInsets); CGRect presentedViewFrame = CGRectZero; presentedViewFrame.size = [self sizeForChildContentContainer:self.presentedViewController @@ -267,14 +268,15 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [coordinator animateAlongsideTransition: - ^(__unused id context) { + [coordinator + animateAlongsideTransition:^( + __unused id context) { self.dimmingView.frame = self.containerView.bounds; CGRect presentedViewFrame = [self frameOfPresentedViewInContainerView]; self.presentedView.frame = presentedViewFrame; self.trackingView.frame = presentedViewFrame; } - completion:NULL]; + completion:NULL]; } /** diff --git a/components/Dialogs/src/private/MDCAlertControllerView+Private.m b/components/Dialogs/src/private/MDCAlertControllerView+Private.m index 17696a738e6..ed7c2615778 100644 --- a/components/Dialogs/src/private/MDCAlertControllerView+Private.m +++ b/components/Dialogs/src/private/MDCAlertControllerView+Private.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MDCAlertControllerView.h" #import "MDCAlertControllerView+Private.h" +#import "MDCAlertControllerView.h" #import @@ -164,8 +164,8 @@ - (void)updateTitleFont { UIFont *titleFont = _titleFont ?: [[self class] titleFontDefault]; if (_mdc_adjustsFontForContentSizeCategory) { _titleLabel.font = - [titleFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + [titleFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { _titleLabel.font = titleFont; } @@ -239,7 +239,7 @@ - (void)updateMessageFont { if (_mdc_adjustsFontForContentSizeCategory) { _messageLabel.font = [messageFont mdc_fontSizedForMaterialTextStyle:kMessageTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { _messageLabel.font = messageFont; } @@ -270,7 +270,7 @@ - (void)updateButtonFont { if (_mdc_adjustsFontForContentSizeCategory) { finalButtonFont = [finalButtonFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } for (MDCButton *button in self.actionManager.buttonsInActionOrder) { [button setTitleFont:finalButtonFont forState:UIControlStateNormal]; @@ -286,7 +286,6 @@ + (UIFont *)buttonFontDefault { return [MDCTypography titleFont]; } - - (void)setButtonColor:(UIColor *)color { _buttonColor = color; @@ -317,13 +316,12 @@ - (void)setCornerRadius:(CGFloat)cornerRadius { #pragma mark - Internal - - (CGSize)actionButtonsSizeInHorizontalLayout { CGSize size = CGSizeZero; NSArray *buttons = self.actionManager.buttonsInActionOrder; if (0 < [buttons count]) { size.height = - MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; + MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; size.width = MDCDialogActionsInsets.left + MDCDialogActionsInsets.right; for (UIButton *button in buttons) { CGSize buttonSize = [button sizeThatFits:size]; @@ -357,10 +355,8 @@ - (CGSize)actionButtonsSizeInVericalLayout { return size; } - // @param boundsSize should not include any internal margins or padding - (CGSize)calculatePreferredContentSizeForBounds:(CGSize)boundsSize { - // Even if we have more room, limit our maximum width boundsSize.width = MIN(boundsSize.width, MDCDialogMaximumWidth); @@ -438,7 +434,6 @@ - (CGSize)calculateActionsSizeThatFitsWidth:(CGFloat)boundingWidth { return actionsSize; } - - (void)layoutSubviews { [super layoutSubviews]; @@ -447,19 +442,15 @@ - (void)layoutSubviews { for (MDCButton *button in buttons) { [button sizeToFit]; CGRect buttonFrame = button.frame; - buttonFrame.size.width = - MAX(CGRectGetWidth(buttonFrame), MDCDialogActionButtonMinimumWidth); - buttonFrame.size.height = - MAX(CGRectGetHeight(buttonFrame), MDCDialogActionButtonHeight); + buttonFrame.size.width = MAX(CGRectGetWidth(buttonFrame), MDCDialogActionButtonMinimumWidth); + buttonFrame.size.height = MAX(CGRectGetHeight(buttonFrame), MDCDialogActionButtonHeight); button.frame = buttonFrame; CGFloat verticalInsets = (CGRectGetHeight(button.frame) - MDCDialogActionMinTouchTarget) / 2; CGFloat horizontalInsets = (CGRectGetWidth(button.frame) - MDCDialogActionMinTouchTarget) / 2; verticalInsets = MIN(0, verticalInsets); horizontalInsets = MIN(0, horizontalInsets); - button.hitAreaInsets = UIEdgeInsetsMake(verticalInsets, - horizontalInsets, - verticalInsets, - horizontalInsets); + button.hitAreaInsets = + UIEdgeInsetsMake(verticalInsets, horizontalInsets, verticalInsets, horizontalInsets); } // Used to calculate the height of the scrolling content, so we limit the width. @@ -530,7 +521,7 @@ - (void)layoutSubviews { // Actions CGSize actionSize = [self calculateActionsSizeThatFitsWidth:boundsSize.width]; const CGFloat horizontalActionHeight = - MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; + MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; if (horizontalActionHeight < actionSize.height) { self.verticalActionsLayout = YES; } else { @@ -581,8 +572,7 @@ - (void)layoutSubviews { if (self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { for (UIButton *button in buttons) { - CGRect flippedRect = - MDFRectFlippedHorizontally(button.frame, CGRectGetWidth(self.bounds)); + CGRect flippedRect = MDFRectFlippedHorizontally(button.frame, CGRectGetWidth(self.bounds)); button.frame = flippedRect; } } @@ -596,29 +586,29 @@ - (void)layoutSubviews { actionsScrollViewRect.size = self.actionsScrollView.contentSize; const CGFloat requestedHeight = - self.contentScrollView.contentSize.height + self.actionsScrollView.contentSize.height; + self.contentScrollView.contentSize.height + self.actionsScrollView.contentSize.height; if (requestedHeight <= CGRectGetHeight(self.bounds)) { // Simple layout case : both content and actions fit on the screen at once self.contentScrollView.frame = contentScrollViewRect; actionsScrollViewRect.origin.y = - CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; + CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; self.actionsScrollView.frame = actionsScrollViewRect; } else { // Complex layout case : Split the space between the two scrollviews if (CGRectGetHeight(contentScrollViewRect) < CGRectGetHeight(self.bounds) * (CGFloat)0.5) { actionsScrollViewRect.size.height = - CGRectGetHeight(self.bounds) - contentScrollViewRect.size.height; + CGRectGetHeight(self.bounds) - contentScrollViewRect.size.height; } else { CGFloat maxActionsHeight = CGRectGetHeight(self.bounds) * (CGFloat)0.5; actionsScrollViewRect.size.height = MIN(maxActionsHeight, actionsScrollViewRect.size.height); } actionsScrollViewRect.origin.y = - CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; + CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; self.actionsScrollView.frame = actionsScrollViewRect; contentScrollViewRect.size.height = - CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; + CGRectGetHeight(self.bounds) - actionsScrollViewRect.size.height; self.contentScrollView.frame = contentScrollViewRect; } } @@ -648,6 +638,4 @@ - (void)updateFonts { [self setNeedsLayout]; } - - @end diff --git a/components/Dialogs/tests/unit/MDCAlertControllerColorThemerTests.m b/components/Dialogs/tests/unit/MDCAlertControllerColorThemerTests.m index 37cd58f3286..90de83907ce 100644 --- a/components/Dialogs/tests/unit/MDCAlertControllerColorThemerTests.m +++ b/components/Dialogs/tests/unit/MDCAlertControllerColorThemerTests.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialDialogs.h" #import "MaterialDialogs+ColorThemer.h" +#import "MaterialDialogs.h" #import "MDCAlertControllerView+Private.h" @@ -44,10 +44,8 @@ - (BOOL)color1:(UIColor *)color1 equalsColor2:(UIColor *)color2 { CGFloat blue2 = 0; CGFloat alpha2 = 0; [color2 getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2]; - return (fabs(red1 - red2) < CGFLOAT_EPSILON - && fabs(green1 - green2) < CGFLOAT_EPSILON - && fabs(blue1 - blue2) < CGFLOAT_EPSILON - && fabs(alpha1 - alpha2) < CGFLOAT_EPSILON); + return (fabs(red1 - red2) < CGFLOAT_EPSILON && fabs(green1 - green2) < CGFLOAT_EPSILON && + fabs(blue1 - blue2) < CGFLOAT_EPSILON && fabs(alpha1 - alpha2) < CGFLOAT_EPSILON); } - (void)testApplyingColorScheme { diff --git a/components/Dialogs/tests/unit/MDCAlertControllerTypographyThemerTests.m b/components/Dialogs/tests/unit/MDCAlertControllerTypographyThemerTests.m index 102af4dffe3..9a985b989ac 100644 --- a/components/Dialogs/tests/unit/MDCAlertControllerTypographyThemerTests.m +++ b/components/Dialogs/tests/unit/MDCAlertControllerTypographyThemerTests.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialDialogs.h" #import "MaterialDialogs+TypographyThemer.h" +#import "MaterialDialogs.h" #import "MDCAlertControllerView+Private.h" diff --git a/components/FeatureHighlight/examples/FeatureHighlightColorExample.m b/components/FeatureHighlight/examples/FeatureHighlightColorExample.m index 06a8d7a8cf2..b71fb7c1a20 100644 --- a/components/FeatureHighlight/examples/FeatureHighlightColorExample.m +++ b/components/FeatureHighlight/examples/FeatureHighlightColorExample.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialFeatureHighlight.h" #import "MaterialFeatureHighlight+FeatureHighlightAccessibilityMutator.h" +#import "MaterialFeatureHighlight.h" #import "supplemental/FeatureHighlightExampleSupplemental.h" @implementation FeatureHighlightColorExample diff --git a/components/FeatureHighlight/examples/FeatureHighlightCustomFontsExample.m b/components/FeatureHighlight/examples/FeatureHighlightCustomFontsExample.m index 592442b7bd9..f95b1e3156c 100644 --- a/components/FeatureHighlight/examples/FeatureHighlightCustomFontsExample.m +++ b/components/FeatureHighlight/examples/FeatureHighlightCustomFontsExample.m @@ -13,9 +13,9 @@ // limitations under the License. #import "MaterialButtons.h" +#import "MaterialFeatureHighlight+FeatureHighlightAccessibilityMutator.h" #import "MaterialFeatureHighlight.h" #import "MaterialTypography.h" -#import "MaterialFeatureHighlight+FeatureHighlightAccessibilityMutator.h" #import "supplemental/FeatureHighlightExampleSupplemental.h" @implementation FeatureHighlightCustomFontsExample @@ -55,8 +55,7 @@ - (void)viewDidLoad { - (void)didTapButton:(id)sender { MDCFeatureHighlightViewController *vc = - [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:_button - completion:nil]; + [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:_button completion:nil]; [MDCFeatureHighlightAccessibilityMutator mutate:vc]; vc.titleText = @"Feature Highlight can use custom fonts"; diff --git a/components/FeatureHighlight/examples/FeatureHighlightTypicalUseViewController.m b/components/FeatureHighlight/examples/FeatureHighlightTypicalUseViewController.m index ba9b448206c..b0ef1b69982 100644 --- a/components/FeatureHighlight/examples/FeatureHighlightTypicalUseViewController.m +++ b/components/FeatureHighlight/examples/FeatureHighlightTypicalUseViewController.m @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialFeatureHighlight.h" #import "MaterialFeatureHighlight+ColorThemer.h" #import "MaterialFeatureHighlight+TypographyThemer.h" +#import "MaterialFeatureHighlight.h" #import "supplemental/FeatureHighlightExampleSupplemental.h" @implementation FeatureHighlightTypicalUseViewController diff --git a/components/FeatureHighlight/examples/supplemental/FeatureHighlightExampleSupplemental.m b/components/FeatureHighlight/examples/supplemental/FeatureHighlightExampleSupplemental.m index df1b654e9c9..10925b8b289 100644 --- a/components/FeatureHighlight/examples/supplemental/FeatureHighlightExampleSupplemental.m +++ b/components/FeatureHighlight/examples/supplemental/FeatureHighlightExampleSupplemental.m @@ -96,11 +96,11 @@ - (void)didTapBackground:(UITapGestureRecognizer *)recognizer { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Feature Highlight", @"Feature Highlight" ], - @"description": @"The Feature Highlight component is used to introduce users to new features " - @"and functionality at contextually relevant moments.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Feature Highlight", @"Feature Highlight" ], + @"description" : @"The Feature Highlight component is used to introduce users to new features " + @"and functionality at contextually relevant moments.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -154,15 +154,14 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Feature Highlight", @"Colors" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Feature Highlight", @"Colors" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @end - @implementation FeatureHighlightCustomFontsExample (CatalogByConvention) - (void)viewDidLayoutSubviews { @@ -176,18 +175,18 @@ - (void)viewDidLayoutSubviews { CGSize labelSize = [self.infoLabel sizeThatFits:self.view.frame.size]; self.infoLabel.frame = - MDCRectAlignToScale(CGRectMake(self.view.frame.size.width / 2 - labelSize.width / 2, 20, - labelSize.width, labelSize.height), - [UIScreen mainScreen].scale); + MDCRectAlignToScale(CGRectMake(self.view.frame.size.width / 2 - labelSize.width / 2, 20, + labelSize.width, labelSize.height), + [UIScreen mainScreen].scale); } #pragma mark - CatalogByConvention + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Feature Highlight", @"Custom Fonts" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Feature Highlight", @"Custom Fonts" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -244,9 +243,9 @@ - (void)viewDidLayoutSubviews { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Feature Highlight", @"Shown Views" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Feature Highlight", @"Shown Views" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/FeatureHighlight/src/ColorThemer/MDCFeatureHighlightColorThemer.m b/components/FeatureHighlight/src/ColorThemer/MDCFeatureHighlightColorThemer.m index af397a37a32..96898c4afd3 100644 --- a/components/FeatureHighlight/src/ColorThemer/MDCFeatureHighlightColorThemer.m +++ b/components/FeatureHighlight/src/ColorThemer/MDCFeatureHighlightColorThemer.m @@ -25,8 +25,8 @@ + (void)applyColorScheme:(id)colorScheme } + (void)applySemanticColorScheme:(id)colorScheme - toFeatureHighlightViewController: - (MDCFeatureHighlightViewController *)featureHighlightViewController { + toFeatureHighlightViewController: + (MDCFeatureHighlightViewController *)featureHighlightViewController { featureHighlightViewController.innerHighlightColor = colorScheme.surfaceColor; featureHighlightViewController.outerHighlightColor = colorScheme.primaryColor; featureHighlightViewController.titleColor = colorScheme.onPrimaryColor; diff --git a/components/FeatureHighlight/src/FeatureHighlightAccessibilityMutator/MDCFeatureHighlightAccessibilityMutator.m b/components/FeatureHighlight/src/FeatureHighlightAccessibilityMutator/MDCFeatureHighlightAccessibilityMutator.m index 1b387d93341..22f31995de5 100644 --- a/components/FeatureHighlight/src/FeatureHighlightAccessibilityMutator/MDCFeatureHighlightAccessibilityMutator.m +++ b/components/FeatureHighlight/src/FeatureHighlightAccessibilityMutator/MDCFeatureHighlightAccessibilityMutator.m @@ -19,13 +19,12 @@ @implementation MDCFeatureHighlightAccessibilityMutator - + (void)mutate:(MDCFeatureHighlightViewController *)featureHighlightViewController { [MDCFeatureHighlightAccessibilityMutator mutateTitleColor:featureHighlightViewController]; [MDCFeatureHighlightAccessibilityMutator mutateBodyColor:featureHighlightViewController]; } -+ (void)mutateTitleColor:(MDCFeatureHighlightViewController *)featureHighlightViewController{ ++ (void)mutateTitleColor:(MDCFeatureHighlightViewController *)featureHighlightViewController { MDFTextAccessibilityOptions options = MDFTextAccessibilityOptionsPreferLighter; if ([MDFTextAccessibility isLargeForContrastRatios:featureHighlightViewController.titleFont]) { options |= MDFTextAccessibilityOptionsLargeFont; @@ -44,10 +43,9 @@ + (void)mutateTitleColor:(MDCFeatureHighlightViewController *)featureHighlightVi } // Make title alpha the maximum it can be. - CGFloat titleAlpha = - [MDFTextAccessibility minAlphaOfTextColor:titleColor - onBackgroundColor:backgroundColor - options:options]; + CGFloat titleAlpha = [MDFTextAccessibility minAlphaOfTextColor:titleColor + onBackgroundColor:backgroundColor + options:options]; titleAlpha = MAX([MDCTypography titleFontOpacity], titleAlpha); featureHighlightViewController.titleColor = [titleColor colorWithAlphaComponent:titleAlpha]; } @@ -83,4 +81,3 @@ + (UIColor *)accessibleColorForTextColor:(UIColor *)textColor } @end - diff --git a/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m b/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m index dd068470ca8..c050b2136a1 100644 --- a/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m +++ b/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m @@ -93,7 +93,7 @@ - (void)viewDidLoad { /* Disable setter. Always use internal transition controller */ - (void)setTransitioningDelegate: - (__unused id)transitioningDelegate { + (__unused id)transitioningDelegate { NSAssert(NO, @"MDCAlertController.transitioningDelegate cannot be changed."); return; } @@ -166,14 +166,14 @@ - (void)viewWillDisappear:(BOOL)animated { - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [coordinator animateAlongsideTransition: - ^(__unused id _Nonnull context) { - [self resetHighlightPoint]; - } - completion: - ^(id _Nonnull context) { - [self resetHighlightPoint]; - }]; + [coordinator + animateAlongsideTransition:^( + __unused id _Nonnull context) { + [self resetHighlightPoint]; + } + completion:^(id _Nonnull context) { + [self resetHighlightPoint]; + }]; } - (void)resetHighlightPoint { @@ -298,7 +298,7 @@ - (BOOL)accessibilityPerformEscape { } - (id)animationControllerForDismissedController: - (UIViewController *)dismissed { + (UIViewController *)dismissed { if (dismissed == self) { return _animationController; } @@ -362,5 +362,4 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName { return [resourcePath stringByAppendingPathComponent:bundleName]; } - @end diff --git a/components/FeatureHighlight/src/TypographyThemer/MDCFeatureHighlightTypographyThemer.m b/components/FeatureHighlight/src/TypographyThemer/MDCFeatureHighlightTypographyThemer.m index 30370c029ba..51a800d6c94 100644 --- a/components/FeatureHighlight/src/TypographyThemer/MDCFeatureHighlightTypographyThemer.m +++ b/components/FeatureHighlight/src/TypographyThemer/MDCFeatureHighlightTypographyThemer.m @@ -17,7 +17,7 @@ @implementation MDCFeatureHighlightTypographyThemer + (void)applyTypographyScheme:(nonnull id)typographyScheme - toFeatureHighlightViewController: + toFeatureHighlightViewController: (nonnull MDCFeatureHighlightViewController *)featureHighlightViewController { featureHighlightViewController.titleFont = typographyScheme.headline6; featureHighlightViewController.bodyFont = typographyScheme.body2; diff --git a/components/FeatureHighlight/src/private/MDCFeatureHighlightDismissGestureRecognizer.m b/components/FeatureHighlight/src/private/MDCFeatureHighlightDismissGestureRecognizer.m index 4679fe4daaf..4c2dcfd2ee8 100644 --- a/components/FeatureHighlight/src/private/MDCFeatureHighlightDismissGestureRecognizer.m +++ b/components/FeatureHighlight/src/private/MDCFeatureHighlightDismissGestureRecognizer.m @@ -136,15 +136,16 @@ - (CGFloat)progressForTouchPosition:(CGPoint)touchPos { // Now compute in the form at^2 + bt + c = 0 // a = (r2 - r1)^2 - (c2.x - c1.x)^2 - (c2.y - c1.y)^2 CGFloat a = MDCPow(r2 - r1, 2) - MDCPow(c2.x - c1.x, 2) - MDCPow(c2.y - c1.y, 2); - // b = 2r1(r2 - r1) - 2c1.x(c2.x - c1.x) + 2(c2.x - c1.x)p.x - 2c1.y(c2.y - c1.y) + 2(c2.y - c1.y)p.y - CGFloat b = 2*r1*(r2 - r1) - 2*c1.x*(c2.x - c1.x) + 2*(c2.x - c1.x)*p.x - 2*c1.y*(c2.y - c1.y) - + 2*(c2.y - c1.y)*p.y; + // b = 2r1(r2 - r1) - 2c1.x(c2.x - c1.x) + 2(c2.x - c1.x)p.x - 2c1.y(c2.y - c1.y) + 2(c2.y - + // c1.y)p.y + CGFloat b = 2 * r1 * (r2 - r1) - 2 * c1.x * (c2.x - c1.x) + 2 * (c2.x - c1.x) * p.x - + 2 * c1.y * (c2.y - c1.y) + 2 * (c2.y - c1.y) * p.y; // c = r1^2 - c1.x^2 + 2c1.x*p.x - p.x^2 - c1.y^2 + 2c1.y*p.y - p.y^2 - CGFloat c = MDCPow(r1, 2) - MDCPow(c1.x, 2) + 2*c1.x*p.x - MDCPow(p.x, 2) - MDCPow(c1.y, 2) - + 2*c1.y*p.y - MDCPow(p.y, 2); + CGFloat c = MDCPow(r1, 2) - MDCPow(c1.x, 2) + 2 * c1.x * p.x - MDCPow(p.x, 2) - MDCPow(c1.y, 2) + + 2 * c1.y * p.y - MDCPow(p.y, 2); // Apply the quadratic equation - CGFloat t = (-b - MDCSqrt(b*b - 4*a*c))/(2*a); + CGFloat t = (-b - MDCSqrt(b * b - 4 * a * c)) / (2 * a); return MIN(1, MAX(0, t)); } diff --git a/components/FeatureHighlight/src/private/MDCFeatureHighlightLayer.m b/components/FeatureHighlight/src/private/MDCFeatureHighlightLayer.m index cb4775aedbe..8b00d1dbf71 100644 --- a/components/FeatureHighlight/src/private/MDCFeatureHighlightLayer.m +++ b/components/FeatureHighlight/src/private/MDCFeatureHighlightLayer.m @@ -21,7 +21,7 @@ @implementation MDCFeatureHighlightLayer { } - (void)setPosition:(CGPoint)position animated:(BOOL)animated { - if (CGPointEqualToPoint(self.position , position)) { + if (CGPointEqualToPoint(self.position, position)) { return; } if (animated) { @@ -49,8 +49,8 @@ - (void)setRadius:(CGFloat)radius animated:(BOOL)animated { if (self.path) { animation.fromValue = (__bridge id)self.path; } else { - animation.fromValue = CFBridgingRelease( - CGPathCreateWithEllipseInRect(CGRectMake(0, 0, 0, 0), NULL)); + animation.fromValue = + CFBridgingRelease(CGPathCreateWithEllipseInRect(CGRectMake(0, 0, 0, 0), NULL)); } self.path = (__bridge CGPathRef _Nullable)CFBridgingRelease( CGPathCreateWithEllipseInRect(circleRect, NULL)); @@ -74,8 +74,7 @@ - (void)setFillColor:(CGColorRef)fillColor animated:(BOOL)animated { } } -- (void)animateRadiusOverKeyframes:(NSArray *)radii - keyTimes:(NSArray *)keyTimes { +- (void)animateRadiusOverKeyframes:(NSArray *)radii keyTimes:(NSArray *)keyTimes { NSMutableArray *values = [NSMutableArray arrayWithCapacity:radii.count]; for (NSNumber *radius in radii) { CGFloat r = radius.floatValue; diff --git a/components/FeatureHighlight/src/private/MDCFeatureHighlightView+Private.m b/components/FeatureHighlight/src/private/MDCFeatureHighlightView+Private.m index c9bfc7fcb71..e75efeed87d 100644 --- a/components/FeatureHighlight/src/private/MDCFeatureHighlightView+Private.m +++ b/components/FeatureHighlight/src/private/MDCFeatureHighlightView+Private.m @@ -14,9 +14,9 @@ #import "MDCFeatureHighlightView+Private.h" +#import #import "MDCFeatureHighlightDismissGestureRecognizer.h" #import "MDCFeatureHighlightLayer.h" -#import #import "MaterialFeatureHighlightStrings.h" #import "MaterialFeatureHighlightStrings_table.h" @@ -144,7 +144,7 @@ - (instancetype)initWithFrame:(CGRect)frame { } - (void)dealloc { - //TODO(#2651): Remove once we move to iOS8 + // TODO(#2651): Remove once we move to iOS8 // Remove Dynamic Type contentSizeCategoryDidChangeNotification [[NSNotificationCenter defaultCenter] removeObserver:self name:UIContentSizeCategoryDidChangeNotification @@ -185,7 +185,7 @@ - (void)updateTitleFont { if (_mdc_adjustsFontForContentSizeCategory) { _titleLabel.font = [_titleFont mdc_fontSizedForMaterialTextStyle:kTitleTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { _titleLabel.font = _titleFont; } @@ -354,7 +354,7 @@ - (void)layoutSubviews { CGFloat leftTextBound = kMDCFeatureHighlightTextPadding; CGFloat rightTextBound = self.frame.size.width - MAX(titleSize.width, detailSize.width) - - kMDCFeatureHighlightTextPadding; + kMDCFeatureHighlightTextPadding; CGPoint titlePos = CGPointMake(0, 0); titlePos.x = MIN(MAX(_highlightCenter.x - textWidth / 2, leftTextBound), rightTextBound); if (topHalf) { @@ -619,8 +619,7 @@ - (void)contentSizeCategoryDidChange:(__unused NSNotification *)notification { - (BOOL)gestureRecognizer:(__unused UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: - (__unused UIGestureRecognizer *)otherGestureRecognizer -{ + (__unused UIGestureRecognizer *)otherGestureRecognizer { return YES; } diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightAccessibilityTests.m b/components/FeatureHighlight/tests/unit/FeatureHighlightAccessibilityTests.m index fb336106459..f49cc52200e 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightAccessibilityTests.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightAccessibilityTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialFeatureHighlight.h" #import "MDCFeatureHighlightView+Private.h" +#import "MaterialFeatureHighlight.h" @interface MDCFeatureHighlightViewController (Testing) @property(nonatomic, strong) MDCFeatureHighlightView *view; @@ -32,9 +32,9 @@ - (void)testAccessibilityHintDefaultAfterLoadingView { UIView *view = [[UIView alloc] init]; UIView *view2 = [[UIView alloc] init]; MDCFeatureHighlightViewController *controller = - [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:view - andShowView:view2 - completion:nil]; + [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:view + andShowView:view2 + completion:nil]; // When (cause the view to load) (void)controller.view; @@ -66,9 +66,9 @@ - (void)testSetAccessibilityHintNil { UIView *view = [[UIView alloc] init]; UIView *view2 = [[UIView alloc] init]; MDCFeatureHighlightViewController *controller = - [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:view - andShowView:view2 - completion:nil]; + [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:view + andShowView:view2 + completion:nil]; controller.accessibilityHint = nil; // Then diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightColorThemerTests.m b/components/FeatureHighlight/tests/unit/FeatureHighlightColorThemerTests.m index 265bb41f15e..0b33ad1a749 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightColorThemerTests.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightColorThemerTests.m @@ -12,15 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. - -#import "MaterialFeatureHighlight.h" #import "MaterialFeatureHighlight+ColorThemer.h" +#import "MaterialFeatureHighlight.h" #import @interface FeatureHighlightColorThemerTests : XCTestCase -@property (nonatomic, strong) UIView *highlightedView; -@property (nonatomic, strong) UIView *showView; +@property(nonatomic, strong) UIView *highlightedView; +@property(nonatomic, strong) UIView *showView; @end @implementation FeatureHighlightColorThemerTests diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightCustomFontTest.m b/components/FeatureHighlight/tests/unit/FeatureHighlightCustomFontTest.m index c15af544601..4cede552124 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightCustomFontTest.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightCustomFontTest.m @@ -30,7 +30,6 @@ @interface FeatureHighlightCustomFontTest : XCTestCase @implementation FeatureHighlightCustomFontTest - (void)testCustomTitleFontUpdateLabel { - // Given MDCFeatureHighlightView *view = [[MDCFeatureHighlightView alloc] init]; @@ -48,7 +47,6 @@ - (void)testCustomTitleFontUpdateLabel { } - (void)testCustomBodyFontUpdateLabel { - // Given MDCFeatureHighlightView *view = [[MDCFeatureHighlightView alloc] init]; diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightTitleBodyAccessibilityMutatorTests.m b/components/FeatureHighlight/tests/unit/FeatureHighlightTitleBodyAccessibilityMutatorTests.m index 647c2c85556..b540b44d60f 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightTitleBodyAccessibilityMutatorTests.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightTitleBodyAccessibilityMutatorTests.m @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. - #import "MaterialFeatureHighlight+FeatureHighlightAccessibilityMutator.h" #import "MaterialFeatureHighlight.h" #import -static NSArray *testColors(){ - return @[[UIColor whiteColor], [UIColor blackColor], [UIColor redColor], [UIColor orangeColor], - [UIColor greenColor], [UIColor blueColor], [UIColor grayColor]]; +static NSArray *testColors() { + return @[ + [UIColor whiteColor], [UIColor blackColor], [UIColor redColor], [UIColor orangeColor], + [UIColor greenColor], [UIColor blueColor], [UIColor grayColor] + ]; } - @interface FeatureHighlightTitleBodyAccessibilityMutatorTests : XCTestCase -@property (nonatomic, strong) UIView *highlightedView; -@property (nonatomic, strong) UIView *showView; +@property(nonatomic, strong) UIView *highlightedView; +@property(nonatomic, strong) UIView *showView; @end @implementation FeatureHighlightTitleBodyAccessibilityMutatorTests @@ -53,7 +53,7 @@ - (void)testMutatorChangesTextColor { [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:self.highlightedView andShowView:self.showView completion:nil]; - + // Making the background color the same as the title/body color. featureHighlightViewController.outerHighlightColor = color; featureHighlightViewController.titleColor = color; @@ -95,7 +95,7 @@ - (void)testMutatorChangesTextColorToExpectedColor { } - (void)testMutatorKeepsAccessibleTextColor { - NSDictionary* colors = @{ [UIColor redColor]: [UIColor blackColor]}; + NSDictionary *colors = @{[UIColor redColor] : [UIColor blackColor]}; for (UIColor *color in colors) { MDCFeatureHighlightViewController *featureHighlightViewController = [[MDCFeatureHighlightViewController alloc] initWithHighlightedView:self.highlightedView diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightTypographyThemerTests.m b/components/FeatureHighlight/tests/unit/FeatureHighlightTypographyThemerTests.m index 07cc8e7ecc5..cfc19c17f3e 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightTypographyThemerTests.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightTypographyThemerTests.m @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialFeatureHighlight.h" #import "MaterialFeatureHighlight+TypographyThemer.h" +#import "MaterialFeatureHighlight.h" #import @interface FeatureHighlightTypographyThemerTests : XCTestCase -@property (nonatomic, strong) UIView *highlightedView; -@property (nonatomic, strong) UIView *showView; +@property(nonatomic, strong) UIView *highlightedView; +@property(nonatomic, strong) UIView *showView; @end @@ -47,7 +47,6 @@ - (void)testFeaturehighlightTypographyThemer { toFeatureHighlightViewController:featureHighlightViewController]; XCTAssertEqualObjects(featureHighlightViewController.titleFont, typographyScheme.headline6); XCTAssertEqualObjects(featureHighlightViewController.bodyFont, typographyScheme.body2); - } - +} @end diff --git a/components/FeatureHighlight/tests/unit/FeatureHighlightViewControllerTests.m b/components/FeatureHighlight/tests/unit/FeatureHighlightViewControllerTests.m index d03d5fc0e17..73a24f14762 100644 --- a/components/FeatureHighlight/tests/unit/FeatureHighlightViewControllerTests.m +++ b/components/FeatureHighlight/tests/unit/FeatureHighlightViewControllerTests.m @@ -22,7 +22,6 @@ @interface FeatureHighlightViewControllerTests : XCTestCase @implementation FeatureHighlightViewControllerTests - - (void)testFeatureHighlightViewIsNotLoadedWhenSettingProperties { UIView *view = [[UIView alloc] init]; UIView *view2 = [[UIView alloc] init]; diff --git a/components/FlexibleHeader/examples/FlexibleHeaderConfiguratorExample.m b/components/FlexibleHeader/examples/FlexibleHeaderConfiguratorExample.m index e7847e49d1b..19885539c2e 100644 --- a/components/FlexibleHeader/examples/FlexibleHeaderConfiguratorExample.m +++ b/components/FlexibleHeader/examples/FlexibleHeaderConfiguratorExample.m @@ -37,7 +37,7 @@ - (void)flexibleHeaderViewController:(MDCFlexibleHeaderViewController *)flexible - (void)field:(FlexibleHeaderConfiguratorField)field didChangeValue:(NSNumber *)value { MDCFlexibleHeaderView *headerView = self.fhvc.headerView; switch (field) { - // Basic behavior + // Basic behavior case FlexibleHeaderConfiguratorFieldCanOverExtend: headerView.canOverExtend = [value boolValue]; @@ -60,7 +60,7 @@ - (void)field:(FlexibleHeaderConfiguratorField)field didChangeValue:(NSNumber *) break; } - // Shift behavior + // Shift behavior case FlexibleHeaderConfiguratorFieldShiftBehaviorEnabled: { BOOL isOn = [value boolValue]; diff --git a/components/FlexibleHeader/examples/FlexibleHeaderFABExample.m b/components/FlexibleHeader/examples/FlexibleHeaderFABExample.m index 5cc7208606b..841ac8631db 100644 --- a/components/FlexibleHeader/examples/FlexibleHeaderFABExample.m +++ b/components/FlexibleHeader/examples/FlexibleHeaderFABExample.m @@ -131,8 +131,8 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView == self.fhvc.headerView.trackingScrollView) { [self.fhvc scrollViewDidScroll:scrollView]; } - self.floatingButton.center = CGPointMake(self.floatingButton.center.x, - CGRectGetMaxY(self.fhvc.headerView.frame)); + self.floatingButton.center = + CGPointMake(self.floatingButton.center.x, CGRectGetMaxY(self.fhvc.headerView.frame)); } @end diff --git a/components/FlexibleHeader/examples/FlexibleHeaderUINavigationBarExample.m b/components/FlexibleHeader/examples/FlexibleHeaderUINavigationBarExample.m index f0458a1ccd4..4b572ea0b96 100644 --- a/components/FlexibleHeader/examples/FlexibleHeaderUINavigationBarExample.m +++ b/components/FlexibleHeader/examples/FlexibleHeaderUINavigationBarExample.m @@ -55,7 +55,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { - (void)commonMDCFlexibleHeaderViewControllerInit { _fhvc = [[MDCFlexibleHeaderViewController alloc] initWithNibName:nil bundle:nil]; - + // Behavioral flags. _fhvc.topLayoutGuideAdjustmentEnabled = YES; _fhvc.inferTopSafeAreaInsetFromViewController = YES; @@ -75,36 +75,36 @@ - (void)commonMDCFlexibleHeaderViewControllerInit { [self.fhvc.headerView addSubview:navBar]; navBar.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints: - @[[NSLayoutConstraint constraintWithItem:navBar - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView.topSafeAreaGuide - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:navBar - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:navBar - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:navBar - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:0] - ]]; + [NSLayoutConstraint activateConstraints:@[ + [NSLayoutConstraint constraintWithItem:navBar + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView.topSafeAreaGuide + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:navBar + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:navBar + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:navBar + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0] + ]]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain @@ -115,10 +115,9 @@ - (void)commonMDCFlexibleHeaderViewControllerInit { target:self action:@selector(doneAction:)]; - [self.navigationItem setLeftBarButtonItem:backItem animated:YES]; [self.navigationItem setRightBarButtonItem:doneItem animated:YES]; - [navBar setItems:@[self.navigationItem] animated:YES]; + [navBar setItems:@[ self.navigationItem ] animated:YES]; self.button = [[UIButton alloc] init]; [self.button setTitle:@"UIButton" forState:UIControlStateNormal]; diff --git a/components/FlexibleHeader/examples/FlexibleHeaderWrappedExample.m b/components/FlexibleHeader/examples/FlexibleHeaderWrappedExample.m index 015ccb4a4a4..18cb279e7fa 100644 --- a/components/FlexibleHeader/examples/FlexibleHeaderWrappedExample.m +++ b/components/FlexibleHeader/examples/FlexibleHeaderWrappedExample.m @@ -53,7 +53,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { - (void)commonMDCFlexibleHeaderViewControllerInit { _fhvc = [[MDCFlexibleHeaderViewController alloc] initWithNibName:nil bundle:nil]; - + // Behavioral flags. _fhvc.topLayoutGuideAdjustmentEnabled = YES; _fhvc.inferTopSafeAreaInsetFromViewController = YES; diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m index 0d28d0e664e..31404e6e4e5 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m @@ -27,9 +27,9 @@ @implementation FlexibleHeaderConfiguratorExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Configurator" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Configurator" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -99,36 +99,36 @@ - (void)viewDidLoad { [self.fhvc.headerView addSubview:self.titleLabel]; self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints: - @[[NSLayoutConstraint constraintWithItem:self.titleLabel - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView.topSafeAreaGuide - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:self.titleLabel - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:self.titleLabel - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:0], - [NSLayoutConstraint constraintWithItem:self.titleLabel - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:self.fhvc.headerView - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:0] - ]]; + [NSLayoutConstraint activateConstraints:@[ + [NSLayoutConstraint constraintWithItem:self.titleLabel + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView.topSafeAreaGuide + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:self.titleLabel + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:self.titleLabel + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:self.titleLabel + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self.fhvc.headerView + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0] + ]]; [self.fhvc.headerView hideViewWhenShifted:self.titleLabel]; diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderFABSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderFABSupplemental.m index 20452001cde..218b8485381 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderFABSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderFABSupplemental.m @@ -25,9 +25,9 @@ @implementation FlexibleHeaderFABExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Floating Action Button" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Floating Action Button" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m index 459f637909c..aade919cc12 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m @@ -23,9 +23,9 @@ @implementation FlexibleHeaderHorizontalPagingViewController (CatalogByConventio + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Horizontal Paging" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Horizontal Paging" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderPageControlSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderPageControlSupplemental.m index e34f48cb35d..440d0dcd8b3 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderPageControlSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderPageControlSupplemental.m @@ -25,9 +25,9 @@ @implementation FlexibleHeaderPageControlExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Page Control in Flexible Header" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Page Control in Flexible Header" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTopLayoutGuideSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTopLayoutGuideSupplemental.m index 737370f060f..074afc05b04 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTopLayoutGuideSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTopLayoutGuideSupplemental.m @@ -26,9 +26,9 @@ @implementation FlexibleHeaderTopLayoutGuideExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Utilizing Top Layout Guide" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Utilizing Top Layout Guide" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -47,9 +47,7 @@ - (UIStatusBarStyle)preferredStatusBarStyle { - (void)setupScrollViewContent { UIColor *color = MDCPalette.greyPalette.tint700; UIView *scrollViewContent = - [[UIView alloc] initWithFrame:CGRectMake(0, - 0, - self.scrollView.frame.size.width, + [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height * 2)]; scrollViewContent.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m index 9fcc9cdfab2..8e9d1fa6a4a 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m @@ -23,11 +23,11 @@ @implementation FlexibleHeaderTypicalUseViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Flexible Header" ], - @"description": @"The Flexible Header is a container view whose height and vertical offset " - @"react to UIScrollViewDelegate events.", - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Flexible Header" ], + @"description" : @"The Flexible Header is a container view whose height and vertical offset " + @"react to UIScrollViewDelegate events.", + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderUINavigationBarSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderUINavigationBarSupplemental.m index 68a3e8784cc..c5da14b7891 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderUINavigationBarSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderUINavigationBarSupplemental.m @@ -25,9 +25,9 @@ @implementation FlexibleHeaderUINavigationBarExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Standard UINavigationBar" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Standard UINavigationBar" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderWrappedSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderWrappedSupplemental.m index 17ebc90eebb..3e279a563cb 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderWrappedSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderWrappedSupplemental.m @@ -23,9 +23,9 @@ @implementation FlexibleHeaderWrappedExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Flexible Header", @"Wrapped View Controller" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Flexible Header", @"Wrapped View Controller" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m b/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m index deb142627a9..c8358e5defa 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m @@ -110,8 +110,8 @@ - (void)updateTopLayoutGuideBehavior { if (self.topLayoutGuideAdjustmentEnabled) { if ([self isViewLoaded]) { self.contentViewController.view.translatesAutoresizingMaskIntoConstraints = YES; - self.contentViewController.view.autoresizingMask = (UIViewAutoresizingFlexibleWidth - | UIViewAutoresizingFlexibleHeight); + self.contentViewController.view.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); self.contentViewController.view.frame = self.view.bounds; } diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderView.m b/components/FlexibleHeader/src/MDCFlexibleHeaderView.m index f11c90df045..a8eff327356 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderView.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderView.m @@ -65,8 +65,7 @@ static const CGFloat kMinimumVisibleProportion = 0.25; // KVO contexts -static char *const kKVOContextMDCFlexibleHeaderView = - "kKVOContextMDCFlexibleHeaderView"; +static char *const kKVOContextMDCFlexibleHeaderView = "kKVOContextMDCFlexibleHeaderView"; static inline MDCFlexibleHeaderShiftBehavior ShiftBehaviorForCurrentAppContext( MDCFlexibleHeaderShiftBehavior intendedShiftBehavior) { @@ -399,8 +398,8 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *hitView = [super hitTest:point withEvent:event]; // Forwards taps to the scroll view. - if (hitView == self || (_contentView != nil && hitView == _contentView) - || [_forwardingViews containsObject:hitView]) { + if (hitView == self || (_contentView != nil && hitView == _contentView) || + [_forwardingViews containsObject:hitView]) { hitView = _trackingScrollView; } @@ -542,8 +541,8 @@ - (void)fhv_adjustTrackingScrollViewInsets { if (@available(iOS 11.0, *)) { scrollViewAdjustedContentInsetTop = _trackingScrollView.adjustedContentInset.top; } - offsetPriorToInsetAdjustment.y = MAX(offsetPriorToInsetAdjustment.y, - -scrollViewAdjustedContentInsetTop); + offsetPriorToInsetAdjustment.y = + MAX(offsetPriorToInsetAdjustment.y, -scrollViewAdjustedContentInsetTop); [self fhv_setContentOffset:offsetPriorToInsetAdjustment]; } } @@ -576,8 +575,8 @@ - (CGFloat)fhv_existingContentInsetAdjustmentForScrollView:(UIScrollView *)scrol CGFloat existingContentInsetAdjustment = 0; if (@available(iOS 11.0, *)) { - existingContentInsetAdjustment = (scrollView.adjustedContentInset.top - - scrollView.contentInset.top); + existingContentInsetAdjustment = + (scrollView.adjustedContentInset.top - scrollView.contentInset.top); } return existingContentInsetAdjustment; @@ -592,8 +591,8 @@ - (CGFloat)fhv_existingContentInsetAdjustmentForScrollView:(UIScrollView *)scrol // This ensures that when our scroll view is scrolled to its top that our header is able to be fully // expanded. - (CGFloat)fhv_enforceInsetsForScrollView:(UIScrollView *)scrollView { - if (!scrollView || (self.useAdditionalSafeAreaInsetsForWebKitScrollViews - && [self trackingScrollViewIsWebKit])) { + if (!scrollView || + (self.useAdditionalSafeAreaInsetsForWebKitScrollViews && [self trackingScrollViewIsWebKit])) { return 0; } if (@available(iOS 11.0, *)) { @@ -640,8 +639,8 @@ - (CGFloat)fhv_enforceInsetsForScrollView:(UIScrollView *)scrollView { } BOOL statusBarIsHidden = [UIApplication mdc_safeSharedApplication].statusBarHidden ? YES : NO; - if (_wasStatusBarHiddenIsValid && _wasStatusBarHidden != statusBarIsHidden - && !_isChangingStatusBarVisibility && !self.inferTopSafeAreaInsetFromViewController) { + if (_wasStatusBarHiddenIsValid && _wasStatusBarHidden != statusBarIsHidden && + !_isChangingStatusBarVisibility && !self.inferTopSafeAreaInsetFromViewController) { // Our status bar state has changed without our knowledge. UIKit will have already adjusted our // content offset by now, so we want to counteract this. This logic is similar to that found in // statusBarShifterNeedsStatusBarAppearanceUpdate: @@ -955,9 +954,8 @@ - (void)fhv_accumulatorDidChange { CGFloat existingContentInsetAdjustment = [self fhv_existingContentInsetAdjustmentForScrollView:_trackingScrollView]; - _trackingInfo.injectedTopScrollIndicatorInset = (frame.size.height - - boundedAccumulator - - existingContentInsetAdjustment); + _trackingInfo.injectedTopScrollIndicatorInset = + (frame.size.height - boundedAccumulator - existingContentInsetAdjustment); scrollIndicatorInsets.top += _trackingInfo.injectedTopScrollIndicatorInset; _trackingScrollView.scrollIndicatorInsets = scrollIndicatorInsets; @@ -1207,7 +1205,7 @@ - (void)fhv_contentOffsetDidChange { } if (self.trackingScrollView.isTracking) { - _didDecelerate = NO; // Invalidate the flag - we're not actually decelerating right now. + _didDecelerate = NO; // Invalidate the flag - we're not actually decelerating right now. } // We generally expect the tracking scroll view to be a sibling to the flexible header, but there @@ -1292,8 +1290,8 @@ - (void)fhv_stopObservingContentOffset { } - (void)setObservesTrackingScrollViewScrollEvents:(BOOL)observesTrackingScrollViewScrollEvents { - NSAssert(self.shiftBehavior == MDCFlexibleHeaderShiftBehaviorDisabled - || !observesTrackingScrollViewScrollEvents, + NSAssert(self.shiftBehavior == MDCFlexibleHeaderShiftBehaviorDisabled || + !observesTrackingScrollViewScrollEvents, @"Please set shiftBehavior to disabled prior to enabling this property."); if (_observesTrackingScrollViewScrollEvents == observesTrackingScrollViewScrollEvents) { @@ -1319,10 +1317,10 @@ static BOOL isRunningiOS10_3OrAbove() { static BOOL isRunningiOS10_3OrAbove; dispatch_once(&onceToken, ^{ NSProcessInfo *info = [NSProcessInfo processInfo]; - isRunningiOS10_3OrAbove = [info isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion) { - .majorVersion = 10, - .minorVersion = 3, - .patchVersion = 0, + isRunningiOS10_3OrAbove = [info isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){ + .majorVersion = 10, + .minorVersion = 3, + .patchVersion = 0, }]; }); return isRunningiOS10_3OrAbove; @@ -1341,8 +1339,8 @@ - (void)fhv_scrollViewDidPan:(UIPanGestureRecognizer *)pan { if (!isRunningiOS10_3OrAbove()) { NSAssert(_didAdjustTargetContentOffset, @"%@ isn't invoking %@'s %@.", NSStringFromClass([_trackingScrollView class]), NSStringFromClass([self class]), - NSStringFromSelector( - @selector(trackingScrollViewWillEndDraggingWithVelocity:targetContentOffset:))); + NSStringFromSelector(@selector(trackingScrollViewWillEndDraggingWithVelocity: + targetContentOffset:))); } } } @@ -1620,9 +1618,9 @@ - (void)setStatusBarHintCanOverlapHeader:(BOOL)statusBarHintCanOverlapHeader { } - (void)setShiftBehavior:(MDCFlexibleHeaderShiftBehavior)shiftBehavior { - NSAssert((self.observesTrackingScrollViewScrollEvents - && shiftBehavior == MDCFlexibleHeaderShiftBehaviorDisabled) - || !self.observesTrackingScrollViewScrollEvents, + NSAssert((self.observesTrackingScrollViewScrollEvents && + shiftBehavior == MDCFlexibleHeaderShiftBehaviorDisabled) || + !self.observesTrackingScrollViewScrollEvents, @"Flexible Header shift behavior must be disabled before content offset observation is" @" enabled."); @@ -1700,8 +1698,9 @@ - (void)interfaceOrientationDidChange { - (void)viewWillTransitionToSize:(__unused CGSize)size withTransitionCoordinator:(id)coordinator { [self interfaceOrientationWillChange]; - [coordinator animateAlongsideTransition: - ^(__unused id context) { + [coordinator + animateAlongsideTransition:^( + __unused id context) { [self interfaceOrientationIsChanging]; } completion:^(__unused id context) { diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m b/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m index 1c3b70a1ee5..17b150fbc1e 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m @@ -14,16 +14,16 @@ #import "MDCFlexibleHeaderViewController.h" -#import "MaterialApplication.h" -#import "MaterialUIMetrics.h" +#import #import "MDCFlexibleHeaderContainerViewController.h" -#import "MDCFlexibleHeaderView.h" #import "MDCFlexibleHeaderView+ShiftBehavior.h" +#import "MDCFlexibleHeaderView.h" +#import "MaterialApplication.h" +#import "MaterialUIMetrics.h" #import "private/MDCFlexibleHeaderView+Private.h" -#import @interface UIView () -- (UIEdgeInsets)safeAreaInsets; // For pre-iOS 11 SDK targets. +- (UIEdgeInsets)safeAreaInsets; // For pre-iOS 11 SDK targets. @end static inline BOOL ShouldUseLightStatusBarOnBackgroundColor(UIColor *color) { @@ -202,9 +202,8 @@ - (UIStatusBarStyle)preferredStatusBarStyle { if (self.inferPreferredStatusBarStyle) { UIColor *backgroundColor = [MDCFlexibleHeaderView appearance].backgroundColor ?: _headerView.backgroundColor; - return (ShouldUseLightStatusBarOnBackgroundColor(backgroundColor) - ? UIStatusBarStyleLightContent - : UIStatusBarStyleDefault); + return (ShouldUseLightStatusBarOnBackgroundColor(backgroundColor) ? UIStatusBarStyleLightContent + : UIStatusBarStyleDefault); } else { return _preferredStatusBarStyle; } @@ -221,7 +220,8 @@ - (BOOL)prefersStatusBarHidden { return _headerView.prefersStatusBarHidden; } -- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [_headerView viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; @@ -272,12 +272,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath context:(void *)context { if (context == kKVOContextMDCFlexibleHeaderViewController) { void (^mainThreadWork)(void) = ^{ - if (object == self->_topLayoutGuideConstraint - && self.topLayoutGuideAdjustmentEnabled) { + if (object == self->_topLayoutGuideConstraint && self.topLayoutGuideAdjustmentEnabled) { [self updateTopLayoutGuide]; } - if (self.inferTopSafeAreaInsetFromViewController - && (object == self->_topSafeAreaConstraint || object == self->_topSafeAreaView)) { + if (self.inferTopSafeAreaInsetFromViewController && + (object == self->_topSafeAreaConstraint || object == self->_topSafeAreaView)) { [self->_headerView topSafeAreaInsetDidChange]; } }; @@ -321,15 +320,15 @@ - (void)fhv_extractTopLayoutGuideConstraint { self.topLayoutGuideConstraint = nil; return; } - if (self.topLayoutGuideAdjustmentEnabled - || [topLayoutGuideViewController.view.constraints count] > 0) { + if (self.topLayoutGuideAdjustmentEnabled || + [topLayoutGuideViewController.view.constraints count] > 0) { self.topLayoutGuideConstraint = [self fhv_topLayoutGuideConstraintForViewController:topLayoutGuideViewController]; } } -- (NSLayoutConstraint *) - fhv_topLayoutGuideConstraintForViewController:(UIViewController *)viewController { +- (NSLayoutConstraint *)fhv_topLayoutGuideConstraintForViewController: + (UIViewController *)viewController { // Note: accessing topLayoutGuide has the side effect of setting up all of the view controller // constraints. We need to access this property before we enter the for loop, otherwise // view.constraints will be empty. @@ -428,10 +427,9 @@ - (void)fhv_setTopLayoutGuideConstraintConstant:(CGFloat)constant { } - (void)updateTopLayoutGuide { - NSAssert([NSThread isMainThread], - @"updateTopLayoutGuide must be called from the main thread."); - NSAssert(!self.useAdditionalSafeAreaInsetsForWebKitScrollViews - || (self.topLayoutGuideViewController != nil), + NSAssert([NSThread isMainThread], @"updateTopLayoutGuide must be called from the main thread."); + NSAssert(!self.useAdditionalSafeAreaInsetsForWebKitScrollViews || + (self.topLayoutGuideViewController != nil), @"If useAdditionalSafeAreaInsetsForWebKitScrollViews is enabled you must also set a" @"topLayoutGuideViewController."); // We observe (using KVO) the top layout guide's constant and re-invoke updateTopLayoutGuide @@ -462,12 +460,13 @@ - (void)updateTopLayoutGuide { if (@available(iOS 11.0, *)) { BOOL alwaysUseAdditionalSafeAreaInsets = NO; - if (self.useAdditionalSafeAreaInsetsForWebKitScrollViews - && [self.headerView trackingScrollViewIsWebKit]) { + if (self.useAdditionalSafeAreaInsetsForWebKitScrollViews && + [self.headerView trackingScrollViewIsWebKit]) { alwaysUseAdditionalSafeAreaInsets = YES; } - UIViewController *topLayoutGuideViewController = [self fhv_topLayoutGuideViewControllerWithFallback]; + UIViewController *topLayoutGuideViewController = + [self fhv_topLayoutGuideViewControllerWithFallback]; // If there is a tracking scroll view then the flexible header will manage safe area insets via // the tracking scroll view's contentInsets. Some day - in the long distant future when we only // support iOS 11 and up - we can probably drop the content inset adjustment behavior in favor @@ -500,11 +499,9 @@ - (void)updateTopLayoutGuide { - (CGFloat)headerViewControllerHeight { BOOL shiftEnabledForStatusBar = _headerView.shiftBehavior == MDCFlexibleHeaderShiftBehaviorEnabledWithStatusBar; - CGFloat statusBarHeight = - [UIApplication mdc_safeSharedApplication].statusBarFrame.size.height; - CGFloat height = - MAX(_headerView.frame.origin.y + _headerView.frame.size.height, - shiftEnabledForStatusBar ? 0 : statusBarHeight); + CGFloat statusBarHeight = [UIApplication mdc_safeSharedApplication].statusBarFrame.size.height; + CGFloat height = MAX(_headerView.frame.origin.y + _headerView.frame.size.height, + shiftEnabledForStatusBar ? 0 : statusBarHeight); return height; } @@ -592,14 +589,15 @@ - (void)fhv_inferTopSafeAreaSourceViewController { // We can't use the provided ancestor because it's a child of the top layout guide view // controller. Doing so would result in the top layout guide being infinitely increased. // Let's use the top layout guide view controller's ancestor instead. - ancestor = [self fhv_rootAncestorOfViewController: - self.topLayoutGuideViewController.parentViewController]; + ancestor = [self + fhv_rootAncestorOfViewController:self.topLayoutGuideViewController.parentViewController]; } // if ancestor == nil at this point, then we're in a bad spot because there's nowhere for us to // extract a top safe area inset from. Should we throw an assert? NSAssert(ancestor != nil, - @"inferTopSafeAreaInsetFromViewController is true but we were unable to infer a view controller" + @"inferTopSafeAreaInsetFromViewController is true but we were unable to infer a view " + @"controller" @" from which we could extract a safe area. Consider placing your view controller inside" @" a container view controller."); diff --git a/components/FlexibleHeader/src/private/MDCStatusBarShifter.m b/components/FlexibleHeader/src/private/MDCStatusBarShifter.m index df182da782c..07fd971db1f 100644 --- a/components/FlexibleHeader/src/private/MDCStatusBarShifter.m +++ b/components/FlexibleHeader/src/private/MDCStatusBarShifter.m @@ -184,8 +184,7 @@ - (void)attemptSnapshotState:(MDCStatusBarShifterState)snapshotState { UIView *clippingView = [[UIView alloc] init]; CGFloat statusBarHeight = [UIApplication mdc_safeSharedApplication].statusBarFrame.size.height; - clippingView.frame = - CGRectMake(0, 0, snapshotView.frame.size.width, statusBarHeight); + clippingView.frame = CGRectMake(0, 0, snapshotView.frame.size.width, statusBarHeight); clippingView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin); clippingView.clipsToBounds = YES; @@ -197,8 +196,8 @@ - (void)attemptSnapshotState:(MDCStatusBarShifterState)snapshotState { _replicaViewTimestamp = [NSDate timeIntervalSinceReferenceDate]; NSCalendar *calendar = [NSCalendar currentCalendar]; - NSDateComponents *components = - [calendar components:NSCalendarUnitSecond fromDate:[NSDate date]]; + NSDateComponents *components = [calendar components:NSCalendarUnitSecond + fromDate:[NSDate date]]; _secondsRemainingInMinute = MAX(kMinimumNumberOfSecondsToWaitFor, (NSTimeInterval)(60 - components.second)); diff --git a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m index 3c8f9bc0b3e..1538222bd8b 100644 --- a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m +++ b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m @@ -108,10 +108,8 @@ - (void)setupExampleViews { self.legacyShape.backgroundColor = MDCPalette.greyPalette.tint800; - CGRect legacyTitleLabelFrame = CGRectMake(0, - CGRectGetHeight(self.legacyShape.frame), - CGRectGetWidth(self.legacyShape.frame), - 36); + CGRect legacyTitleLabelFrame = CGRectMake(0, CGRectGetHeight(self.legacyShape.frame), + CGRectGetWidth(self.legacyShape.frame), 36); UILabel *legacyTitleLabel = [[UILabel alloc] initWithFrame:legacyTitleLabelFrame]; legacyTitleLabel.text = @"Legacy Ink"; legacyTitleLabel.textAlignment = NSTextAlignmentCenter; @@ -123,30 +121,30 @@ - (void)setupExampleViews { - (void)viewWillLayoutSubviews { if (@available(iOS 11.0, *)) { UIEdgeInsets safeAreaInsets = self.view.safeAreaInsets; - self.containerView.frame = CGRectMake(safeAreaInsets.left, - safeAreaInsets.top, - CGRectGetWidth(self.view.frame) - safeAreaInsets.left - safeAreaInsets.right, - CGRectGetHeight(self.view.frame) - safeAreaInsets.top - safeAreaInsets.bottom); + self.containerView.frame = + CGRectMake(safeAreaInsets.left, safeAreaInsets.top, + CGRectGetWidth(self.view.frame) - safeAreaInsets.left - safeAreaInsets.right, + CGRectGetHeight(self.view.frame) - safeAreaInsets.top - safeAreaInsets.bottom); } else { - self.containerView.frame = CGRectMake(0, - self.topLayoutGuide.length, - CGRectGetWidth(self.view.frame), - CGRectGetHeight(self.view.frame) - self.topLayoutGuide.length); + self.containerView.frame = + CGRectMake(0, self.topLayoutGuide.length, CGRectGetWidth(self.view.frame), + CGRectGetHeight(self.view.frame) - self.topLayoutGuide.length); } CGFloat offset = 8; CGFloat shapeDimension = 200; CGFloat spacing = 16; if (CGRectGetHeight(self.containerView.frame) > CGRectGetWidth(self.containerView.frame)) { - self.shapes.center = - CGPointMake(self.containerView.center.x, self.containerView.center.y - shapeDimension - offset); - self.legacyShape.center = - CGPointMake(self.containerView.center.x, self.containerView.center.y + spacing * 2 + offset); + self.shapes.center = CGPointMake(self.containerView.center.x, + self.containerView.center.y - shapeDimension - offset); + self.legacyShape.center = CGPointMake(self.containerView.center.x, + self.containerView.center.y + spacing * 2 + offset); } else { self.shapes.center = CGPointMake(self.containerView.center.x - shapeDimension / 2 - spacing * 2, self.containerView.center.y / 2 + spacing * 2); - self.legacyShape.center = CGPointMake(self.containerView.center.x + shapeDimension / 2 + spacing * 2, - self.containerView.center.y / 2 + spacing * 2); + self.legacyShape.center = + CGPointMake(self.containerView.center.x + shapeDimension / 2 + spacing * 2, + self.containerView.center.y / 2 + spacing * 2); } } diff --git a/components/Ink/src/ColorThemer/MDCInkColorThemer.m b/components/Ink/src/ColorThemer/MDCInkColorThemer.m index 03143c7ecc6..74ebf1f61e3 100644 --- a/components/Ink/src/ColorThemer/MDCInkColorThemer.m +++ b/components/Ink/src/ColorThemer/MDCInkColorThemer.m @@ -16,8 +16,7 @@ @implementation MDCInkColorThemer -+ (void)applyColorScheme:(id)colorScheme - toInkView:(MDCInkView *)inkView { ++ (void)applyColorScheme:(id)colorScheme toInkView:(MDCInkView *)inkView { if ([colorScheme respondsToSelector:@selector(primaryLightColor)]) { inkView.inkColor = colorScheme.primaryLightColor; } diff --git a/components/Ink/src/MDCInkTouchController.m b/components/Ink/src/MDCInkTouchController.m index 06c378799a9..91653533467 100644 --- a/components/Ink/src/MDCInkTouchController.m +++ b/components/Ink/src/MDCInkTouchController.m @@ -34,7 +34,7 @@ @protocol MDCInkTouchControllerLegacyDelegate has been migrated to the new delegate protocol. */ - (BOOL)shouldInkTouchControllerProcessInkTouches: - (nonnull MDCInkTouchController *)inkTouchController + (nonnull MDCInkTouchController *)inkTouchController __deprecated_msg("shouldInkTouchControllerProcessInkTouches has been replaced with " "inkTouchController:shouldProcessInkTouchesAtTouchLocation."); @@ -186,8 +186,8 @@ - (void)cancelInkGestureWithRecognizer:(MDCInkGestureRecognizer *)recognizer { - (void)touchBeganAtPoint:(CGPoint)point touchLocation:(CGPoint)touchLocation { if (_shouldRespondToTouch) { [_addedInkView startTouchBeganAnimationAtPoint:point completion:nil]; - if ([_delegate - respondsToSelector:@selector(inkTouchController:didProcessInkView:atTouchLocation:)]) { + if ([_delegate respondsToSelector:@selector(inkTouchController: + didProcessInkView:atTouchLocation:)]) { [_delegate inkTouchController:self didProcessInkView:_addedInkView atTouchLocation:touchLocation]; diff --git a/components/Ink/src/MDCInkView.m b/components/Ink/src/MDCInkView.m index d7649c2b0fd..0f9dbd81684 100644 --- a/components/Ink/src/MDCInkView.m +++ b/components/Ink/src/MDCInkView.m @@ -111,7 +111,7 @@ - (void)setInkStyle:(MDCInkStyle)inkStyle { break; } } else { - switch(inkStyle) { + switch (inkStyle) { case MDCInkStyleBounded: self.inkLayer.maxRippleRadius = 0; break; @@ -151,7 +151,7 @@ - (void)setMaxRippleRadius:(CGFloat)radius { [self setNeedsLayout]; } else { // New Ink Bounded style ignores maxRippleRadius - switch(self.inkStyle) { + switch (self.inkStyle) { case MDCInkStyleUnbounded: self.inkLayer.maxRippleRadius = radius; break; @@ -187,7 +187,8 @@ - (void)startTouchBeganAnimationAtPoint:(CGPoint)point [self startTouchBeganAtPoint:point animated:YES withCompletion:completionBlock]; } -- (void)startTouchBeganAtPoint:(CGPoint)point animated:(BOOL)animated +- (void)startTouchBeganAtPoint:(CGPoint)point + animated:(BOOL)animated withCompletion:(nullable MDCInkCompletionBlock)completionBlock { if (self.usesLegacyInkRipple) { [self.inkLayer spreadFromPoint:point completion:completionBlock]; @@ -205,7 +206,8 @@ - (void)startTouchBeganAtPoint:(CGPoint)point animated:(BOOL)animated } } -- (void)startTouchEndAtPoint:(CGPoint)point animated:(BOOL)animated +- (void)startTouchEndAtPoint:(CGPoint)point + animated:(BOOL)animated withCompletion:(nullable MDCInkCompletionBlock)completionBlock { if (self.usesLegacyInkRipple) { [self.inkLayer evaporateWithCompletion:completionBlock]; @@ -283,7 +285,6 @@ - (void)inkLayerAnimationDidEnd:(MDCInkLayer *)inkLayer { - (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event { if ([event isEqualToString:@"path"] || [event isEqualToString:@"shadowPath"]) { - // We have to create a pending animation because if we are inside a UIKit animation block we // won't know any properties of the animation block until it is commited. MDCInkPendingAnimation *pendingAnim = [[MDCInkPendingAnimation alloc] init]; diff --git a/components/Ink/src/private/MDCInkLayer.m b/components/Ink/src/private/MDCInkLayer.m index fe9d975ed54..d8a37502b62 100644 --- a/components/Ink/src/private/MDCInkLayer.m +++ b/components/Ink/src/private/MDCInkLayer.m @@ -91,9 +91,7 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated { radius = self.maxRippleRadius; } CGRect ovalRect = CGRectMake(CGRectGetWidth(self.bounds) / 2 - radius, - CGRectGetHeight(self.bounds) / 2 - radius, - radius * 2, - radius * 2); + CGRectGetHeight(self.bounds) / 2 - radius, radius * 2, radius * 2); UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:ovalRect]; self.path = circlePath.CGPath; self.fillColor = self.inkColor.CGColor; @@ -106,7 +104,7 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated { _startAnimationActive = YES; CAMediaTimingFunction *materialTimingFunction = - [[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.4:0:(float)0.2:1]; + [[CAMediaTimingFunction alloc] initWithControlPoints:(float) 0.4:0:(float)0.2:1]; CGFloat scaleStart = MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)) / MDCInkLayerScaleDivisor; @@ -128,7 +126,8 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated { UIBezierPath *centerPath = [UIBezierPath bezierPath]; CGPoint startPoint = point; - CGPoint endPoint = CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2); + CGPoint endPoint = + CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2); [centerPath moveToPoint:startPoint]; [centerPath addLineToPoint:endPoint]; [centerPath closePath]; @@ -150,7 +149,8 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated { fadeInAnim.toValue = @1; fadeInAnim.duration = MDCInkLayerCommonDuration; fadeInAnim.beginTime = MDCInkLayerCommonDuration; - fadeInAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; + fadeInAnim.timingFunction = + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; fadeInAnim.fillMode = kCAFillModeForwards; fadeInAnim.removedOnCompletion = NO; @@ -174,8 +174,8 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated { - (void)changeAnimationAtPoint:(CGPoint)point { CGFloat animationDelay = 0; if (self.startAnimationActive) { - animationDelay = MDCInkLayerStartFadeHalfBeginTimeFadeOutDuration + - MDCInkLayerStartFadeHalfDuration; + animationDelay = + MDCInkLayerStartFadeHalfBeginTimeFadeOutDuration + MDCInkLayerStartFadeHalfDuration; } BOOL viewContainsPoint = CGRectContainsPoint(self.bounds, point) ? YES : NO; @@ -191,8 +191,7 @@ - (void)changeAnimationAtPoint:(CGPoint)point { changeAnim.toValue = @(updatedOpacity); changeAnim.duration = MDCInkLayerCommonDuration; changeAnim.beginTime = [self convertTime:(CACurrentMediaTime() + animationDelay) fromLayer:nil]; - changeAnim.timingFunction = - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; + changeAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; changeAnim.fillMode = kCAFillModeForwards; changeAnim.removedOnCompletion = NO; [self addAnimation:changeAnim forKey:nil]; diff --git a/components/Ink/src/private/MDCLegacyInkLayer.m b/components/Ink/src/private/MDCLegacyInkLayer.m index fbba00bf699..06b217f69f1 100644 --- a/components/Ink/src/private/MDCLegacyInkLayer.m +++ b/components/Ink/src/private/MDCLegacyInkLayer.m @@ -160,10 +160,9 @@ - (CAKeyframeAnimation *)scaleAnimWithValues:(NSArray *)values - (CAMediaTimingFunction *)logDecelerateEasing { // This bezier curve is an approximation of a log curve. - return [[CAMediaTimingFunction alloc] initWithControlPoints:(float)0.157 - :(float)0.72 - :(float)0.386 - :(float)0.987]; + return + [[CAMediaTimingFunction alloc] initWithControlPoints:(float) + 0.157:(float)0.72:(float)0.386:(float)0.987]; } - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished { @@ -274,8 +273,8 @@ - (void)exit:(BOOL)animated completion:(void (^)(void))completionBlock { MDCLegacyInkLayerForegroundRipple *strongSelf = weakSelf; [strongSelf removeFromSuperlayer]; - if ([strongSelf.animationDelegate - respondsToSelector:@selector(animationDidStop:shapeLayer:finished:)]) { + if ([strongSelf.animationDelegate respondsToSelector:@selector(animationDidStop: + shapeLayer:finished:)]) { [strongSelf.animationDelegate animationDidStop:nil shapeLayer:strongSelf finished:YES]; } }]; @@ -404,8 +403,8 @@ - (void)exit:(BOOL)animated { MDCLegacyInkLayerBackgroundRipple *strongSelf = weakSelf; [strongSelf removeFromSuperlayer]; - if ([strongSelf.animationDelegate - respondsToSelector:@selector(animationDidStop:shapeLayer:finished:)]) { + if ([strongSelf.animationDelegate respondsToSelector:@selector(animationDidStop: + shapeLayer:finished:)]) { [strongSelf.animationDelegate animationDidStop:nil shapeLayer:strongSelf finished:YES]; } }]; diff --git a/components/Ink/tests/unit/MDCInkViewTests.m b/components/Ink/tests/unit/MDCInkViewTests.m index 952efd25761..86d9c566eca 100644 --- a/components/Ink/tests/unit/MDCInkViewTests.m +++ b/components/Ink/tests/unit/MDCInkViewTests.m @@ -31,10 +31,8 @@ - (void)testInit { // Then XCTAssertTrue(inkView.usesLegacyInkRipple); XCTAssertFalse(inkView.usesCustomInkCenter); - XCTAssertTrue(CGPointEqualToPoint(inkView.customInkCenter, CGPointZero), - @"%@ is not equal to %@", - NSStringFromCGPoint(inkView.customInkCenter), - NSStringFromCGPoint(CGPointZero)); + XCTAssertTrue(CGPointEqualToPoint(inkView.customInkCenter, CGPointZero), @"%@ is not equal to %@", + NSStringFromCGPoint(inkView.customInkCenter), NSStringFromCGPoint(CGPointZero)); XCTAssertNil(inkView.animationDelegate); XCTAssertEqualObjects(inkView.inkColor, inkView.defaultInkColor); XCTAssertEqual(inkView.inkStyle, MDCInkStyleBounded); @@ -54,7 +52,6 @@ - (void)testNewInkUsesMaxRippleRadiusWhenUnbounded { inkViewRadiusThenStyle.maxRippleRadius = 12; inkViewRadiusThenStyle.inkStyle = MDCInkStyleUnbounded; - // Then XCTAssertEqualWithAccuracy(inkViewStyleThenRadius.maxRippleRadius, 12, 0.0001); XCTAssertEqualWithAccuracy(inkViewRadiusThenStyle.maxRippleRadius, 12, 0.0001); @@ -73,7 +70,6 @@ - (void)testLegacyInkUsesMaxRippleRadiusWhenUnbounded { inkViewRadiusThenStyle.maxRippleRadius = 12; inkViewRadiusThenStyle.inkStyle = MDCInkStyleUnbounded; - // Then XCTAssertEqualWithAccuracy(inkViewStyleThenRadius.maxRippleRadius, 12, 0.0001); XCTAssertEqualWithAccuracy(inkViewRadiusThenStyle.maxRippleRadius, 12, 0.0001); @@ -92,7 +88,6 @@ - (void)testNewInkIgnoresMaxRippleRadiusWhenBounded { inkViewRadiusThenStyle.maxRippleRadius = 12; inkViewRadiusThenStyle.inkStyle = MDCInkStyleBounded; - // Then XCTAssertEqualWithAccuracy(inkViewStyleThenRadius.maxRippleRadius, 0, 0.0001); XCTAssertEqualWithAccuracy(inkViewRadiusThenStyle.maxRippleRadius, 0, 0.0001); @@ -111,7 +106,6 @@ - (void)testLegacyInkUsesMaxRippleRadiusWhenBounded { inkViewRadiusThenStyle.maxRippleRadius = 12; inkViewRadiusThenStyle.inkStyle = MDCInkStyleBounded; - // Then XCTAssertEqualWithAccuracy(inkViewStyleThenRadius.maxRippleRadius, 12, 0.0001); XCTAssertEqualWithAccuracy(inkViewRadiusThenStyle.maxRippleRadius, 12, 0.0001); diff --git a/components/Ink/tests/unit/MDCLegacyInkLayerTests.m b/components/Ink/tests/unit/MDCLegacyInkLayerTests.m index 6025d837a19..1b0cebdc6e1 100644 --- a/components/Ink/tests/unit/MDCLegacyInkLayerTests.m +++ b/components/Ink/tests/unit/MDCLegacyInkLayerTests.m @@ -13,8 +13,8 @@ // limitations under the License. #import -#import "MaterialInk.h" #import "MDCLegacyInkLayer+Testing.h" +#import "MaterialInk.h" #pragma mark - Property exposure @@ -94,8 +94,7 @@ - (void)testInit { XCTAssertTrue(self.inkLayer.isBounded); XCTAssertFalse(self.inkLayer.useCustomInkCenter); XCTAssertTrue(CGPointEqualToPoint(self.inkLayer.customInkCenter, CGPointZero), - @"%@ is not equal to %@", - NSStringFromCGPoint(self.inkLayer.customInkCenter), + @"%@ is not equal to %@", NSStringFromCGPoint(self.inkLayer.customInkCenter), NSStringFromCGPoint(CGPointZero)); XCTAssertFalse(self.inkLayer.userLinearExpansion); XCTAssertEqualWithAccuracy(self.inkLayer.evaporateDuration, 0, 0.0001); diff --git a/components/List/examples/CollectionListCellExampleTypicalUse.m b/components/List/examples/CollectionListCellExampleTypicalUse.m index a4517bb70e2..09b4115dd4e 100644 --- a/components/List/examples/CollectionListCellExampleTypicalUse.m +++ b/components/List/examples/CollectionListCellExampleTypicalUse.m @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#import "supplemental/CollectionListCellExampleTypicalUse.h" #import "MaterialIcons+ic_info.h" #import "MaterialTypographyScheme.h" -#import "supplemental/CollectionListCellExampleTypicalUse.h" #import "supplemental/CollectionViewListCell.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; @@ -76,13 +76,10 @@ - (void)viewDidLoad { for (NSString *alignmentKey in alignmentValues) { [_content addObject:@[ [NSString stringWithFormat:@"(%@) Single line text", alignmentKey], - alignmentValues[alignmentKey], - @"", - alignmentValues[alignmentKey] + alignmentValues[alignmentKey], @"", alignmentValues[alignmentKey] ]]; [_content addObject:@[ - @"", - alignmentValues[alignmentKey], + @"", alignmentValues[alignmentKey], [NSString stringWithFormat:@"(%@) Single line detail text", alignmentKey], alignmentValues[alignmentKey] ]]; @@ -159,20 +156,21 @@ - (void)viewWillTransitionToSize:(CGSize)size [self.collectionView.collectionViewLayout invalidateLayout]; - [coordinator animateAlongsideTransition:nil completion:^(__unused id context) { - [self.collectionView.collectionViewLayout invalidateLayout]; - }]; + [coordinator animateAlongsideTransition:nil + completion:^(__unused id context) { + [self.collectionView.collectionViewLayout invalidateLayout]; + }]; } #pragma mark - CatalogByConvention + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Lists", @"List Cell Example" ], - @"description": @"Material Collection Lists are continuous, vertical indexes of text " - @"or images.", - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Lists", @"List Cell Example" ], + @"description" : @"Material Collection Lists are continuous, vertical indexes of text " + @"or images.", + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/List/examples/MDCBaseCellExample.m b/components/List/examples/MDCBaseCellExample.m index 4028566318f..3d473579ded 100644 --- a/components/List/examples/MDCBaseCellExample.m +++ b/components/List/examples/MDCBaseCellExample.m @@ -25,7 +25,7 @@ - (void)viewDidLoad { [self createCollectionView]; } --(void)viewWillLayoutSubviews { +- (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; [self positionCollectionView]; } @@ -66,33 +66,32 @@ - (void)positionCollectionView { [self.collectionView reloadData]; } --(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } --(NSInteger)collectionView:(UICollectionView *)collectionView - numberOfItemsInSection:(NSInteger)section { +- (NSInteger)collectionView:(UICollectionView *)collectionView + numberOfItemsInSection:(NSInteger)section { return self.numberOfCells; } --(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView - cellForItemAtIndexPath:(NSIndexPath *)indexPath { - MDCBaseCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:kBaseCellIdentifier - forIndexPath:indexPath]; +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + cellForItemAtIndexPath:(NSIndexPath *)indexPath { + MDCBaseCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kBaseCellIdentifier + forIndexPath:indexPath]; cell.layer.borderColor = [UIColor darkGrayColor].CGColor; cell.layer.borderWidth = 1; cell.inkColor = [UIColor colorWithRed:0 green:(CGFloat)0 blue:(CGFloat)0 alpha:(CGFloat)0.1]; return cell; } --(void)collectionView:(UICollectionView *)collectionView +- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath { MDCBaseCell *cell = (MDCBaseCell *)[self.collectionView cellForItemAtIndexPath:indexPath]; cell.elevation = 10; } --(void)collectionView:(UICollectionView *)collectionView +- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath { MDCBaseCell *cell = (MDCBaseCell *)[self.collectionView cellForItemAtIndexPath:indexPath]; cell.elevation = 0; @@ -102,10 +101,10 @@ -(void)collectionView:(UICollectionView *)collectionView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"List Items", @"MDCBaseCell Example" ], - @"description": @"MDCBaseCell Example", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"List Items", @"MDCBaseCell Example" ], + @"description" : @"MDCBaseCell Example", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/List/examples/supplemental/CollectionViewListCell.m b/components/List/examples/supplemental/CollectionViewListCell.m index e28c2b7f575..c5d983c491e 100644 --- a/components/List/examples/supplemental/CollectionViewListCell.m +++ b/components/List/examples/supplemental/CollectionViewListCell.m @@ -24,9 +24,13 @@ static const CGFloat kTitleColorOpacity = (CGFloat)0.87; static const CGFloat kDetailsColorOpacity = (CGFloat)0.6; -static inline UIFont *defaultTitleFont(void) { return [UIFont systemFontOfSize:16]; } +static inline UIFont *defaultTitleFont(void) { + return [UIFont systemFontOfSize:16]; +} -static inline UIFont *defaultDetailsFont(void) { return [UIFont systemFontOfSize:14]; } +static inline UIFont *defaultDetailsFont(void) { + return [UIFont systemFontOfSize:14]; +} @implementation CollectionViewListCell { CGPoint _lastTouch; @@ -61,23 +65,21 @@ - (void)commonCollectionViewListCellInit { [self addSubview:_inkView]; _contentWrapper = [[UIView alloc] initWithFrame:self.contentView.bounds]; - _contentWrapper.autoresizingMask = UIViewAutoresizingFlexibleWidth | - MDFTrailingMarginAutoresizingMaskForLayoutDirection( - self.mdf_effectiveUserInterfaceLayoutDirection); + _contentWrapper.autoresizingMask = + UIViewAutoresizingFlexibleWidth | MDFTrailingMarginAutoresizingMaskForLayoutDirection( + self.mdf_effectiveUserInterfaceLayoutDirection); _contentWrapper.clipsToBounds = YES; [self.contentView addSubview:_contentWrapper]; // Text label. _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - _titleLabel.autoresizingMask = - MDFTrailingMarginAutoresizingMaskForLayoutDirection( - self.mdf_effectiveUserInterfaceLayoutDirection); + _titleLabel.autoresizingMask = MDFTrailingMarginAutoresizingMaskForLayoutDirection( + self.mdf_effectiveUserInterfaceLayoutDirection); // Detail text label. _detailsTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - _detailsTextLabel.autoresizingMask = - MDFTrailingMarginAutoresizingMaskForLayoutDirection( - self.mdf_effectiveUserInterfaceLayoutDirection); + _detailsTextLabel.autoresizingMask = MDFTrailingMarginAutoresizingMaskForLayoutDirection( + self.mdf_effectiveUserInterfaceLayoutDirection); [self resetCollectionViewListCell]; @@ -86,9 +88,8 @@ - (void)commonCollectionViewListCellInit { // Image view. _imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; - _imageView.autoresizingMask = - MDFTrailingMarginAutoresizingMaskForLayoutDirection( - self.mdf_effectiveUserInterfaceLayoutDirection); + _imageView.autoresizingMask = MDFTrailingMarginAutoresizingMaskForLayoutDirection( + self.mdf_effectiveUserInterfaceLayoutDirection); [self.contentView addSubview:_imageView]; [self setupConstraints]; @@ -124,14 +125,16 @@ - (void)setupConstraints { toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 - constant:1].active = YES; + constant:1] + .active = YES; [NSLayoutConstraint constraintWithItem:self.contentView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 - constant:1].active = YES; + constant:1] + .active = YES; _contentWrapper.translatesAutoresizingMaskIntoConstraints = NO; _titleLabel.translatesAutoresizingMaskIntoConstraints = NO; @@ -139,15 +142,15 @@ - (void)setupConstraints { _imageView.translatesAutoresizingMaskIntoConstraints = NO; NSDictionary *metrics = @{ - @"kTextVerticalPadding" : @(kTextVerticalPadding), - }; + @"kTextVerticalPadding" : @(kTextVerticalPadding), + }; NSDictionary *views = @{ - @"contentWrapper": _contentWrapper, - @"titleLabel": _titleLabel, - @"detailsTextLabel": _detailsTextLabel, - @"imageView": _imageView, - }; + @"contentWrapper" : _contentWrapper, + @"titleLabel" : _titleLabel, + @"detailsTextLabel" : _detailsTextLabel, + @"imageView" : _imageView, + }; NSMutableArray *constraints = [[NSMutableArray alloc] init]; @@ -178,57 +181,54 @@ - (void)setupConstraints { constant:0]; _imageWidthConstraint.active = YES; - [constraints addObject: - [NSLayoutConstraint constraintWithItem:self.contentView - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:_contentWrapper - attribute:NSLayoutAttributeRight - multiplier:1 - constant:kImagePadding]]; - - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[contentWrapper]|" - options:0 - metrics:nil - views:views]]; - - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:@"|[titleLabel]|" - options:0 - metrics:nil - views:views]]; - - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:@"|[detailsTextLabel]|" - options:0 - metrics:nil - views:views]]; - - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat: - @"V:|-(kTextVerticalPadding)-[titleLabel][detailsTextLabel]-(kTextVerticalPadding)-|" - options:0 - metrics:metrics - views:views]]; - - [constraints addObject: - [NSLayoutConstraint constraintWithItem:_imageView - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:self.contentView - attribute:NSLayoutAttributeCenterY - multiplier:1 - constant:0]]; - - [constraints addObject: - [NSLayoutConstraint constraintWithItem:_imageView - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationEqual - toItem:nil - attribute:NSLayoutAttributeNotAnAttribute - multiplier:1 - constant:kImageHeight]]; + [constraints addObject:[NSLayoutConstraint constraintWithItem:self.contentView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:_contentWrapper + attribute:NSLayoutAttributeRight + multiplier:1 + constant:kImagePadding]]; + + [constraints + addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[contentWrapper]|" + options:0 + metrics:nil + views:views]]; + + [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"|[titleLabel]|" + options:0 + metrics:nil + views:views]]; + + [constraints + addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"|[detailsTextLabel]|" + options:0 + metrics:nil + views:views]]; + + [constraints + addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat: + @"V:|-(kTextVerticalPadding)-[titleLabel][" + @"detailsTextLabel]-(kTextVerticalPadding)-|" + options:0 + metrics:metrics + views:views]]; + + [constraints addObject:[NSLayoutConstraint constraintWithItem:_imageView + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self.contentView + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; + + [constraints addObject:[NSLayoutConstraint constraintWithItem:_imageView + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute:NSLayoutAttributeNotAnAttribute + multiplier:1 + constant:kImageHeight]]; [NSLayoutConstraint activateConstraints:constraints]; } @@ -315,7 +315,6 @@ - (void)mdc_setAdjustsFontForContentSizeCategory:(BOOL)adjusts { - (void)contentSizeCategoryDidChange:(__unused NSNotification *)notification { [self updateTitleFont]; [self updateDetailsFont]; - } - (void)setTitleFont:(UIFont *)titleFont { @@ -329,8 +328,8 @@ - (void)updateTitleFont { } if (_mdc_adjustsFontForContentSizeCategory) { _titleLabel.font = - [_titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + [_titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { _titleLabel.font = _titleFont; } @@ -348,8 +347,8 @@ - (void)updateDetailsFont { } if (_mdc_adjustsFontForContentSizeCategory) { _detailsTextLabel.font = - [_detailsFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + [_detailsFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } else { _detailsTextLabel.font = _detailsFont; } diff --git a/components/List/src/MDCBaseCell.m b/components/List/src/MDCBaseCell.m index d1116689211..af050cad57f 100644 --- a/components/List/src/MDCBaseCell.m +++ b/components/List/src/MDCBaseCell.m @@ -19,8 +19,8 @@ @interface MDCBaseCell () -@property (nonatomic, assign) CGPoint lastTouch; -@property (strong, nonatomic, nonnull) MDCInkView *inkView; +@property(nonatomic, assign) CGPoint lastTouch; +@property(strong, nonatomic, nonnull) MDCInkView *inkView; @end @@ -57,15 +57,11 @@ - (void)commonMDCBaseCellInit { #pragma mark Ink - (void)startInk { - [self.inkView startTouchBeganAtPoint:_lastTouch - animated:YES - withCompletion:nil]; + [self.inkView startTouchBeganAtPoint:_lastTouch animated:YES withCompletion:nil]; } - (void)endInk { - [self.inkView startTouchEndAtPoint:_lastTouch - animated:YES - withCompletion:nil]; + [self.inkView startTouchEndAtPoint:_lastTouch animated:YES withCompletion:nil]; } #pragma mark Shadow diff --git a/components/MaskedTransition/src/MDCMaskedTransitionController.m b/components/MaskedTransition/src/MDCMaskedTransitionController.m index 69f162a84b8..e81e25b2bce 100644 --- a/components/MaskedTransition/src/MDCMaskedTransitionController.m +++ b/components/MaskedTransition/src/MDCMaskedTransitionController.m @@ -14,8 +14,8 @@ #import "MDCMaskedTransitionController.h" -#import "private/MDCMaskedTransition.h" #import "private/MDCMaskedPresentationController.h" +#import "private/MDCMaskedTransition.h" #import "private/MDCMaskedTransitionMotionForContext.h" @implementation MDCMaskedTransitionController @@ -37,8 +37,8 @@ - (instancetype)init { - (id) animationControllerForPresentedController:(UIViewController *)presented - presentingController:(UIViewController *)presenting - sourceController:(UIViewController *)source { + presentingController:(UIViewController *)presenting + sourceController:(UIViewController *)source { if (_sourceView == nil) { return nil; } @@ -46,14 +46,13 @@ - (instancetype)init { direction:MDMTransitionDirectionForward]; } -- (id) - animationControllerForDismissedController:(UIViewController *)dismissed { +- (id)animationControllerForDismissedController: + (UIViewController *)dismissed { if (_sourceView == nil) { return nil; } - MDCMaskedTransitionMotionSpec motionSpecification = - MDCMaskedTransitionMotionSpecForContext(dismissed.presentingViewController.view.superview, - dismissed); + MDCMaskedTransitionMotionSpec motionSpecification = MDCMaskedTransitionMotionSpecForContext( + dismissed.presentingViewController.view.superview, dismissed); if (motionSpecification.shouldSlideWhenCollapsed) { return nil; } @@ -63,13 +62,13 @@ - (instancetype)init { - (UIPresentationController *) presentationControllerForPresentedViewController:(UIViewController *)presented - presentingViewController:(UIViewController *)presenting - sourceViewController:(UIViewController *)source { - return - [[MDCMaskedPresentationController alloc] initWithPresentedViewController:presented - presentingViewController:presenting - calculateFrameOfPresentedView:self.calculateFrameOfPresentedView - sourceView:self.sourceView]; + presentingViewController:(UIViewController *)presenting + sourceViewController:(UIViewController *)source { + return [[MDCMaskedPresentationController alloc] + initWithPresentedViewController:presented + presentingViewController:presenting + calculateFrameOfPresentedView:self.calculateFrameOfPresentedView + sourceView:self.sourceView]; } @end diff --git a/components/MaskedTransition/src/private/MDCMaskedPresentationController.m b/components/MaskedTransition/src/private/MDCMaskedPresentationController.m index 055c7102b0e..29d688dfa38 100644 --- a/components/MaskedTransition/src/private/MDCMaskedPresentationController.m +++ b/components/MaskedTransition/src/private/MDCMaskedPresentationController.m @@ -17,8 +17,8 @@ #import "MDCMaskedPresentationController.h" -#import #import +#import #import "MDCMaskedTransitionMotionForContext.h" @@ -29,14 +29,15 @@ @implementation MDCMaskedPresentationController { - (instancetype)initWithPresentedViewController:(UIViewController *)presentedViewController presentingViewController:(UIViewController *)presentingViewController - calculateFrameOfPresentedView:(CGRect (^)(UIPresentationController *))calculateFrameOfPresentedView + calculateFrameOfPresentedView: + (CGRect (^)(UIPresentationController *))calculateFrameOfPresentedView sourceView:(UIView *)sourceView { self = [super initWithPresentedViewController:presentedViewController presentingViewController:presentingViewController]; if (self) { _scrimView = [[UIView alloc] init]; - _scrimView.autoresizingMask = (UIViewAutoresizingFlexibleWidth - | UIViewAutoresizingFlexibleHeight); + _scrimView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _scrimView.backgroundColor = [UIColor colorWithWhite:0 alpha:(CGFloat)0.3]; _calculateFrameOfPresentedView = [calculateFrameOfPresentedView copy]; @@ -94,7 +95,8 @@ - (void)dismissalTransitionWillBegin { [self.presentedViewController.transitionCoordinator animateAlongsideTransition:^(id context) { self.scrimView.alpha = 0; - } completion:nil]; + } + completion:nil]; } else { MDCMaskedTransitionMotionTiming motionTiming = motionSpecification.collapse; diff --git a/components/MaskedTransition/src/private/MDCMaskedTransition.m b/components/MaskedTransition/src/private/MDCMaskedTransition.m index d9f01531055..ba6fb71a2a7 100644 --- a/components/MaskedTransition/src/private/MDCMaskedTransition.m +++ b/components/MaskedTransition/src/private/MDCMaskedTransition.m @@ -34,9 +34,7 @@ static inline CGPoint AnchorPointFromPosition(CGPoint position, CGRect bounds) { } static inline CGRect FrameCenteredAround(CGPoint position, CGSize size) { - return CGRectMake(position.x - size.width / 2, - position.y - size.height / 2, - size.width, + return CGRectMake(position.x - size.width / 2, position.y - size.height / 2, size.width, size.height); } @@ -45,9 +43,8 @@ static inline CGFloat LengthOfVector(CGVector vector) { } // TODO: Pull this out to MotionTransitioning. -static void -PrepareTransitionWithContext(id transitionContext, - MDMTransitionDirection direction) { +static void PrepareTransitionWithContext(id transitionContext, + MDMTransitionDirection direction) { UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; @@ -88,19 +85,17 @@ static inline CGFloat LengthOfVector(CGVector vector) { } // TODO: Pull this out to MotionTransitioning. -static NSArray * -OrderedViewControllersWithTransitionContext(id transitionContext, - MDMTransitionDirection direction) { - +static NSArray *OrderedViewControllersWithTransitionContext( + id transitionContext, MDMTransitionDirection direction) { UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; if (direction == MDMTransitionDirectionForward) { - return @[fromViewController, toViewController]; + return @[ fromViewController, toViewController ]; } else { - return @[toViewController, fromViewController]; + return @[ toViewController, fromViewController ]; } } @@ -131,13 +126,12 @@ - (NSTimeInterval)transitionDuration:(id)t return 0; } UIViewController *presentedViewController = viewControllers[1]; - MDCMaskedTransitionMotionSpec motionSpecification = - MDCMaskedTransitionMotionSpecForContext(transitionContext.containerView, - presentedViewController); + MDCMaskedTransitionMotionSpec motionSpecification = MDCMaskedTransitionMotionSpecForContext( + transitionContext.containerView, presentedViewController); - MDCMaskedTransitionMotionTiming motion = ((_direction == MDMTransitionDirectionForward) - ? motionSpecification.expansion - : motionSpecification.collapse); + MDCMaskedTransitionMotionTiming motion = + ((_direction == MDMTransitionDirectionForward) ? motionSpecification.expansion + : motionSpecification.collapse); return motion.overallDuration; } @@ -154,9 +148,8 @@ - (void)animateTransition:(id)transitionCo } UIViewController *presentedViewController = viewControllers[1]; - MDCMaskedTransitionMotionSpec motionSpecification = - MDCMaskedTransitionMotionSpecForContext(transitionContext.containerView, - presentedViewController); + MDCMaskedTransitionMotionSpec motionSpecification = MDCMaskedTransitionMotionSpecForContext( + transitionContext.containerView, presentedViewController); // Cache original state. // We're going to reparent the fore view, so keep this information for later. @@ -201,8 +194,7 @@ - (void)animateTransition:(id)transitionCo } else { initialMaskedFrame = CGRectMake(CGRectGetMinX(transitionContext.containerView.bounds), CGRectGetMinY(initialSourceFrame) - 20, - CGRectGetWidth(originalFrame), - CGRectGetHeight(originalFrame)); + CGRectGetWidth(originalFrame), CGRectGetHeight(originalFrame)); if (CGRectGetMidX(initialSourceFrame) < CGRectGetMidX(initialMaskedFrame)) { // Middle-right corner = CGPointMake(CGRectGetMaxX(initialMaskedFrame), CGRectGetMidY(initialMaskedFrame)); @@ -217,15 +209,15 @@ - (void)animateTransition:(id)transitionCo fromView:transitionContext.containerView]; const CGFloat initialRadius = CGRectGetWidth(_sourceView.bounds) / 2; - const CGFloat finalRadius = LengthOfVector(CGVectorMake(initialSourceCenter.x - corner.x, - initialSourceCenter.y - corner.y)); + const CGFloat finalRadius = LengthOfVector( + CGVectorMake(initialSourceCenter.x - corner.x, initialSourceCenter.y - corner.y)); const CGFloat finalScale = finalRadius / initialRadius; CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; { // Ensures that we transform from the center of the source view's frame. - shapeLayer.anchorPoint = AnchorPointFromPosition(CenterOfFrame(initialSourceFrameInMask), - maskedView.layer.bounds); + shapeLayer.anchorPoint = + AnchorPointFromPosition(CenterOfFrame(initialSourceFrameInMask), maskedView.layer.bounds); shapeLayer.frame = maskedView.layer.bounds; shapeLayer.path = [[UIBezierPath bezierPathWithOvalInRect:initialSourceFrameInMask] CGPath]; } @@ -242,8 +234,8 @@ - (void)animateTransition:(id)transitionCo self->_sourceView.frame = originalSourceFrame; self->_sourceView.backgroundColor = originalSourceBackgroundColor; - if (motionSpecification.shouldSlideWhenCollapsed - && transitionContext.presentationStyle != UIModalPresentationCustom) { + if (motionSpecification.shouldSlideWhenCollapsed && + transitionContext.presentationStyle != UIModalPresentationCustom) { // If we're going to slide when collapsed then this transition won't be invoked. If we also // don't have a presentation controller (because of the presentation style) then we need to // restore the source view's visibility somehow. This is the only place I could think of to @@ -256,12 +248,12 @@ - (void)animateTransition:(id)transitionCo [maskedView removeFromSuperview]; - [transitionContext completeTransition:YES]; // Hand off back to UIKit + [transitionContext completeTransition:YES]; // Hand off back to UIKit }]; - MDCMaskedTransitionMotionTiming motion = ((_direction == MDMTransitionDirectionForward) - ? motionSpecification.expansion - : motionSpecification.collapse); + MDCMaskedTransitionMotionTiming motion = + ((_direction == MDMTransitionDirectionForward) ? motionSpecification.expansion + : motionSpecification.collapse); MDMMotionAnimator *animator = [[MDMMotionAnimator alloc] init]; animator.shouldReverseValues = _direction == MDMTransitionDirectionBackward; @@ -304,8 +296,8 @@ - (void)animateTransition:(id)transitionCo // Upon completion of the animation we want all of the content to be visible, so we jump // to a full bounds mask. shapeLayer.transform = CATransform3DIdentity; - shapeLayer.path = [[UIBezierPath bezierPathWithRect:presentedViewController.view.bounds] - CGPath]; + shapeLayer.path = + [[UIBezierPath bezierPathWithRect:presentedViewController.view.bounds] CGPath]; }; } [animator animateWithTiming:motion.maskTransformation @@ -317,14 +309,16 @@ - (void)animateTransition:(id)transitionCo [animator animateWithTiming:motion.horizontalMovement toLayer:maskedView.layer - withValues:@[ @(CGRectGetMidX(initialMaskedFrame)), - @(CGRectGetMidX(finalMaskedFrame)) ] + withValues:@[ + @(CGRectGetMidX(initialMaskedFrame)), @(CGRectGetMidX(finalMaskedFrame)) + ] keyPath:MDMKeyPathX]; [animator animateWithTiming:motion.verticalMovement toLayer:maskedView.layer - withValues:@[ @(CGRectGetMidY(initialMaskedFrame)), - @(CGRectGetMidY(finalMaskedFrame)) ] + withValues:@[ + @(CGRectGetMidY(initialMaskedFrame)), @(CGRectGetMidY(finalMaskedFrame)) + ] keyPath:MDMKeyPathY]; [CATransaction commit]; diff --git a/components/MaskedTransition/src/private/MDCMaskedTransitionMotionForContext.m b/components/MaskedTransition/src/private/MDCMaskedTransitionMotionForContext.m index 802d14f88c4..0e5b4ba166c 100644 --- a/components/MaskedTransition/src/private/MDCMaskedTransitionMotionForContext.m +++ b/components/MaskedTransition/src/private/MDCMaskedTransitionMotionForContext.m @@ -16,9 +16,8 @@ #import "MDCMaskedTransitionMotionForContext.h" -MDCMaskedTransitionMotionSpec -MDCMaskedTransitionMotionSpecForContext(UIView *containerView, - UIViewController *presentedViewController) { +MDCMaskedTransitionMotionSpec MDCMaskedTransitionMotionSpecForContext( + UIView *containerView, UIViewController *presentedViewController) { const CGRect foreBounds = presentedViewController.view.bounds; const CGRect foreFrame = presentedViewController.view.frame; const CGRect containerBounds = containerView.bounds; @@ -26,8 +25,8 @@ if (CGRectEqualToRect(presentedViewController.view.frame, containerBounds)) { return MDCMaskedTransitionMotionSpecs.fullscreen; - } else if (foreBounds.size.width == containerBounds.size.width - && CGRectGetMaxY(foreFrame) == CGRectGetMaxY(containerBounds)) { + } else if (foreBounds.size.width == containerBounds.size.width && + CGRectGetMaxY(foreFrame) == CGRectGetMaxY(containerBounds)) { if (foreFrame.size.height > 100) { return MDCMaskedTransitionMotionSpecs.bottomSheet; diff --git a/components/MaskedTransition/src/private/MDCMaskedTransitionMotionSpecs.m b/components/MaskedTransition/src/private/MDCMaskedTransitionMotionSpecs.m index a4026025ad6..139c309aabf 100644 --- a/components/MaskedTransition/src/private/MDCMaskedTransitionMotionSpecs.m +++ b/components/MaskedTransition/src/private/MDCMaskedTransitionMotionSpecs.m @@ -32,178 +32,279 @@ + (MDCMaskedTransitionMotionSpec)fullscreen { MDMMotionCurve easeInEaseOut = [self easeInEaseOut]; MDMMotionCurve easeIn = [self easeIn]; return (MDCMaskedTransitionMotionSpec){ - .expansion = { - .iconFade = { - .delay = 0.000, .duration = 0.075, .curve = easeInEaseOut, - }, - .contentFade = { - .delay = 0.150, .duration = 0.225, .curve = easeInEaseOut, - }, - .floodBackgroundColor = { - .delay = 0.000, .duration = 0.075, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.000, .duration = 0.105, .curve = easeIn, - }, - .horizontalMovement = {.curve = { .type = MDMMotionCurveTypeInstant }}, - .verticalMovement = { - .delay = 0.045, .duration = 0.330, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.000, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.375 - }, - .shouldSlideWhenCollapsed = true, - .isCentered = false - }; + .expansion = {.iconFade = + { + .delay = 0.000, + .duration = 0.075, + .curve = easeInEaseOut, + }, + .contentFade = + { + .delay = 0.150, + .duration = 0.225, + .curve = easeInEaseOut, + }, + .floodBackgroundColor = + { + .delay = 0.000, + .duration = 0.075, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.000, + .duration = 0.105, + .curve = easeIn, + }, + .horizontalMovement = {.curve = {.type = MDMMotionCurveTypeInstant}}, + .verticalMovement = + { + .delay = 0.045, + .duration = 0.330, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.000, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.375}, + .shouldSlideWhenCollapsed = true, + .isCentered = false}; } + (MDCMaskedTransitionMotionSpec)bottomSheet { MDMMotionCurve easeInEaseOut = [self easeInEaseOut]; MDMMotionCurve easeIn = [self easeIn]; return (MDCMaskedTransitionMotionSpec){ - .expansion = { - .iconFade = { - .delay = 0.000, .duration = 0.075, .curve = easeInEaseOut, // No spec - }, - .contentFade = { // No spec for this - .delay = 0.100, .duration = 0.200, .curve = easeInEaseOut, - }, - .floodBackgroundColor = { - .delay = 0.000, .duration = 0.075, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.000, .duration = 0.105, .curve = easeIn, - }, - .horizontalMovement = {.curve = { .type = MDMMotionCurveTypeInstant }}, - .verticalMovement = { - .delay = 0.045, .duration = 0.330, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.000, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.375 - }, - .shouldSlideWhenCollapsed = true, - .isCentered = false - }; + .expansion = {.iconFade = + { + .delay = 0.000, .duration = 0.075, .curve = easeInEaseOut, // No spec + }, + .contentFade = + { + // No spec for this + .delay = 0.100, + .duration = 0.200, + .curve = easeInEaseOut, + }, + .floodBackgroundColor = + { + .delay = 0.000, + .duration = 0.075, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.000, + .duration = 0.105, + .curve = easeIn, + }, + .horizontalMovement = {.curve = {.type = MDMMotionCurveTypeInstant}}, + .verticalMovement = + { + .delay = 0.045, + .duration = 0.330, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.000, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.375}, + .shouldSlideWhenCollapsed = true, + .isCentered = false}; } + (MDCMaskedTransitionMotionSpec)bottomCard { MDMMotionCurve easeInEaseOut = [self easeInEaseOut]; MDMMotionCurve easeIn = [self easeIn]; MDMMotionCurve easeOut = [self easeOut]; - return (MDCMaskedTransitionMotionSpec){ - .expansion = { - .iconFade = { - .delay = 0.000, .duration = 0.120, .curve = easeInEaseOut, - }, - .contentFade = { - .delay = 0.150, .duration = 0.150, .curve = easeInEaseOut, - }, - .floodBackgroundColor = { - .delay = 0.075, .duration = 0.075, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.045, .duration = 0.225, .curve = easeIn, - }, - .horizontalMovement = { - .delay = 0.000, .duration = 0.150, .curve = easeInEaseOut, - }, - .verticalMovement = { - .delay = 0.000, .duration = 0.345, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.075, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.345 - }, - .collapse = { - .iconFade = { - .delay = 0.150, .duration = 0.150, .curve = easeInEaseOut, - }, - .contentFade = { - .delay = 0.000, .duration = 0.075, .curve = easeIn, - }, - .floodBackgroundColor = { - .delay = 0.060, .duration = 0.150, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.000, .duration = 0.180, .curve = easeOut, - }, - .horizontalMovement = { - .delay = 0.045, .duration = 0.255, .curve = easeInEaseOut, - }, - .verticalMovement = { - .delay = 0.000, .duration = 0.255, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.000, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.300 - }, - .shouldSlideWhenCollapsed = false, - .isCentered = true - }; + return (MDCMaskedTransitionMotionSpec){.expansion = {.iconFade = + { + .delay = 0.000, + .duration = 0.120, + .curve = easeInEaseOut, + }, + .contentFade = + { + .delay = 0.150, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .floodBackgroundColor = + { + .delay = 0.075, + .duration = 0.075, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.045, + .duration = 0.225, + .curve = easeIn, + }, + .horizontalMovement = + { + .delay = 0.000, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .verticalMovement = + { + .delay = 0.000, + .duration = 0.345, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.075, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.345}, + .collapse = {.iconFade = + { + .delay = 0.150, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .contentFade = + { + .delay = 0.000, + .duration = 0.075, + .curve = easeIn, + }, + .floodBackgroundColor = + { + .delay = 0.060, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.000, + .duration = 0.180, + .curve = easeOut, + }, + .horizontalMovement = + { + .delay = 0.045, + .duration = 0.255, + .curve = easeInEaseOut, + }, + .verticalMovement = + { + .delay = 0.000, + .duration = 0.255, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.000, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.300}, + .shouldSlideWhenCollapsed = false, + .isCentered = true}; } + (MDCMaskedTransitionMotionSpec)toolbar { MDMMotionCurve easeInEaseOut = [self easeInEaseOut]; MDMMotionCurve easeIn = [self easeIn]; MDMMotionCurve easeOut = [self easeOut]; - return (MDCMaskedTransitionMotionSpec){ - .expansion = { - .iconFade = { - .delay = 0.000, .duration = 0.120, .curve = easeInEaseOut, - }, - .contentFade = { - .delay = 0.150, .duration = 0.150, .curve = easeInEaseOut, - }, - .floodBackgroundColor = { - .delay = 0.075, .duration = 0.075, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.045, .duration = 0.225, .curve = easeIn, - }, - .horizontalMovement = { - .delay = 0.000, .duration = 0.300, .curve = easeInEaseOut, - }, - .verticalMovement = { - .delay = 0.000, .duration = 0.120, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.075, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.300 - }, - .collapse = { - .iconFade = { - .delay = 0.150, .duration = 0.150, .curve = easeInEaseOut, - }, - .contentFade = { - .delay = 0.000, .duration = 0.075, .curve = easeIn, - }, - .floodBackgroundColor = { - .delay = 0.060, .duration = 0.150, .curve = easeInEaseOut, - }, - .maskTransformation = { - .delay = 0.000, .duration = 0.180, .curve = easeOut, - }, - .horizontalMovement = { - .delay = 0.105, .duration = 0.195, .curve = easeInEaseOut, - }, - .verticalMovement = { - .delay = 0.000, .duration = 0.255, .curve = easeInEaseOut, - }, - .scrimFade = { - .delay = 0.000, .duration = 0.150, .curve = easeInEaseOut, - }, - .overallDuration = 0.300 - }, - .shouldSlideWhenCollapsed = false, - .isCentered = true - }; + return (MDCMaskedTransitionMotionSpec){.expansion = {.iconFade = + { + .delay = 0.000, + .duration = 0.120, + .curve = easeInEaseOut, + }, + .contentFade = + { + .delay = 0.150, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .floodBackgroundColor = + { + .delay = 0.075, + .duration = 0.075, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.045, + .duration = 0.225, + .curve = easeIn, + }, + .horizontalMovement = + { + .delay = 0.000, + .duration = 0.300, + .curve = easeInEaseOut, + }, + .verticalMovement = + { + .delay = 0.000, + .duration = 0.120, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.075, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.300}, + .collapse = {.iconFade = + { + .delay = 0.150, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .contentFade = + { + .delay = 0.000, + .duration = 0.075, + .curve = easeIn, + }, + .floodBackgroundColor = + { + .delay = 0.060, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .maskTransformation = + { + .delay = 0.000, + .duration = 0.180, + .curve = easeOut, + }, + .horizontalMovement = + { + .delay = 0.105, + .duration = 0.195, + .curve = easeInEaseOut, + }, + .verticalMovement = + { + .delay = 0.000, + .duration = 0.255, + .curve = easeInEaseOut, + }, + .scrimFade = + { + .delay = 0.000, + .duration = 0.150, + .curve = easeInEaseOut, + }, + .overallDuration = 0.300}, + .shouldSlideWhenCollapsed = false, + .isCentered = true}; } @end diff --git a/components/NavigationBar/examples/NavigationBarIconsExample.m b/components/NavigationBar/examples/NavigationBarIconsExample.m index 52f396ba4ae..9bc223343f9 100644 --- a/components/NavigationBar/examples/NavigationBarIconsExample.m +++ b/components/NavigationBar/examples/NavigationBarIconsExample.m @@ -18,9 +18,9 @@ #import "MaterialIcons+ic_arrow_back.h" #import "MaterialIcons+ic_info.h" #import "MaterialIcons+ic_reorder.h" -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+ColorThemer.h" #import "MaterialNavigationBar+TypographyThemer.h" +#import "MaterialNavigationBar.h" #import "supplemental/NavigationBarTypicalUseExampleSupplemental.h" @interface NavigationBarIconsExample () @@ -59,8 +59,7 @@ - (void)viewDidLoad { toNavigationBar:self.navigationBar]; UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] - initWithImage:[[[MDCIcons imageFor_ic_arrow_back] - mdf_imageWithHorizontallyFlippedOrientation] + initWithImage:[[[MDCIcons imageFor_ic_arrow_back] mdf_imageWithHorizontallyFlippedOrientation] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] style:UIBarButtonItemStylePlain target:self @@ -87,7 +86,8 @@ - (void)viewDidLoad { self.navigationItem.backBarButtonItem = backButtonItem; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor] + .active = YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -95,7 +95,8 @@ - (void)viewDidLoad { toItem:self.navigationBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } NSDictionary *viewsBindings = NSDictionaryOfVariableBindings(_navigationBar); @@ -126,9 +127,9 @@ @implementation NavigationBarIconsExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Navigation Bar", @"Navigation Bar With Icons" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Navigation Bar", @"Navigation Bar With Icons" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/NavigationBar/examples/NavigationBarLayoutExample.m b/components/NavigationBar/examples/NavigationBarLayoutExample.m index f972aa4d072..04d5350c832 100644 --- a/components/NavigationBar/examples/NavigationBarLayoutExample.m +++ b/components/NavigationBar/examples/NavigationBarLayoutExample.m @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#import #import "MaterialIcons+ic_arrow_back.h" +#import "MaterialNavigationBar+ColorThemer.h" #import "MaterialNavigationBar.h" #import "MaterialTextFields.h" -#import "MaterialNavigationBar+ColorThemer.h" -#import @interface NavigationBarLayoutExample : UIViewController @@ -101,7 +101,8 @@ - (void)viewDidLoad { [self.view addSubview:self.titleField]; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor] + .active = YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -109,7 +110,8 @@ - (void)viewDidLoad { toItem:self.navigationBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } [NSLayoutConstraint constraintWithItem:self.navigationBar attribute:NSLayoutAttributeBottom @@ -117,21 +119,24 @@ - (void)viewDidLoad { toItem:self.leadingItemField attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:self.leadingItemField attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.titleField attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:self.titleField attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.trailingItemField attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; NSDictionary *viewsBindings = NSDictionaryOfVariableBindings(_navigationBar, _leadingItemField, _titleField, _trailingItemField); @@ -179,8 +184,8 @@ - (void)didTapBackButton { - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSString *finishedString = - [textField.text stringByReplacingCharactersInRange:range withString:string]; + NSString *finishedString = [textField.text stringByReplacingCharactersInRange:range + withString:string]; // MDCNavigationBar doesn't handle BarButtonItems with no image and zero-length strings if (finishedString.length == 0) { @@ -215,9 +220,9 @@ @implementation NavigationBarLayoutExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Navigation Bar", @"Navigation Bar Item Layout" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Navigation Bar", @"Navigation Bar Item Layout" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/NavigationBar/examples/NavigationBarRTLIcons.m b/components/NavigationBar/examples/NavigationBarRTLIcons.m index 67949c3bd69..c74f2ae82b5 100644 --- a/components/NavigationBar/examples/NavigationBarRTLIcons.m +++ b/components/NavigationBar/examples/NavigationBarRTLIcons.m @@ -16,11 +16,11 @@ #import #import "MaterialIcons+ic_arrow_back.h" +#import "MaterialIcons+ic_check_circle.h" #import "MaterialIcons+ic_info.h" #import "MaterialIcons+ic_reorder.h" -#import "MaterialIcons+ic_check_circle.h" -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+ColorThemer.h" +#import "MaterialNavigationBar.h" #import "supplemental/NavigationBarTypicalUseExampleSupplemental.h" @interface NavigationBarRTL : UIViewController @@ -29,7 +29,6 @@ @interface NavigationBarRTL : UIViewController @end - @implementation NavigationBarRTL - (void)viewDidLoad { @@ -62,18 +61,20 @@ - (void)viewDidLoad { style:UIBarButtonItemStylePlain target:nil action:nil]; - UIBarButtonItem *checkCircleButtonItem = - [[UIBarButtonItem alloc] initWithImage:[[MDCIcons imageFor_ic_check_circle] - imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] - style:UIBarButtonItemStylePlain - target:nil - action:nil]; + UIBarButtonItem *checkCircleButtonItem = [[UIBarButtonItem alloc] + initWithImage:[[MDCIcons imageFor_ic_check_circle] + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] + style:UIBarButtonItemStylePlain + target:nil + action:nil]; self.navigationBar.tintColor = UIColor.whiteColor; - self.navigationItem.rightBarButtonItems = @[ infoButtonItem, reorderButtonItem, checkCircleButtonItem]; + self.navigationItem.rightBarButtonItems = + @[ infoButtonItem, reorderButtonItem, checkCircleButtonItem ]; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navigationBar.topAnchor] + .active = YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -81,7 +82,8 @@ - (void)viewDidLoad { toItem:self.navigationBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } NSDictionary *viewsBindings = NSDictionaryOfVariableBindings(_navigationBar); @@ -110,9 +112,9 @@ - (void)didTapBackButton { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Navigation Bar", @"Navigation Bar TitleView RTL" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Navigation Bar", @"Navigation Bar TitleView RTL" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/NavigationBar/examples/NavigationBarTypicalUseExample.m b/components/NavigationBar/examples/NavigationBarTypicalUseExample.m index eca1a26f58d..f668270ed6e 100644 --- a/components/NavigationBar/examples/NavigationBarTypicalUseExample.m +++ b/components/NavigationBar/examples/NavigationBarTypicalUseExample.m @@ -14,8 +14,8 @@ #import -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+ColorThemer.h" +#import "MaterialNavigationBar.h" #import "supplemental/NavigationBarTypicalUseExampleSupplemental.h" @interface NavigationBarTypicalUseExample () @@ -34,7 +34,7 @@ - (id)init { } - (void)viewDidLoad { - [super viewDidLoad]; + [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; self.title = @"Navigation Bar"; @@ -54,7 +54,8 @@ - (void)viewDidLoad { self.navBar.translatesAutoresizingMaskIntoConstraints = NO; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = + YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -62,17 +63,18 @@ - (void)viewDidLoad { toItem:self.navBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } - + NSDictionary *viewsBindings = NSDictionaryOfVariableBindings(_navBar); [NSLayoutConstraint - activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_navBar]|" - options:0 - metrics:nil - views:viewsBindings]]; - + activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_navBar]|" + options:0 + metrics:nil + views:viewsBindings]]; + [self setupExampleViews]; } diff --git a/components/NavigationBar/examples/NavigationBarWithBarItemsExample.m b/components/NavigationBar/examples/NavigationBarWithBarItemsExample.m index a85dff5aa8b..71a585eb59f 100644 --- a/components/NavigationBar/examples/NavigationBarWithBarItemsExample.m +++ b/components/NavigationBar/examples/NavigationBarWithBarItemsExample.m @@ -14,8 +14,8 @@ #import -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+ColorThemer.h" +#import "MaterialNavigationBar.h" #import "supplemental/NavigationBarTypicalUseExampleSupplemental.h" @implementation NavigationBarWithBarItemsExample @@ -64,7 +64,8 @@ - (void)viewDidLoad { self.navBar.translatesAutoresizingMaskIntoConstraints = NO; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = + YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -72,16 +73,17 @@ - (void)viewDidLoad { toItem:self.navBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } - NSDictionary *viewsBindings = @{@"navBar": self.navBar}; + NSDictionary *viewsBindings = @{@"navBar" : self.navBar}; [NSLayoutConstraint - activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[navBar]|" - options:0 - metrics:nil - views:viewsBindings]]; + activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[navBar]|" + options:0 + metrics:nil + views:viewsBindings]]; [self setupExampleViews]; } @@ -103,12 +105,12 @@ @implementation NavigationBarWithBarItemsExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"App Bar", @"Modal Presentation" ], - @"description": @"Animation timing easing curves create smooth and consistent motion. " - @"Easing curves allow elements to move between positions or states.", - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"AppBarInterfaceBuilderExampleController" + @"breadcrumbs" : @[ @"App Bar", @"Modal Presentation" ], + @"description" : @"Animation timing easing curves create smooth and consistent motion. " + @"Easing curves allow elements to move between positions or states.", + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"AppBarInterfaceBuilderExampleController" }; } diff --git a/components/NavigationBar/examples/NavigationbarWithCustomFont.m b/components/NavigationBar/examples/NavigationbarWithCustomFont.m index 420d5e8fae7..e4e84b6e857 100644 --- a/components/NavigationBar/examples/NavigationbarWithCustomFont.m +++ b/components/NavigationBar/examples/NavigationbarWithCustomFont.m @@ -14,8 +14,8 @@ #import -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+ColorThemer.h" +#import "MaterialNavigationBar.h" #import "supplemental/NavigationBarTypicalUseExampleSupplemental.h" @implementation NavigationBarWithCustomFontExample @@ -40,7 +40,7 @@ - (void)viewDidLoad { UIFont *font = [UIFont fontWithName:@"Zapfino" size:18.0]; - NSDictionary *titleTextAttributes = @{ NSFontAttributeName : font }; + NSDictionary *titleTextAttributes = @{NSFontAttributeName : font}; [self.navBar setTitleTextAttributes:titleTextAttributes]; @@ -56,7 +56,8 @@ - (void)viewDidLoad { self.navBar.translatesAutoresizingMaskIntoConstraints = NO; if (@available(iOS 11.0, *)) { - [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = YES; + [self.view.safeAreaLayoutGuide.topAnchor constraintEqualToAnchor:self.navBar.topAnchor].active = + YES; } else { [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom @@ -64,16 +65,17 @@ - (void)viewDidLoad { toItem:self.navBar attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } - NSDictionary *viewsBindings = @{@"navBar": self.navBar}; + NSDictionary *viewsBindings = @{@"navBar" : self.navBar}; [NSLayoutConstraint - activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[navBar]|" - options:0 - metrics:nil - views:viewsBindings]]; + activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[navBar]|" + options:0 + metrics:nil + views:viewsBindings]]; [self setupExampleViews]; } @@ -95,9 +97,9 @@ @implementation NavigationBarWithCustomFontExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Navigation Bar", @"Navigation Bar with Custom Font" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Navigation Bar", @"Navigation Bar with Custom Font" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m index 821fe9b0cd9..a50611eff9a 100644 --- a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m +++ b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m @@ -34,7 +34,7 @@ - (void)setupExampleViews { self.exampleView.translatesAutoresizingMaskIntoConstraints = NO; - NSDictionary *viewBindings = @{ @"exampleView" : self.exampleView, @"navBar" : self.navBar }; + NSDictionary *viewBindings = @{@"exampleView" : self.exampleView, @"navBar" : self.navBar}; NSMutableArray<__kindof NSLayoutConstraint *> *arrayOfConstraints = [NSMutableArray array]; // clang-format off @@ -58,11 +58,11 @@ @implementation NavigationBarTypicalUseExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Navigation Bar", @"Navigation Bar" ], - @"description": @"The Navigation Bar component is a view composed of a left and right Button " - @"Bar and either a title label or a custom title view.", - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Navigation Bar", @"Navigation Bar" ], + @"description" : @"The Navigation Bar component is a view composed of a left and right Button " + @"Bar and either a title label or a custom title view.", + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/NavigationBar/src/MDCNavigationBar.m b/components/NavigationBar/src/MDCNavigationBar.m index 1d3bfa7c4ce..b0a0873df7d 100644 --- a/components/NavigationBar/src/MDCNavigationBar.m +++ b/components/NavigationBar/src/MDCNavigationBar.m @@ -22,7 +22,6 @@ #import "MaterialMath.h" #import "MaterialTypography.h" - static const NSUInteger kTitleFontSize = 20; static const CGFloat kNavigationBarDefaultHeight = 56; static const CGFloat kNavigationBarMinHeight = 24; @@ -238,31 +237,26 @@ - (void)layoutSubviews { // values are zero. DO NOT use this to get the top or bottom Safe Area insets. UIEdgeInsets RTLFriendlySafeAreaInsets = UIEdgeInsetsZero; if (@available(iOS 11.0, *)) { - RTLFriendlySafeAreaInsets = - MDFInsetsMakeWithLayoutDirection(self.safeAreaInsets.top, - self.safeAreaInsets.left, - self.safeAreaInsets.bottom, - self.safeAreaInsets.right, - self.mdf_effectiveUserInterfaceLayoutDirection); + RTLFriendlySafeAreaInsets = MDFInsetsMakeWithLayoutDirection( + self.safeAreaInsets.top, self.safeAreaInsets.left, self.safeAreaInsets.bottom, + self.safeAreaInsets.right, self.mdf_effectiveUserInterfaceLayoutDirection); } CGSize leadingButtonBarSize = [_leadingButtonBar sizeThatFits:self.bounds.size]; - CGRect leadingButtonBarFrame = CGRectMake(RTLFriendlySafeAreaInsets.left, - CGRectGetMinY(self.bounds), - leadingButtonBarSize.width, - leadingButtonBarSize.height); + CGRect leadingButtonBarFrame = + CGRectMake(RTLFriendlySafeAreaInsets.left, CGRectGetMinY(self.bounds), + leadingButtonBarSize.width, leadingButtonBarSize.height); CGSize trailingButtonBarSize = [_trailingButtonBar sizeThatFits:self.bounds.size]; CGFloat xOrigin = CGRectGetWidth(self.bounds) - RTLFriendlySafeAreaInsets.right - trailingButtonBarSize.width; - CGRect trailingButtonBarFrame = CGRectMake(xOrigin, - CGRectGetMinY(self.bounds), - trailingButtonBarSize.width, - trailingButtonBarSize.height); + CGRect trailingButtonBarFrame = + CGRectMake(xOrigin, CGRectGetMinY(self.bounds), trailingButtonBarSize.width, + trailingButtonBarSize.height); if (self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { - leadingButtonBarFrame = MDFRectFlippedHorizontally(leadingButtonBarFrame, - CGRectGetWidth(self.bounds)); - trailingButtonBarFrame = MDFRectFlippedHorizontally(trailingButtonBarFrame, - CGRectGetWidth(self.bounds)); + leadingButtonBarFrame = + MDFRectFlippedHorizontally(leadingButtonBarFrame, CGRectGetWidth(self.bounds)); + trailingButtonBarFrame = + MDFRectFlippedHorizontally(trailingButtonBarFrame, CGRectGetWidth(self.bounds)); } _leadingButtonBar.frame = leadingButtonBarFrame; _trailingButtonBar.frame = trailingButtonBarFrame; @@ -314,8 +308,8 @@ - (void)layoutSubviews { case MDCNavigationBarTitleViewLayoutBehaviorCenter: { CGFloat availableWidth = UIEdgeInsetsInsetRect(self.bounds, self.titleInsets).size.width; - availableWidth -= MAX(_leadingButtonBar.frame.size.width, - _trailingButtonBar.frame.size.width) * 2; + availableWidth -= + MAX(_leadingButtonBar.frame.size.width, _trailingButtonBar.frame.size.width) * 2; if (@available(iOS 11.0, *)) { availableWidth -= self.safeAreaInsets.left + self.safeAreaInsets.right; } @@ -451,12 +445,13 @@ - (CGRect)mdc_frameAlignedVertically:(CGRect)frame switch (alignment) { case UIControlContentVerticalAlignmentBottom: return CGRectMake(CGRectGetMinX(frame), CGRectGetMaxY(bounds) - CGRectGetHeight(frame), - CGRectGetWidth(frame), - CGRectGetHeight(frame)); + CGRectGetWidth(frame), CGRectGetHeight(frame)); case UIControlContentVerticalAlignmentCenter: { - CGFloat centeredY = MDCFloor((CGRectGetHeight(bounds) - CGRectGetHeight(frame)) / 2) + CGRectGetMinY(bounds); - return CGRectMake(CGRectGetMinX(frame), centeredY, CGRectGetWidth(frame), CGRectGetHeight(frame)); + CGFloat centeredY = + MDCFloor((CGRectGetHeight(bounds) - CGRectGetHeight(frame)) / 2) + CGRectGetMinY(bounds); + return CGRectMake(CGRectGetMinX(frame), centeredY, CGRectGetWidth(frame), + CGRectGetHeight(frame)); } case UIControlContentVerticalAlignmentTop: { @@ -513,8 +508,7 @@ - (CGRect)mdc_frameAlignedHorizontally:(CGRect)frame if (leftMidSpaceX >= halfFrameWidth) { CGFloat frameMaxX = CGRectGetMinX(rightButtonBar.frame) - titleRightInset; return CGRectMake(frameMaxX - CGRectGetWidth(frame), CGRectGetMinY(frame), - CGRectGetWidth(frame), - CGRectGetHeight(frame)); + CGRectGetWidth(frame), CGRectGetHeight(frame)); } if (rightMidSpaceX >= halfFrameWidth) { CGFloat frameOriginX = CGRectGetMaxX(leftButtonBar.frame) + titleLeftInset; @@ -556,8 +550,8 @@ - (void)tintColorDidChange { - (void)setTitle:(NSString *)title { // |self.titleTextAttributes| can only be set if |title| is set if (self.titleTextAttributes && title.length > 0) { - _titleLabel.attributedText = - [[NSAttributedString alloc] initWithString:title attributes:_titleTextAttributes]; + _titleLabel.attributedText = [[NSAttributedString alloc] initWithString:title + attributes:_titleTextAttributes]; } else { _titleLabel.text = title; } @@ -594,7 +588,7 @@ - (void)setTitleView:(UIView *)titleView { } _titleLabel.hidden = _titleView != nil; - + [self setNeedsLayout]; } @@ -610,8 +604,8 @@ - (void)setTitleTextAttributes:(NSDictionary *)titleTextAttribut // |_titleTextAttributes| can only be set if |self.title| is set if (_titleTextAttributes && self.title.length > 0) { // Set label text as newly created attributed string with attributes if non-nil - _titleLabel.attributedText = - [[NSAttributedString alloc] initWithString:self.title attributes:_titleTextAttributes]; + _titleLabel.attributedText = [[NSAttributedString alloc] initWithString:self.title + attributes:_titleTextAttributes]; } else { // Otherwise set titleLabel text property _titleLabel.text = self.title; diff --git a/components/NavigationBar/tests/unit/NavigationBarTests.m b/components/NavigationBar/tests/unit/NavigationBarTests.m index 470de77c57b..8a6f8fbf04f 100644 --- a/components/NavigationBar/tests/unit/NavigationBarTests.m +++ b/components/NavigationBar/tests/unit/NavigationBarTests.m @@ -15,8 +15,8 @@ #import #import "MaterialButtonBar.h" -#import "MaterialNavigationBar.h" #import "MaterialNavigationBar+TypographyThemer.h" +#import "MaterialNavigationBar.h" static const CGFloat kEpsilonAccuracy = (CGFloat)0.001; @@ -309,9 +309,9 @@ - (void)testTitleFontProperty { XCTAssertEqualWithAccuracy(resultFont.pointSize, 20, 0.01); // When - NSDictionary *fontTraits = + NSDictionary *fontTraits = [[font fontDescriptor] objectForKey:UIFontDescriptorTraitsAttribute]; - NSDictionary *resultTraits = + NSDictionary *resultTraits = [[resultFont fontDescriptor] objectForKey:UIFontDescriptorTraitsAttribute]; // Then @@ -337,9 +337,9 @@ - (void)testTitleFontPropertyWithAllowAnyTitleFontSizeEnabled { XCTAssertEqualWithAccuracy(resultFont.pointSize, 24, 0.01); // When - NSDictionary *fontTraits = + NSDictionary *fontTraits = [[font fontDescriptor] objectForKey:UIFontDescriptorTraitsAttribute]; - NSDictionary *resultTraits = + NSDictionary *resultTraits = [[resultFont fontDescriptor] objectForKey:UIFontDescriptorTraitsAttribute]; // Then @@ -355,7 +355,7 @@ - (void)testNavigationBarIsNotAccessibilityElement { - (void)testAccessibilityItemsCountWithNoTitle { // Then - const NSInteger elementsCount = 3; // Leading bar, titleLabel, trailing bar + const NSInteger elementsCount = 3; // Leading bar, titleLabel, trailing bar XCTAssertEqual(elementsCount, self.navBar.accessibilityElementCount); } @@ -364,7 +364,7 @@ - (void)testAccessibilityItemsCountWithTitleView { self.navBar.titleView = [[UIView alloc] init]; // Then - const NSInteger elementsCount = 3; // Leading bar, titleView, trailing bar + const NSInteger elementsCount = 3; // Leading bar, titleView, trailing bar XCTAssertEqual(elementsCount, self.navBar.accessibilityElementCount); } @@ -489,7 +489,6 @@ + (CGFloat)weightForFont:(UIFont *)font { } return weight; - } #pragma mark - Color diff --git a/components/NavigationDrawer/src/MDCBottomDrawerPresentationController.m b/components/NavigationDrawer/src/MDCBottomDrawerPresentationController.m index 466289cb364..75a3e66a0bc 100644 --- a/components/NavigationDrawer/src/MDCBottomDrawerPresentationController.m +++ b/components/NavigationDrawer/src/MDCBottomDrawerPresentationController.m @@ -167,7 +167,7 @@ - (void)presentationTransitionWillBegin { - (void)presentationTransitionDidEnd:(BOOL)completed { // Set up the tap recognizer to dimiss the drawer by. UITapGestureRecognizer *tapGestureRecognizer = - [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideDrawer)]; + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideDrawer)]; [self.containerView addGestureRecognizer:tapGestureRecognizer]; tapGestureRecognizer.delegate = self; @@ -206,7 +206,7 @@ - (void)preferredContentSizeDidChangeForChildContentContainer:(id)coordinator { + withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [self.bottomDrawerContainerViewController viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; diff --git a/components/NavigationDrawer/src/private/MDCBottomDrawerContainerViewController.m b/components/NavigationDrawer/src/private/MDCBottomDrawerContainerViewController.m index d5dd51d3f8b..6f8bfaca641 100644 --- a/components/NavigationDrawer/src/private/MDCBottomDrawerContainerViewController.m +++ b/components/NavigationDrawer/src/private/MDCBottomDrawerContainerViewController.m @@ -540,7 +540,8 @@ - (void)setUpContentHeader { } [self addChildViewController:self.headerViewController]; - if ([self.headerViewController respondsToSelector:@selector(updateDrawerHeaderTransitionRatio:)]) { + if ([self.headerViewController + respondsToSelector:@selector(updateDrawerHeaderTransitionRatio:)]) { [self.headerViewController updateDrawerHeaderTransitionRatio:0]; } @@ -597,7 +598,7 @@ - (void)updateContentHeaderWithTransitionToTop:(CGFloat)headerTransitionToTop BOOL contentReachesFullscreen = self.contentReachesFullscreen; if ([self.headerViewController - respondsToSelector:@selector(updateDrawerHeaderTransitionRatio:)]) { + respondsToSelector:@selector(updateDrawerHeaderTransitionRatio:)]) { [self.headerViewController updateDrawerHeaderTransitionRatio:contentReachesFullscreen ? headerTransitionToTop : 0]; } @@ -671,7 +672,8 @@ - (CGFloat)addedContentHeight { return _addedContentHeight; } -- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; _contentHeaderTopInset = NSNotFound; _contentHeightSurplus = NSNotFound; diff --git a/components/NavigationDrawer/tests/unit/MDCNavigationDrawerThemeTest.m b/components/NavigationDrawer/tests/unit/MDCNavigationDrawerThemeTest.m index 47fc01683d5..676184746cd 100644 --- a/components/NavigationDrawer/tests/unit/MDCNavigationDrawerThemeTest.m +++ b/components/NavigationDrawer/tests/unit/MDCNavigationDrawerThemeTest.m @@ -15,8 +15,8 @@ #import #import "MDCNavigationDrawerFakes.h" -#import "MaterialNavigationDrawer.h" #import "MaterialNavigationDrawer+ColorThemer.h" +#import "MaterialNavigationDrawer.h" static const CGFloat kScimAlpha = (CGFloat)0.32; diff --git a/components/PageControl/examples/PageControlAnimationBlockExample.m b/components/PageControl/examples/PageControlAnimationBlockExample.m index 8ed063b5284..7e2a2188d98 100644 --- a/components/PageControl/examples/PageControlAnimationBlockExample.m +++ b/components/PageControl/examples/PageControlAnimationBlockExample.m @@ -192,9 +192,9 @@ - (void)didTapButton:(id)sender { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Page Control", @"Page Control with animation block" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Page Control", @"Page Control with animation block" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/PageControl/examples/PageControlButtonExample.m b/components/PageControl/examples/PageControlButtonExample.m index e75be18ac16..b126b8d63fd 100644 --- a/components/PageControl/examples/PageControlButtonExample.m +++ b/components/PageControl/examples/PageControlButtonExample.m @@ -162,9 +162,9 @@ - (void)didTapButton:(id)sender { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Page Control", @"Page Control with Next Button" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Page Control", @"Page Control with Next Button" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/PageControl/examples/PageControlTypicalUseExample.m b/components/PageControl/examples/PageControlTypicalUseExample.m index 6bb5a6ddbf8..8f27e4fc4a0 100644 --- a/components/PageControl/examples/PageControlTypicalUseExample.m +++ b/components/PageControl/examples/PageControlTypicalUseExample.m @@ -157,11 +157,11 @@ - (void)didChangePage:(MDCPageControl *)sender { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Page Control", @"Page Control" ], - @"description": @"This control is designed to be a drop-in replacement for UIPageControl, " - @"with a user experience influenced by Material Design.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Page Control", @"Page Control" ], + @"description" : @"This control is designed to be a drop-in replacement for UIPageControl, " + @"with a user experience influenced by Material Design.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/PageControl/src/MDCPageControl.m b/components/PageControl/src/MDCPageControl.m index 7d2012679a4..594c3c01b30 100644 --- a/components/PageControl/src/MDCPageControl.m +++ b/components/PageControl/src/MDCPageControl.m @@ -167,13 +167,14 @@ - (void)setCurrentPage:(NSInteger)currentPage // destination. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self->_trackLayer removeTrackTowardsPoint:shouldReverse ? startPoint : endPoint - completion:^{ - // Once track is removed, reveal indicators once - // more to ensure - // no hidden indicators remain. - [self revealIndicatorsReversed:shouldReverse]; - }]; + [self->_trackLayer + removeTrackTowardsPoint:shouldReverse ? startPoint : endPoint + completion:^{ + // Once track is removed, reveal indicators once + // more to ensure + // no hidden indicators remain. + [self revealIndicatorsReversed:shouldReverse]; + }]; [self revealIndicatorsReversed:shouldReverse]; }); }; @@ -211,11 +212,11 @@ - (CGSize)sizeThatFits:(__unused CGSize)size { } + (CGSize)sizeForNumberOfPages:(NSInteger)pageCount { - CGFloat radius = kPageControlIndicatorRadius; - CGFloat margin = kPageControlIndicatorMargin; - CGFloat width = pageCount * ((radius * 2) + margin) - margin; - CGFloat height = MAX(kPageControlMinimumHeight, radius * 2); - return CGSizeMake(width, height); + CGFloat radius = kPageControlIndicatorRadius; + CGFloat margin = kPageControlIndicatorMargin; + CGFloat width = pageCount * ((radius * 2) + margin) - margin; + CGFloat height = MAX(kPageControlMinimumHeight, radius * 2); + return CGSizeMake(width, height); } #pragma mark - Colors @@ -422,8 +423,8 @@ - (BOOL)isAccessibilityElement { } - (NSString *)accessibilityLabel { - return - [[self class] pageControlAccessibilityLabelWithPage:_currentPage + 1 ofPages:_numberOfPages]; + return [[self class] pageControlAccessibilityLabelWithPage:_currentPage + 1 + ofPages:_numberOfPages]; } - (UIAccessibilityTraits)accessibilityTraits { @@ -489,8 +490,8 @@ - (void)resetControl { CGFloat offsetX = i * (margin + (radius * 2)); CGFloat offsetY = radius; CGPoint center = CGPointMake(offsetX + radius, offsetY); - MDCPageControlIndicator *indicator = - [[MDCPageControlIndicator alloc] initWithCenter:center radius:radius]; + MDCPageControlIndicator *indicator = [[MDCPageControlIndicator alloc] initWithCenter:center + radius:radius]; indicator.opacity = kPageControlIndicatorDefaultOpacity; [_containerView.layer addSublayer:indicator]; NSInteger pageNumber = i; @@ -548,7 +549,7 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName { // not be in the main .app bundle, but rather in a nested framework, so figure out where we live // and use that as the search location. NSBundle *bundle = [NSBundle bundleForClass:[MDCPageControl class]]; - NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle)resourcePath]; + NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle) resourcePath]; return [resourcePath stringByAppendingPathComponent:bundleName]; } diff --git a/components/PageControl/tests/unit/PageControlExampleTests.m b/components/PageControl/tests/unit/PageControlExampleTests.m index e30bc564247..126abd47843 100644 --- a/components/PageControl/tests/unit/PageControlExampleTests.m +++ b/components/PageControl/tests/unit/PageControlExampleTests.m @@ -144,8 +144,7 @@ - (void)testResetNumberOfPagesToZero { @try { pageControl.numberOfPages = 0; pageControl.currentPage = 0; - } - @catch (NSException *e) { + } @catch (NSException *e) { exception = e; } @@ -163,8 +162,7 @@ - (void)testScrollViewDidScrollWithZeroPages { // When @try { [pageControl scrollViewDidScroll:scrollView]; - } - @catch (NSException *e) { + } @catch (NSException *e) { exception = e; } diff --git a/components/ProgressView/examples/ProgressViewExample.m b/components/ProgressView/examples/ProgressViewExample.m index 54a9d7d2c7b..5b146f6c226 100644 --- a/components/ProgressView/examples/ProgressViewExample.m +++ b/components/ProgressView/examples/ProgressViewExample.m @@ -121,12 +121,12 @@ - (void)viewDidLoad { self.navigationItem.rightBarButtonItem.accessibilityIdentifier = @"animate_button"; } --(void)viewDidLayoutSubviews { +- (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self positionContainer]; } --(void)setupContainer { +- (void)setupContainer { self.container = [[UIView alloc] initWithFrame:self.view.bounds]; [self.view addSubview:self.container]; } @@ -134,10 +134,10 @@ -(void)setupContainer { - (void)positionContainer { CGFloat originX = CGRectGetMinX(self.view.bounds) + self.view.layoutMargins.left; CGFloat originY = CGRectGetMinY(self.view.bounds) + self.view.layoutMargins.top; - CGFloat width = self.view.bounds.size.width - - (self.view.layoutMargins.left + self.view.layoutMargins.right); - CGFloat height = self.view.bounds.size.height - - (self.view.layoutMargins.top + self.view.layoutMargins.bottom); + CGFloat width = + self.view.bounds.size.width - (self.view.layoutMargins.left + self.view.layoutMargins.right); + CGFloat height = + self.view.bounds.size.height - (self.view.layoutMargins.top + self.view.layoutMargins.bottom); CGRect frame = CGRectMake(originX, originY, width, height); self.container.frame = frame; } @@ -241,10 +241,10 @@ - (void)didPressAnimateButton:(UIButton *)sender { [self animateStep1:_tintedProgressView]; [self animateStep1:_fullyColoredProgressView]; [self animateBackwardProgressResetViewWithCountdown:4]; - [self animateBackwardProgressAnimateViewWithCountdown:4 completion:^(BOOL ignored) { - sender.enabled = YES; - }]; - + [self animateBackwardProgressAnimateViewWithCountdown:4 + completion:^(BOOL ignored) { + sender.enabled = YES; + }]; } - (void)animateStep1:(MDCProgressView *)progressView { @@ -274,9 +274,7 @@ - (void)animateStep3:(MDCProgressView *)progressView { } - (void)animateStep4:(MDCProgressView *)progressView { - [progressView setHidden:YES - animated:YES - completion:nil]; + [progressView setHidden:YES animated:YES completion:nil]; } - (void)animateBackwardProgressResetViewWithCountdown:(NSInteger)remainingCounts { @@ -290,8 +288,8 @@ - (void)animateBackwardProgressResetViewWithCountdown:(NSInteger)remainingCounts dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MDCProgressViewAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [weakSelf animateBackwardProgressResetViewWithCountdown:remainingCounts]; - }); + [weakSelf animateBackwardProgressResetViewWithCountdown:remainingCounts]; + }); } } @@ -307,9 +305,9 @@ - (void)animateBackwardProgressAnimateViewWithCountdown:(NSInteger)remainingCoun dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MDCProgressViewAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [weakSelf animateBackwardProgressAnimateViewWithCountdown:remainingCounts - completion:completion]; - }); + [weakSelf animateBackwardProgressAnimateViewWithCountdown:remainingCounts + completion:completion]; + }); } } @@ -317,11 +315,11 @@ - (void)animateBackwardProgressAnimateViewWithCountdown:(NSInteger)remainingCoun + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Progress View", @"Progress View" ], - @"description": @"Progress indicators display the length of a process or express an " - @"unspecified wait time.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Progress View", @"Progress View" ], + @"description" : @"Progress indicators display the length of a process or express an " + @"unspecified wait time.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/ProgressView/src/MDCProgressView.m b/components/ProgressView/src/MDCProgressView.m index 235e7a717ef..0ddeb434520 100644 --- a/components/ProgressView/src/MDCProgressView.m +++ b/components/ProgressView/src/MDCProgressView.m @@ -189,18 +189,18 @@ - (void)setHidden:(BOOL)hidden } [UIView animateWithDuration:animated ? [[self class] animationDuration] : 0 - delay:0 - options:[[self class] animationOptions] - animations:animations - completion:^(BOOL finished) { - if (hidden) { - self.animatingHide = NO; - self.hidden = YES; - } - if (userCompletion) { - userCompletion(finished); - } - }]; + delay:0 + options:[[self class] animationOptions] + animations:animations + completion:^(BOOL finished) { + if (hidden) { + self.animatingHide = NO; + self.hidden = YES; + } + if (userCompletion) { + userCompletion(finished); + } + }]; } #pragma mark Accessibility diff --git a/components/ProgressView/src/private/MDCProgressViewMotionSpec.m b/components/ProgressView/src/private/MDCProgressViewMotionSpec.m index 8e884441844..18023096d1c 100644 --- a/components/ProgressView/src/private/MDCProgressViewMotionSpec.m +++ b/components/ProgressView/src/private/MDCProgressViewMotionSpec.m @@ -18,15 +18,16 @@ @implementation MDCProgressViewMotionSpec + (MDMMotionTiming)willChangeProgress { return (MDMMotionTiming){ - .duration = 0.250, .curve = MDMMotionCurveMakeBezier(0, 0, 1, 1), + .duration = 0.250, + .curve = MDMMotionCurveMakeBezier(0, 0, 1, 1), }; } + (MDMMotionTiming)willChangeHidden { return (MDMMotionTiming){ - .duration = 0.250, .curve = MDMMotionCurveMakeBezier(0, 0, 1, 1), + .duration = 0.250, + .curve = MDMMotionCurveMakeBezier(0, 0, 1, 1), }; } @end - diff --git a/components/ShadowElevations/examples/ShadowElevationsTypicalUseExample.m b/components/ShadowElevations/examples/ShadowElevationsTypicalUseExample.m index d922a479b12..5ba90ff94f7 100644 --- a/components/ShadowElevations/examples/ShadowElevationsTypicalUseExample.m +++ b/components/ShadowElevations/examples/ShadowElevationsTypicalUseExample.m @@ -46,16 +46,19 @@ - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; - + // Add label - _elevationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kShadowElevationLabelTopOffset, frame.size.width, kShadowElevationLabelHeight)]; + _elevationLabel = + [[UILabel alloc] initWithFrame:CGRectMake(0, kShadowElevationLabelTopOffset, + frame.size.width, kShadowElevationLabelHeight)]; _elevationLabel.textAlignment = NSTextAlignmentCenter; - _elevationLabel.text = [[self class] elevationStringForShadowElevationValue:kShadowElevationsDefault]; + _elevationLabel.text = + [[self class] elevationStringForShadowElevationValue:kShadowElevationsDefault]; [self addSubview:_elevationLabel]; - + // Add slider control MDCSlider *sliderControl = [[MDCSlider alloc] initWithFrame:CGRectZero]; - sliderControl.numberOfDiscreteValues = (NSUInteger) kShadowElevationsMax + 1; + sliderControl.numberOfDiscreteValues = (NSUInteger)kShadowElevationsMax + 1; sliderControl.maximumValue = kShadowElevationsMax; sliderControl.value = kShadowElevationsDefault; sliderControl.delegate = self; @@ -70,29 +73,33 @@ - (id)initWithFrame:(CGRect)frame { toItem:_elevationLabel attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:kShadowElevationsElementSpace].active = YES; + constant:kShadowElevationsElementSpace] + .active = YES; [NSLayoutConstraint constraintWithItem:sliderControl attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 - constant:kShadowElevationsSliderFrameHeight].active = YES; + constant:kShadowElevationsSliderFrameHeight] + .active = YES; [NSLayoutConstraint constraintWithItem:sliderControl attribute:NSLayoutAttributeLeftMargin relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeftMargin multiplier:1.0 - constant:kShadowElevationsSliderFrameMargin].active = YES; + constant:kShadowElevationsSliderFrameMargin] + .active = YES; [NSLayoutConstraint constraintWithItem:sliderControl attribute:NSLayoutAttributeRightMargin relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRightMargin multiplier:1.0 - constant:-kShadowElevationsSliderFrameMargin].active = YES; - + constant:-kShadowElevationsSliderFrameMargin] + .active = YES; + // Add paper _paper = [[ShadowElevationsPointsLabel alloc] initWithFrame:CGRectZero]; _paper.translatesAutoresizingMaskIntoConstraints = NO; @@ -106,36 +113,40 @@ - (id)initWithFrame:(CGRect)frame { toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:_paper attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sliderControl attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:kShadowElevationsElementSpace].active = YES; + constant:kShadowElevationsElementSpace] + .active = YES; [NSLayoutConstraint constraintWithItem:_paper attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationLessThanOrEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:kShadowElevationsPaperBottomMargin].active = YES; + constant:kShadowElevationsPaperBottomMargin] + .active = YES; [NSLayoutConstraint constraintWithItem:_paper attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_paper attribute:NSLayoutAttributeHeight multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:_paper attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 - constant:kShadowElevationsPaperDimRange].active = YES; - + constant:kShadowElevationsPaperDimRange] + .active = YES; } return self; } @@ -158,7 +169,7 @@ - (void)sliderValueChanged:(MDCSlider *)slider { + (NSString *)elevationStringForShadowElevationValue:(MDCShadowElevation)shadowElevationValue { NSString *elevationString = kDefaultShadowElevationLabelString; - + if (MDCCGFloatEqual(shadowElevationValue, MDCShadowElevationNone)) { elevationString = @"MDCShadowElevationNone"; } else if (MDCCGFloatEqual(shadowElevationValue, MDCShadowElevationSwitch)) { @@ -182,7 +193,7 @@ + (NSString *)elevationStringForShadowElevationValue:(MDCShadowElevation)shadowE } else if (MDCCGFloatEqual(shadowElevationValue, MDCShadowElevationDialog)) { elevationString = @"MDCShadowElevationDialog"; } - + return elevationString; } @@ -200,10 +211,10 @@ - (void)viewDidLoad { self.title = @"Shadow Elevations"; _shadowsView = [[ShadowElevationsPointsView alloc] initWithFrame:self.view.bounds]; [self.view addSubview:_shadowsView]; - + if (@available(iOS 11.0, *)) { self.shadowsView.autoresizingMask = - UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } else { _shadowsView.translatesAutoresizingMaskIntoConstraints = NO; [self setupShadowsViewConstraints]; @@ -217,39 +228,44 @@ - (void)setupShadowsViewConstraints { toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:0].active = YES; - + constant:0] + .active = YES; + [NSLayoutConstraint constraintWithItem:self.shadowsView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.0 - constant:0].active = YES; - + constant:0] + .active = YES; + [NSLayoutConstraint constraintWithItem:self.shadowsView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1.0 - constant:0].active = YES; - + constant:0] + .active = YES; + [NSLayoutConstraint constraintWithItem:self.shadowsView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop multiplier:1.0 - constant:0].active = YES; + constant:0] + .active = YES; } - (void)viewSafeAreaInsetsDidChange { [super viewSafeAreaInsetsDidChange]; - CGRect insetedShadowViewFrame = CGRectMake(self.view.bounds.origin.x, - self.view.bounds.origin.y + self.view.safeAreaInsets.top, - self.view.bounds.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, - self.view.bounds.size.height - self.view.safeAreaInsets.top - self.view.safeAreaInsets.bottom); + CGRect insetedShadowViewFrame = CGRectMake( + self.view.bounds.origin.x, self.view.bounds.origin.y + self.view.safeAreaInsets.top, + self.view.bounds.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, + self.view.bounds.size.height - self.view.safeAreaInsets.top - + self.view.safeAreaInsets.bottom); self.shadowsView.frame = insetedShadowViewFrame; } @@ -257,9 +273,9 @@ - (void)viewSafeAreaInsetsDidChange { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Shadow", @"Shadow Elevations" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Shadow", @"Shadow Elevations" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/ShadowLayer/examples/ShadowCornerRadiusExample.m b/components/ShadowLayer/examples/ShadowCornerRadiusExample.m index b2473504140..211dd935fec 100644 --- a/components/ShadowLayer/examples/ShadowCornerRadiusExample.m +++ b/components/ShadowLayer/examples/ShadowCornerRadiusExample.m @@ -53,7 +53,7 @@ - (id)initWithFrame:(CGRect)frame { CGRect sliderRect = CGRectMake(margin, 140, frame.size.width - margin * 2, kShadowElevationsSliderFrameHeight); MDCSlider *sliderControl = [[MDCSlider alloc] initWithFrame:sliderRect]; - sliderControl.numberOfDiscreteValues = (NSUInteger) kShadowElevationsMax + 1; + sliderControl.numberOfDiscreteValues = (NSUInteger)kShadowElevationsMax + 1; sliderControl.maximumValue = kShadowElevationsMax; sliderControl.value = kShadowElevationsDefault; sliderControl.delegate = self; @@ -116,9 +116,9 @@ - (void)viewDidLayoutSubviews { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Shadow", @"Shadow Corner Radius" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Shadow", @"Shadow Corner Radius" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Slider/examples/SliderAutolayoutExampleViewController.m b/components/Slider/examples/SliderAutolayoutExampleViewController.m index 0ab13fd58d5..900b0ea9977 100644 --- a/components/Slider/examples/SliderAutolayoutExampleViewController.m +++ b/components/Slider/examples/SliderAutolayoutExampleViewController.m @@ -14,15 +14,15 @@ #import "SliderAutolayoutExampleViewController.h" -#import "MaterialSlider.h" #import "MaterialSlider+ColorThemer.h" +#import "MaterialSlider.h" @interface SliderAutolayoutExampleViewController () @property(weak, nonatomic) IBOutlet UISlider *vanillaSlider; @property(weak, nonatomic) IBOutlet UISwitch *enabledSwitch; -@property (weak, nonatomic) IBOutlet UILabel *materialLabel; -@property (weak, nonatomic) IBOutlet UILabel *uiLabel; -@property (weak, nonatomic) IBOutlet MDCSlider *materialSlider; +@property(weak, nonatomic) IBOutlet UILabel *materialLabel; +@property(weak, nonatomic) IBOutlet UILabel *uiLabel; +@property(weak, nonatomic) IBOutlet MDCSlider *materialSlider; @end @@ -46,7 +46,7 @@ - (void)viewDidLoad { _vanillaSlider.enabled = _materialSlider.enabled; _enabledSwitch.on = _materialSlider.enabled; _materialSlider.value = _vanillaSlider.value; - + [MDCSliderColorThemer applySemanticColorScheme:self.colorScheme toSlider:self.materialSlider]; _materialLabel.font = self.typographyScheme.body1; @@ -75,10 +75,10 @@ - (IBAction)toggleSwitchesEnabled:(id)sender { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Slider", @"Slider Autolayout" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"SliderAutolayoutExample" + @"breadcrumbs" : @[ @"Slider", @"Slider Autolayout" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"SliderAutolayoutExample" }; } diff --git a/components/Slider/examples/SliderCollectionViewController.m b/components/Slider/examples/SliderCollectionViewController.m index 2b2a83e9f96..05f249364a5 100644 --- a/components/Slider/examples/SliderCollectionViewController.m +++ b/components/Slider/examples/SliderCollectionViewController.m @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "supplemental/SliderCollectionSupplemental.h" #import "MaterialCollections.h" #import "MaterialColorScheme.h" #import "MaterialPalettes.h" -#import "MaterialSlider.h" #import "MaterialSlider+ColorThemer.h" +#import "MaterialSlider.h" #import "MaterialTypographyScheme.h" +#import "supplemental/SliderCollectionSupplemental.h" static NSString *const kReusableIdentifierItem = @"sliderItemCellIdentifier"; static CGFloat const kSliderHorizontalMargin = 16; @@ -73,7 +73,7 @@ - (void)didChangeMDCSliderValue:(MDCSlider *)slider { @end @interface MDCSliderExampleCollectionViewCell : UICollectionViewCell -@property (nonatomic, strong, nullable) UIFont *labelFont; +@property(nonatomic, strong, nullable) UIFont *labelFont; - (void)applyModel:(MDCSliderModel *)model withColorScheme:(MDCSemanticColorScheme *)colorScheme; @end @@ -106,7 +106,7 @@ - (void)applyModel:(MDCSliderModel *)model withColorScheme:(MDCSemanticColorSche _slider.shouldDisplayDiscreteValueLabel = model.discreteValueLabel; _slider.thumbHollowAtStart = model.hollowCircle; _slider.enabled = model.enabled; - + // Don't apply a `nil` color, use the default if (model.sliderColor) { [_slider setTrackFillColor:model.sliderColor forState:UIControlStateNormal]; @@ -117,7 +117,7 @@ - (void)applyModel:(MDCSliderModel *)model withColorScheme:(MDCSemanticColorSche if (model.trackBackgroundColor) { [_slider setTrackBackgroundColor:model.trackBackgroundColor forState:UIControlStateNormal]; } - + if (model.filledTickColor) { [_slider setFilledTrackTickColor:model.filledTickColor forState:UIControlStateNormal]; } @@ -149,8 +149,9 @@ - (void)layoutSubviews { safeArea = self.safeAreaInsets; safeArea.top = 0; } - CGRect labelFrame = CGRectMake(kSliderHorizontalMargin + 6, kSliderVerticalMargin, - self.contentView.frame.size.width - (2 * kSliderHorizontalMargin), 20); + CGRect labelFrame = + CGRectMake(kSliderHorizontalMargin + 6, kSliderVerticalMargin, + self.contentView.frame.size.width - (2 * kSliderHorizontalMargin), 20); _label.frame = UIEdgeInsetsInsetRect(labelFrame, safeArea); @@ -187,7 +188,7 @@ - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { - (void)invalidateLayout { [super invalidateLayout]; - + [self.collectionView setNeedsLayout]; } diff --git a/components/Slider/examples/SliderCompareExampleViewController.m b/components/Slider/examples/SliderCompareExampleViewController.m index 67bae504f98..9bd113108ee 100644 --- a/components/Slider/examples/SliderCompareExampleViewController.m +++ b/components/Slider/examples/SliderCompareExampleViewController.m @@ -16,8 +16,8 @@ #import "MaterialColorScheme.h" #import "MaterialMath.h" -#import "MaterialSlider.h" #import "MaterialSlider+ColorThemer.h" +#import "MaterialSlider.h" #import "MaterialTypographyScheme.h" @interface SliderCompareExampleViewController : UIViewController @@ -50,8 +50,8 @@ - (void)viewDidLoad { self.slider.statefulAPIEnabled = YES; [MDCSliderColorThemer applySemanticColorScheme:self.colorScheme toSlider:self.slider]; [self.slider addTarget:self - action:@selector(didChangeMDCSliderValue:) - forControlEvents:UIControlEventValueChanged]; + action:@selector(didChangeMDCSliderValue:) + forControlEvents:UIControlEventValueChanged]; [self.view addSubview:self.slider]; self.label = [[UILabel alloc] init]; self.label.text = @"MDCSlider"; @@ -63,8 +63,8 @@ - (void)viewDidLoad { // Vanilla UISlider for comparison. self.uiSlider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 100, 27)]; [self.uiSlider addTarget:self - action:@selector(didChangeUISliderValue:) - forControlEvents:UIControlEventValueChanged]; + action:@selector(didChangeUISliderValue:) + forControlEvents:UIControlEventValueChanged]; [self.view addSubview:self.uiSlider]; self.uiSliderLabel = [[UILabel alloc] init]; @@ -77,18 +77,19 @@ - (void)viewDidLoad { - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; - self.slider.center = CGPointMake(CGRectGetMidX(self.view.bounds), - CGRectGetMidY(self.view.bounds) - 50); + self.slider.center = + CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds) - 50); CGFloat labelHeight = CGRectGetHeight(self.label.bounds); self.label.center = CGPointMake(self.slider.center.x, self.slider.center.y + 2 * labelHeight); self.label.frame = MDCRectAlignToScale(self.label.frame, [UIScreen mainScreen].scale); - self.uiSlider.center = CGPointMake(CGRectGetMidX(self.view.bounds), - CGRectGetMidY(self.view.bounds) + 50); + self.uiSlider.center = + CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds) + 50); CGFloat uiLabelHeight = CGRectGetHeight(self.uiSliderLabel.bounds); - self.uiSliderLabel.center = CGPointMake(self.uiSlider.center.x, - self.uiSlider.center.y + 2 * uiLabelHeight); - self.uiSliderLabel.frame = MDCRectAlignToScale(self.uiSliderLabel.frame, [UIScreen mainScreen].scale); + self.uiSliderLabel.center = + CGPointMake(self.uiSlider.center.x, self.uiSlider.center.y + 2 * uiLabelHeight); + self.uiSliderLabel.frame = + MDCRectAlignToScale(self.uiSliderLabel.frame, [UIScreen mainScreen].scale); } - (void)didChangeMDCSliderValue:(MDCSlider *)slider { @@ -103,9 +104,9 @@ - (void)didChangeUISliderValue:(UISlider *)slider { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Slider", @"MDCSlider and UISlider Compared" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Slider", @"MDCSlider and UISlider Compared" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Slider/examples/supplemental/SliderCollectionSupplemental.m b/components/Slider/examples/supplemental/SliderCollectionSupplemental.m index 9f372cf8d52..b295b4f3c90 100644 --- a/components/Slider/examples/supplemental/SliderCollectionSupplemental.m +++ b/components/Slider/examples/supplemental/SliderCollectionSupplemental.m @@ -23,10 +23,10 @@ @implementation SliderCollectionViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Slider", @"Slider" ], - @"description": @"Sliders allow users to make selections from a range of values.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Slider", @"Slider" ], + @"description" : @"Sliders allow users to make selections from a range of values.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/Slider/src/ColorThemer/MDCSliderColorThemer.m b/components/Slider/src/ColorThemer/MDCSliderColorThemer.m index 1131bc42556..1c5741c8ff7 100644 --- a/components/Slider/src/ColorThemer/MDCSliderColorThemer.m +++ b/components/Slider/src/ColorThemer/MDCSliderColorThemer.m @@ -31,7 +31,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme [colorScheme.onSurfaceColor colorWithAlphaComponent:kSliderBaselineDisabledFillAlpha]; UIColor *enabledBackgroundColor = [colorScheme.primaryColor colorWithAlphaComponent:kSliderBaselineEnabledBackgroundAlpha]; - + if (slider.statefulAPIEnabled) { [slider setTrackFillColor:colorScheme.primaryColor forState:UIControlStateNormal]; [slider setTrackFillColor:disabledFillColor forState:UIControlStateDisabled]; @@ -64,8 +64,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme slider.valueLabelBackgroundColor = colorScheme.primaryColor; } -+ (void)applyColorScheme:(id)colorScheme - toSlider:(MDCSlider *)slider { ++ (void)applyColorScheme:(id)colorScheme toSlider:(MDCSlider *)slider { if ([colorScheme respondsToSelector:@selector(primaryLightColor)]) { slider.trackBackgroundColor = colorScheme.primaryLightColor; } diff --git a/components/Slider/src/MDCSlider.m b/components/Slider/src/MDCSlider.m index 36e54bb4262..bb610fde68f 100644 --- a/components/Slider/src/MDCSlider.m +++ b/components/Slider/src/MDCSlider.m @@ -14,10 +14,10 @@ #import "MDCSlider.h" -#import "private/MDCSlider+Private.h" -#import "private/MDCSlider_Subclassable.h" #import "MaterialPalettes.h" #import "MaterialThumbTrack.h" +#import "private/MDCSlider+Private.h" +#import "private/MDCSlider_Subclassable.h" static const CGFloat kSliderDefaultWidth = 100; static const CGFloat kSliderFrameHeight = 27; @@ -59,8 +59,8 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { } - (void)commonMDCSliderInit { - _thumbTrack = - [[MDCThumbTrack alloc] initWithFrame:self.bounds onTintColor:MDCThumbTrackDefaultColor()]; + _thumbTrack = [[MDCThumbTrack alloc] initWithFrame:self.bounds + onTintColor:MDCThumbTrackDefaultColor()]; _thumbTrack.delegate = self; _thumbTrack.disabledTrackHasThumbGaps = YES; _thumbTrack.trackEndsAreInset = YES; @@ -134,7 +134,6 @@ - (UIColor *)trackFillColorForState:(UIControlState)state { return color; } - - (void)setTrackBackgroundColor:(UIColor *)trackBackgroundColor forState:(UIControlState)state { _trackBackgroundColorsForState[@(state)] = trackBackgroundColor; if (state == self.state) { @@ -495,10 +494,10 @@ - (BOOL)accessibilityActivate { newValue = self.value + adjustmentAmount; } [_thumbTrack setValue:newValue - animated:NO - animateThumbAfterMove:NO - userGenerated:YES - completion:NULL]; + animated:NO + animateThumbAfterMove:NO + userGenerated:YES + completion:NULL]; [self sendActionsForControlEvents:UIControlEventValueChanged]; } return YES; @@ -539,7 +538,7 @@ + (UIColor *)defaultDisabledColor { - (void)setTrackBackgroundColor:(UIColor *)trackBackgroundColor { _thumbTrack.trackOffColor = - trackBackgroundColor ? trackBackgroundColor : [[self class] defaultTrackOffColor]; + trackBackgroundColor ? trackBackgroundColor : [[self class] defaultTrackOffColor]; } - (UIColor *)trackBackgroundColor { diff --git a/components/Slider/tests/unit/SliderTests.m b/components/Slider/tests/unit/SliderTests.m index 5b930cb0ef4..cb301079802 100644 --- a/components/Slider/tests/unit/SliderTests.m +++ b/components/Slider/tests/unit/SliderTests.m @@ -16,8 +16,8 @@ #import "MDCSlider+Private.h" #import "MaterialPalettes.h" -#import "MaterialThumbTrack.h" #import "MaterialSlider.h" +#import "MaterialThumbTrack.h" static const int kNumberOfRepeats = 20; static const CGFloat kEpsilonAccuracy = (CGFloat)0.001; @@ -100,7 +100,7 @@ - (void)testSetMaximumToLowerThanValue { // Given self.slider.maximumValue = [self randomNumber]; self.slider.value = self.slider.minimumValue + - [self randomPercent] * (self.slider.maximumValue - self.slider.minimumValue); + [self randomPercent] * (self.slider.maximumValue - self.slider.minimumValue); // When self.slider.maximumValue = self.slider.value - [self randomPercent] * self.slider.value; @@ -113,7 +113,7 @@ - (void)testSetMinimumToHigherThanValue { // Given self.slider.maximumValue = [self randomNumber]; self.slider.value = self.slider.minimumValue + - [self randomPercent] * (self.slider.maximumValue - self.slider.minimumValue); + [self randomPercent] * (self.slider.maximumValue - self.slider.minimumValue); // When self.slider.minimumValue = self.slider.value + [self randomPercent] * self.slider.value; @@ -320,11 +320,10 @@ - (void)testThumbColorForStateDefaults { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state == UIControlStateDisabled) { - XCTAssertEqualObjects([self.slider thumbColorForState:state], - expectedThumbDisabledColor, + XCTAssertEqualObjects([self.slider thumbColorForState:state], expectedThumbDisabledColor, @"(%@) is not equal to (%@) for state (%ld)", [self.slider thumbColorForState:state], expectedThumbDisabledColor, (long)state); @@ -344,7 +343,7 @@ - (void)testThumbColorForStateFallback { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider thumbColorForState:state], UIColor.purpleColor, @"(%@) is not equal to (%@) for state (%ld)", @@ -377,12 +376,12 @@ - (void)testThumbColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = NO; - XCTAssertEqualObjects(self.slider.thumbTrack.thumbDisabledColor, - [self.slider thumbColorForState:UIControlStateDisabled | - UIControlStateSelected]); - XCTAssertNotEqualObjects(self.slider.thumbTrack.thumbEnabledColor, - [self.slider thumbColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.thumbDisabledColor, + [self.slider thumbColorForState:UIControlStateDisabled | UIControlStateSelected]); + XCTAssertNotEqualObjects( + self.slider.thumbTrack.thumbEnabledColor, + [self.slider thumbColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = NO; self.slider.selected = NO; self.slider.highlighted = YES; @@ -393,12 +392,12 @@ - (void)testThumbColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.thumbDisabledColor, - [self.slider thumbColorForState:UIControlStateDisabled | - UIControlStateSelected]); - XCTAssertNotEqualObjects(self.slider.thumbTrack.thumbEnabledColor, - [self.slider thumbColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.thumbDisabledColor, + [self.slider thumbColorForState:UIControlStateDisabled | UIControlStateSelected]); + XCTAssertNotEqualObjects( + self.slider.thumbTrack.thumbEnabledColor, + [self.slider thumbColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = YES; self.slider.selected = NO; self.slider.highlighted = NO; @@ -423,12 +422,12 @@ - (void)testThumbColorForStateAppliesToThumbTrack { self.slider.enabled = YES; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.thumbEnabledColor, - [self.slider thumbColorForState:UIControlStateHighlighted | - UIControlStateSelected]); - XCTAssertNotEqualObjects(self.slider.thumbTrack.thumbDisabledColor, - [self.slider thumbColorForState:UIControlStateHighlighted | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.thumbEnabledColor, + [self.slider thumbColorForState:UIControlStateHighlighted | UIControlStateSelected]); + XCTAssertNotEqualObjects( + self.slider.thumbTrack.thumbDisabledColor, + [self.slider thumbColorForState:UIControlStateHighlighted | UIControlStateSelected]); } - (void)testSettingThumbColorForStateHasNoEffectWhenStatefulAPIDisabled { @@ -453,7 +452,7 @@ - (void)testSettingThumbColorToNilResultsInClearColorOnThumbTrack { // When NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [self.slider setThumbColor:nil forState:state]; } @@ -470,7 +469,7 @@ - (void)testTrackFillColorForStateDefaults { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider trackFillColorForState:state], expectedTrackFillColor, @"(%@) is not equal to (%@) for state (%ld)", @@ -485,11 +484,12 @@ - (void)testTrackFillColorForStateFallback { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider trackFillColorForState:state], UIColor.purpleColor, @"(%@) is not equal to (%@) for state (%ld)", - [self.slider trackFillColorForState:state], UIColor.purpleColor, (long)state); + [self.slider trackFillColorForState:state], UIColor.purpleColor, + (long)state); } } @@ -512,13 +512,13 @@ - (void)testTrackFillColorForStateAppliesToThumbTrack { self.slider.selected = NO; self.slider.highlighted = NO; XCTAssertEqualObjects(self.slider.thumbTrack.trackOnColor, - [self.slider trackFillColorForState:UIControlStateDisabled]); + [self.slider trackFillColorForState:UIControlStateDisabled]); self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = NO; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOnColor, - [self.slider trackFillColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOnColor, + [self.slider trackFillColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = NO; self.slider.selected = NO; self.slider.highlighted = YES; @@ -527,9 +527,9 @@ - (void)testTrackFillColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOnColor, - [self.slider trackFillColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOnColor, + [self.slider trackFillColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = YES; self.slider.selected = NO; self.slider.highlighted = NO; @@ -554,12 +554,12 @@ - (void)testTrackFillColorForStateAppliesToThumbTrack { self.slider.enabled = YES; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOnColor, - [self.slider trackFillColorForState:UIControlStateHighlighted | - UIControlStateSelected]); - XCTAssertNotEqualObjects(self.slider.thumbTrack.trackDisabledColor, - [self.slider trackFillColorForState:UIControlStateHighlighted | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOnColor, + [self.slider trackFillColorForState:UIControlStateHighlighted | UIControlStateSelected]); + XCTAssertNotEqualObjects( + self.slider.thumbTrack.trackDisabledColor, + [self.slider trackFillColorForState:UIControlStateHighlighted | UIControlStateSelected]); } - (void)testSettingTrackFillColorForStateHasNoEffectWhenStatefulAPIDisabled { @@ -584,7 +584,7 @@ - (void)testSettingTrackFillColorToNilResultsInClearColorOnThumbTrack { // When NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { [self.slider setTrackFillColor:nil forState:state]; } @@ -604,7 +604,7 @@ - (void)testTrackBackgroundColorForStateDefaults { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { if (state == UIControlStateDisabled) { XCTAssertEqualObjects([self.slider trackBackgroundColorForState:state], @@ -626,7 +626,7 @@ - (void)testTrackBackgroundColorForStateFallback { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider trackBackgroundColorForState:state], UIColor.purpleColor, @"(%@) is not equal to (%@) for state (%ld)", @@ -658,9 +658,9 @@ - (void)testTrackBackgroundColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = NO; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOffColor, - [self.slider trackBackgroundColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOffColor, + [self.slider trackBackgroundColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = NO; self.slider.selected = NO; self.slider.highlighted = YES; @@ -669,9 +669,9 @@ - (void)testTrackBackgroundColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOffColor, - [self.slider trackBackgroundColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOffColor, + [self.slider trackBackgroundColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = YES; self.slider.selected = NO; self.slider.highlighted = NO; @@ -692,7 +692,7 @@ - (void)testTrackBackgroundColorForStateAppliesToThumbTrack { self.slider.highlighted = YES; XCTAssertEqualObjects(self.slider.thumbTrack.trackOffColor, [self.slider trackBackgroundColorForState:UIControlStateHighlighted | - UIControlStateSelected]); + UIControlStateSelected]); } - (void)testSettingTrackBackgroundColorForStateHasNoEffectWhenStatefulAPIDisabled { @@ -718,10 +718,9 @@ - (void)testSettingTrackBackgroundColorForStateHasNoEffectWhenStatefulAPIDisable - (void)testFilledTrackTickColorForStateDefaults { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { - XCTAssertEqualObjects([self.slider filledTrackTickColorForState:state], - UIColor.blackColor); + XCTAssertEqualObjects([self.slider filledTrackTickColorForState:state], UIColor.blackColor); } } @@ -731,7 +730,7 @@ - (void)testFilledTrackTickColorForStateFallback { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider filledTrackTickColorForState:state], UIColor.orangeColor, @"(%@) is not equal to (%@) for state (%ld)", @@ -763,9 +762,9 @@ - (void)testFilledTrackTickColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = NO; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOnTickColor, - [self.slider filledTrackTickColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOnTickColor, + [self.slider filledTrackTickColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = NO; self.slider.selected = NO; self.slider.highlighted = YES; @@ -774,9 +773,9 @@ - (void)testFilledTrackTickColorForStateAppliesToThumbTrack { self.slider.enabled = NO; self.slider.selected = YES; self.slider.highlighted = YES; - XCTAssertEqualObjects(self.slider.thumbTrack.trackOnTickColor, - [self.slider filledTrackTickColorForState:UIControlStateDisabled | - UIControlStateSelected]); + XCTAssertEqualObjects( + self.slider.thumbTrack.trackOnTickColor, + [self.slider filledTrackTickColorForState:UIControlStateDisabled | UIControlStateSelected]); self.slider.enabled = YES; self.slider.selected = NO; self.slider.highlighted = NO; @@ -797,7 +796,7 @@ - (void)testFilledTrackTickColorForStateAppliesToThumbTrack { self.slider.highlighted = YES; XCTAssertEqualObjects(self.slider.thumbTrack.trackOnTickColor, [self.slider filledTrackTickColorForState:UIControlStateHighlighted | - UIControlStateSelected]); + UIControlStateSelected]); } #pragma mark - backgroundTrackTickColorForState @@ -805,10 +804,9 @@ - (void)testFilledTrackTickColorForStateAppliesToThumbTrack { - (void)testBackgroundTrackTickColorForStateDefaults { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { - XCTAssertEqualObjects([self.slider backgroundTrackTickColorForState:state], - UIColor.blackColor); + XCTAssertEqualObjects([self.slider backgroundTrackTickColorForState:state], UIColor.blackColor); } } @@ -818,7 +816,7 @@ - (void)testBackgroundTrackTickColorForStateFallback { // Then NSUInteger maximumStateValue = UIControlStateNormal | UIControlStateSelected | - UIControlStateHighlighted | UIControlStateDisabled; + UIControlStateHighlighted | UIControlStateDisabled; for (NSUInteger state = 0; state <= maximumStateValue; ++state) { XCTAssertEqualObjects([self.slider backgroundTrackTickColorForState:state], UIColor.orangeColor, @"(%@) is not equal to (%@) for state (%ld)", @@ -852,7 +850,7 @@ - (void)testBackgroundTrackTickColorForStateAppliesToThumbTrack { self.slider.highlighted = NO; XCTAssertEqualObjects(self.slider.thumbTrack.trackOffTickColor, [self.slider backgroundTrackTickColorForState:UIControlStateDisabled | - UIControlStateSelected]); + UIControlStateSelected]); self.slider.enabled = NO; self.slider.selected = NO; self.slider.highlighted = YES; @@ -863,7 +861,7 @@ - (void)testBackgroundTrackTickColorForStateAppliesToThumbTrack { self.slider.highlighted = YES; XCTAssertEqualObjects(self.slider.thumbTrack.trackOffTickColor, [self.slider backgroundTrackTickColorForState:UIControlStateDisabled | - UIControlStateSelected]); + UIControlStateSelected]); self.slider.enabled = YES; self.slider.selected = NO; self.slider.highlighted = NO; @@ -884,7 +882,7 @@ - (void)testBackgroundTrackTickColorForStateAppliesToThumbTrack { self.slider.highlighted = YES; XCTAssertEqualObjects(self.slider.thumbTrack.trackOffTickColor, [self.slider backgroundTrackTickColorForState:UIControlStateHighlighted | - UIControlStateSelected]); + UIControlStateSelected]); } #pragma mark - InkColor @@ -990,7 +988,8 @@ - (void)testValueLabelBackgroundColorNullResettable { // This test is flaky. /* Test Case '-[SliderTests testAccessibilityValue]' started. - components/Slider/tests/unit/SliderTests.m:1000: error: -[SliderTests testAccessibilityValue] : (([self.slider accessibilityValue]) equal to (expected)) failed: ("30%") is not equal to ("29%") + components/Slider/tests/unit/SliderTests.m:1000: error: -[SliderTests testAccessibilityValue] : + (([self.slider accessibilityValue]) equal to (expected)) failed: ("30%") is not equal to ("29%") Test Case '-[SliderTests testAccessibilityValue]' failed (0.002 seconds). */ - (void)disabled_testAccessibilityValue { @@ -1020,7 +1019,7 @@ - (void)testAccessibilityValueWithLargerMax { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; numberFormatter.numberStyle = NSNumberFormatterPercentStyle; CGFloat percent = (self.slider.value - self.slider.minimumValue) / - (self.slider.maximumValue - self.slider.minimumValue); + (self.slider.maximumValue - self.slider.minimumValue); NSString *expected = [numberFormatter stringFromNumber:[NSNumber numberWithFloat:(float)percent]]; XCTAssertEqualObjects([self.slider accessibilityValue], expected); } @@ -1096,7 +1095,7 @@ - (void)testAccessibilityIncrementDiscreteSlider { // Then CGFloat stepValue = (self.slider.maximumValue - self.slider.minimumValue) / - (self.slider.numberOfDiscreteValues - 1); + (self.slider.numberOfDiscreteValues - 1); CGFloat expectedValue = self.slider.minimumValue + stepValue; XCTAssertEqualWithAccuracy(self.slider.value, expectedValue, kEpsilonAccuracy, @"A slider with (%lu) discrete values should have step of '%.3f'.", diff --git a/components/Snackbar/examples/SnackbarInputAccessoryViewController.m b/components/Snackbar/examples/SnackbarInputAccessoryViewController.m index daa993f2864..b74e272b788 100644 --- a/components/Snackbar/examples/SnackbarInputAccessoryViewController.m +++ b/components/Snackbar/examples/SnackbarInputAccessoryViewController.m @@ -30,29 +30,20 @@ - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = UIColor.whiteColor; UIToolbar *toolbar = - [[UIToolbar alloc] initWithFrame:CGRectMake(0, - 0, - UIScreen.mainScreen.bounds.size.width, - 50)]; + [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, 50)]; UIButton *button = - [[UIButton alloc] initWithFrame:CGRectMake(0, - 0, - UIScreen.mainScreen.bounds.size.width, - 50)]; + [[UIButton alloc] initWithFrame:CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, 50)]; button.contentMode = UIViewContentModeCenter; [button setTitle:@"Show Snackbar" forState:UIControlStateNormal]; [button setTitleColor:UIColor.darkTextColor forState:UIControlStateNormal]; [button addTarget:self - action:@selector(handleSend:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(handleSend:) + forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; - toolbar.items = @[buttonItem]; + toolbar.items = @[ buttonItem ]; - _textField = - [[UITextField alloc] initWithFrame:CGRectMake(0, - 0, - UIScreen.mainScreen.bounds.size.width, - 50)]; + _textField = [[UITextField alloc] + initWithFrame:CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, 50)]; _textField.inputAccessoryView = toolbar; _textField.backgroundColor = UIColor.whiteColor; _textField.text = @"Tap Me"; diff --git a/components/Snackbar/examples/SnackbarOverlayViewExample.m b/components/Snackbar/examples/SnackbarOverlayViewExample.m index afa8f8835d6..7c07247148a 100644 --- a/components/Snackbar/examples/SnackbarOverlayViewExample.m +++ b/components/Snackbar/examples/SnackbarOverlayViewExample.m @@ -46,10 +46,10 @@ - (void)viewDidLoad { _legacyMode = YES; self.navigationItem.rightBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:@"Legacy" - style:UIBarButtonItemStylePlain - target:self - action:@selector(toggleModes)]; + [[UIBarButtonItem alloc] initWithTitle:@"Legacy" + style:UIBarButtonItemStylePlain + target:self + action:@selector(toggleModes)]; self.floatingButton = [[MDCFloatingButton alloc] init]; [self.floatingButton sizeToFit]; diff --git a/components/Snackbar/examples/SnackbarSimpleExample.m b/components/Snackbar/examples/SnackbarSimpleExample.m index 7234b4ba972..10d16e23f7c 100644 --- a/components/Snackbar/examples/SnackbarSimpleExample.m +++ b/components/Snackbar/examples/SnackbarSimpleExample.m @@ -35,26 +35,23 @@ - (void)viewDidLoad { [[MDCTypographyScheme alloc] initWithDefaults:MDCTypographySchemeDefaultsMaterial201804]; } [self setupExampleViews:@[ - @"Simple Snackbar", - @"Snackbar with Action Button", - @"Snackbar with Long Text", - @"Attributed Text Example", - @"Color Themed Snackbar", - @"Customize Font Example", - @"De-Customize Example" + @"Simple Snackbar", @"Snackbar with Action Button", @"Snackbar with Long Text", + @"Attributed Text Example", @"Color Themed Snackbar", @"Customize Font Example", + @"De-Customize Example" ]]; self.title = @"Snackbar"; _legacyMode = YES; _dynamicType = NO; - self.navigationItem.rightBarButtonItems = - @[[[UIBarButtonItem alloc] initWithTitle:@"Legacy" - style:UIBarButtonItemStylePlain - target:self - action:@selector(toggleModes)], - [[UIBarButtonItem alloc] initWithTitle:@"DT Off" - style:UIBarButtonItemStylePlain - target:self - action:@selector(toggleDynamicType)]]; + self.navigationItem.rightBarButtonItems = @[ + [[UIBarButtonItem alloc] initWithTitle:@"Legacy" + style:UIBarButtonItemStylePlain + target:self + action:@selector(toggleModes)], + [[UIBarButtonItem alloc] initWithTitle:@"DT Off" + style:UIBarButtonItemStylePlain + target:self + action:@selector(toggleDynamicType)] + ]; MDCSnackbarManager.delegate = self; } @@ -95,7 +92,6 @@ - (void)showSnackbarWithAction:(id)sender { [MDCSnackbarManager showMessage:message]; } - - (void)showLongSnackbarMessage:(id)sender { MDCSnackbarMessage *message = [[MDCSnackbarMessage alloc] init]; message.text = @"A red flair silhouetted the jagged edge of a sublime wing."; @@ -112,17 +108,14 @@ - (void)showLongSnackbarMessage:(id)sender { [MDCSnackbarManager showMessage:message]; } - - (void)showBoldSnackbar:(id)sender { MDCSnackbarMessage *message = [[MDCSnackbarMessage alloc] init]; NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init]; [text appendAttributedString:[[NSAttributedString alloc] - initWithString:@"Boldly" - attributes:@{ - MDCSnackbarMessageBoldAttributeName : @YES - }]]; + initWithString:@"Boldly" + attributes:@{MDCSnackbarMessageBoldAttributeName : @YES}]]; [text appendAttributedString:[[NSAttributedString alloc] - initWithString:@" go where no one has gone before."]]; + initWithString:@" go where no one has gone before."]]; message.attributedText = text; [MDCSnackbarManager showMessage:message]; @@ -178,7 +171,8 @@ - (void)showDecustomizedSnackbar:(id)sender { #pragma mark - UICollectionView -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)collectionView:(UICollectionView *)collectionView + didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; switch (indexPath.row) { case 0: diff --git a/components/Snackbar/examples/SnackbarSuspensionExample.m b/components/Snackbar/examples/SnackbarSuspensionExample.m index 4586dca0463..ead96049db1 100644 --- a/components/Snackbar/examples/SnackbarSuspensionExample.m +++ b/components/Snackbar/examples/SnackbarSuspensionExample.m @@ -47,12 +47,9 @@ - (void)viewDidLoad { [[MDCTypographyScheme alloc] initWithDefaults:MDCTypographySchemeDefaultsMaterial201804]; } [self setupExampleViews:@[ - @"Show Category A Message", - @"Show Category B Message", - @"Show Message with no category", - @"Suspend Category A", - @"Suspend Category B", - @"Suspend All"]]; + @"Show Category A Message", @"Show Category B Message", @"Show Message with no category", + @"Suspend Category A", @"Suspend Category B", @"Suspend All" + ]]; self.title = @"Message Suspension"; } @@ -62,9 +59,7 @@ - (void)showMessageWithPrefix:(NSString *)prefix category:(NSString *)category { NSString *formattedPrefix = [NSString stringWithFormat:@"%@ : ", prefix]; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:formattedPrefix - attributes:@{ - MDCSnackbarMessageBoldAttributeName : @YES - }]; + attributes:@{MDCSnackbarMessageBoldAttributeName : @YES}]; [attributedMessage appendAttributedString:attributedString]; NSAttributedString *attributedStringID = @@ -106,7 +101,8 @@ - (void)setSuspendedAllMessages:(BOOL)suspended { #pragma mark - Event Handling -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)collectionView:(UICollectionView *)collectionView + didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; switch (indexPath.row) { case 0: diff --git a/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m b/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m index bdba62741cf..a5362c7eea9 100644 --- a/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m +++ b/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m @@ -16,7 +16,7 @@ #import "MaterialSnackbar+ColorThemer.h" #import "MaterialSnackbar+TypographyThemer.h" -static NSString * const kCellIdentifier = @"Cell"; +static NSString *const kCellIdentifier = @"Cell"; @implementation SnackbarExample @@ -36,7 +36,6 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView return self.choices.count; } - - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MDCCollectionViewTextCell *cell = @@ -56,11 +55,11 @@ @implementation SnackbarSimpleExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Snackbar", @"Snackbar" ], - @"description": @"Snackbars provide brief messages about app processes at the bottom of " - @"the screen.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Snackbar", @"Snackbar" ], + @"description" : @"Snackbars provide brief messages about app processes at the bottom of " + @"the screen.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } @@ -70,9 +69,9 @@ @implementation SnackbarOverlayViewExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Snackbar", @"Snackbar Overlay View" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Snackbar", @"Snackbar Overlay View" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } @@ -82,9 +81,9 @@ @implementation SnackbarInputAccessoryViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Snackbar", @"Snackbar Input Accessory" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Snackbar", @"Snackbar Input Accessory" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -95,8 +94,8 @@ @implementation SnackbarSuspensionExample (CollectionView) - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MDCCollectionViewTextCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:kCellIdentifier - forIndexPath:indexPath]; + [collectionView dequeueReusableCellWithReuseIdentifier:kCellIdentifier + forIndexPath:indexPath]; cell.textLabel.text = self.choices[indexPath.row]; cell.isAccessibilityElement = YES; @@ -124,9 +123,9 @@ @implementation SnackbarSuspensionExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Snackbar", @"Snackbar Suspension" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Snackbar", @"Snackbar Suspension" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/Snackbar/src/ColorThemer/MDCSnackbarColorThemer.m b/components/Snackbar/src/ColorThemer/MDCSnackbarColorThemer.m index b8d151d4044..7954aa6f221 100644 --- a/components/Snackbar/src/ColorThemer/MDCSnackbarColorThemer.m +++ b/components/Snackbar/src/ColorThemer/MDCSnackbarColorThemer.m @@ -35,7 +35,7 @@ + (void)applySemanticColorScheme:(id)colorScheme #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" + (void)applyColorScheme:(nonnull id)colorScheme - toSnackbarMessageView:(nonnull MDCSnackbarMessageView *)snackbarMessageView { + toSnackbarMessageView:(nonnull MDCSnackbarMessageView *)snackbarMessageView { } #pragma clang diagnostic pop diff --git a/components/Snackbar/src/MDCSnackbarManager.m b/components/Snackbar/src/MDCSnackbarManager.m index 2fac33e851b..83e899ae824 100644 --- a/components/Snackbar/src/MDCSnackbarManager.m +++ b/components/Snackbar/src/MDCSnackbarManager.m @@ -281,11 +281,11 @@ - (void)hideSnackbarViewReally:(MDCSnackbarMessageView *)snackbarView MDCSnackbarMessage *message = snackbarView.message; // Fire off the button action, if necessary. Always call the message's completion handler. - [message - executeActionHandler:action - completion:^{ - [message executeCompletionHandlerWithUserInteraction:userPrompted completion:nil]; - }]; + [message executeActionHandler:action + completion:^{ + [message executeCompletionHandlerWithUserInteraction:userPrompted + completion:nil]; + }]; [self.overlayView dismissSnackbarViewAnimated:YES completion:^{ @@ -434,18 +434,16 @@ - (void)dismissAndCallCompletionBlocksOnMainThreadWithCategory:(NSString *)categ // through pending messages and fire off their completion blocks as we remove them from the // queue. NSMutableIndexSet *indexesToRemove = [NSMutableIndexSet indexSet]; - [self.pendingMessages - enumerateObjectsUsingBlock:^(MDCSnackbarMessage *pendingMessage, - NSUInteger idx, - __unused BOOL *stop) { - if (!categoryToDismiss || [pendingMessage.category isEqualToString:categoryToDismiss]) { - // Mark the message for removal from the pending messages list. - [indexesToRemove addIndex:idx]; - - // Notify the outside world that this Snackbar has been completed. - [pendingMessage executeCompletionHandlerWithUserInteraction:NO completion:nil]; - } - }]; + [self.pendingMessages enumerateObjectsUsingBlock:^(MDCSnackbarMessage *pendingMessage, + NSUInteger idx, __unused BOOL *stop) { + if (!categoryToDismiss || [pendingMessage.category isEqualToString:categoryToDismiss]) { + // Mark the message for removal from the pending messages list. + [indexesToRemove addIndex:idx]; + + // Notify the outside world that this Snackbar has been completed. + [pendingMessage executeCompletionHandlerWithUserInteraction:NO completion:nil]; + } + }]; // Make sure the queued up messages aren't shown. if ([indexesToRemove count]) { @@ -525,7 +523,6 @@ @implementation MDCSnackbarManager { BOOL _shouldApplyStyleChangesToVisibleSnackbars; } - + (instancetype)defaultManager { static MDCSnackbarManager *defaultManager; static dispatch_once_t onceToken; @@ -810,16 +807,16 @@ + (void)setBottomOffset:(CGFloat)offset { [MDCSnackbarManager.defaultManager setBottomOffset:offset]; } -+ (nullable id )suspendAllMessages { ++ (nullable id)suspendAllMessages { return MDCSnackbarManager.defaultManager.suspendAllMessages; } -+ (nullable id ) - suspendMessagesWithCategory:(nullable NSString *)category { ++ (nullable id)suspendMessagesWithCategory: + (nullable NSString *)category { return [MDCSnackbarManager.defaultManager suspendMessagesWithCategory:category]; } -+ (void)resumeMessagesWithToken:(nullable id )token { ++ (void)resumeMessagesWithToken:(nullable id)token { [MDCSnackbarManager.defaultManager resumeMessagesWithToken:token]; } @@ -868,8 +865,8 @@ + (BOOL)shouldApplyStyleChangesToVisibleSnackbars { return MDCSnackbarManager.defaultManager.shouldApplyStyleChangesToVisibleSnackbars; } -+ (void)setShouldApplyStyleChangesToVisibleSnackbars:(BOOL)shouldApplyStyleChangesToVisibleSnackbars - { ++ (void)setShouldApplyStyleChangesToVisibleSnackbars: + (BOOL)shouldApplyStyleChangesToVisibleSnackbars { MDCSnackbarManager.defaultManager.shouldApplyStyleChangesToVisibleSnackbars = shouldApplyStyleChangesToVisibleSnackbars; } diff --git a/components/Snackbar/src/MDCSnackbarMessageView.m b/components/Snackbar/src/MDCSnackbarMessageView.m index cd9b3523601..4c3cf7a6281 100644 --- a/components/Snackbar/src/MDCSnackbarMessageView.m +++ b/components/Snackbar/src/MDCSnackbarMessageView.m @@ -20,10 +20,10 @@ #import "MaterialAnimationTiming.h" #import "MaterialTypography.h" -#import "private/MaterialSnackbarStrings.h" -#import "private/MaterialSnackbarStrings_table.h" #import "private/MDCSnackbarMessageViewInternal.h" #import "private/MDCSnackbarOverlayView.h" +#import "private/MaterialSnackbarStrings.h" +#import "private/MaterialSnackbarStrings_table.h" NSString *const MDCSnackbarMessageTitleAutomationIdentifier = @"MDCSnackbarMessageTitleAutomationIdentifier"; @@ -183,18 +183,14 @@ - (instancetype)initWithFrame:(CGRect)frame { self.titleLabel.numberOfLines = 1; self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; - self.contentEdgeInsets = UIEdgeInsetsMake(buttonContentPadding, - buttonContentPadding, - buttonContentPadding, - buttonContentPadding); + self.contentEdgeInsets = UIEdgeInsetsMake(buttonContentPadding, buttonContentPadding, + buttonContentPadding, buttonContentPadding); // Make sure the button doesn't get too compressed. [self setContentCompressionResistancePriority:UILayoutPriorityRequired - forAxis:UILayoutConstraintAxisHorizontal]; + forAxis:UILayoutConstraintAxisHorizontal]; [self setContentHuggingPriority:UILayoutPriorityDefaultHigh - forAxis:UILayoutConstraintAxisHorizontal]; - - + forAxis:UILayoutConstraintAxisHorizontal]; } return self; } @@ -225,21 +221,17 @@ - (instancetype)initWithMessage:(MDCSnackbarMessage *)message self = [super initWithFrame:CGRectZero]; if (self) { - _snackbarMessageViewShadowColor = - manager.snackbarMessageViewShadowColor ?: UIColor.blackColor; + _snackbarMessageViewShadowColor = manager.snackbarMessageViewShadowColor ?: UIColor.blackColor; _snackbarMessageViewBackgroundColor = manager.snackbarMessageViewBackgroundColor ?: MDCRGBAColor(0x32, 0x32, 0x32, 1); - _messageTextColor = - manager.messageTextColor ?: UIColor.whiteColor; + _messageTextColor = manager.messageTextColor ?: UIColor.whiteColor; _buttonTitleColors = [NSMutableDictionary dictionary]; _buttonTitleColors[@(UIControlStateNormal)] = [manager buttonTitleColorForState:UIControlStateNormal] ?: MDCRGBAColor(0xFF, 0xFF, 0xFF, (float)0.6); _buttonTitleColors[@(UIControlStateHighlighted)] = - [manager buttonTitleColorForState:UIControlStateHighlighted] ?: - UIColor.whiteColor; - _mdc_adjustsFontForContentSizeCategory = - manager.mdc_adjustsFontForContentSizeCategory; + [manager buttonTitleColorForState:UIControlStateHighlighted] ?: UIColor.whiteColor; + _mdc_adjustsFontForContentSizeCategory = manager.mdc_adjustsFontForContentSizeCategory; _messageFont = manager.messageFont; _buttonFont = manager.buttonFont; _message = message; @@ -314,8 +306,8 @@ - (instancetype)initWithMessage:(MDCSnackbarMessage *)message if (!_messageFont && !_mdc_adjustsFontForContentSizeCategory) { // Find any of the bold attributes in the string, and set the proper font for those ranges. - // Use NSAttributedStringEnumerationLongestEffectiveRangeNotRequired as opposed to 0, otherwise - // it will only work if bold text is in the end. + // Use NSAttributedStringEnumerationLongestEffectiveRangeNotRequired as opposed to 0, + // otherwise it will only work if bold text is in the end. [messageString enumerateAttribute:MDCSnackbarMessageBoldAttributeName inRange:NSMakeRange(0, messageString.length) @@ -325,7 +317,7 @@ - (instancetype)initWithMessage:(MDCSnackbarMessage *)message if ([value boolValue]) { font = [MDCTypography body2Font]; } - [messageString setAttributes:@{ NSFontAttributeName : font } range:range]; + [messageString setAttributes:@{NSFontAttributeName : font} range:range]; }]; } @@ -343,11 +335,9 @@ - (instancetype)initWithMessage:(MDCSnackbarMessage *)message NSString *accessibilityHintKey = kMaterialSnackbarStringTable[kStr_MaterialSnackbarMessageViewTitleA11yHint]; - NSString *accessibilityHint = - NSLocalizedStringFromTableInBundle(accessibilityHintKey, - kMaterialSnackbarStringsTableName, - [[self class] bundle], - @"Dismissal accessibility hint for Snackbar"); + NSString *accessibilityHint = NSLocalizedStringFromTableInBundle( + accessibilityHintKey, kMaterialSnackbarStringsTableName, [[self class] bundle], + @"Dismissal accessibility hint for Snackbar"); // For UIAccessibility purposes, the label is the primary 'button' for dismissing the Snackbar, // so we'll make sure the label is treated like a button. @@ -406,8 +396,8 @@ - (void)initializeMDCSnackbarMessageViewButtons:(MDCSnackbarMessage *)message { [button setTitle:message.action.title forState:UIControlStateHighlighted]; [button addTarget:self - action:@selector(handleButtonTapped:) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(handleButtonTapped:) + forControlEvents:UIControlEventTouchUpInside]; [actions addObject:buttonView]; } @@ -482,7 +472,7 @@ - (void)setButtonTitleColor:(nullable UIColor *)buttonTitleColor forState:(UICon } else { // Set to default UIColor *defaultButtonTitleColor; - switch(state) { + switch (state) { case UIControlStateHighlighted: defaultButtonTitleColor = UIColor.whiteColor; break; @@ -494,7 +484,6 @@ - (void)setButtonTitleColor:(nullable UIColor *)buttonTitleColor forState:(UICon [button setTitleColor:defaultButtonTitleColor forState:state]; } } - } - (void)addColorToMessageLabel:(UIColor *)color { @@ -539,9 +528,9 @@ - (void)updateMessageFont { } else { // There is a custom font loader, retrieve the font and scale it. UIFont *customTypographyFont = [MDCTypography body1Font]; - _label.font = - [customTypographyFont mdc_fontSizedForMaterialTextStyle:kMessageTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + _label.font = [customTypographyFont + mdc_fontSizedForMaterialTextStyle:kMessageTextStyle + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } } else { // If we are using the default (system) font loader, retrieve the @@ -592,9 +581,9 @@ - (void)updateButtonFont { } else { // There is a custom font loader, retrieve the font and scale it. UIFont *customTypographyFont = [MDCTypography buttonFont]; - finalButtonFont = - [customTypographyFont mdc_fontSizedForMaterialTextStyle:kButtonTextStyle - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + finalButtonFont = [customTypographyFont + mdc_fontSizedForMaterialTextStyle:kButtonTextStyle + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } } else { // If we are using the default (system) font loader, retrieve the @@ -663,8 +652,8 @@ - (NSArray *)containerViewConstraints { @"kTitleImagePadding" : @(kTitleImagePadding), @"kTopMargin" : @(self.safeContentMargin.top), @"kTitleButtonPadding" : @(kTitleButtonPadding), - @"kContentSafeBottomInset" : @(kBorderWidth + self.contentSafeBottomInset), - @"kMinVerticalButtonPadding": @(kMinVerticalButtonPadding), + @"kContentSafeBottomInset" : @(kBorderWidth + self.contentSafeBottomInset), + @"kMinVerticalButtonPadding" : @(kMinVerticalButtonPadding), }; NSDictionary *views = @{ @"container" : self.containerView, @@ -730,11 +719,11 @@ - (NSArray *)containerViewConstraints { } else { // This is a horizontal layout, and there are buttons present. // Align the content and buttons horizontally. formatString = @"H:[content]-(==kTitleButtonPadding)-[buttons]-(==kRightMargin)-|"; - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:formatString - options:NSLayoutFormatAlignAllCenterY - metrics:metrics - views:views]]; + [constraints addObjectsFromArray:[NSLayoutConstraint + constraintsWithVisualFormat:formatString + options:NSLayoutFormatAlignAllCenterY + metrics:metrics + views:views]]; if (MDCSnackbarMessage.usesLegacySnackbar) { // The buttons should take up the entire height of the container view. @@ -745,11 +734,11 @@ - (NSArray *)containerViewConstraints { views:views]]; } else { formatString = @"V:|-(>=kMinVerticalButtonPadding)-[buttons]-(>=kMinVerticalButtonPadding)-|"; - [constraints addObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:formatString - options:NSLayoutFormatAlignAllCenterY - metrics:metrics - views:views]]; + [constraints addObjectsFromArray:[NSLayoutConstraint + constraintsWithVisualFormat:formatString + options:NSLayoutFormatAlignAllCenterY + metrics:metrics + views:views]]; } // Pin the content to the bottom of the container view, since there's nothing below. @@ -915,9 +904,10 @@ - (void)layoutSubviews { [super layoutSubviews]; // As our layout changes, make sure that the shadow path is kept up-to-date. - UIBezierPath *path = - [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius: - MDCSnackbarMessage.usesLegacySnackbar ? kLegacyCornerRadius : kCornerRadius]; + UIBezierPath *path = [UIBezierPath + bezierPathWithRoundedRect:self.bounds + cornerRadius:MDCSnackbarMessage.usesLegacySnackbar ? kLegacyCornerRadius + : kCornerRadius]; self.layer.shadowPath = path.CGPath; } @@ -940,9 +930,9 @@ - (CGSize)intrinsicContentSize { } - (CGFloat)contentSafeBottomInset { - // If a bottom offset has been set to raise the HUD/Snackbar, e.g. above a tab bar, we should ignore - // any safeAreaInsets, since it is no longer 'anchored' to the bottom of the screen. This is set - // by the MDCSnackbarOverlayView whenever the bottomOffset is non-zero. + // If a bottom offset has been set to raise the HUD/Snackbar, e.g. above a tab bar, we should + // ignore any safeAreaInsets, since it is no longer 'anchored' to the bottom of the screen. This + // is set by the MDCSnackbarOverlayView whenever the bottomOffset is non-zero. if (!self.anchoredToScreenBottom || !MDCSnackbarMessage.usesLegacySnackbar) { return 0; } @@ -1059,16 +1049,14 @@ - (void)animateContentOpacityFrom:(CGFloat)fromOpacity [CATransaction commit]; } -- (CABasicAnimation *)animateSnackbarOpacityFrom:(CGFloat)fromOpacity - to:(CGFloat)toOpacity { +- (CABasicAnimation *)animateSnackbarOpacityFrom:(CGFloat)fromOpacity to:(CGFloat)toOpacity { CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; opacityAnimation.fromValue = @(fromOpacity); opacityAnimation.toValue = @(toOpacity); return opacityAnimation; } -- (CABasicAnimation *)animateSnackbarScaleFrom:(CGFloat)fromScale - toScale:(CGFloat)toScale { +- (CABasicAnimation *)animateSnackbarScaleFrom:(CGFloat)fromScale toScale:(CGFloat)toScale { CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; scaleAnimation.fromValue = [NSNumber numberWithDouble:fromScale]; scaleAnimation.toValue = [NSNumber numberWithDouble:toScale]; diff --git a/components/Snackbar/src/private/MDCSnackbarOverlayView.m b/components/Snackbar/src/private/MDCSnackbarOverlayView.m index ba473404a48..c6a974e5ca9 100644 --- a/components/Snackbar/src/private/MDCSnackbarOverlayView.m +++ b/components/Snackbar/src/private/MDCSnackbarOverlayView.m @@ -233,8 +233,9 @@ - (CGFloat)dynamicBottomMargin { */ - (CGFloat)staticBottomMargin { if (MDCSnackbarMessage.usesLegacySnackbar) { - return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? MDCSnackbarLegacyBottomMargin_iPad - : MDCSnackbarLegacyBottomMargin_iPhone; + return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad + ? MDCSnackbarLegacyBottomMargin_iPad + : MDCSnackbarLegacyBottomMargin_iPhone; } return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? MDCSnackbarBottomMargin_iPad : MDCSnackbarBottomMargin_iPhone; @@ -242,13 +243,13 @@ - (CGFloat)staticBottomMargin { - (CGFloat)sideMargin { if (MDCSnackbarMessage.usesLegacySnackbar) { - return self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular ? - MDCSnackbarSideMargin_RegularWidth : - MDCSnackbarLegacySideMargin_CompactWidth; + return self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular + ? MDCSnackbarSideMargin_RegularWidth + : MDCSnackbarLegacySideMargin_CompactWidth; } - return self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular ? - MDCSnackbarSideMargin_RegularWidth : - MDCSnackbarSideMargin_CompactWidth; + return self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular + ? MDCSnackbarSideMargin_RegularWidth + : MDCSnackbarSideMargin_CompactWidth; } - (void)setSnackbarView:(MDCSnackbarMessageView *)snackbarView { @@ -507,7 +508,7 @@ - (void)slideMessageView:(MDCSnackbarMessageView *)snackbarView duration = onscreen ? MDCSnackbarEnterTransitionDuration : MDCSnackbarExitTransitionDuration; } CAMediaTimingFunction *timingFunction = - [CAMediaTimingFunction mdc_functionWithType:MDCAnimationTimingFunctionEaseInOut]; + [CAMediaTimingFunction mdc_functionWithType:MDCAnimationTimingFunctionEaseInOut]; [CATransaction begin]; [CATransaction setAnimationTimingFunction:timingFunction]; [CATransaction setCompletionBlock:completion]; @@ -535,9 +536,8 @@ - (void)slideMessageView:(MDCSnackbarMessageView *)snackbarView timingFunction:timingFunction]; } else { NSMutableArray *animations = - [NSMutableArray arrayWithObject: - [snackbarView animateSnackbarOpacityFrom:fromContentOpacity - to:toContentOpacity]]; + [NSMutableArray arrayWithObject:[snackbarView animateSnackbarOpacityFrom:fromContentOpacity + to:toContentOpacity]]; if (onscreen) { [animations addObject:[snackbarView animateSnackbarScaleFrom:MDCSnackbarEnterStartingScale toScale:1]]; diff --git a/components/Snackbar/tests/unit/MDCSnackbarFontThemerTests.m b/components/Snackbar/tests/unit/MDCSnackbarFontThemerTests.m index a2f0ab5bc88..9c802357d3e 100644 --- a/components/Snackbar/tests/unit/MDCSnackbarFontThemerTests.m +++ b/components/Snackbar/tests/unit/MDCSnackbarFontThemerTests.m @@ -14,9 +14,9 @@ #import +#import "MaterialSnackbar+FontThemer.h" #import "MaterialSnackbar.h" #import "MaterialThemes.h" -#import "MaterialSnackbar+FontThemer.h" @interface MDCSnackbarFontThemerTests : XCTestCase @end @@ -38,10 +38,8 @@ - (void)testSnackbarFontThemerUsingUIAppearance { fontScheme.body2 = [UIFont systemFontOfSize:13]; [MDCSnackbarFontThemer applyFontScheme:fontScheme toSnackbarMessageView:[MDCSnackbarMessageView appearance]]; - XCTAssertEqualObjects([MDCSnackbarMessageView appearance].messageFont, - fontScheme.body2); - XCTAssertEqualObjects([MDCSnackbarMessageView appearance].buttonFont, - fontScheme.button); + XCTAssertEqualObjects([MDCSnackbarMessageView appearance].messageFont, fontScheme.body2); + XCTAssertEqualObjects([MDCSnackbarMessageView appearance].buttonFont, fontScheme.button); } - (void)testSnackbarFontThemer { @@ -52,10 +50,8 @@ - (void)testSnackbarFontThemer { fontScheme.button = [UIFont boldSystemFontOfSize:12]; fontScheme.body2 = [UIFont systemFontOfSize:13]; [MDCSnackbarFontThemer applyFontScheme:fontScheme]; - XCTAssertEqualObjects(MDCSnackbarManager.messageFont, - fontScheme.body2); - XCTAssertEqualObjects(MDCSnackbarManager.buttonFont, - fontScheme.button); + XCTAssertEqualObjects(MDCSnackbarManager.messageFont, fontScheme.body2); + XCTAssertEqualObjects(MDCSnackbarManager.buttonFont, fontScheme.button); } @end diff --git a/components/Snackbar/tests/unit/MDCSnackbarManagerInstanceTests.m b/components/Snackbar/tests/unit/MDCSnackbarManagerInstanceTests.m index c75e425a057..729767ed3f7 100644 --- a/components/Snackbar/tests/unit/MDCSnackbarManagerInstanceTests.m +++ b/components/Snackbar/tests/unit/MDCSnackbarManagerInstanceTests.m @@ -41,8 +41,8 @@ - (void)setUp { self.snackbarMessageViewShadowColor = MDCSnackbarManager.snackbarMessageViewShadowColor; self.snackbarMessageViewBackgroundColor = MDCSnackbarManager.snackbarMessageViewBackgroundColor; self.titleColorForState = [@{} mutableCopy]; - NSUInteger maxState = UIControlStateNormal | UIControlStateDisabled | UIControlStateSelected - | UIControlStateHighlighted; + NSUInteger maxState = UIControlStateNormal | UIControlStateDisabled | UIControlStateSelected | + UIControlStateHighlighted; for (NSUInteger state = 0; state < maxState; ++state) { self.titleColorForState[@(state)] = [MDCSnackbarManager buttonTitleColorForState:state]; } diff --git a/components/Snackbar/tests/unit/SnackbarManagerTests.m b/components/Snackbar/tests/unit/SnackbarManagerTests.m index 9aa623fc989..81a1ec7ce46 100644 --- a/components/Snackbar/tests/unit/SnackbarManagerTests.m +++ b/components/Snackbar/tests/unit/SnackbarManagerTests.m @@ -41,7 +41,7 @@ - (void)disabled_testMessagesResumedWhenTokenIsDeallocated { id token = [MDCSnackbarManager suspendAllMessages]; [MDCSnackbarManager showMessage:suspendedMessage]; - // When + // When token = nil; } diff --git a/components/Tabs/examples/BottomNavigationBarExample.m b/components/Tabs/examples/BottomNavigationBarExample.m index 2d687523ea3..38ff9343809 100644 --- a/components/Tabs/examples/BottomNavigationBarExample.m +++ b/components/Tabs/examples/BottomNavigationBarExample.m @@ -13,8 +13,8 @@ // limitations under the License. #import "MaterialColorScheme.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" @interface BottomNavigationBarExample : UIViewController @property(nonatomic, strong) MDCSemanticColorScheme *colorScheme; @@ -48,18 +48,22 @@ - (void)viewDidLoad { alpha:(CGFloat)0.15]; NSBundle *bundle = [NSBundle bundleForClass:[BottomNavigationBarExample class]]; - UIImage *infoImage = - [UIImage imageNamed:@"TabBarDemo_ic_info" inBundle:bundle compatibleWithTraitCollection:nil]; - UIImage *starImage = - [UIImage imageNamed:@"TabBarDemo_ic_star" inBundle:bundle compatibleWithTraitCollection:nil]; + UIImage *infoImage = [UIImage imageNamed:@"TabBarDemo_ic_info" + inBundle:bundle + compatibleWithTraitCollection:nil]; + UIImage *starImage = [UIImage imageNamed:@"TabBarDemo_ic_star" + inBundle:bundle + compatibleWithTraitCollection:nil]; _bottomNavigationBar.items = @[ [[UITabBarItem alloc] initWithTitle:@"Red" image:infoImage tag:0], [[UITabBarItem alloc] initWithTitle:@"Blue" image:starImage tag:0] ]; _colors = @[ - [UIColor colorWithRed:0.5 green:0 blue:0 alpha:1], - [UIColor colorWithRed:0 green:0 blue:0.5 alpha:1] + [UIColor colorWithRed:0.5 green:0 blue:0 alpha:1], [UIColor colorWithRed:0 + green:0 + blue:0.5 + alpha:1] ]; [self.view addSubview:_bottomNavigationBar]; @@ -71,21 +75,24 @@ - (void)viewDidLoad { toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:_bottomNavigationBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 - constant:0].active = YES; + constant:0] + .active = YES; [NSLayoutConstraint constraintWithItem:_bottomNavigationBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1 - constant:0].active = YES; + constant:0] + .active = YES; } #pragma mark - MDCTabBarDelegate @@ -122,9 +129,9 @@ @implementation BottomNavigationBarExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"Bottom Navigation" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Tab Bar", @"Bottom Navigation" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Tabs/examples/TabBarIconExample.m b/components/Tabs/examples/TabBarIconExample.m index e8df6700623..964bd4758b6 100644 --- a/components/Tabs/examples/TabBarIconExample.m +++ b/components/Tabs/examples/TabBarIconExample.m @@ -16,11 +16,11 @@ #import "MaterialAppBar.h" #import "MaterialColorScheme.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" @interface TabBarIconExample () -@property(nonatomic, strong)UIBarButtonItem *addStarButtonItem; +@property(nonatomic, strong) UIBarButtonItem *addStarButtonItem; @end @implementation TabBarIconExample @@ -78,10 +78,12 @@ - (void)loadTabBar { tabBar.alignment = MDCTabBarAlignmentCenterSelected; NSBundle *bundle = [NSBundle bundleForClass:[TabBarIconExample class]]; - UIImage *infoImage = - [UIImage imageNamed:@"TabBarDemo_ic_info" inBundle:bundle compatibleWithTraitCollection:nil]; - UIImage *starImage = - [UIImage imageNamed:@"TabBarDemo_ic_star" inBundle:bundle compatibleWithTraitCollection:nil]; + UIImage *infoImage = [UIImage imageNamed:@"TabBarDemo_ic_info" + inBundle:bundle + compatibleWithTraitCollection:nil]; + UIImage *starImage = [UIImage imageNamed:@"TabBarDemo_ic_star" + inBundle:bundle + compatibleWithTraitCollection:nil]; tabBar.items = @[ [[UITabBarItem alloc] initWithTitle:@"Info" image:infoImage tag:0], [[UITabBarItem alloc] initWithTitle:@"Stars" image:starImage tag:0] diff --git a/components/Tabs/examples/TabBarInterfaceBuilderExample.m b/components/Tabs/examples/TabBarInterfaceBuilderExample.m index b6ac4d1c7e7..48e3b0b91f7 100644 --- a/components/Tabs/examples/TabBarInterfaceBuilderExample.m +++ b/components/Tabs/examples/TabBarInterfaceBuilderExample.m @@ -16,8 +16,8 @@ #import "MaterialColorScheme.h" #import "MaterialPalettes.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" @interface TabBarInterfaceBuilderExample : UIViewController @@ -49,12 +49,12 @@ - (void)viewDidLoad { ]; self.colors = @[ - MDCPalette.bluePalette.tint500, MDCPalette.pinkPalette.tint500, - MDCPalette.redPalette.tint500, MDCPalette.greenPalette.tint500 + MDCPalette.bluePalette.tint500, MDCPalette.pinkPalette.tint500, MDCPalette.redPalette.tint500, + MDCPalette.greenPalette.tint500 ]; [MDCTabBarColorThemer applySemanticColorScheme:self.colorScheme toTabs:self.tabBar]; - + self.view.backgroundColor = self.colors[0]; } @@ -112,10 +112,10 @@ @implementation TabBarInterfaceBuilderExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"Interface Builder" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"TabBarInterfaceBuilderExample" + @"breadcrumbs" : @[ @"Tab Bar", @"Interface Builder" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"TabBarInterfaceBuilderExample" }; } diff --git a/components/Tabs/examples/TabBarTextOnlyExample.m b/components/Tabs/examples/TabBarTextOnlyExample.m index ba642e32a13..3a04e1f31e0 100644 --- a/components/Tabs/examples/TabBarTextOnlyExample.m +++ b/components/Tabs/examples/TabBarTextOnlyExample.m @@ -18,8 +18,8 @@ #import "MaterialButtons.h" #import "MaterialCollections.h" #import "MaterialColorScheme.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" #import "supplemental/TabBarTextOnlyExampleSupplemental.h" @implementation TabBarTextOnlyExample @@ -27,7 +27,7 @@ @implementation TabBarTextOnlyExample - (id)initWithCollectionViewLayout:(UICollectionViewLayout *)layout { self = [super initWithCollectionViewLayout:layout]; if (self) { - [self setupExampleViews:@[@"Change Alignment", @"Toggle Case", @"Clear Selection"]]; + [self setupExampleViews:@[ @"Change Alignment", @"Toggle Case", @"Clear Selection" ]]; self.colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804]; } @@ -110,8 +110,8 @@ - (void)setAlignment:(MDCTabBarAlignment)alignment { #pragma mark - Options in Collection View - -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)collectionView:(UICollectionView *)collectionView + didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; switch (indexPath.row) { case 0: diff --git a/components/Tabs/examples/TabBarViewControllerExample.m b/components/Tabs/examples/TabBarViewControllerExample.m index a03cd8d2f11..a47728a4cf5 100644 --- a/components/Tabs/examples/TabBarViewControllerExample.m +++ b/components/Tabs/examples/TabBarViewControllerExample.m @@ -16,8 +16,8 @@ #import "MaterialColorScheme.h" #import "MaterialSlider.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" #import "supplemental/TabBarViewControllerExampleSupplemental.h" @implementation TabBarViewControllerExample diff --git a/components/Tabs/examples/TabBarViewControllerInterfaceBuilderExample.m b/components/Tabs/examples/TabBarViewControllerInterfaceBuilderExample.m index ac719fd765d..b848de56517 100644 --- a/components/Tabs/examples/TabBarViewControllerInterfaceBuilderExample.m +++ b/components/Tabs/examples/TabBarViewControllerInterfaceBuilderExample.m @@ -15,8 +15,8 @@ #import #import "MaterialColorScheme.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" @interface TabBarViewControllerInterfaceBuilderExample : MDCTabBarViewController @property(nonatomic, strong) MDCSemanticColorScheme *colorScheme; @@ -64,10 +64,10 @@ @implementation TabBarViewControllerInterfaceBuilderExample (CatalogByConvention + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"TabBarViewController Interface Builder" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"TabBarViewControllerInterfaceBuilderExample" + @"breadcrumbs" : @[ @"Tab Bar", @"TabBarViewController Interface Builder" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"TabBarViewControllerInterfaceBuilderExample" }; } diff --git a/components/Tabs/examples/supplemental/TabBarIconExampleSupplemental.m b/components/Tabs/examples/supplemental/TabBarIconExampleSupplemental.m index 3ae829d24e3..65982716cf6 100644 --- a/components/Tabs/examples/supplemental/TabBarIconExampleSupplemental.m +++ b/components/Tabs/examples/supplemental/TabBarIconExampleSupplemental.m @@ -266,11 +266,13 @@ - (UIStatusBarStyle)preferredStatusBarStyle { - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { - [coordinator animateAlongsideTransition: - ^(__unused id _Nonnull context) { - // Update the scrollView position so that the selected view is entirely visible - [self tabBar:self.tabBar didSelectItem:self.tabBar.selectedItem]; - } completion:nil]; + [coordinator + animateAlongsideTransition:^( + __unused id _Nonnull context) { + // Update the scrollView position so that the selected view is entirely visible + [self tabBar:self.tabBar didSelectItem:self.tabBar.selectedItem]; + } + completion:nil]; [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } @@ -280,11 +282,11 @@ @implementation TabBarIconExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"Tabs with Icons" ], - @"description": @"Tabs organize content across different screens, data sets, and " - @"other interactions.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Tab Bar", @"Tabs with Icons" ], + @"description" : @"Tabs organize content across different screens, data sets, and " + @"other interactions.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/Tabs/examples/supplemental/TabBarTextOnlyExampleSupplemental.m b/components/Tabs/examples/supplemental/TabBarTextOnlyExampleSupplemental.m index 06b13e08e7a..12da0b113d0 100644 --- a/components/Tabs/examples/supplemental/TabBarTextOnlyExampleSupplemental.m +++ b/components/Tabs/examples/supplemental/TabBarTextOnlyExampleSupplemental.m @@ -21,7 +21,7 @@ static CGFloat const kAppBarMinHeight = 56; static CGFloat const kTabBarHeight = 48; -static NSString * const kReusableIdentifierItem = @"Cell"; +static NSString *const kReusableIdentifierItem = @"Cell"; @implementation TabBarTextOnlyExample (Supplemental) @@ -50,38 +50,34 @@ - (void)setupExampleViews:(NSArray *)choices { self.appBarViewController.headerView.minimumHeight = kTabBarHeight; self.appBarViewController.headerView.maximumHeight = kAppBarMinHeight + kTabBarHeight; - UIFont *font; - if ([UIFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { - font = [UIFont monospacedDigitSystemFontOfSize:14 weight:UIFontWeightRegular]; - } else { - font = [UIFont systemFontOfSize:14]; - UIFontDescriptor *descriptor = - [[font fontDescriptor] fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitMonoSpace]; - if (descriptor) { - font = [UIFont fontWithDescriptor:descriptor size:0.0]; - } - } - - self.appBarViewController.navigationBar.titleTextAttributes = @{ - NSForegroundColorAttributeName: [UIColor whiteColor], - NSFontAttributeName: font }; + UIFont *font; + if ([UIFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { + font = [UIFont monospacedDigitSystemFontOfSize:14 weight:UIFontWeightRegular]; + } else { + font = [UIFont systemFontOfSize:14]; + UIFontDescriptor *descriptor = + [[font fontDescriptor] fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitMonoSpace]; + if (descriptor) { + font = [UIFont fontWithDescriptor:descriptor size:0.0]; + } + } + + self.appBarViewController.navigationBar.titleTextAttributes = + @{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : font}; [self.view addSubview:self.appBarViewController.view]; [self.appBarViewController didMoveToParentViewController:self]; - [self.collectionView registerClass:[MDCCollectionViewTextCell class] forCellWithReuseIdentifier:kReusableIdentifierItem]; } #pragma mark - UICollectionView - - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return self.choices.count; } - - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MDCCollectionViewTextCell *cell = @@ -107,7 +103,8 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { if (scrollView == self.appBarViewController.headerView.trackingScrollView) { - [self.appBarViewController.headerView trackingScrollViewDidEndDraggingWillDecelerate:decelerate]; + [self.appBarViewController.headerView + trackingScrollViewDidEndDraggingWillDecelerate:decelerate]; } } @@ -115,8 +112,9 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { if (scrollView == self.appBarViewController.headerView.trackingScrollView) { - [self.appBarViewController.headerView trackingScrollViewWillEndDraggingWithVelocity:velocity - targetContentOffset:targetContentOffset]; + [self.appBarViewController.headerView + trackingScrollViewWillEndDraggingWithVelocity:velocity + targetContentOffset:targetContentOffset]; } } @@ -126,9 +124,9 @@ @implementation TabBarTextOnlyExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"Text Tabs" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Tab Bar", @"Text Tabs" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Tabs/examples/supplemental/TabBarViewControllerExampleSupplemental.m b/components/Tabs/examples/supplemental/TabBarViewControllerExampleSupplemental.m index 511cb4286ec..d6675e80898 100644 --- a/components/Tabs/examples/supplemental/TabBarViewControllerExampleSupplemental.m +++ b/components/Tabs/examples/supplemental/TabBarViewControllerExampleSupplemental.m @@ -18,9 +18,9 @@ #import "TabBarViewControllerExampleSupplemental.h" -#import "MaterialAppBar.h" #import "MaterialAppBar+ColorThemer.h" #import "MaterialAppBar+TypographyThemer.h" +#import "MaterialAppBar.h" #import "MaterialButtons.h" #import "MaterialPalettes.h" @@ -48,7 +48,7 @@ @interface TBVCSampleViewController () @property(nonatomic) MDCAppBarViewController *appBarViewController; @property(nonatomic) UILabel *titleLabel; -@property(nonatomic) CGRect buttonFrame; // The desired frame of the button +@property(nonatomic) CGRect buttonFrame; // The desired frame of the button @property(nonatomic) MDCButton *button; @property(nonatomic, copy) MDCButtonActionBlock buttonActionBlock; @@ -130,8 +130,8 @@ - (void)setMDCButtonWithFrame:(CGRect)frame self.buttonFrame = CGRectStandardize(frame); self.buttonActionBlock = actionBlock; [button addTarget:self - action:@selector(triggerButtonActionHandler) - forControlEvents:UIControlEventTouchUpInside]; + action:@selector(triggerButtonActionHandler) + forControlEvents:UIControlEventTouchUpInside]; } - (void)triggerButtonActionHandler { @@ -155,8 +155,8 @@ - (nonnull NSArray *)constructExampleViewControllers { buttonScheme.colorScheme = self.colorScheme; buttonScheme.typographyScheme = self.typographyScheme; - TBVCSampleViewController *child1 = - [TBVCSampleViewController sampleWithTitle:@"One" color:UIColor.redColor]; + TBVCSampleViewController *child1 = [TBVCSampleViewController sampleWithTitle:@"One" + color:UIColor.redColor]; UIColor *blue = [UIColor colorWithRed:0x3A / 255.f green:0x56 / 255.f blue:0xFF / 255.f alpha:1]; TBVCSampleViewController *child2 = [TBVCSampleViewController sampleWithTitle:@"Two" color:blue]; @@ -167,16 +167,19 @@ - (nonnull NSArray *)constructExampleViewControllers { actionBlock:^{ TabBarViewControllerExample *strongSelf = weakSelf; TBVCSampleViewController *vc = - [TBVCSampleViewController sampleWithTitle:@"Push&Hide" color:UIColor.grayColor]; + [TBVCSampleViewController sampleWithTitle:@"Push&Hide" + color:UIColor.grayColor]; vc.colorScheme = strongSelf.colorScheme; vc.typographyScheme = strongSelf.typographyScheme; [strongSelf.navigationController pushViewController:vc animated:YES]; }]; - UIImage *starImage = - [UIImage imageNamed:@"TabBarDemo_ic_star" inBundle:bundle compatibleWithTraitCollection:nil]; - TBVCSampleViewController *child3 = - [TBVCSampleViewController sampleWithTitle:@"Three" color:UIColor.blueColor icon:starImage]; + UIImage *starImage = [UIImage imageNamed:@"TabBarDemo_ic_star" + inBundle:bundle + compatibleWithTraitCollection:nil]; + TBVCSampleViewController *child3 = [TBVCSampleViewController sampleWithTitle:@"Three" + color:UIColor.blueColor + icon:starImage]; [child3 setMDCButtonWithFrame:CGRectMake(10, 120, 300, 40) buttonScheme:buttonScheme title:@"Toggle Tab Bar" @@ -199,9 +202,9 @@ @implementation TabBarViewControllerExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Tab Bar", @"TabBarViewController" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Tab Bar", @"TabBarViewController" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Tabs/src/ColorThemer/MDCTabBarColorThemer.m b/components/Tabs/src/ColorThemer/MDCTabBarColorThemer.m index fe25db7c515..8343284c738 100644 --- a/components/Tabs/src/ColorThemer/MDCTabBarColorThemer.m +++ b/components/Tabs/src/ColorThemer/MDCTabBarColorThemer.m @@ -52,8 +52,7 @@ + (void)applySurfaceVariantWithColorScheme:(nonnull id)colorSc [colorScheme.onSurfaceColor colorWithAlphaComponent:kBottomDividerOpacity]; } -+ (void)applyColorScheme:(id)colorScheme - toTabBar:(MDCTabBar *)tabBar { ++ (void)applyColorScheme:(id)colorScheme toTabBar:(MDCTabBar *)tabBar { if ([colorScheme respondsToSelector:@selector(primaryLightColor)]) { tabBar.unselectedItemTintColor = colorScheme.primaryLightColor; tabBar.inkColor = colorScheme.primaryLightColor; diff --git a/components/Tabs/src/FontThemer/MDCTabBarFontThemer.m b/components/Tabs/src/FontThemer/MDCTabBarFontThemer.m index 919084d43ac..3639f56aa7a 100644 --- a/components/Tabs/src/FontThemer/MDCTabBarFontThemer.m +++ b/components/Tabs/src/FontThemer/MDCTabBarFontThemer.m @@ -16,8 +16,7 @@ @implementation MDCTabBarFontThemer -+ (void)applyFontScheme:(id)fontScheme - toTabBar:(MDCTabBar *)tabBar { ++ (void)applyFontScheme:(id)fontScheme toTabBar:(MDCTabBar *)tabBar { tabBar.selectedItemTitleFont = fontScheme.button; tabBar.unselectedItemTitleFont = fontScheme.button; } diff --git a/components/Tabs/src/MDCTabBar.m b/components/Tabs/src/MDCTabBar.m index ad347c0f00f..3a94c53682f 100644 --- a/components/Tabs/src/MDCTabBar.m +++ b/components/Tabs/src/MDCTabBar.m @@ -146,11 +146,8 @@ - (void)commonMDCTabBarInit { [self addSubview:_itemBar]; CGFloat dividerTop = CGRectGetMaxY(self.bounds) - kBottomNavigationBarDividerHeight; - _dividerBar = - [[UIView alloc] initWithFrame:CGRectMake(0, - dividerTop, - CGRectGetWidth(self.bounds), - kBottomNavigationBarDividerHeight)]; + _dividerBar = [[UIView alloc] initWithFrame:CGRectMake(0, dividerTop, CGRectGetWidth(self.bounds), + kBottomNavigationBarDividerHeight)]; _dividerBar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; _dividerBar.backgroundColor = _bottomDividerColor; diff --git a/components/Tabs/src/MDCTabBarUnderlineIndicatorTemplate.m b/components/Tabs/src/MDCTabBarUnderlineIndicatorTemplate.m index e0c6ac319fa..67ddc257f08 100644 --- a/components/Tabs/src/MDCTabBarUnderlineIndicatorTemplate.m +++ b/components/Tabs/src/MDCTabBarUnderlineIndicatorTemplate.m @@ -22,14 +22,13 @@ @implementation MDCTabBarUnderlineIndicatorTemplate -- (MDCTabBarIndicatorAttributes *) - indicatorAttributesForContext:(id)context { +- (MDCTabBarIndicatorAttributes *)indicatorAttributesForContext: + (id)context { CGRect bounds = context.bounds; MDCTabBarIndicatorAttributes *attributes = [[MDCTabBarIndicatorAttributes alloc] init]; - CGRect underlineFrame = CGRectMake(CGRectGetMinX(bounds), - CGRectGetMaxY(bounds) - kUnderlineIndicatorHeight, - CGRectGetWidth(bounds), - kUnderlineIndicatorHeight); + CGRect underlineFrame = + CGRectMake(CGRectGetMinX(bounds), CGRectGetMaxY(bounds) - kUnderlineIndicatorHeight, + CGRectGetWidth(bounds), kUnderlineIndicatorHeight); attributes.path = [UIBezierPath bezierPathWithRect:underlineFrame]; return attributes; } diff --git a/components/Tabs/src/MDCTabBarViewController.m b/components/Tabs/src/MDCTabBarViewController.m index 3a1833eb80e..3c53806a926 100644 --- a/components/Tabs/src/MDCTabBarViewController.m +++ b/components/Tabs/src/MDCTabBarViewController.m @@ -90,7 +90,7 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibB return self; } --(void)commonInit { +- (void)commonInit { if (self.tabBar) { return; } @@ -330,7 +330,7 @@ - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { } } -- (UIBarPosition)positionForBar:(id )bar { +- (UIBarPosition)positionForBar:(id)bar { if (_tabBar == bar) { return UIBarPositionBottom; } else { diff --git a/components/Tabs/src/private/MDCItemBar.m b/components/Tabs/src/private/MDCItemBar.m index 9ac8a2135b4..08d4be05354 100644 --- a/components/Tabs/src/private/MDCItemBar.m +++ b/components/Tabs/src/private/MDCItemBar.m @@ -105,8 +105,8 @@ - (void)commonItemBarInit { // Configure the collection view. _flowLayout = [self generatedFlowLayout]; - UICollectionView *collectionView = - [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:_flowLayout]; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.bounds + collectionViewLayout:_flowLayout]; collectionView.backgroundColor = [UIColor clearColor]; collectionView.clipsToBounds = NO; collectionView.scrollsToTop = NO; @@ -393,8 +393,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSParameterAssert(_collectionView == collectionView); - MDCItemBarCell *itemCell = - [collectionView dequeueReusableCellWithReuseIdentifier:kItemReuseID forIndexPath:indexPath]; + MDCItemBarCell *itemCell = [collectionView dequeueReusableCellWithReuseIdentifier:kItemReuseID + forIndexPath:indexPath]; UITabBarItem *item = [self itemAtIndexPath:indexPath]; [self configureCell:itemCell]; @@ -416,9 +416,7 @@ - (CGSize)collectionView:(UICollectionView *)collectionView CGSize size = CGSizeMake(CGFLOAT_MAX, itemHeight); // Size cell to fit content. - size = [MDCItemBarCell sizeThatFits:size - item:item - style:_style]; + size = [MDCItemBarCell sizeThatFits:size item:item style:_style]; // Divide justified items evenly across the view. if (_alignment == MDCItemBarAlignmentJustified) { @@ -443,8 +441,8 @@ - (CGSize)collectionView:(UICollectionView *)collectionView - (CGFloat)adjustedCollectionViewWidth { if (@available(iOS 11.0, *)) { - return CGRectGetWidth(UIEdgeInsetsInsetRect(_collectionView.bounds, - _collectionView.adjustedContentInset)); + return CGRectGetWidth( + UIEdgeInsetsInsetRect(_collectionView.bounds, _collectionView.adjustedContentInset)); } return CGRectGetWidth(_collectionView.bounds); } @@ -637,7 +635,6 @@ - (void)updateScrollProperties { } - (void)updateFlowLayoutMetrics { - UIUserInterfaceSizeClass horizontalSizeClass = [self horizontalSizeClass]; UIEdgeInsets newSectionInset = UIEdgeInsetsZero; @@ -833,7 +830,7 @@ - (void)prepareLayout { } - (nullable UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath: - (NSIndexPath *)indexPath { + (NSIndexPath *)indexPath { if (_correctedAttributesForIndexPath) { return _correctedAttributesForIndexPath[indexPath]; } @@ -875,7 +872,7 @@ - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { /// Computes RTL-flipped attributes given superclass-calculated attributes. - (UICollectionViewLayoutAttributes *)flippedAttributesFromAttributes: - (UICollectionViewLayoutAttributes *)attributes { + (UICollectionViewLayoutAttributes *)attributes { UICollectionViewLayoutAttributes *newAttributes = [attributes copy]; CGRect itemFrame = attributes.frame; @@ -893,7 +890,7 @@ - (BOOL)shouldEnforceRightToLeftLayout { UIUserInterfaceLayoutDirection rtl = UIUserInterfaceLayoutDirectionRightToLeft; NSProcessInfo *processInfo = [NSProcessInfo processInfo]; return [processInfo isOperatingSystemAtLeastVersion:iOS9Version] && - self.collectionView.mdf_effectiveUserInterfaceLayoutDirection == rtl; + self.collectionView.mdf_effectiveUserInterfaceLayoutDirection == rtl; } /// Indicates if the superclass' layout appears to have been layed out in a left-to-right order. If @@ -964,7 +961,7 @@ - (BOOL)shouldPadContentSizeForRTL { } - (UICollectionViewLayoutAttributes *)paddedAttributesFromAttributes: - (UICollectionViewLayoutAttributes *)attributes { + (UICollectionViewLayoutAttributes *)attributes { // Must call super here to ensure we have the original collection content size. CGSize contentSize = [super collectionViewContentSize]; CGRect scrollBounds = [self adjustedCollectionViewBounds]; diff --git a/components/Tabs/src/private/MDCItemBarCell.m b/components/Tabs/src/private/MDCItemBarCell.m index f80334b4d45..6abedaee6eb 100644 --- a/components/Tabs/src/private/MDCItemBarCell.m +++ b/components/Tabs/src/private/MDCItemBarCell.m @@ -81,7 +81,7 @@ - (instancetype)initWithFrame:(CGRect)frame { // Set up ink controller to splash ink on taps. _inkTouchController = [[MDCInkTouchController alloc] initWithView:self]; - [_inkTouchController addInkView]; // Ink should always be on top of other views + [_inkTouchController addInkView]; // Ink should always be on top of other views [self updateInk]; [self updateColors]; @@ -92,9 +92,7 @@ - (instancetype)initWithFrame:(CGRect)frame { #pragma mark - Public -+ (CGSize)sizeThatFits:(CGSize)size - item:(UITabBarItem *)item - style:(MDCItemBarStyle *)style { ++ (CGSize)sizeThatFits:(CGSize)size item:(UITabBarItem *)item style:(MDCItemBarStyle *)style { NSString *title = [self displayedTitleForTitle:item.title style:style]; CGRect textBounds = CGRectZero; @@ -299,9 +297,8 @@ - (void)layoutSubviews { _badgeLabel.center = MDCRoundCenterWithBoundsAndScale(badgeCenter, _badgeLabel.bounds, scale); self.titleLabel.bounds = MDCRectAlignToScale(titleBounds, scale); - self.titleLabel.center = MDCRoundCenterWithBoundsAndScale(titleCenter, - self.titleLabel.bounds, - scale); + self.titleLabel.center = + MDCRoundCenterWithBoundsAndScale(titleCenter, self.titleLabel.bounds, scale); } - (void)tintColorDidChange { @@ -395,8 +392,8 @@ + (UIEdgeInsets)minimumEdgeInsets { + (NSString *)localizedStringWithKey:(NSString *)key { NSBundle *containingBundle = [NSBundle bundleForClass:self]; - NSURL *resourceBundleURL = - [containingBundle URLForResource:kResourceBundleName withExtension:@"bundle"]; + NSURL *resourceBundleURL = [containingBundle URLForResource:kResourceBundleName + withExtension:@"bundle"]; NSBundle *resourceBundle = [NSBundle bundleWithURL:resourceBundleURL]; return [resourceBundle localizedStringForKey:key value:nil table:kStringTableName]; } diff --git a/components/Tabs/src/private/MDCTabBarIndicatorView.m b/components/Tabs/src/private/MDCTabBarIndicatorView.m index db89d1b0654..26c581f499e 100644 --- a/components/Tabs/src/private/MDCTabBarIndicatorView.m +++ b/components/Tabs/src/private/MDCTabBarIndicatorView.m @@ -17,7 +17,7 @@ #import "MDCTabBarIndicatorAttributes.h" /** Content view that displays a filled path and supports animation between states. */ -@interface MDCTabBarIndicatorShapeView: UIView +@interface MDCTabBarIndicatorShapeView : UIView /** The path to display. It will be filled using the view's tintColor. */ @property(nonatomic, nullable) UIBezierPath *path; @@ -56,8 +56,7 @@ - (void)applySelectionIndicatorAttributes:(MDCTabBarIndicatorAttributes *)attrib - (void)commonMDCTabBarIndicatorViewInit { // Fill the indicator with the shape. _shapeView = [[MDCTabBarIndicatorShapeView alloc] initWithFrame:self.bounds]; - _shapeView.autoresizingMask = - UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _shapeView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:_shapeView]; } diff --git a/components/Tabs/src/private/MDCTabBarPrivateIndicatorContext.m b/components/Tabs/src/private/MDCTabBarPrivateIndicatorContext.m index dd58532c14a..c2e5506cbcf 100644 --- a/components/Tabs/src/private/MDCTabBarPrivateIndicatorContext.m +++ b/components/Tabs/src/private/MDCTabBarPrivateIndicatorContext.m @@ -36,11 +36,8 @@ - (instancetype)initWithItem:(UITabBarItem *)item #pragma mark - NSObject - (NSString *)description { - return [NSString stringWithFormat:@"%@ item:%@ bounds:%@ frame:%@", - [super description], - _item, - NSStringFromCGRect(_bounds), - NSStringFromCGRect(_contentFrame)]; + return [NSString stringWithFormat:@"%@ item:%@ bounds:%@ frame:%@", [super description], _item, + NSStringFromCGRect(_bounds), NSStringFromCGRect(_contentFrame)]; } - (BOOL)isEqual:(id)object { diff --git a/components/Tabs/tests/unit/MDCItemBarCellTests.m b/components/Tabs/tests/unit/MDCItemBarCellTests.m index 687a0394a39..35b23210c61 100644 --- a/components/Tabs/tests/unit/MDCItemBarCellTests.m +++ b/components/Tabs/tests/unit/MDCItemBarCellTests.m @@ -14,8 +14,8 @@ #import -#import "MDCItemBarCell.h" #import "MDCItemBarCell+Private.h" +#import "MDCItemBarCell.h" #import "MDCItemBarStyle.h" @interface MDCItemBarCellTests : XCTestCase diff --git a/components/Tabs/tests/unit/MDCTabBarColorThemerTests.m b/components/Tabs/tests/unit/MDCTabBarColorThemerTests.m index 540873338d6..0ed254af327 100644 --- a/components/Tabs/tests/unit/MDCTabBarColorThemerTests.m +++ b/components/Tabs/tests/unit/MDCTabBarColorThemerTests.m @@ -15,8 +15,8 @@ #import #import "MaterialColorScheme.h" -#import "MaterialTabs.h" #import "MaterialTabs+ColorThemer.h" +#import "MaterialTabs.h" @interface MDCTabBarTestColorScheme : NSObject @@ -66,10 +66,9 @@ - (void)testColorScheming { tabBar.barTintColor = [UIColor greenColor]; tabBar.tintColor = [UIColor yellowColor]; tabBar.selectedItemTintColor = [UIColor yellowColor]; - + // When - [MDCTabBarColorThemer applySemanticColorScheme:colorScheme - toTabs:tabBar]; + [MDCTabBarColorThemer applySemanticColorScheme:colorScheme toTabs:tabBar]; // Then XCTAssertEqualObjects(tabBar.barTintColor, colorScheme.primaryColor); diff --git a/components/Tabs/tests/unit/MDCTabBarFontThemerTests.m b/components/Tabs/tests/unit/MDCTabBarFontThemerTests.m index 4c39efa752f..6d49847f8b6 100644 --- a/components/Tabs/tests/unit/MDCTabBarFontThemerTests.m +++ b/components/Tabs/tests/unit/MDCTabBarFontThemerTests.m @@ -14,9 +14,9 @@ #import +#import "MaterialTabs+FontThemer.h" #import "MaterialTabs.h" #import "MaterialThemes.h" -#import "MaterialTabs+FontThemer.h" @interface MDCTabBarFontThemerTests : XCTestCase @end diff --git a/components/Tabs/tests/unit/MDCTabBarTypographyThemerTests.m b/components/Tabs/tests/unit/MDCTabBarTypographyThemerTests.m index 251318fb87d..9dc6057bce0 100644 --- a/components/Tabs/tests/unit/MDCTabBarTypographyThemerTests.m +++ b/components/Tabs/tests/unit/MDCTabBarTypographyThemerTests.m @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTabs.h" #import "MaterialTabs+TypographyThemer.h" +#import "MaterialTabs.h" #import diff --git a/components/TextFields/examples/MultilineTextFieldLegacyExample.m b/components/TextFields/examples/MultilineTextFieldLegacyExample.m index f0fa8d79d7a..68b69ea963c 100644 --- a/components/TextFields/examples/MultilineTextFieldLegacyExample.m +++ b/components/TextFields/examples/MultilineTextFieldLegacyExample.m @@ -48,17 +48,13 @@ - (void)viewDidLoad { constraintsWithVisualFormat:@"V:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; MDCMultilineTextField *multilineTextFieldUnstyled = [[MDCMultilineTextField alloc] init]; [self.scrollView addSubview:multilineTextFieldUnstyled]; @@ -236,9 +232,9 @@ - (void)tapDidTouch { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"[Legacy] Multi-line" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Text Field", @"[Legacy] Multi-line" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/TextFields/examples/TextFieldControllerStylesExample.m b/components/TextFields/examples/TextFieldControllerStylesExample.m index d8e2e85e9f9..80367f090c3 100644 --- a/components/TextFields/examples/TextFieldControllerStylesExample.m +++ b/components/TextFields/examples/TextFieldControllerStylesExample.m @@ -76,8 +76,7 @@ - (void)setupTextFields { // Second the controller is created to manage the text field self.textFieldControllerOutlined = [[MDCTextInputControllerOutlined alloc] initWithTextInput:textFieldOutlined]; - self.textFieldControllerOutlined.placeholderText = - @"MDCTextInputControllerOutlined"; + self.textFieldControllerOutlined.placeholderText = @"MDCTextInputControllerOutlined"; self.textFieldControllerOutlined.characterCountMax = characterCountMax; [self.textFieldControllerOutlined mdc_setAdjustsFontForContentSizeCategory:YES]; @@ -197,7 +196,7 @@ - (void)setupTextFields { attribute:NSLayoutAttributeBottom multiplier:1 constant:-20] - .active = YES; + .active = YES; } else { [NSLayoutConstraint constraintWithItem:textFieldOutlined attribute:NSLayoutAttributeTop @@ -214,7 +213,7 @@ - (void)setupTextFields { attribute:NSLayoutAttributeBottom multiplier:1 constant:-20] - .active = YES; + .active = YES; } } @@ -259,5 +258,4 @@ - (void)keyboardWillHide:(NSNotification *)notification { self.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); } - @end diff --git a/components/TextFields/examples/TextFieldCustomFontExample.m b/components/TextFields/examples/TextFieldCustomFontExample.m index 70c8cb56296..4d881e0b841 100644 --- a/components/TextFields/examples/TextFieldCustomFontExample.m +++ b/components/TextFields/examples/TextFieldCustomFontExample.m @@ -52,10 +52,12 @@ - (void)viewDidLoad { MDCTextField *systemFontDynamicTextField = [self setupSystemFontDynamicTextField]; // Create a Custom Font TextField. - MDCTextField *customFontTextField = [self setupCustomFontTextField];; + MDCTextField *customFontTextField = [self setupCustomFontTextField]; + ; // Create a Custom Font Dynamic TextField. - MDCTextField *customFontDynamicTextField = [self setupCustomFontDynamicTextField];; + MDCTextField *customFontDynamicTextField = [self setupCustomFontDynamicTextField]; + ; // Create a System Multiline TextField. MDCMultilineTextField *multilineTextField = [self setupSystemMultilineTextField]; @@ -67,25 +69,23 @@ - (void)viewDidLoad { MDCMultilineTextField *multilineCustomDynamicTextField = [self setupCustomMultilineDynamicTextField]; - NSDictionary *views = @{ - @"t1" : systemFontTextField, - @"t2" : systemFontDynamicTextField, - @"t3" : customFontTextField, - @"t4" : customFontDynamicTextField, - @"t5" : multilineTextField, - @"t6" : multilineDynamicTextField, - @"t7" : multilineCustomDynamicTextField - }; + @"t1" : systemFontTextField, + @"t2" : systemFontDynamicTextField, + @"t3" : customFontTextField, + @"t4" : customFontDynamicTextField, + @"t5" : multilineTextField, + @"t6" : multilineDynamicTextField, + @"t7" : multilineCustomDynamicTextField + }; NSMutableArray *constraints = [NSMutableArray - arrayWithArray: - [NSLayoutConstraint - constraintsWithVisualFormat:@"V:[t1]-[t2]-[t3]-[t4]-[t5]-[t6]-[t7]" + arrayWithArray:[NSLayoutConstraint + constraintsWithVisualFormat:@"V:[t1]-[t2]-[t3]-[t4]-[t5]-[t6]-[t7]" - options:NSLayoutFormatAlignAllLeading | - NSLayoutFormatAlignAllTrailing - metrics:nil - views:views]]; + options:NSLayoutFormatAlignAllLeading | + NSLayoutFormatAlignAllTrailing + metrics:nil + views:views]]; [constraints addObject:[NSLayoutConstraint constraintWithItem:systemFontTextField attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual @@ -102,38 +102,38 @@ - (void)viewDidLoad { constant:0]]; if (@available(iOS 11.0, *)) { [NSLayoutConstraint activateConstraints:@[ - [NSLayoutConstraint constraintWithItem:systemFontTextField - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.scrollView.contentLayoutGuide - attribute:NSLayoutAttributeTop - multiplier:1 - constant:20], - [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.scrollView.contentLayoutGuide - attribute:NSLayoutAttributeBottomMargin - multiplier:1 - constant:-20] - ]]; + [NSLayoutConstraint constraintWithItem:systemFontTextField + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.scrollView.contentLayoutGuide + attribute:NSLayoutAttributeTop + multiplier:1 + constant:20], + [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.scrollView.contentLayoutGuide + attribute:NSLayoutAttributeBottomMargin + multiplier:1 + constant:-20] + ]]; } else { [NSLayoutConstraint activateConstraints:@[ - [NSLayoutConstraint constraintWithItem:systemFontTextField - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.scrollView - attribute:NSLayoutAttributeTop - multiplier:1 - constant:20], - [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.scrollView - attribute:NSLayoutAttributeBottomMargin - multiplier:1 - constant:-20] - ]]; + [NSLayoutConstraint constraintWithItem:systemFontTextField + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.scrollView + attribute:NSLayoutAttributeTop + multiplier:1 + constant:20], + [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.scrollView + attribute:NSLayoutAttributeBottomMargin + multiplier:1 + constant:-20] + ]]; } [NSLayoutConstraint activateConstraints:constraints]; @@ -173,7 +173,8 @@ - (MDCTextField *)setupSystemFontTextField { systemFontTextField.clearButtonMode = UITextFieldViewModeUnlessEditing; systemFontTextField.backgroundColor = [UIColor whiteColor]; - self.systemFontController = [[MDCTextInputControllerOutlined alloc] initWithTextInput:systemFontTextField]; + self.systemFontController = + [[MDCTextInputControllerOutlined alloc] initWithTextInput:systemFontTextField]; self.systemFontController.placeholderText = @"System Font"; self.systemFontController.mdc_adjustsFontForContentSizeCategory = NO; return systemFontTextField; @@ -208,12 +209,12 @@ - (MDCTextField *)setupCustomFontTextField { [[MDCTextInputControllerOutlined alloc] initWithTextInput:customFontTextField]; self.customFontController.placeholderText = @"Custom Font"; self.customFontController.mdc_adjustsFontForContentSizeCategory = NO; - self.customFontController.leadingUnderlineLabelFont = - [UIFont fontWithName:@"AmericanTypewriter" size:12]; - self.customFontController.trailingUnderlineLabelFont = - [UIFont fontWithName:@"Chalkduster" size:12]; - self.customFontController.inlinePlaceholderFont = - [UIFont fontWithName:@"AmericanTypewriter" size:12]; + self.customFontController.leadingUnderlineLabelFont = [UIFont fontWithName:@"AmericanTypewriter" + size:12]; + self.customFontController.trailingUnderlineLabelFont = [UIFont fontWithName:@"Chalkduster" + size:12]; + self.customFontController.inlinePlaceholderFont = [UIFont fontWithName:@"AmericanTypewriter" + size:12]; self.customFontController.textInputFont = [UIFont fontWithName:@"Chalkduster" size:16]; return customFontTextField; } @@ -230,10 +231,10 @@ - (MDCTextField *)setupCustomFontDynamicTextField { [[MDCTextInputControllerOutlined alloc] initWithTextInput:customFontDynamicTextField]; self.customFontDynamicController.placeholderText = @"Custom Font - Dynamic"; self.customFontDynamicController.helperText = @"Helper"; - self.customFontDynamicController.leadingUnderlineLabelFont = - [UIFont fontWithName:@"Zapfino" size:12]; - self.customFontDynamicController.trailingUnderlineLabelFont = - [UIFont fontWithName:@"Chalkduster" size:12]; + self.customFontDynamicController.leadingUnderlineLabelFont = [UIFont fontWithName:@"Zapfino" + size:12]; + self.customFontDynamicController.trailingUnderlineLabelFont = [UIFont fontWithName:@"Chalkduster" + size:12]; self.customFontDynamicController.inlinePlaceholderFont = [UIFont fontWithName:@"Zapfino" size:12]; self.customFontDynamicController.textInputFont = [UIFont fontWithName:@"Zapfino" size:16]; self.customFontDynamicController.mdc_adjustsFontForContentSizeCategory = YES; @@ -277,23 +278,21 @@ - (MDCMultilineTextField *)setupCustomMultilineDynamicTextField { multilineCustomDynamicTextField.textView.delegate = self; - self.multilineCustomFontDynamicController = - [[MDCTextInputControllerOutlinedTextArea alloc] - initWithTextInput:multilineCustomDynamicTextField]; + self.multilineCustomFontDynamicController = [[MDCTextInputControllerOutlinedTextArea alloc] + initWithTextInput:multilineCustomDynamicTextField]; self.multilineCustomFontDynamicController.placeholderText = @"Multiline Custom Font Dynamic Text"; self.multilineCustomFontDynamicController.leadingUnderlineLabelFont = [UIFont fontWithName:@"AmericanTypewriter" size:12]; - self.customFontDynamicController.trailingUnderlineLabelFont = - [UIFont fontWithName:@"Chalkduster" size:12]; - self.multilineCustomFontDynamicController.inlinePlaceholderFont = - [UIFont fontWithName:@"Zapfino" size:12]; + self.customFontDynamicController.trailingUnderlineLabelFont = [UIFont fontWithName:@"Chalkduster" + size:12]; + self.multilineCustomFontDynamicController.inlinePlaceholderFont = [UIFont fontWithName:@"Zapfino" + size:12]; self.multilineCustomFontDynamicController.textInputFont = [UIFont fontWithName:@"AmericanTypewriter" size:16]; self.multilineCustomFontDynamicController.mdc_adjustsFontForContentSizeCategory = YES; return multilineCustomDynamicTextField; } - #pragma mark - UITextFieldDelegate - (BOOL)textFieldShouldReturn:(UITextField *)textField { @@ -303,16 +302,17 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField { } - (BOOL)textField:(UITextField *)textField -shouldChangeCharactersInRange:(NSRange)range -replacementString:(NSString *)string { - NSString *finishedString = - [textField.text stringByReplacingCharactersInRange:range withString:string]; + shouldChangeCharactersInRange:(NSRange)range + replacementString:(NSString *)string { + NSString *finishedString = [textField.text stringByReplacingCharactersInRange:range + withString:string]; if (textField == (UITextField *)self.systemFontController.textInput) { if ([finishedString rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].length && ![self.systemFontController.errorText isEqualToString:@"Error: You cannot enter numbers"]) { // The entered text contains numbers and we have not set an error - [self.systemFontController setErrorText:@"You cannot enter numbers" errorAccessibilityValue:nil]; + [self.systemFontController setErrorText:@"You cannot enter numbers" + errorAccessibilityValue:nil]; // Since we are doing manual layout, we need to react to the expansion of the input that will // come from setting an error. @@ -329,9 +329,9 @@ - (BOOL)textField:(UITextField *)textField if (textField == (UITextField *)self.customFontController.textInput) { if ([finishedString rangeOfCharacterFromSet:[[NSCharacterSet letterCharacterSet] invertedSet]] - .length > 0) { + .length > 0) { [self.customFontController setErrorText:@"Error: City can only contain letters" - errorAccessibilityValue:nil]; + errorAccessibilityValue:nil]; } else { [self.customFontController setErrorText:nil errorAccessibilityValue:nil]; } @@ -409,9 +409,9 @@ @implementation TextFieldCustomFontExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"Custom Fonts" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Text Field", @"Custom Fonts" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/TextFields/examples/TextFieldManualLayoutLegacyExample.m b/components/TextFields/examples/TextFieldManualLayoutLegacyExample.m index bf410718e4f..12298351d45 100644 --- a/components/TextFields/examples/TextFieldManualLayoutLegacyExample.m +++ b/components/TextFields/examples/TextFieldManualLayoutLegacyExample.m @@ -82,8 +82,8 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSString *finishedString = - [textField.text stringByReplacingCharactersInRange:range withString:string]; + NSString *finishedString = [textField.text stringByReplacingCharactersInRange:range + withString:string]; if (textField == (UITextField *)self.nameController.textInput) { if ([finishedString rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].length && @@ -153,9 +153,9 @@ @implementation TextFieldManualLayoutLegacyExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"[Legacy] Manual Layout" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Text Field", @"[Legacy] Manual Layout" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/TextFields/examples/TextFieldOutlinedExample.m b/components/TextFields/examples/TextFieldOutlinedExample.m index aee16b7014c..e40a3be0d0f 100644 --- a/components/TextFields/examples/TextFieldOutlinedExample.m +++ b/components/TextFields/examples/TextFieldOutlinedExample.m @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MaterialTextFields.h" #import "MaterialTextFields+ColorThemer.h" #import "MaterialTextFields+TypographyThemer.h" +#import "MaterialTextFields.h" @interface TextFieldOutlinedObjectiveCExample : UIViewController @@ -172,7 +172,7 @@ - (void)viewDidLoad { self.messageController = [[MDCTextInputControllerOutlinedTextArea alloc] initWithTextInput:textFieldMessage]; textFieldMessage.text = @"This is where you could put a multi-line message like an email.\n\n" - "It can even handle new lines."; + "It can even handle new lines."; self.messageController.placeholderText = @"Message"; [self styleTextInputController:self.messageController]; @@ -271,17 +271,13 @@ - (void)setupScrollView { constraintsWithVisualFormat:@"V:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; UIEdgeInsets margins = UIEdgeInsetsMake(0, 16, 0, 16); self.scrollView.layoutMargins = margins; @@ -306,8 +302,8 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSString *finishedString = - [textField.text stringByReplacingCharactersInRange:range withString:string]; + NSString *finishedString = [textField.text stringByReplacingCharactersInRange:range + withString:string]; if (textField == (UITextField *)self.nameController.textInput) { if ([finishedString rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].length && @@ -439,9 +435,9 @@ @implementation TextFieldOutlinedObjectiveCExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"Outlined text fields" ], - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Text Field", @"Outlined text fields" ], + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/TextFields/examples/TextFieldStatesViewController.m b/components/TextFields/examples/TextFieldStatesViewController.m index f709e9209a1..c67080f161b 100644 --- a/components/TextFields/examples/TextFieldStatesViewController.m +++ b/components/TextFields/examples/TextFieldStatesViewController.m @@ -193,17 +193,13 @@ - (void)setupScrollView { constraintsWithVisualFormat:@"V:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; CGFloat marginOffset = 16; UIEdgeInsets margins = UIEdgeInsetsMake(0, marginOffset, 0, marginOffset); @@ -249,9 +245,9 @@ @implementation TextFieldStatesViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"States" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Text Field", @"States" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/TextFields/examples/TextFieldsTableViewExample.m b/components/TextFields/examples/TextFieldsTableViewExample.m index 23b1647ee23..7ab53adb462 100644 --- a/components/TextFields/examples/TextFieldsTableViewExample.m +++ b/components/TextFields/examples/TextFieldsTableViewExample.m @@ -23,9 +23,10 @@ @interface TextFieldTableViewCell : UITableViewCell @end -@interface TextFieldsTableViewExample : UIViewController +@interface TextFieldsTableViewExample + : UIViewController -@property(nonatomic, strong) NSMutableArray *strings; +@property(nonatomic, strong) NSMutableArray *strings; @property(nonatomic, strong) UITableView *tableView; @end @@ -39,7 +40,8 @@ - (void)viewDidLoad { self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.estimatedRowHeight = 82; self.tableView.dataSource = self; - [self.tableView registerClass:[TextFieldTableViewCell class] forCellReuseIdentifier:TSTTextFieldTableViewCellIdentifier]; + [self.tableView registerClass:[TextFieldTableViewCell class] + forCellReuseIdentifier:TSTTextFieldTableViewCellIdentifier]; self.tableView.translatesAutoresizingMaskIntoConstraints = NO; [self.view addSubview:self.tableView]; @@ -48,12 +50,13 @@ - (void)viewDidLoad { [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; if (@available(iOS 11.0, *)) { - [self.tableView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = YES; + [self.tableView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor] + .active = YES; } else { - [self.tableView.topAnchor constraintEqualToAnchor:self.topLayoutGuide.bottomAnchor].active = YES; + [self.tableView.topAnchor constraintEqualToAnchor:self.topLayoutGuide.bottomAnchor].active = + YES; } - [self.tableView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = YES; [self.tableView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES; @@ -64,10 +67,12 @@ - (void)viewDidLoad { #pragma mark - UITableViewDataSource -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TSTTextFieldTableViewCellIdentifier]; +- (UITableViewCell *)tableView:(UITableView *)tableView + cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = + [tableView dequeueReusableCellWithIdentifier:TSTTextFieldTableViewCellIdentifier]; if ([cell isKindOfClass:[TextFieldTableViewCell class]]) { - TextFieldTableViewCell *textFieldCell = (TextFieldTableViewCell*)cell; + TextFieldTableViewCell *textFieldCell = (TextFieldTableViewCell *)cell; textFieldCell.textField.tag = indexPath.row; textFieldCell.textField.delegate = self; @@ -76,7 +81,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N NSString *string = self.strings[indexPath.row]; textFieldCell.textFieldController.textInput.text = string; } - textFieldCell.textFieldController.placeholderText = [NSString stringWithFormat:@"TextField #%lu", (long)indexPath.row]; + textFieldCell.textFieldController.placeholderText = + [NSString stringWithFormat:@"TextField #%lu", (long)indexPath.row]; } return cell; @@ -113,9 +119,9 @@ @implementation TextFieldsTableViewExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"Table View" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Text Field", @"Table View" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } @@ -123,7 +129,8 @@ + (NSDictionary *)catalogMetadata { @implementation TextFieldTableViewCell -- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { +- (instancetype)initWithStyle:(UITableViewCellStyle)style + reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.textField = [[MDCTextField alloc] initWithFrame:CGRectZero]; @@ -132,8 +139,10 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr [self.textField.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES; [self.textField.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES; - [self.textField.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:8].active = YES; - [self.textField.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-8].active = YES; + [self.textField.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:8].active = + YES; + [self.textField.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-8].active = + YES; _textFieldController = [[MDCTextInputControllerFilled alloc] initWithTextInput:self.textField]; } diff --git a/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.m b/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.m index db50b34521e..7a3f243989c 100644 --- a/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.m +++ b/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.m @@ -32,17 +32,13 @@ - (void)setupScrollView { constraintsWithVisualFormat:@"V:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics:nil - views:@{ - @"scrollView" : self.scrollView - }]]; + views:@{@"scrollView" : self.scrollView}]]; CGFloat marginOffset = 16; UIEdgeInsets margins = UIEdgeInsetsMake(0, marginOffset, 0, marginOffset); @@ -63,9 +59,9 @@ @implementation TextFieldControllerStylesExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"Controller Styles" ], - @"primaryDemo": @NO, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Text Field", @"Controller Styles" ], + @"primaryDemo" : @NO, + @"presentable" : @YES, }; } diff --git a/components/TextFields/examples/supplemental/TextFieldInterfaceBuilderExampleSupplemental.m b/components/TextFields/examples/supplemental/TextFieldInterfaceBuilderExampleSupplemental.m index fc682b55f09..6b34832ad91 100644 --- a/components/TextFields/examples/supplemental/TextFieldInterfaceBuilderExampleSupplemental.m +++ b/components/TextFields/examples/supplemental/TextFieldInterfaceBuilderExampleSupplemental.m @@ -26,10 +26,10 @@ @implementation TextFieldInterfaceBuilderExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"Storyboard" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"TextFieldInterfaceBuilderExample" + @"breadcrumbs" : @[ @"Text Field", @"Storyboard" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"TextFieldInterfaceBuilderExample" }; } @@ -47,10 +47,10 @@ @implementation TextFieldInterfaceBuilderLegacyExample (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Text Field", @"[Legacy] Storyboard" ], - @"primaryDemo": @NO, - @"presentable": @NO, - @"storyboardName": @"TextFieldInterfaceBuilderLegacyExample" + @"breadcrumbs" : @[ @"Text Field", @"[Legacy] Storyboard" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, + @"storyboardName" : @"TextFieldInterfaceBuilderLegacyExample" }; } diff --git a/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.m b/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.m index 752260a9097..d3c2bf3f2dd 100644 --- a/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.m +++ b/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.m @@ -48,4 +48,3 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme } @end - diff --git a/components/TextFields/src/ColorThemer/MDCOutlinedTextFieldColorThemer.m b/components/TextFields/src/ColorThemer/MDCOutlinedTextFieldColorThemer.m index 575205c7c6e..a27908f2e93 100644 --- a/components/TextFields/src/ColorThemer/MDCOutlinedTextFieldColorThemer.m +++ b/components/TextFields/src/ColorThemer/MDCOutlinedTextFieldColorThemer.m @@ -38,18 +38,17 @@ + (void)applySemanticColorScheme:(id)colorScheme [colorScheme.onSurfaceColor colorWithAlphaComponent:kOutlinedTextFieldDisabledAlpha]; if ([textInputController isKindOfClass:[MDCTextInputControllerBase class]]) { - MDCTextInputControllerBase *baseController = - (MDCTextInputControllerBase *)textInputController; + MDCTextInputControllerBase *baseController = (MDCTextInputControllerBase *)textInputController; baseController.textInputClearButtonTintColor = [colorScheme.onSurfaceColor colorWithAlphaComponent:kOutlinedTextFieldIconAlpha]; } if ([textInputController - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { id textInputControllerFloatingPlaceholder = - (id)textInputController; + (id)textInputController; if ([textInputControllerFloatingPlaceholder - respondsToSelector:@selector(setFloatingPlaceholderNormalColor:)]) { + respondsToSelector:@selector(setFloatingPlaceholderNormalColor:)]) { textInputControllerFloatingPlaceholder.floatingPlaceholderNormalColor = onSurfaceOpacity; textInputControllerFloatingPlaceholder.floatingPlaceholderActiveColor = [colorScheme.primaryColor colorWithAlphaComponent:kOutlinedTextFieldActiveAlpha]; diff --git a/components/TextFields/src/ColorThemer/MDCTextFieldColorThemer.m b/components/TextFields/src/ColorThemer/MDCTextFieldColorThemer.m index 16d43b30c49..a83e1112b01 100644 --- a/components/TextFields/src/ColorThemer/MDCTextFieldColorThemer.m +++ b/components/TextFields/src/ColorThemer/MDCTextFieldColorThemer.m @@ -20,7 +20,7 @@ @implementation MDCTextFieldColorThemer + (void)applyColorScheme:(id)colorScheme - toTextInputController:(id)textInputController { + toTextInputController:(id)textInputController { textInputController.activeColor = colorScheme.primaryColor; if ([textInputController conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { @@ -90,7 +90,7 @@ + (void)applySemanticColorScheme:(nonnull id)colorScheme #pragma clang diagnostic ignored "-Wobjc-method-access" #endif + (void)applySemanticColorScheme:(id)colorScheme -toAllTextInputControllersOfClass:(Class)textInputControllerClass { + toAllTextInputControllersOfClass:(Class)textInputControllerClass { UIColor *onSurface87Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.87]; UIColor *onSurface60Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.60]; [textInputControllerClass setActiveColorDefault:colorScheme.primaryColor]; diff --git a/components/TextFields/src/FontThemer/MDCTextFieldFontThemer.m b/components/TextFields/src/FontThemer/MDCTextFieldFontThemer.m index 6576e7b2625..501bbb218b6 100644 --- a/components/TextFields/src/FontThemer/MDCTextFieldFontThemer.m +++ b/components/TextFields/src/FontThemer/MDCTextFieldFontThemer.m @@ -20,25 +20,24 @@ @implementation MDCTextFieldFontThemer + (void)applyFontScheme:(id)fontScheme - toTextInputController:(id)textInputController { + toTextInputController:(id)textInputController { textInputController.inlinePlaceholderFont = fontScheme.body1; textInputController.leadingUnderlineLabelFont = fontScheme.caption; textInputController.trailingUnderlineLabelFont = fontScheme.caption; if ([textInputController - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { id textInputControllerFloatingPlaceholder = (id)textInputController; if (!fontScheme.body1 || !fontScheme.caption || fontScheme.caption.pointSize <= 0) { [textInputControllerFloatingPlaceholder setFloatingPlaceholderScaleDefault:0]; } else { textInputControllerFloatingPlaceholder.floatingPlaceholderScale = - [NSNumber numberWithDouble:fontScheme.caption.pointSize/fontScheme.body1.pointSize]; + [NSNumber numberWithDouble:fontScheme.caption.pointSize / fontScheme.body1.pointSize]; } } } -+ (void)applyFontScheme:(id)fontScheme - toTextField:(MDCTextField *)textField { ++ (void)applyFontScheme:(id)fontScheme toTextField:(MDCTextField *)textField { textField.font = fontScheme.body1; textField.placeholderLabel.font = fontScheme.body1; textField.leadingUnderlineLabel.font = fontScheme.caption; @@ -52,18 +51,18 @@ + (void)applyFontScheme:(id)fontScheme #pragma clang diagnostic ignored "-Wobjc-method-access" #endif + (void)applyFontScheme:(id)fontScheme -toAllTextInputControllersOfClass:(Class)textInputControllerClass { + toAllTextInputControllersOfClass:(Class)textInputControllerClass { [textInputControllerClass setInlinePlaceholderFontDefault:fontScheme.body1]; [textInputControllerClass setTrailingUnderlineLabelFontDefault:fontScheme.caption]; [textInputControllerClass setLeadingUnderlineLabelFontDefault:fontScheme.caption]; if ([textInputControllerClass - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { Class textInputControllerFloatingPlaceholderClass = (Class)textInputControllerClass; if (!fontScheme.body1 || !fontScheme.caption || fontScheme.caption.pointSize <= 0) { [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderScaleDefault:0.75]; } else { - CGFloat scale = fontScheme.caption.pointSize/fontScheme.body1.pointSize; + CGFloat scale = fontScheme.caption.pointSize / fontScheme.body1.pointSize; [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderScaleDefault:scale]; } } @@ -72,5 +71,4 @@ + (void)applyFontScheme:(id)fontScheme #pragma clang diagnostic pop #endif - @end diff --git a/components/TextFields/src/MDCMultilineTextField.m b/components/TextFields/src/MDCMultilineTextField.m index f3fa2f2c823..9f7ad830ac5 100644 --- a/components/TextFields/src/MDCMultilineTextField.m +++ b/components/TextFields/src/MDCMultilineTextField.m @@ -723,8 +723,8 @@ - (void)textViewDidChange:(__unused NSNotification *)note { CGSize currentSize = self.bounds.size; CGSize requiredSize = [self sizeThatFits:CGSizeMake(currentSize.width, CGFLOAT_MAX)]; if (currentSize.height != requiredSize.height && self.textView.delegate && - [self.layoutDelegate - respondsToSelector:@selector(multilineTextField:didChangeContentSize:)]) { + [self.layoutDelegate respondsToSelector:@selector(multilineTextField: + didChangeContentSize:)]) { id delegate = (id)self.layoutDelegate; [delegate multilineTextField:self didChangeContentSize:requiredSize]; diff --git a/components/TextFields/src/MDCTextField.m b/components/TextFields/src/MDCTextField.m index d71304f9833..dfef4df8ebe 100644 --- a/components/TextFields/src/MDCTextField.m +++ b/components/TextFields/src/MDCTextField.m @@ -221,7 +221,9 @@ - (void)updateInputLayoutStrut { self.inputLayoutStrut.text = self.text; UIEdgeInsets insets = [self textInsets]; - self.inputLayoutStrut.frame = CGRectMake(insets.left, insets.top, CGRectGetWidth(self.bounds) - insets.right, self.inputLayoutStrut.intrinsicContentSize.height); + self.inputLayoutStrut.frame = + CGRectMake(insets.left, insets.top, CGRectGetWidth(self.bounds) - insets.right, + self.inputLayoutStrut.intrinsicContentSize.height); } #pragma mark - Applying Color @@ -468,8 +470,8 @@ - (void)setAttributedText:(NSAttributedString *)attributedText { if (!self.isFirstResponder) { [[NSNotificationCenter defaultCenter] - postNotificationName:MDCTextFieldTextDidSetTextNotification - object:self]; + postNotificationName:MDCTextFieldTextDidSetTextNotification + object:self]; } } @@ -606,10 +608,10 @@ - (CGRect)editingRectForBounds:(CGRect)bounds { editingRect = MDFRectFlippedHorizontally(editingRect, CGRectGetWidth(bounds)); } - if ([self.fundament.positioningDelegate - respondsToSelector:@selector(editingRectForBounds:defaultRect:)]) { - editingRect = - [self.fundament.positioningDelegate editingRectForBounds:bounds defaultRect:editingRect]; + if ([self.fundament.positioningDelegate respondsToSelector:@selector(editingRectForBounds: + defaultRect:)]) { + editingRect = [self.fundament.positioningDelegate editingRectForBounds:bounds + defaultRect:editingRect]; } return editingRect; @@ -626,16 +628,16 @@ - (CGRect)leftViewRectForBounds:(CGRect)bounds { if ((self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) && - [self.positioningDelegate - respondsToSelector:@selector(trailingViewRectForBounds:defaultRect:)]) { - leftViewRect = - [self.positioningDelegate trailingViewRectForBounds:bounds defaultRect:leftViewRect]; + [self.positioningDelegate respondsToSelector:@selector(trailingViewRectForBounds: + defaultRect:)]) { + leftViewRect = [self.positioningDelegate trailingViewRectForBounds:bounds + defaultRect:leftViewRect]; } else if ((self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionLeftToRight) && - [self.positioningDelegate - respondsToSelector:@selector(leadingViewRectForBounds:defaultRect:)]) { - leftViewRect = - [self.positioningDelegate leadingViewRectForBounds:bounds defaultRect:leftViewRect]; + [self.positioningDelegate respondsToSelector:@selector(leadingViewRectForBounds: + defaultRect:)]) { + leftViewRect = [self.positioningDelegate leadingViewRectForBounds:bounds + defaultRect:leftViewRect]; } return leftViewRect; @@ -648,16 +650,16 @@ - (CGRect)rightViewRectForBounds:(CGRect)bounds { if ((self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) && - [self.positioningDelegate - respondsToSelector:@selector(leadingViewRectForBounds:defaultRect:)]) { - rightViewRect = - [self.positioningDelegate leadingViewRectForBounds:bounds defaultRect:rightViewRect]; + [self.positioningDelegate respondsToSelector:@selector(leadingViewRectForBounds: + defaultRect:)]) { + rightViewRect = [self.positioningDelegate leadingViewRectForBounds:bounds + defaultRect:rightViewRect]; } else if ((self.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionLeftToRight) && - [self.positioningDelegate - respondsToSelector:@selector(trailingViewRectForBounds:defaultRect:)]) { - rightViewRect = - [self.positioningDelegate trailingViewRectForBounds:bounds defaultRect:rightViewRect]; + [self.positioningDelegate respondsToSelector:@selector(trailingViewRectForBounds: + defaultRect:)]) { + rightViewRect = [self.positioningDelegate trailingViewRectForBounds:bounds + defaultRect:rightViewRect]; } return rightViewRect; } diff --git a/components/TextFields/src/MDCTextInputControllerBase.m b/components/TextFields/src/MDCTextInputControllerBase.m index 09a26c39977..7509918cb81 100644 --- a/components/TextFields/src/MDCTextInputControllerBase.m +++ b/components/TextFields/src/MDCTextInputControllerBase.m @@ -393,7 +393,7 @@ - (void)updateLeadingUnderlineLabel { : self.leadingUnderlineLabelTextColor; } -#pragma mark - TextInput Customization +#pragma mark - TextInput Customization - (void)updateTextInput { UIFont *font = self.textInputFont; @@ -416,22 +416,19 @@ - (void)updatePlaceholder { placeHolderFont = [placeHolderFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; - } // Aside from not wanting to kick off extra work for setting a font that hasn't changed, we use // this custom equality check to prevent an edge case that caused a 1 pixel change in width even // when the important parts of the new font were the same as the existing font. - if (![self.textInput.placeholderLabel.font mdc_isSimplyEqual:placeHolderFont]){ + if (![self.textInput.placeholderLabel.font mdc_isSimplyEqual:placeHolderFont]) { self.textInput.placeholderLabel.font = placeHolderFont; } UIColor *placeholderColor; if ([self isPlaceholderUp]) { - UIColor *nonErrorColor = - self.textInput.isEditing - ? self.floatingPlaceholderActiveColor - : self.floatingPlaceholderNormalColor; + UIColor *nonErrorColor = self.textInput.isEditing ? self.floatingPlaceholderActiveColor + : self.floatingPlaceholderNormalColor; placeholderColor = (self.isDisplayingCharacterCountError || self.isDisplayingErrorText) ? self.errorColor : nonErrorColor; @@ -503,8 +500,8 @@ - (void)updatePlaceholderAnimationConstraints:(BOOL)isToUp { // See MDCTextInputController.h. UIEdgeInsets insets = self.textInput.textInsets; - CGFloat leadingConstant = - [self floatingPlaceholderAnimationConstraintLeadingConstant:insets offset:offset]; + CGFloat leadingConstant = [self floatingPlaceholderAnimationConstraintLeadingConstant:insets + offset:offset]; if (!self.placeholderAnimationConstraintLeading) { self.placeholderAnimationConstraintLeading = [NSLayoutConstraint constraintWithItem:self.textInput.placeholderLabel @@ -529,8 +526,8 @@ - (void)updatePlaceholderAnimationConstraints:(BOOL)isToUp { } self.placeholderAnimationConstraintTop.constant = offset.vertical; - CGFloat trailingConstant = - [self floatingPlaceholderAnimationConstraintTrailingConstant:insets offset:offset]; + CGFloat trailingConstant = [self floatingPlaceholderAnimationConstraintTrailingConstant:insets + offset:offset]; if (!self.placeholderAnimationConstraintTrailing) { self.placeholderAnimationConstraintTrailing = [NSLayoutConstraint constraintWithItem:self.textInput.placeholderLabel @@ -568,10 +565,10 @@ - (BOOL)needsUpdatePlaceholderAnimationConstraintsToUp { UIOffset offset = [self floatingPlaceholderOffset]; - CGFloat leadingConstant = - [self floatingPlaceholderAnimationConstraintLeadingConstant:insets offset:offset]; - CGFloat trailingConstant = - [self floatingPlaceholderAnimationConstraintTrailingConstant:insets offset:offset]; + CGFloat leadingConstant = [self floatingPlaceholderAnimationConstraintLeadingConstant:insets + offset:offset]; + CGFloat trailingConstant = [self floatingPlaceholderAnimationConstraintTrailingConstant:insets + offset:offset]; return self.placeholderAnimationConstraintLeading.constant != leadingConstant && self.placeholderAnimationConstraintTrailing.constant != trailingConstant; @@ -669,9 +666,8 @@ - (void)updateTrailingUnderlineLabel { UIFont *font = self.trailingUnderlineLabelFont; if (self.mdc_adjustsFontForContentSizeCategory) { // TODO: (#4331) This needs to be converted to the new text scheme. - font = - [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleCaption - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + font = [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleCaption + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } self.textInput.trailingUnderlineLabel.font = font; } @@ -819,8 +815,7 @@ - (UIColor *)disabledColor { - (void)setDisabledColor:(UIColor *)disabledColor { if (_disabledColor != disabledColor) { - _disabledColor = disabledColor ? disabledColor - : [self class].disabledColorDefault; + _disabledColor = disabledColor ? disabledColor : [self class].disabledColorDefault; [self updateLayout]; } } @@ -852,7 +847,7 @@ - (void)setErrorAccessibilityValue:(NSString *)errorAccessibilityValue { _errorAccessibilityValue = [errorAccessibilityValue copy]; } --(void)setHelperAccessibilityLabel:(NSString *)helperAccessibilityLabel { +- (void)setHelperAccessibilityLabel:(NSString *)helperAccessibilityLabel { _helperAccessibilityLabel = [helperAccessibilityLabel copy]; if ([self.textInput.leadingUnderlineLabel.text isEqualToString:self.helperText]) { self.textInput.leadingUnderlineLabel.accessibilityLabel = _helperAccessibilityLabel; @@ -905,7 +900,7 @@ - (void)setExpandsOnOverflow:(BOOL)expandsOnOverflow { } - (UIColor *)floatingPlaceholderActiveColor { return _floatingPlaceholderActiveColor ? _floatingPlaceholderActiveColor - : [self class].floatingPlaceholderActiveColorDefault; + : [self class].floatingPlaceholderActiveColorDefault; } - (void)setFloatingPlaceholderActiveColor:(UIColor *)floatingPlaceholderActiveColor { @@ -924,8 +919,8 @@ + (UIColor *)floatingPlaceholderActiveColorDefault { + (void)setFloatingPlaceholderActiveColorDefault:(UIColor *)floatingPlaceholderActiveColorDefault { _floatingPlaceholderActiveColorDefault = floatingPlaceholderActiveColorDefault - ? floatingPlaceholderActiveColorDefault - : [self class].activeColorDefault; + ? floatingPlaceholderActiveColorDefault + : [self class].activeColorDefault; } - (UIColor *)floatingPlaceholderNormalColor { @@ -1210,7 +1205,7 @@ + (UIFont *)textInputFontDefault { } + (void)setTextInputFontDefault:(UIFont *)textInputFontDefault { - _textInputFontDefault = textInputFontDefault; + _textInputFontDefault = textInputFontDefault; } - (UIColor *)textInputClearButtonTintColor { @@ -1276,7 +1271,7 @@ + (UIColor *)trailingUnderlineLabelTextColorDefault { } + (void)setTrailingUnderlineLabelTextColorDefault: - (UIColor *)trailingUnderlineLabelTextColorDefault { + (UIColor *)trailingUnderlineLabelTextColorDefault { _trailingUnderlineLabelTextColorDefault = trailingUnderlineLabelTextColorDefault ? trailingUnderlineLabelTextColorDefault @@ -1590,7 +1585,7 @@ - (void)setErrorText:(NSString *)errorText self.textInput.leadingUnderlineLabel); } --(void)setHelperText:(NSString *)helperText +- (void)setHelperText:(NSString *)helperText helperAccessibilityLabel:(NSString *)helperAccessibilityLabel { self.helperText = helperText; self.helperAccessibilityLabel = helperAccessibilityLabel; @@ -1624,7 +1619,7 @@ + (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { } + (void)setMdc_adjustsFontForContentSizeCategoryDefault: - (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { + (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { _mdc_adjustsFontForContentSizeCategoryDefault = mdc_adjustsFontForContentSizeCategoryDefault; } diff --git a/components/TextFields/src/MDCTextInputControllerFullWidth.m b/components/TextFields/src/MDCTextInputControllerFullWidth.m index a72147db272..3d894df10ac 100644 --- a/components/TextFields/src/MDCTextInputControllerFullWidth.m +++ b/components/TextFields/src/MDCTextInputControllerFullWidth.m @@ -255,15 +255,14 @@ - (void)setCharacterCountMax:(NSUInteger)characterCountMax { } } -#pragma mark - TextInput Customization +#pragma mark - TextInput Customization - (void)updateTextInput { UIFont *font = self.textInputFont; if (self.mdc_adjustsFontForContentSizeCategory) { // TODO: (#4331) This needs to be converted to the new text scheme. - font = - [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + font = [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } self.textInput.font = font; } @@ -284,7 +283,6 @@ - (void)updatePlaceholder { placeHolderFont = [placeHolderFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1 scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; - } self.textInput.placeholderLabel.font = placeHolderFont; @@ -302,9 +300,8 @@ - (void)updateTrailingUnderlineLabel { UIFont *font = self.trailingUnderlineLabelFont; if (self.mdc_adjustsFontForContentSizeCategory) { // TODO: (#4331) This needs to be converted to the new text scheme. - font = - [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleCaption - scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; + font = [font mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleCaption + scaledForDynamicType:_mdc_adjustsFontForContentSizeCategory]; } self.textInput.trailingUnderlineLabel.font = font; } @@ -429,7 +426,7 @@ - (void)setErrorAccessibilityValue:(NSString *)errorAccessibilityValue { _errorAccessibilityValue = [errorAccessibilityValue copy]; } --(void)setHelperAccessibilityLabel:(NSString *)helperAccessibilityLabel { +- (void)setHelperAccessibilityLabel:(NSString *)helperAccessibilityLabel { _helperAccessibilityLabel = [helperAccessibilityLabel copy]; if ([self.textInput.leadingUnderlineLabel.text isEqualToString:self.helperText]) { self.textInput.leadingUnderlineLabel.accessibilityLabel = _helperAccessibilityLabel; @@ -576,7 +573,7 @@ + (UIColor *)leadingUnderlineLabelTextColorDefault { } + (void)setLeadingUnderlineLabelTextColorDefault: - (__unused UIColor *)leadingUnderlineLabelTextColorDefault { + (__unused UIColor *)leadingUnderlineLabelTextColorDefault { // Not implemented. Leading underline label is always clear. } @@ -664,23 +661,23 @@ + (void)setTextInputFontDefault:(UIFont *)textInputFontDefault { } - (UIColor *)textInputClearButtonTintColor { - if (_textInputClearButtonTintColor) { - return _textInputClearButtonTintColor; - } - return [self class].textInputClearButtonTintColorDefault ?: self.textInput.clearButton.tintColor; + if (_textInputClearButtonTintColor) { + return _textInputClearButtonTintColor; + } + return [self class].textInputClearButtonTintColorDefault ?: self.textInput.clearButton.tintColor; } - (void)setTextInputClearButtonTintColor:(UIColor *)textInputClearButtonTintColor { - _textInputClearButtonTintColor = textInputClearButtonTintColor; - _textInput.clearButton.tintColor = _textInputClearButtonTintColor; + _textInputClearButtonTintColor = textInputClearButtonTintColor; + _textInput.clearButton.tintColor = _textInputClearButtonTintColor; } + (UIColor *)textInputClearButtonTintColorDefault { - return _textInputClearButtonTintColorDefault; + return _textInputClearButtonTintColorDefault; } + (void)setTextInputClearButtonTintColorDefault:(UIColor *)textInputClearButtonTintColorDefault { - _textInputClearButtonTintColorDefault = textInputClearButtonTintColorDefault; + _textInputClearButtonTintColorDefault = textInputClearButtonTintColorDefault; } - (UIFont *)trailingUnderlineLabelFont { @@ -726,7 +723,7 @@ + (UIColor *)trailingUnderlineLabelTextColorDefault { } + (void)setTrailingUnderlineLabelTextColorDefault: - (UIColor *)trailingUnderlineLabelTextColorDefault { + (UIColor *)trailingUnderlineLabelTextColorDefault { _trailingUnderlineLabelTextColorDefault = trailingUnderlineLabelTextColorDefault ? trailingUnderlineLabelTextColorDefault @@ -1003,9 +1000,7 @@ - (UIEdgeInsets)textInsets:(__unused UIEdgeInsets)defaultInsets { CGRect charCountRect = [[self characterCountText] boundingRectWithSize:self.textInput.bounds.size options:NSStringDrawingUsesLineFragmentOrigin - attributes:@{ - NSFontAttributeName : self.textInput.trailingUnderlineLabel.font - } + attributes:@{NSFontAttributeName : self.textInput.trailingUnderlineLabel.font} context:nil]; textInsets.right += MDCCeil(CGRectGetWidth(charCountRect)); } @@ -1197,7 +1192,7 @@ + (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { } + (void)setMdc_adjustsFontForContentSizeCategoryDefault: - (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { + (BOOL)mdc_adjustsFontForContentSizeCategoryDefault { _mdc_adjustsFontForContentSizeCategoryDefault = mdc_adjustsFontForContentSizeCategoryDefault; } diff --git a/components/TextFields/src/MDCTextInputControllerLegacyDefault.m b/components/TextFields/src/MDCTextInputControllerLegacyDefault.m index 1f571bd26ee..108aaa9a934 100644 --- a/components/TextFields/src/MDCTextInputControllerLegacyDefault.m +++ b/components/TextFields/src/MDCTextInputControllerLegacyDefault.m @@ -134,9 +134,9 @@ - (UIEdgeInsets)textInsets:(UIEdgeInsets)defaultInsets { } textInsets.top = MDCTextInputControllerLegacyDefaultVerticalPadding + - MDCRint(self.textInput.placeholderLabel.font.lineHeight * - (CGFloat)self.floatingPlaceholderScale.floatValue) + - MDCTextInputControllerLegacyDefaultVerticalHalfPadding; + MDCRint(self.textInput.placeholderLabel.font.lineHeight * + (CGFloat)self.floatingPlaceholderScale.floatValue) + + MDCTextInputControllerLegacyDefaultVerticalHalfPadding; return textInsets; } @@ -158,7 +158,7 @@ - (UIOffset)floatingPlaceholderOffset { CGFloat placeholderWidth = [self.textInput.placeholderLabel systemLayoutSizeFittingSize:UILayoutFittingCompressedSize] - .width; + .width; if (placeholderWidth > placeholderMaxWidth) { placeholderWidth = placeholderMaxWidth; } diff --git a/components/TextFields/src/MDCTextInputControllerLegacyFullWidth.m b/components/TextFields/src/MDCTextInputControllerLegacyFullWidth.m index e9193b4cb13..369191f6da9 100644 --- a/components/TextFields/src/MDCTextInputControllerLegacyFullWidth.m +++ b/components/TextFields/src/MDCTextInputControllerLegacyFullWidth.m @@ -34,7 +34,6 @@ - (void)setupInput; @end @implementation MDCTextInputControllerLegacyFullWidth - - (void)setupInput { [super setupInput]; if (!self.textInput) { diff --git a/components/TextFields/src/TypographyThemer/MDCTextFieldTypographyThemer.m b/components/TextFields/src/TypographyThemer/MDCTextFieldTypographyThemer.m index a520a9d2bcc..12be26d15ae 100644 --- a/components/TextFields/src/TypographyThemer/MDCTextFieldTypographyThemer.m +++ b/components/TextFields/src/TypographyThemer/MDCTextFieldTypographyThemer.m @@ -22,7 +22,7 @@ + (void)applyTypographyScheme:(id)typographyScheme textInputController.leadingUnderlineLabelFont = typographyScheme.caption; textInputController.trailingUnderlineLabelFont = typographyScheme.caption; if ([textInputController - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { id textInputControllerFloatingPlaceholder = (id)textInputController; @@ -30,7 +30,7 @@ + (void)applyTypographyScheme:(id)typographyScheme if (typographyScheme.caption.pointSize <= 0) { textInputControllerFloatingPlaceholder.floatingPlaceholderScale = nil; } else { - double ratio = typographyScheme.caption.pointSize/typographyScheme.subtitle1.pointSize; + double ratio = typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize; textInputControllerFloatingPlaceholder.floatingPlaceholderScale = [NSNumber numberWithDouble:ratio]; } @@ -52,19 +52,19 @@ + (void)applyTypographyScheme:(id)typographyScheme #pragma clang diagnostic ignored "-Wobjc-method-access" #endif + (void)applyTypographyScheme:(id)typographyScheme - toAllTextInputControllersOfClass:(Class)textInputControllerClass { + toAllTextInputControllersOfClass:(Class)textInputControllerClass { [textInputControllerClass setInlinePlaceholderFontDefault:typographyScheme.subtitle1]; [textInputControllerClass setTrailingUnderlineLabelFontDefault:typographyScheme.caption]; [textInputControllerClass setLeadingUnderlineLabelFontDefault:typographyScheme.caption]; if ([textInputControllerClass - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { Class textInputControllerFloatingPlaceholderClass = (Class)textInputControllerClass; // if caption.pointSize <= 0 there is no meaningful ratio so we fallback to default. - if (typographyScheme.caption.pointSize <= 0) { + if (typographyScheme.caption.pointSize <= 0) { [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderScaleDefault:0]; } else { - CGFloat scale = typographyScheme.caption.pointSize/typographyScheme.subtitle1.pointSize; + CGFloat scale = typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize; [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderScaleDefault:scale]; } } @@ -73,5 +73,4 @@ + (void)applyTypographyScheme:(id)typographyScheme #pragma clang diagnostic pop #endif - @end diff --git a/components/TextFields/src/private/MDCTextInputCommonFundament.m b/components/TextFields/src/private/MDCTextInputCommonFundament.m index d87e1ae7bd2..35ee594a1d5 100644 --- a/components/TextFields/src/private/MDCTextInputCommonFundament.m +++ b/components/TextFields/src/private/MDCTextInputCommonFundament.m @@ -431,17 +431,13 @@ - (void)setupBorder { [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[border]|" options:0 metrics:nil - views:@{ - @"border" : _borderView - }]; + views:@{@"border" : _borderView}]; constraints = [constraints arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[border]|" options:0 metrics:nil - views:@{ - @"border" : _borderView - }]]; + views:@{@"border" : _borderView}]]; for (NSLayoutConstraint *constraint in constraints) { constraint.priority = UILayoutPriorityDefaultLow; } @@ -508,9 +504,8 @@ - (void)updateConstraintsOfInput { #pragma mark - Clear Button Implementation - (void)updateClearButton { - UIImage *image = self.clearButton.currentImage - ? self.clearButton.currentImage - : [self drawnClearButtonImage]; + UIImage *image = + self.clearButton.currentImage ? self.clearButton.currentImage : [self drawnClearButtonImage]; if (![self.clearButton imageForState:UIControlStateNormal]) { [self.clearButton setImage:image forState:UIControlStateNormal]; diff --git a/components/TextFields/tests/snapshot/supplemental/SnapshotFakeMDCTextField.m b/components/TextFields/tests/snapshot/supplemental/SnapshotFakeMDCTextField.m index 513264ece50..6e284a35c1f 100644 --- a/components/TextFields/tests/snapshot/supplemental/SnapshotFakeMDCTextField.m +++ b/components/TextFields/tests/snapshot/supplemental/SnapshotFakeMDCTextField.m @@ -13,8 +13,8 @@ // limitations under the License. #import -#import "SnapshotFakeMDCTextField.h" #import +#import "SnapshotFakeMDCTextField.h" @implementation SnapshotFakeMDCTextField { BOOL _isEditing; diff --git a/components/TextFields/tests/unit/FilledTextFieldColorThemerTests.m b/components/TextFields/tests/unit/FilledTextFieldColorThemerTests.m index 46bb540c519..c8045b467db 100644 --- a/components/TextFields/tests/unit/FilledTextFieldColorThemerTests.m +++ b/components/TextFields/tests/unit/FilledTextFieldColorThemerTests.m @@ -16,8 +16,8 @@ #import "MDCTextInputBorderView.h" #import "MaterialColorScheme.h" -#import "MaterialTextFields.h" #import "MaterialTextFields+ColorThemer.h" +#import "MaterialTextFields.h" @interface FilledTextFieldColorThemerTests : XCTestCase diff --git a/components/TextFields/tests/unit/OutlinedTextFieldColorThemerTests.m b/components/TextFields/tests/unit/OutlinedTextFieldColorThemerTests.m index 7532c6dbf66..87159a86bf1 100644 --- a/components/TextFields/tests/unit/OutlinedTextFieldColorThemerTests.m +++ b/components/TextFields/tests/unit/OutlinedTextFieldColorThemerTests.m @@ -16,8 +16,8 @@ #import "MDCTextInputBorderView.h" #import "MaterialColorScheme.h" -#import "MaterialTextFields.h" #import "MaterialTextFields+ColorThemer.h" +#import "MaterialTextFields.h" @interface OutlinedTextFieldColorThemerTests : XCTestCase diff --git a/components/TextFields/tests/unit/TextFieldColorThemerTests.m b/components/TextFields/tests/unit/TextFieldColorThemerTests.m index 780b003feb4..4179ffe303f 100644 --- a/components/TextFields/tests/unit/TextFieldColorThemerTests.m +++ b/components/TextFields/tests/unit/TextFieldColorThemerTests.m @@ -14,11 +14,11 @@ #import +#import "MDCSemanticColorScheme.h" +#import "MaterialTextFields+ColorThemer.h" #import "MaterialTextFields.h" -#import "MaterialTypographyScheme.h" #import "MaterialThemes.h" -#import "MaterialTextFields+ColorThemer.h" -#import "MDCSemanticColorScheme.h" +#import "MaterialTypographyScheme.h" @interface MDCTextFieldColorThemer (ResetDefaults) @@ -43,7 +43,7 @@ + (void)resetDefaultsForClass:(Class)textInputController [textInputControllerClass setLeadingUnderlineLabelTextColorDefault:nil]; if ([textInputControllerClass - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { Class textInputControllerFloatingPlaceholderClass = (Class)textInputControllerClass; [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderActiveColorDefault:nil]; @@ -62,15 +62,14 @@ @interface TextFieldColorThemerTests : XCTestCase @implementation TextFieldColorThemerTests -- (void)setUp{ +- (void)setUp { [super setUp]; MDCSemanticColorScheme *colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804]; [MDCTextFieldColorThemer applySemanticColorScheme:colorScheme - toAllTextInputControllersOfClass:[MDCTextInputControllerFullWidth class]]; + toAllTextInputControllersOfClass:[MDCTextInputControllerFullWidth class]]; [MDCTextFieldColorThemer applySemanticColorScheme:colorScheme - toAllTextInputControllersOfClass:[MDCTextInputControllerBase class]]; - + toAllTextInputControllersOfClass:[MDCTextInputControllerBase class]]; } - (void)tearDown { @@ -126,9 +125,7 @@ - (void)testInstanceColorValuesAreSet { MDCTextInputControllerFullWidth *fullWidthInputController = [[MDCTextInputControllerFullWidth alloc] initWithTextInput:fullWidthTextField]; - - [MDCTextFieldColorThemer applySemanticColorScheme:colorScheme - toTextInput:textField]; + [MDCTextFieldColorThemer applySemanticColorScheme:colorScheme toTextInput:textField]; XCTAssertEqualObjects(textField.cursorColor, colorScheme.primaryColor); XCTAssertEqualObjects(textField.textColor, onSurface87Opacity); XCTAssertEqualObjects(textField.placeholderLabel.textColor, onSurface60Opacity); @@ -145,7 +142,7 @@ - (void)testInstanceColorValuesAreSet { XCTAssertEqualObjects(baseInputController.leadingUnderlineLabelTextColor, onSurface60Opacity); [MDCTextFieldColorThemer applySemanticColorScheme:colorScheme - toTextInputController:fullWidthInputController]; + toTextInputController:fullWidthInputController]; XCTAssertEqualObjects(fullWidthInputController.errorColor, colorScheme.errorColor); XCTAssertEqualObjects(fullWidthInputController.inlinePlaceholderColor, onSurface60Opacity); XCTAssertEqualObjects(fullWidthInputController.trailingUnderlineLabelTextColor, diff --git a/components/TextFields/tests/unit/TextFieldTypographyThemer.m b/components/TextFields/tests/unit/TextFieldTypographyThemer.m index 503d96116d4..a64efa52578 100644 --- a/components/TextFields/tests/unit/TextFieldTypographyThemer.m +++ b/components/TextFields/tests/unit/TextFieldTypographyThemer.m @@ -14,9 +14,9 @@ #import +#import "MaterialTextFields+TypographyThemer.h" #import "MaterialTextFields.h" #import "MaterialThemes.h" -#import "MaterialTextFields+TypographyThemer.h" @interface MDCTextFieldTypographyThemer (ResetDefaults) @@ -38,7 +38,7 @@ + (void)resetDefaultsForClass:(Class)textInputController [textInputControllerClass setLeadingUnderlineLabelFontDefault:nil]; if ([textInputControllerClass - conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { Class textInputControllerFloatingPlaceholderClass = (Class)textInputControllerClass; [textInputControllerFloatingPlaceholderClass setFloatingPlaceholderScaleDefault:0]; @@ -97,7 +97,7 @@ - (void)testTypographyThemerSetsTheFontsForTextInputControllerFloatingPlaceHolde XCTAssertEqualObjects([MDCTextInputControllerBase inlinePlaceholderFontDefault], typographyScheme.subtitle1); XCTAssertEqual([MDCTextInputControllerBase floatingPlaceholderScaleDefault], - typographyScheme.caption.pointSize/typographyScheme.subtitle1.pointSize); + typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize); } - (void)testTypographyThemerSetsTheFontsForTextInputControllerInstance { @@ -125,7 +125,7 @@ - (void)testTypographyThemerSetsTheFontsForTextInputControllerFloatingPlaceHolde typographyScheme.caption); XCTAssertEqualObjects(floatingInputController.inlinePlaceholderFont, typographyScheme.subtitle1); XCTAssertEqual([floatingInputController.floatingPlaceholderScale doubleValue], - typographyScheme.caption.pointSize/typographyScheme.subtitle1.pointSize); + typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize); } @end diff --git a/components/TextFields/tests/unit/TextFieldsFontThemerTests.m b/components/TextFields/tests/unit/TextFieldsFontThemerTests.m index a63bd88229f..7029140691d 100644 --- a/components/TextFields/tests/unit/TextFieldsFontThemerTests.m +++ b/components/TextFields/tests/unit/TextFieldsFontThemerTests.m @@ -14,9 +14,9 @@ #import +#import "MaterialTextFields+FontThemer.h" #import "MaterialTextFields.h" #import "MaterialThemes.h" -#import "MaterialTextFields+FontThemer.h" @interface TextFieldsFontThemerTests : XCTestCase @@ -77,7 +77,7 @@ - (void)testFontThemerSetsTheFontsForTextInputControllerFloatingPlaceHolderClass XCTAssertEqualObjects([MDCTextInputControllerBase inlinePlaceholderFontDefault], fontScheme.body1); XCTAssertEqual([MDCTextInputControllerBase floatingPlaceholderScaleDefault], - fontScheme.caption.pointSize/fontScheme.body1.pointSize); + fontScheme.caption.pointSize / fontScheme.body1.pointSize); } - (void)testFontThemerSetsTheFontsForTextInputControllerInstance { @@ -105,7 +105,7 @@ - (void)testFontThemerSetsTheFontsForTextInputControllerFloatingPlaceHolderInsta XCTAssertEqualObjects(floatingInputController.leadingUnderlineLabelFont, fontScheme.caption); XCTAssertEqualObjects(floatingInputController.inlinePlaceholderFont, fontScheme.body1); XCTAssertEqual([floatingInputController.floatingPlaceholderScale doubleValue], - fontScheme.caption.pointSize/fontScheme.body1.pointSize); + fontScheme.caption.pointSize / fontScheme.body1.pointSize); } @end diff --git a/components/Themes/tests/unit/MDCBasicColorSchemeTests.m b/components/Themes/tests/unit/MDCBasicColorSchemeTests.m index 13f24c8fdbc..01becc7a659 100644 --- a/components/Themes/tests/unit/MDCBasicColorSchemeTests.m +++ b/components/Themes/tests/unit/MDCBasicColorSchemeTests.m @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - #import #import "MaterialThemes.h" diff --git a/components/Typography/examples/TypographyCustomFontViewController.m b/components/Typography/examples/TypographyCustomFontViewController.m index c76a62718db..f793ce1209f 100644 --- a/components/Typography/examples/TypographyCustomFontViewController.m +++ b/components/Typography/examples/TypographyCustomFontViewController.m @@ -17,145 +17,119 @@ #import "MaterialTypography.h" @implementation TypographyCustomFontViewController { - NSArray *_strings; - NSArray *_styleNames; - NSArray *_styleFonts; - NSArray *_opacities; + NSArray *_strings; + NSArray *_styleNames; + NSArray *_styleFonts; + NSArray *_opacities; } static inline UIFont *customFont(MDCFontTextStyle style) { - UIFontDescriptor *descriptor = [UIFontDescriptor mdc_preferredFontDescriptorForMaterialTextStyle:style]; - descriptor = [descriptor fontDescriptorWithFamily:@"American Typewriter"]; - UIFont *font = [UIFont fontWithDescriptor:descriptor size:descriptor.pointSize]; - return font; + UIFontDescriptor *descriptor = + [UIFontDescriptor mdc_preferredFontDescriptorForMaterialTextStyle:style]; + descriptor = [descriptor fontDescriptorWithFamily:@"American Typewriter"]; + UIFont *font = [UIFont fontWithDescriptor:descriptor size:descriptor.pointSize]; + return font; }; - (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - self.view.backgroundColor = [UIColor whiteColor]; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - - self.tableView.rowHeight = UITableViewAutomaticDimension; - self.tableView.estimatedRowHeight = 50.0; - _strings = @[ - @"ABCDEFGHIJKLMNOPQRSTUVWXYZ", - @"abcdefghijklmnopqrstuvwxyz", - @"0123456789" - ]; - - _styleNames = @[ - // Common UI fonts. - @"Headline Font", - @"Title Font", - @"Subhead Font", - @"Body 2 Font", - @"Body 1 Font", - @"Caption Font", - @"Button Font", - - // Display fonts (extra large fonts) - @"Display 1 Font", - @"Display 2 Font", - @"Display 3 Font", - @"Display 4 Font" - ]; - - _styleFonts = @[ - customFont(MDCFontTextStyleHeadline), - customFont(MDCFontTextStyleTitle), - customFont(MDCFontTextStyleSubheadline), - customFont(MDCFontTextStyleBody2), - customFont(MDCFontTextStyleBody1), - customFont(MDCFontTextStyleCaption), - customFont(MDCFontTextStyleButton), - customFont(MDCFontTextStyleDisplay1), - customFont(MDCFontTextStyleDisplay2), - customFont(MDCFontTextStyleDisplay3), - customFont(MDCFontTextStyleDisplay4) - ]; - - _opacities = @[ - @([MDCTypography headlineFontOpacity]), - @([MDCTypography titleFontOpacity]), - @([MDCTypography subheadFontOpacity]), - @([MDCTypography body2FontOpacity]), - @([MDCTypography body1FontOpacity]), - @([MDCTypography captionFontOpacity]), - @([MDCTypography buttonFontOpacity]), - @([MDCTypography display1FontOpacity]), - @([MDCTypography display2FontOpacity]), - @([MDCTypography display3FontOpacity]), - @([MDCTypography display4FontOpacity]) - ]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(contentSizeCategoryDidChange:) - name:UIContentSizeCategoryDidChangeNotification - object:nil]; + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + self.view.backgroundColor = [UIColor whiteColor]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + + self.tableView.rowHeight = UITableViewAutomaticDimension; + self.tableView.estimatedRowHeight = 50.0; + _strings = @[ @"ABCDEFGHIJKLMNOPQRSTUVWXYZ", @"abcdefghijklmnopqrstuvwxyz", @"0123456789" ]; + + _styleNames = @[ + // Common UI fonts. + @"Headline Font", @"Title Font", @"Subhead Font", @"Body 2 Font", @"Body 1 Font", + @"Caption Font", @"Button Font", + + // Display fonts (extra large fonts) + @"Display 1 Font", @"Display 2 Font", @"Display 3 Font", @"Display 4 Font" + ]; + + _styleFonts = @[ + customFont(MDCFontTextStyleHeadline), customFont(MDCFontTextStyleTitle), + customFont(MDCFontTextStyleSubheadline), customFont(MDCFontTextStyleBody2), + customFont(MDCFontTextStyleBody1), customFont(MDCFontTextStyleCaption), + customFont(MDCFontTextStyleButton), customFont(MDCFontTextStyleDisplay1), + customFont(MDCFontTextStyleDisplay2), customFont(MDCFontTextStyleDisplay3), + customFont(MDCFontTextStyleDisplay4) + ]; + + _opacities = @[ + @([MDCTypography headlineFontOpacity]), @([MDCTypography titleFontOpacity]), + @([MDCTypography subheadFontOpacity]), @([MDCTypography body2FontOpacity]), + @([MDCTypography body1FontOpacity]), @([MDCTypography captionFontOpacity]), + @([MDCTypography buttonFontOpacity]), @([MDCTypography display1FontOpacity]), + @([MDCTypography display2FontOpacity]), @([MDCTypography display3FontOpacity]), + @([MDCTypography display4FontOpacity]) + ]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(contentSizeCategoryDidChange:) + name:UIContentSizeCategoryDidChangeNotification + object:nil]; } - (void)contentSizeCategoryDidChange:(NSNotification *)notification { - // Update font array to reflect new size category - _styleFonts = @[ - customFont(MDCFontTextStyleHeadline), - customFont(MDCFontTextStyleTitle), - customFont(MDCFontTextStyleSubheadline), - customFont(MDCFontTextStyleBody2), - customFont(MDCFontTextStyleBody1), - customFont(MDCFontTextStyleCaption), - customFont(MDCFontTextStyleButton), - customFont(MDCFontTextStyleDisplay1), - customFont(MDCFontTextStyleDisplay2), - customFont(MDCFontTextStyleDisplay3), - customFont(MDCFontTextStyleDisplay4) - ]; - - [self.tableView reloadData]; + // Update font array to reflect new size category + _styleFonts = @[ + customFont(MDCFontTextStyleHeadline), customFont(MDCFontTextStyleTitle), + customFont(MDCFontTextStyleSubheadline), customFont(MDCFontTextStyleBody2), + customFont(MDCFontTextStyleBody1), customFont(MDCFontTextStyleCaption), + customFont(MDCFontTextStyleButton), customFont(MDCFontTextStyleDisplay1), + customFont(MDCFontTextStyleDisplay2), customFont(MDCFontTextStyleDisplay3), + customFont(MDCFontTextStyleDisplay4) + ]; + + [self.tableView reloadData]; } #pragma mark - UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return _strings.count; + return _strings.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return _styleFonts.count; + return _styleFonts.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle - reuseIdentifier:@"cell"]; - } - cell.textLabel.text = _strings[indexPath.section]; - cell.textLabel.font = _styleFonts[indexPath.row]; - cell.textLabel.alpha = [_opacities[indexPath.row] floatValue]; - cell.textLabel.numberOfLines = 0; - cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping; - - if (cell.textLabel.font.pointSize > 100 && indexPath.section == 0) { - cell.textLabel.text = @"ABCD"; - } - - cell.detailTextLabel.text = _styleNames[indexPath.row]; - cell.detailTextLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; - - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - return cell; + UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle + reuseIdentifier:@"cell"]; + } + cell.textLabel.text = _strings[indexPath.section]; + cell.textLabel.font = _styleFonts[indexPath.row]; + cell.textLabel.alpha = [_opacities[indexPath.row] floatValue]; + cell.textLabel.numberOfLines = 0; + cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping; + + if (cell.textLabel.font.pointSize > 100 && indexPath.section == 0) { + cell.textLabel.text = @"ABCD"; + } + + cell.detailTextLabel.text = _styleNames[indexPath.row]; + cell.detailTextLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; + + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + return cell; } #pragma mark - CatalogByConvention + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Typography and Fonts", @"Custom Font Example" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Typography and Fonts", @"Custom Font Example" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Typography/examples/TypographyMaterialStylesViewController.m b/components/Typography/examples/TypographyMaterialStylesViewController.m index 6e39131707b..9b161fa8461 100644 --- a/components/Typography/examples/TypographyMaterialStylesViewController.m +++ b/components/Typography/examples/TypographyMaterialStylesViewController.m @@ -31,66 +31,50 @@ - (void)viewDidLoad { self.tableView.estimatedRowHeight = 50.0; _strings = @[ - @"Material Design Components", - @"A quick brown fox jumped over the lazy dog.", - @"ABCDEFGHIJKLMNOPQRSTUVWXYZ", - @"abcdefghijklmnopqrstuvwxyz", - @"1234567890", - @"!@#$%^&*()-=_+[]\\;',./<>?:\"" - ]; + @"Material Design Components", @"A quick brown fox jumped over the lazy dog.", + @"ABCDEFGHIJKLMNOPQRSTUVWXYZ", @"abcdefghijklmnopqrstuvwxyz", @"1234567890", + @"!@#$%^&*()-=_+[]\\;',./<>?:\"" + ]; _styleNames = @[ - // Common UI fonts. - @"Headline Font", - @"Headline Font (Dynamic Type-enabled)", - @"Title Font", - @"Title Font (Dynamic Type-enabled)", - @"Subhead Font", - @"Subhead Font (Dynamic Type-enabled)", - @"Body 2 Font", - @"Body 2 Font (Dynamic Type-enabled)", - @"Body 1 Font", - @"Body 1 Font (Dynamic Type-enabled)", - @"Caption Font", - @"Caption Font (Dynamic Type-enabled)", - @"Button Font", - @"Button Font (Dynamic Type-enabled)", - - // Display fonts (extra large fonts) - @"Display 1 Font", - @"Display 1 Font (Dynamic Type-enabled)", - @"Display 2 Font", - @"Display 2 Font (Dynamic Type-enabled)", - @"Display 3 Font", - @"Display 3 Font (Dynamic Type-enabled)", - @"Display 4 Font", - @"Display 4 Font (Dynamic Type-enabled)" - ]; + // Common UI fonts. + @"Headline Font", @"Headline Font (Dynamic Type-enabled)", @"Title Font", + @"Title Font (Dynamic Type-enabled)", @"Subhead Font", @"Subhead Font (Dynamic Type-enabled)", + @"Body 2 Font", @"Body 2 Font (Dynamic Type-enabled)", @"Body 1 Font", + @"Body 1 Font (Dynamic Type-enabled)", @"Caption Font", @"Caption Font (Dynamic Type-enabled)", + @"Button Font", @"Button Font (Dynamic Type-enabled)", + + // Display fonts (extra large fonts) + @"Display 1 Font", @"Display 1 Font (Dynamic Type-enabled)", @"Display 2 Font", + @"Display 2 Font (Dynamic Type-enabled)", @"Display 3 Font", + @"Display 3 Font (Dynamic Type-enabled)", @"Display 4 Font", + @"Display 4 Font (Dynamic Type-enabled)" + ]; _styleFonts = @[ - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleHeadline], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleHeadline], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleTitle], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleTitle], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleSubheadline], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody2], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody2], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody1], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleCaption], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleCaption], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleButton], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleButton], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay1], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay1], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay2], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay2], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay3], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay3], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay4], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay4] - ]; + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleHeadline], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleHeadline], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleTitle], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleTitle], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleSubheadline], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody2], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody2], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody1], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleCaption], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleCaption], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleButton], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleButton], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay1], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay1], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay2], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay2], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay3], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay3], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay4], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay4] + ]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contentSizeCategoryDidChange:) @@ -120,7 +104,7 @@ - (void)viewDidLoad { NSLog(@"UIFontWeightBlack %f", UIFontWeightBlack); UIFont *defaultFont = [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody1]; - NSLog (@"Font Family : %@", defaultFont.familyName); + NSLog(@"Font Family : %@", defaultFont.familyName); } - (void)contentSizeCategoryDidChange:(NSNotification *)notification { @@ -129,29 +113,29 @@ - (void)contentSizeCategoryDidChange:(NSNotification *)notification { // Update font array to reflect new size category _styleFonts = @[ - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleHeadline], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleHeadline], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleTitle], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleTitle], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleSubheadline], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody2], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody2], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody1], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleCaption], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleCaption], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleButton], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleButton], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay1], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay1], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay2], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay2], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay3], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay3], - [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay4], - [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay4] - ]; + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleHeadline], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleHeadline], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleTitle], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleTitle], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleSubheadline], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody2], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody2], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleBody1], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleCaption], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleCaption], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleButton], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleButton], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay1], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay1], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay2], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay2], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay3], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay3], + [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleDisplay4], + [UIFont mdc_preferredFontForMaterialTextStyle:MDCFontTextStyleDisplay4] + ]; [self.tableView reloadData]; } @@ -194,9 +178,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Typography and Fonts", @"Material Font Styles" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Typography and Fonts", @"Material Font Styles" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Typography/examples/TypographySimpleExampleViewController.m b/components/Typography/examples/TypographySimpleExampleViewController.m index f0b4d9dea34..cdb1b30ec1a 100644 --- a/components/Typography/examples/TypographySimpleExampleViewController.m +++ b/components/Typography/examples/TypographySimpleExampleViewController.m @@ -42,9 +42,9 @@ - (void)viewDidLoad { + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Typography and Fonts", @"Read Me Demo" ], - @"primaryDemo": @NO, - @"presentable": @NO, + @"breadcrumbs" : @[ @"Typography and Fonts", @"Read Me Demo" ], + @"primaryDemo" : @NO, + @"presentable" : @NO, }; } diff --git a/components/Typography/src/MDCTypography.m b/components/Typography/src/MDCTypography.m index 530ba8532e9..8343b7f5599 100644 --- a/components/Typography/src/MDCTypography.m +++ b/components/Typography/src/MDCTypography.m @@ -290,7 +290,7 @@ - (UIFont *)boldFontOfSize:(CGFloat)fontSize { } else { font = [UIFont boldSystemFontOfSize:fontSize]; } - #pragma clang diagnostic pop +#pragma clang diagnostic pop [self.fontCache setObject:font forKey:cacheKey]; @@ -319,7 +319,7 @@ - (nullable UIFont *)boldItalicFontOfSize:(CGFloat)fontSize { } UIFont *regular = [self regularFontOfSize:fontSize]; - UIFontDescriptor * _Nullable descriptor = [regular.fontDescriptor + UIFontDescriptor *_Nullable descriptor = [regular.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold | UIFontDescriptorTraitItalic]; if (!descriptor) { return nil; diff --git a/components/Typography/src/UIFontDescriptor+MaterialTypography.m b/components/Typography/src/UIFontDescriptor+MaterialTypography.m index 1992232664e..55611e3ef38 100644 --- a/components/Typography/src/UIFontDescriptor+MaterialTypography.m +++ b/components/Typography/src/UIFontDescriptor+MaterialTypography.m @@ -23,8 +23,8 @@ @implementation UIFontDescriptor (MaterialTypography) + (nonnull UIFontDescriptor *)mdc_fontDescriptorForMaterialTextStyle:(MDCFontTextStyle)style sizeCategory:(NSString *)sizeCategory { // TODO(#1179): We should include our leading and tracking metrics when creating this descriptor. - MDCFontTraits *materialTraits = - [MDCFontTraits traitsForTextStyle:style sizeCategory:sizeCategory]; + MDCFontTraits *materialTraits = [MDCFontTraits traitsForTextStyle:style + sizeCategory:sizeCategory]; // Store the system font family name to ensure that we load the system font. // If we do not explicitly include this UIFontDescriptorFamilyAttribute in the @@ -51,7 +51,7 @@ + (nonnull UIFontDescriptor *)mdc_fontDescriptorForMaterialTextStyle:(MDCFontTex largeSystemFontFamilyName = [largeSystemFont.familyName copy]; }); - NSDictionary *traits = @{ UIFontWeightTrait : @(materialTraits.weight) }; + NSDictionary *traits = @{UIFontWeightTrait : @(materialTraits.weight)}; NSString *fontFamily = materialTraits.pointSize < 19.5 ? smallSystemFontFamilyName : largeSystemFontFamilyName; NSDictionary *attributes = @{ diff --git a/components/Typography/src/private/MDCFontTraits.m b/components/Typography/src/private/MDCFontTraits.m index 507e51078ac..0598681cefa 100644 --- a/components/Typography/src/private/MDCFontTraits.m +++ b/components/Typography/src/private/MDCFontTraits.m @@ -48,24 +48,38 @@ @implementation MDCFontTraits #pragma clang diagnostic ignored "-Wpartial-availability" + (void)initialize { _body1Traits = @{ - UIContentSizeCategoryExtraSmall : - [MDCFontTraits traitsWithPointSize:11 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategorySmall : - [MDCFontTraits traitsWithPointSize:12 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategoryMedium : - [MDCFontTraits traitsWithPointSize:13 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategoryLarge : - [MDCFontTraits traitsWithPointSize:14 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategoryExtraLarge : - [MDCFontTraits traitsWithPointSize:16 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategoryExtraExtraLarge : - [MDCFontTraits traitsWithPointSize:18 weight:UIFontWeightRegular leading:0.0 tracking:0.0], + UIContentSizeCategoryExtraSmall : [MDCFontTraits traitsWithPointSize:11 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], + UIContentSizeCategorySmall : [MDCFontTraits traitsWithPointSize:12 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], + UIContentSizeCategoryMedium : [MDCFontTraits traitsWithPointSize:13 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], + UIContentSizeCategoryLarge : [MDCFontTraits traitsWithPointSize:14 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], + UIContentSizeCategoryExtraLarge : [MDCFontTraits traitsWithPointSize:16 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], + UIContentSizeCategoryExtraExtraLarge : [MDCFontTraits traitsWithPointSize:18 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], UIContentSizeCategoryExtraExtraExtraLarge : [MDCFontTraits traitsWithPointSize:20 weight:UIFontWeightRegular leading:0.0 tracking:0.0], UIContentSizeCategoryAccessibilityMedium : [MDCFontTraits traitsWithPointSize:25 weight:UIFontWeightRegular leading:0.0 tracking:0.0], - UIContentSizeCategoryAccessibilityLarge : - [MDCFontTraits traitsWithPointSize:30 weight:UIFontWeightRegular leading:0.0 tracking:0.0], + UIContentSizeCategoryAccessibilityLarge : [MDCFontTraits traitsWithPointSize:30 + weight:UIFontWeightRegular + leading:0.0 + tracking:0.0], UIContentSizeCategoryAccessibilityExtraLarge : [MDCFontTraits traitsWithPointSize:37 weight:UIFontWeightRegular leading:0.0 tracking:0.0], UIContentSizeCategoryAccessibilityExtraExtraLarge : diff --git a/components/Typography/src/private/UIFont+MaterialTypographyPrivate.m b/components/Typography/src/private/UIFont+MaterialTypographyPrivate.m index ade75e85690..fbabac05330 100644 --- a/components/Typography/src/private/UIFont+MaterialTypographyPrivate.m +++ b/components/Typography/src/private/UIFont+MaterialTypographyPrivate.m @@ -20,7 +20,7 @@ @implementation UIFont (MaterialTypographyPrivate) Returns a string indicating the weight of the font. These weights were added in iOS 8.2. */ + (NSString *)mdc_fontWeightDescription:(CGFloat)weight { -// The UIFontWeight enumeration was added in iOS 8.2 + // The UIFontWeight enumeration was added in iOS 8.2 NSString *description = [NSString stringWithFormat:@"(%.3f)", weight]; #if defined(__IPHONE_8_2) #pragma clang diagnostic push diff --git a/components/Typography/tests/unit/SystemFontLoaderTests.m b/components/Typography/tests/unit/SystemFontLoaderTests.m index f8fca4818b7..99d579fe01f 100644 --- a/components/Typography/tests/unit/SystemFontLoaderTests.m +++ b/components/Typography/tests/unit/SystemFontLoaderTests.m @@ -30,8 +30,8 @@ - (void)testWeights { if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - XCTAssertEqual([fontLoader lightFontOfSize:size], - [UIFont systemFontOfSize:size weight:UIFontWeightLight]); + XCTAssertEqual([fontLoader lightFontOfSize:size], [UIFont systemFontOfSize:size + weight:UIFontWeightLight]); XCTAssertEqual([fontLoader regularFontOfSize:size], [UIFont systemFontOfSize:size weight:UIFontWeightRegular]); XCTAssertEqual([fontLoader mediumFontOfSize:size], @@ -41,11 +41,11 @@ - (void)testWeights { #pragma clang diagnostic pop } else { // Fallback on earlier versions - XCTAssertEqual([fontLoader lightFontOfSize:size], - [UIFont fontWithName:@"HelveticaNeue-Light" size:size]); + XCTAssertEqual([fontLoader lightFontOfSize:size], [UIFont fontWithName:@"HelveticaNeue-Light" + size:size]); XCTAssertEqual([fontLoader regularFontOfSize:size], [UIFont systemFontOfSize:size]); - XCTAssertEqual([fontLoader mediumFontOfSize:size], - [UIFont fontWithName:@"HelveticaNeue-Medium" size:size]); + XCTAssertEqual([fontLoader mediumFontOfSize:size], [UIFont fontWithName:@"HelveticaNeue-Medium" + size:size]); XCTAssertEqual([fontLoader boldFontOfSize:size], [UIFont boldSystemFontOfSize:size]); } UIFontDescriptor *fontDescriptorWithBoldItalic = [[UIFont systemFontOfSize:size].fontDescriptor diff --git a/components/Typography/tests/unit/TypographyTests.m b/components/Typography/tests/unit/TypographyTests.m index dd1f17c3d41..b9472505a04 100644 --- a/components/Typography/tests/unit/TypographyTests.m +++ b/components/Typography/tests/unit/TypographyTests.m @@ -14,8 +14,8 @@ #import -#import "MaterialTypography.h" #import "../../src/private/UIFont+MaterialTypographyPrivate.h" +#import "MaterialTypography.h" static const CGFloat kEpsilon = (CGFloat)0.001; static const CGFloat kOpacityLight = (CGFloat)0.54; @@ -354,7 +354,7 @@ - (void)testFontFamilyMatchesSystemFontFamily { if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - systemFont = [UIFont systemFontOfSize:mdcFont.pointSize weight:UIFontWeightRegular]; + systemFont = [UIFont systemFontOfSize:mdcFont.pointSize weight:UIFontWeightRegular]; } else { systemFont = [UIFont systemFontOfSize:mdcFont.pointSize]; } @@ -385,5 +385,4 @@ - (void)testExtendedDescription { XCTAssertNotNil(fontExtendedDescription); } - @end diff --git a/components/private/Icons/icons/ic_arrow_back/src/MaterialIcons+ic_arrow_back.m b/components/private/Icons/icons/ic_arrow_back/src/MaterialIcons+ic_arrow_back.m index c73626e4095..ebff5b7bd3e 100644 --- a/components/private/Icons/icons/ic_arrow_back/src/MaterialIcons+ic_arrow_back.m +++ b/components/private/Icons/icons/ic_arrow_back/src/MaterialIcons+ic_arrow_back.m @@ -24,8 +24,8 @@ static NSString *__icArrowBackIconName = @"ic_arrow_back_ios"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_arrow_back = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_arrow_back = + 0; @implementation MDCIcons (ic_arrow_back) @@ -46,7 +46,7 @@ + (void)ic_arrow_backUseNewStyle:(BOOL)useNewStyle { + (nullable UIImage *)imageFor_ic_arrow_back { NSBundle *bundle = [self bundleNamed:kBundleName]; return [UIImage imageNamed:__icArrowBackIconName - inBundle:bundle + inBundle:bundle compatibleWithTraitCollection:nil]; } diff --git a/components/private/Icons/icons/ic_check/src/MaterialIcons+ic_check.m b/components/private/Icons/icons/ic_check/src/MaterialIcons+ic_check.m index f1ae0abb271..a0000f03dad 100644 --- a/components/private/Icons/icons/ic_check/src/MaterialIcons+ic_check.m +++ b/components/private/Icons/icons/ic_check/src/MaterialIcons+ic_check.m @@ -31,9 +31,7 @@ + (nonnull NSString *)pathFor_ic_check { + (nullable UIImage *)imageFor_ic_check { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_check_circle/src/MaterialIcons+ic_check_circle.m b/components/private/Icons/icons/ic_check_circle/src/MaterialIcons+ic_check_circle.m index 3d0a227d063..9875ba73ac2 100644 --- a/components/private/Icons/icons/ic_check_circle/src/MaterialIcons+ic_check_circle.m +++ b/components/private/Icons/icons/ic_check_circle/src/MaterialIcons+ic_check_circle.m @@ -21,8 +21,8 @@ static NSString *const kIconName = @"ic_check_circle"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_check_circle = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_check_circle = + 0; @implementation MDCIcons (ic_check_circle) @@ -32,9 +32,7 @@ + (nonnull NSString *)pathFor_ic_check_circle { + (nullable UIImage *)imageFor_ic_check_circle { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.m b/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.m index 0ef8f4d54b8..cef1a08bae5 100644 --- a/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.m +++ b/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.m @@ -21,8 +21,8 @@ static NSString *const kIconName = @"ic_chevron_right"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_chevron_right = 0; +__attribute__(( + visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_chevron_right = 0; @implementation MDCIcons (ic_chevron_right) @@ -32,9 +32,7 @@ + (nonnull NSString *)pathFor_ic_chevron_right { + (nullable UIImage *)imageFor_ic_chevron_right { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.m b/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.m index 54efc82453c..bed0e39b6f3 100644 --- a/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.m +++ b/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.m @@ -23,8 +23,8 @@ static NSString *const kIconName = @"ic_color_lens"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_color_lens = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_color_lens = + 0; @implementation MDCIcons (ic_color_lens) @@ -34,9 +34,7 @@ + (nonnull NSString *)pathFor_ic_color_lens { + (nullable UIImage *)imageFor_ic_color_lens { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.m b/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.m index 8ac930cd356..b45e7a207c6 100644 --- a/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.m +++ b/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.m @@ -23,8 +23,8 @@ static NSString *const kIconName = @"ic_help_outline"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_help_outline = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_help_outline = + 0; @implementation MDCIcons (ic_help_outline) @@ -34,9 +34,7 @@ + (nonnull NSString *)pathFor_ic_help_outline { + (nullable UIImage *)imageFor_ic_help_outline { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.m b/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.m index 53342c03bcc..4ce82ba783e 100644 --- a/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.m +++ b/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.m @@ -31,9 +31,7 @@ + (nonnull NSString *)pathFor_ic_info { + (nullable UIImage *)imageFor_ic_info { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_more_horiz/src/MaterialIcons+ic_more_horiz.m b/components/private/Icons/icons/ic_more_horiz/src/MaterialIcons+ic_more_horiz.m index 227794d5cd2..e49866bf586 100644 --- a/components/private/Icons/icons/ic_more_horiz/src/MaterialIcons+ic_more_horiz.m +++ b/components/private/Icons/icons/ic_more_horiz/src/MaterialIcons+ic_more_horiz.m @@ -23,8 +23,8 @@ static NSString *const kIconName = @"ic_more_horiz"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_more_horiz = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_more_horiz = + 0; @implementation MDCIcons (ic_more_horiz) @@ -34,9 +34,7 @@ + (nonnull NSString *)pathFor_ic_more_horiz { + (nullable UIImage *)imageFor_ic_more_horiz { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_radio_button_unchecked/src/MaterialIcons+ic_radio_button_unchecked.m b/components/private/Icons/icons/ic_radio_button_unchecked/src/MaterialIcons+ic_radio_button_unchecked.m index 4b5cf5b4916..14c6788b322 100644 --- a/components/private/Icons/icons/ic_radio_button_unchecked/src/MaterialIcons+ic_radio_button_unchecked.m +++ b/components/private/Icons/icons/ic_radio_button_unchecked/src/MaterialIcons+ic_radio_button_unchecked.m @@ -21,8 +21,8 @@ static NSString *const kIconName = @"ic_radio_button_unchecked"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_radio_button_unchecked = 0; +__attribute__((visibility( + "default"))) char MDCIconsExportToSuppressLibToolWarning_ic_radio_button_unchecked = 0; @implementation MDCIcons (ic_radio_button_unchecked) @@ -32,9 +32,7 @@ + (nonnull NSString *)pathFor_ic_radio_button_unchecked { + (nullable UIImage *)imageFor_ic_radio_button_unchecked { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_reorder/src/MaterialIcons+ic_reorder.m b/components/private/Icons/icons/ic_reorder/src/MaterialIcons+ic_reorder.m index ab06157ca7f..4ad066ce29c 100644 --- a/components/private/Icons/icons/ic_reorder/src/MaterialIcons+ic_reorder.m +++ b/components/private/Icons/icons/ic_reorder/src/MaterialIcons+ic_reorder.m @@ -31,9 +31,7 @@ + (nonnull NSString *)pathFor_ic_reorder { + (nullable UIImage *)imageFor_ic_reorder { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/Icons/icons/ic_settings/src/MaterialIcons+ic_settings.m b/components/private/Icons/icons/ic_settings/src/MaterialIcons+ic_settings.m index 0dcc54aa4ea..ac1a5a0fdf7 100644 --- a/components/private/Icons/icons/ic_settings/src/MaterialIcons+ic_settings.m +++ b/components/private/Icons/icons/ic_settings/src/MaterialIcons+ic_settings.m @@ -23,8 +23,7 @@ static NSString *const kIconName = @"ic_settings"; // Export a nonsense symbol to suppress a libtool warning when this is linked alone in a static lib. -__attribute__((visibility("default"))) - char MDCIconsExportToSuppressLibToolWarning_ic_settings = 0; +__attribute__((visibility("default"))) char MDCIconsExportToSuppressLibToolWarning_ic_settings = 0; @implementation MDCIcons (ic_settings) @@ -34,9 +33,7 @@ + (nonnull NSString *)pathFor_ic_settings { + (nullable UIImage *)imageFor_ic_settings { NSBundle *bundle = [self bundleNamed:kBundleName]; - return [UIImage imageNamed:kIconName - inBundle:bundle - compatibleWithTraitCollection:nil]; + return [UIImage imageNamed:kIconName inBundle:bundle compatibleWithTraitCollection:nil]; } @end diff --git a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m index b715c7a74e7..e6ea78a784e 100644 --- a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m +++ b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m @@ -157,7 +157,7 @@ static UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCurve ani } + (UIViewAnimationOptions)animationCurveOptionFromKeyboardNotification: - (NSNotification *)notification { + (NSNotification *)notification { if (![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillShowNotification] && ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillHideNotification] && ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillChangeFrameNotification]) { diff --git a/components/private/Math/tests/unit/MDCMathTests.m b/components/private/Math/tests/unit/MDCMathTests.m index 10b92a17f2f..5724459edbe 100644 --- a/components/private/Math/tests/unit/MDCMathTests.m +++ b/components/private/Math/tests/unit/MDCMathTests.m @@ -138,8 +138,8 @@ - (void)testMDCRectAlignScaleNonStandardRectangle { // Standardized: (7.80, -20.29), (10.10, 15.85) CGRect alignedScale1Rect = CGRectMake(7, -21, 11, 17); CGRect alignedScale2Rect = CGRectMake((CGFloat)7.5, (CGFloat)-20.5, (CGFloat)10.5, (CGFloat)16.5); - CGRect alignedScale3Rect = CGRectMake((CGFloat)(23.0 / 3.0), (CGFloat)(-61.0 / 3.0), - (CGFloat)(31.0 / 3.0), 16); + CGRect alignedScale3Rect = + CGRectMake((CGFloat)(23.0 / 3.0), (CGFloat)(-61.0 / 3.0), (CGFloat)(31.0 / 3.0), 16); // Then CGRect outputScale1Rect = MDCRectAlignToScale(misalignedRect, 1); @@ -197,8 +197,8 @@ - (void)testMDCRectAlignScaleZeroScale { CGRect rectangle = CGRectMake((CGFloat)1.1, (CGFloat)2.2, (CGFloat)3.3, (CGFloat)4.4); // Then - XCTAssertTrue(CGRectEqualToRect(MDCRectAlignToScale(rectangle, 0), - MDCRectAlignToScale(rectangle, 1))); + XCTAssertTrue( + CGRectEqualToRect(MDCRectAlignToScale(rectangle, 0), MDCRectAlignToScale(rectangle, 1))); } #pragma mark - MDCPoint @@ -211,12 +211,12 @@ - (void)testMDCPointRoundWithScale { CGPoint alignedScale3Point = CGPointMake((CGFloat)(2.0 / 3.0), (CGFloat)(-4.0 / 3.0)); // Then - XCTAssertTrue(CGPointEqualToPoint(alignedScale1Point, - MDCPointRoundWithScale(misalignedPoint, 1))); - XCTAssertTrue(CGPointEqualToPoint(alignedScale2Point, - MDCPointRoundWithScale(misalignedPoint, 2))); - XCTAssertTrue(CGPointEqualToPoint(alignedScale3Point, - MDCPointRoundWithScale(misalignedPoint, 3))); + XCTAssertTrue( + CGPointEqualToPoint(alignedScale1Point, MDCPointRoundWithScale(misalignedPoint, 1))); + XCTAssertTrue( + CGPointEqualToPoint(alignedScale2Point, MDCPointRoundWithScale(misalignedPoint, 2))); + XCTAssertTrue( + CGPointEqualToPoint(alignedScale3Point, MDCPointRoundWithScale(misalignedPoint, 3))); } - (void)testMDCPointRoundScaleZeroScale { @@ -276,18 +276,15 @@ - (void)testMDCRoundCenterWithBoundsAndScaleRoundingErrors { - (void)testMDCRoundCenterWithBoundsAndScaleZero { // Then - XCTAssertTrue(CGPointEqualToPoint(CGPointZero, - MDCRoundCenterWithBoundsAndScale(CGPointMake(-5, 10), - CGRectMake(0, 0, 20, 20), - 0))); + XCTAssertTrue(CGPointEqualToPoint( + CGPointZero, + MDCRoundCenterWithBoundsAndScale(CGPointMake(-5, 10), CGRectMake(0, 0, 20, 20), 0))); } - (void)testMDCRoundCenterWithBoundsAndScaleNullBounds { // Then - XCTAssertTrue(CGPointEqualToPoint(CGPointZero, - MDCRoundCenterWithBoundsAndScale(CGPointMake(1, 2), - CGRectNull, - 1))); + XCTAssertTrue(CGPointEqualToPoint( + CGPointZero, MDCRoundCenterWithBoundsAndScale(CGPointMake(1, 2), CGRectNull, 1))); } @end diff --git a/components/private/Overlay/src/MDCOverlayObserver.m b/components/private/Overlay/src/MDCOverlayObserver.m index d542328ede6..70b157193aa 100644 --- a/components/private/Overlay/src/MDCOverlayObserver.m +++ b/components/private/Overlay/src/MDCOverlayObserver.m @@ -160,8 +160,8 @@ - (void)handleOverlayChangeNotification:(NSNotification *)note { return; } - NSValue *frame = userInfo[MDCOverlayFrameKey] ? - userInfo[MDCOverlayFrameKey] : [NSValue valueWithCGRect:CGRectNull]; + NSValue *frame = userInfo[MDCOverlayFrameKey] ? userInfo[MDCOverlayFrameKey] + : [NSValue valueWithCGRect:CGRectNull]; NSNumber *duration = userInfo[MDCOverlayTransitionDurationKey]; // Update the overlay frame. @@ -217,10 +217,10 @@ - (NSUInteger)indexOfInvocationForTarget:(id)target action:(SEL)action { return NSNotFound; } - return [invocations indexOfObjectPassingTest: - ^BOOL(NSInvocation *invocation, __unused NSUInteger idx, __unused BOOL *stop) { - return invocation.selector == action; - }]; + return [invocations indexOfObjectPassingTest:^BOOL(NSInvocation *invocation, + __unused NSUInteger idx, __unused BOOL *stop) { + return invocation.selector == action; + }]; } - (void)addTarget:(id)target action:(SEL)action { diff --git a/components/private/ShapeLibrary/src/MDCCutCornerTreatment.m b/components/private/ShapeLibrary/src/MDCCutCornerTreatment.m index 059df054e0e..f5265a1dd44 100644 --- a/components/private/ShapeLibrary/src/MDCCutCornerTreatment.m +++ b/components/private/ShapeLibrary/src/MDCCutCornerTreatment.m @@ -68,4 +68,3 @@ - (NSUInteger)hash { } @end - diff --git a/components/private/ShapeLibrary/src/MDCPillShapeGenerator.m b/components/private/ShapeLibrary/src/MDCPillShapeGenerator.m index ed5ee8b0bd5..e8afb608997 100644 --- a/components/private/ShapeLibrary/src/MDCPillShapeGenerator.m +++ b/components/private/ShapeLibrary/src/MDCPillShapeGenerator.m @@ -16,8 +16,8 @@ #import "MDCPillShapeGenerator.h" -#import "MaterialMath.h" #import "MDCRoundedCornerTreatment.h" +#import "MaterialMath.h" @implementation MDCPillShapeGenerator { MDCRectangleShapeGenerator *_rectangleGenerator; diff --git a/components/private/ShapeLibrary/src/MDCSlantedRectShapeGenerator.m b/components/private/ShapeLibrary/src/MDCSlantedRectShapeGenerator.m index ae1de112c99..9b9a03c6bc9 100644 --- a/components/private/ShapeLibrary/src/MDCSlantedRectShapeGenerator.m +++ b/components/private/ShapeLibrary/src/MDCSlantedRectShapeGenerator.m @@ -38,9 +38,9 @@ - (id)copyWithZone:(NSZone *)__unused zone { - (void)setSlant:(CGFloat)slant { _slant = slant; - _rectangleGenerator.topLeftCornerOffset = CGPointMake( slant, 0); - _rectangleGenerator.topRightCornerOffset = CGPointMake( slant, 0); - _rectangleGenerator.bottomLeftCornerOffset = CGPointMake(-slant, 0); + _rectangleGenerator.topLeftCornerOffset = CGPointMake(slant, 0); + _rectangleGenerator.topRightCornerOffset = CGPointMake(slant, 0); + _rectangleGenerator.bottomLeftCornerOffset = CGPointMake(-slant, 0); _rectangleGenerator.bottomRightCornerOffset = CGPointMake(-slant, 0); } diff --git a/components/private/ShapeLibrary/src/MDCTriangleEdgeTreatment.m b/components/private/ShapeLibrary/src/MDCTriangleEdgeTreatment.m index 012eb67094d..9e345c659e1 100644 --- a/components/private/ShapeLibrary/src/MDCTriangleEdgeTreatment.m +++ b/components/private/ShapeLibrary/src/MDCTriangleEdgeTreatment.m @@ -27,9 +27,9 @@ - (instancetype)initWithSize:(CGFloat)size style:(MDCTriangleEdgeStyle)style { - (MDCPathGenerator *)pathGeneratorForEdgeWithLength:(CGFloat)length { BOOL isCut = (self.style == MDCTriangleEdgeStyleCut); MDCPathGenerator *path = [MDCPathGenerator pathGeneratorWithStartPoint:CGPointZero]; - [path addLineToPoint:CGPointMake(length/2 - _size, 0)]; - [path addLineToPoint:CGPointMake(length/2, isCut ? _size : -_size)]; - [path addLineToPoint:CGPointMake(length/2 + _size, 0)]; + [path addLineToPoint:CGPointMake(length / 2 - _size, 0)]; + [path addLineToPoint:CGPointMake(length / 2, isCut ? _size : -_size)]; + [path addLineToPoint:CGPointMake(length / 2 + _size, 0)]; [path addLineToPoint:CGPointMake(length, 0)]; return path; } diff --git a/components/private/Shapes/src/MDCPathGenerator.m b/components/private/Shapes/src/MDCPathGenerator.m index ce9514ce62e..3d862dc52c1 100644 --- a/components/private/Shapes/src/MDCPathGenerator.m +++ b/components/private/Shapes/src/MDCPathGenerator.m @@ -94,8 +94,8 @@ - (void)addArcWithCenter:(CGPoint)center op.clockwise = clockwise; [_operations addObject:op]; - _endPoint = CGPointMake(center.x + radius * MDCCos(endAngle), - center.y + radius * MDCSin(endAngle)); + _endPoint = + CGPointMake(center.x + radius * MDCCos(endAngle), center.y + radius * MDCSin(endAngle)); } - (void)addArcWithTangentPoint:(CGPoint)tangentPoint @@ -122,8 +122,7 @@ - (void)addCurveWithControlPoint1:(CGPoint)controlPoint1 _endPoint = toPoint; } -- (void)addQuadCurveWithControlPoint:(CGPoint)controlPoint - toPoint:(CGPoint)toPoint { +- (void)addQuadCurveWithControlPoint:(CGPoint)controlPoint toPoint:(CGPoint)toPoint { MDCPathQuadCurveCommand *op = [[MDCPathQuadCurveCommand alloc] init]; op.control = controlPoint; op.end = toPoint; @@ -159,26 +158,15 @@ - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)tr @implementation MDCPathArcCommand - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)transform { - CGPathAddArc(cgPath, - transform, - self.point.x, - self.point.y, - self.radius, - self.startAngle, - self.endAngle, - self.clockwise); + CGPathAddArc(cgPath, transform, self.point.x, self.point.y, self.radius, self.startAngle, + self.endAngle, self.clockwise); } @end @implementation MDCPathArcToCommand - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)transform { - CGPathAddArcToPoint(cgPath, - transform, - self.start.x, - self.start.y, - self.end.x, - self.end.y, + CGPathAddArcToPoint(cgPath, transform, self.start.x, self.start.y, self.end.x, self.end.y, self.radius); } @@ -187,14 +175,8 @@ - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)tr @implementation MDCPathCurveCommand - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)transform { - CGPathAddCurveToPoint(cgPath, - transform, - self.control1.x, - self.control1.y, - self.control2.x, - self.control2.y, - self.end.x, - self.end.y); + CGPathAddCurveToPoint(cgPath, transform, self.control1.x, self.control1.y, self.control2.x, + self.control2.y, self.end.x, self.end.y); } @end @@ -202,11 +184,7 @@ - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)tr @implementation MDCPathQuadCurveCommand - (void)applyToCGPath:(CGMutablePathRef)cgPath transform:(CGAffineTransform *)transform { - CGPathAddQuadCurveToPoint(cgPath, - transform, - self.control.x, - self.control.y, - self.end.x, + CGPathAddQuadCurveToPoint(cgPath, transform, self.control.x, self.control.y, self.end.x, self.end.y); } diff --git a/components/private/Shapes/src/MDCRectangleShapeGenerator.m b/components/private/Shapes/src/MDCRectangleShapeGenerator.m index f7e925f7ce3..ada5c4b97e7 100644 --- a/components/private/Shapes/src/MDCRectangleShapeGenerator.m +++ b/components/private/Shapes/src/MDCRectangleShapeGenerator.m @@ -146,17 +146,17 @@ - (CGPathRef)pathForSize:(CGSize)size { // Create transformation matrices for each corner and edge for (NSInteger i = 0; i < 4; i++) { CGPoint cornerCoords = [self cornerCoordsForPosition:i forViewSize:size]; - CGAffineTransform cornerTransform = CGAffineTransformMakeTranslation(cornerCoords.x, - cornerCoords.y); + CGAffineTransform cornerTransform = + CGAffineTransformMakeTranslation(cornerCoords.x, cornerCoords.y); CGFloat prevEdgeAngle = edgeAngles[(i + 4 - 1) % 4]; // We add 90 degrees (M_PI_2) here because the corner starts rotated from the edge. cornerTransform = CGAffineTransformRotate(cornerTransform, prevEdgeAngle + (CGFloat)M_PI_2); cornerTransforms[i] = cornerTransform; - CGPoint edgeStartPoint = CGPointApplyAffineTransform(cornerPaths[i].endPoint, - cornerTransforms[i]); - CGAffineTransform edgeTransform = CGAffineTransformMakeTranslation(edgeStartPoint.x, - edgeStartPoint.y); + CGPoint edgeStartPoint = + CGPointApplyAffineTransform(cornerPaths[i].endPoint, cornerTransforms[i]); + CGAffineTransform edgeTransform = + CGAffineTransformMakeTranslation(edgeStartPoint.x, edgeStartPoint.y); CGFloat edgeAngle = edgeAngles[i]; edgeTransform = CGAffineTransformRotate(edgeTransform, edgeAngle); edgeTransforms[i] = edgeTransform; @@ -165,17 +165,15 @@ - (CGPathRef)pathForSize:(CGSize)size { // Calculate the length of each edge using the transformed corner paths. for (NSInteger i = 0; i < 4; i++) { NSInteger next = (i + 1) % 4; - CGPoint edgeStartPoint = CGPointApplyAffineTransform(cornerPaths[i].endPoint, - cornerTransforms[i]); - CGPoint edgeEndPoint = CGPointApplyAffineTransform(cornerPaths[next].startPoint, - cornerTransforms[next]); + CGPoint edgeStartPoint = + CGPointApplyAffineTransform(cornerPaths[i].endPoint, cornerTransforms[i]); + CGPoint edgeEndPoint = + CGPointApplyAffineTransform(cornerPaths[next].startPoint, cornerTransforms[next]); edgeLengths[i] = CGPointDistanceToPoint(edgeStartPoint, edgeEndPoint); } // Draw the first corner manually because we have to MoveToPoint to start the path. - CGPathMoveToPoint(path, - &cornerTransforms[0], - cornerPaths[0].startPoint.x, + CGPathMoveToPoint(path, &cornerTransforms[0], cornerPaths[0].startPoint.x, cornerPaths[0].startPoint.y); [cornerPaths[0] appendToCGPath:path transform:&cornerTransforms[0]]; @@ -202,18 +200,19 @@ - (CGPathRef)pathForSize:(CGSize)size { - (CGFloat)angleOfCorner:(MDCShapeCornerPosition)cornerPosition forViewSize:(CGSize)size { CGPoint prevCornerCoord = [self cornerCoordsForPosition:(cornerPosition - 1 + 4) % 4 - forViewSize:size]; + forViewSize:size]; CGPoint nextCornerCoord = [self cornerCoordsForPosition:(cornerPosition + 1) % 4 forViewSize:size]; CGPoint cornerCoord = [self cornerCoordsForPosition:cornerPosition forViewSize:size]; - CGPoint prevVector = CGPointMake(prevCornerCoord.x - cornerCoord.x, - prevCornerCoord.y - cornerCoord.y); - CGPoint nextVector = CGPointMake(nextCornerCoord.x - cornerCoord.x, - nextCornerCoord.y - cornerCoord.y); + CGPoint prevVector = + CGPointMake(prevCornerCoord.x - cornerCoord.x, prevCornerCoord.y - cornerCoord.y); + CGPoint nextVector = + CGPointMake(nextCornerCoord.x - cornerCoord.x, nextCornerCoord.y - cornerCoord.y); CGFloat prevAngle = MDCAtan2(prevVector.y, prevVector.x); CGFloat nextAngle = MDCAtan2(nextVector.y, nextVector.x); CGFloat angle = prevAngle - nextAngle; - if (angle < 0) angle += 2 * M_PI; + if (angle < 0) + angle += 2 * M_PI; return angle; } @@ -223,8 +222,8 @@ - (CGFloat)angleOfEdge:(MDCShapeEdgePosition)edgePosition forViewSize:(CGSize)si CGPoint startCornerCoord = [self cornerCoordsForPosition:startCornerPosition forViewSize:size]; CGPoint endCornerCoord = [self cornerCoordsForPosition:endCornerPosition forViewSize:size]; - CGPoint edgeVector = CGPointMake(endCornerCoord.x - startCornerCoord.x, - endCornerCoord.y - startCornerCoord.y); + CGPoint edgeVector = + CGPointMake(endCornerCoord.x - startCornerCoord.x, endCornerCoord.y - startCornerCoord.y); return MDCAtan2(edgeVector.y, edgeVector.x); } @@ -247,8 +246,7 @@ - (CGPoint)cornerCoordsForPosition:(MDCShapeCornerPosition)cornerPosition break; } - return CGPointMake(offset.x + translation.x, - offset.y + translation.y); + return CGPointMake(offset.x + translation.x, offset.y + translation.y); } @end diff --git a/components/private/ThumbTrack/src/MDCThumbTrack.m b/components/private/ThumbTrack/src/MDCThumbTrack.m index 453ab8b1ba9..42b34a94257 100644 --- a/components/private/ThumbTrack/src/MDCThumbTrack.m +++ b/components/private/ThumbTrack/src/MDCThumbTrack.m @@ -89,8 +89,7 @@ - (void)setActiveDotsSegment:(CGRect)activeDotsSegment { CGFloat newMinX = MAX(0, MIN(1, CGRectGetMinX(activeDotsSegment))); CGFloat newMaxX = MIN(1, MAX(0, CGRectGetMaxX(activeDotsSegment))); - _activeDotsSegment = CGRectMake(newMinX, 0, - (newMaxX - newMinX), 0); + _activeDotsSegment = CGRectMake(newMinX, 0, (newMaxX - newMinX), 0); [self setNeedsDisplay]; } @@ -226,8 +225,8 @@ - (instancetype)initWithFrame:(CGRect)frame onTintColor:(UIColor *)onTintColor { _thumbEnabledColor = onTintColor ?: ThumbEnabledColorDefault(); _trackOnColor = onTintColor ?: TrackOnColorDefault(); _valueLabelBackgroundColor = onTintColor ?: ValueLabelBackgroundColorDefault(); - _touchController.defaultInkView.inkColor = onTintColor ? - [onTintColor colorWithAlphaComponent:kTrackOnAlpha] : InkColorDefault(); + _touchController.defaultInkView.inkColor = + onTintColor ? [onTintColor colorWithAlphaComponent:kTrackOnAlpha] : InkColorDefault(); _clearColor = UIColor.clearColor; _valueLabelTextColor = ValueLabelTextColorDefault(); _trackOnTickColor = UIColor.blackColor; @@ -472,8 +471,8 @@ - (void)setValue:(CGFloat)value CGFloat previousValue = _value; CGFloat newValue = MAX(_minimumValue, MIN(value, _maximumValue)); newValue = [self closestValueToTargetValue:newValue]; - if (newValue != previousValue && - [_delegate respondsToSelector:@selector(thumbTrack:willJumpToValue:)]) { + if (newValue != previousValue && [_delegate respondsToSelector:@selector(thumbTrack: + willJumpToValue:)]) { [self.delegate thumbTrack:self willJumpToValue:newValue]; } _value = newValue; @@ -539,7 +538,7 @@ - (BOOL)inkTouchController:(nonnull __unused MDCInkTouchController *)inkTouchCon #pragma mark - Animation helpers - (CAMediaTimingFunction *)timingFunctionFromUIViewAnimationOptions: - (UIViewAnimationOptions)options { + (UIViewAnimationOptions)options { NSString *name; // It's important to check these in this order, due to their actual values specified in UIView.h: @@ -587,7 +586,7 @@ - (void)updateThumbTrackAnimated:(BOOL)animated [self updateViewsNoAnimation]; BOOL activeSegmentShrinking = MDCFabs(self.value - self.filledTrackAnchorValue) < - MDCFabs(previousValue - self.filledTrackAnchorValue); + MDCFabs(previousValue - self.filledTrackAnchorValue); UIViewAnimationOptions baseAnimationOptions = UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction; @@ -723,7 +722,8 @@ - (void)updateDotsViewActiveSegment { if (!MDCCGFloatEqual(self.maximumValue, self.minimumValue)) { CGFloat relativeAnchorPoint = (self.filledTrackAnchorValue - self.minimumValue) / (self.maximumValue - self.minimumValue); - CGFloat relativeValuePoint = (self.value - self.minimumValue) / (self.maximumValue - self.minimumValue); + CGFloat relativeValuePoint = + (self.value - self.minimumValue) / (self.maximumValue - self.minimumValue); CGFloat activeSegmentWidth = MDCFabs(relativeAnchorPoint - relativeValuePoint); CGFloat activeSegmentOriginX = MIN(relativeAnchorPoint, relativeValuePoint); _discreteDots.activeDotsSegment = CGRectMake(activeSegmentOriginX, 0, activeSegmentWidth, 0); @@ -1201,9 +1201,8 @@ - (void)setValueFromThumbPosition:(CGPoint)position isTap:(BOOL)isTap { completion:^{ MDCThumbTrack *strongSelf = weakSelf; [strongSelf sendDiscreteChangeAction]; - if (strongSelf && - [strongSelf->_delegate - respondsToSelector:@selector(thumbTrack:didAnimateToValue:)]) { + if (strongSelf && [strongSelf->_delegate respondsToSelector:@selector + (thumbTrack:didAnimateToValue:)]) { [strongSelf->_delegate thumbTrack:weakSelf didAnimateToValue:value]; } }]; diff --git a/components/private/UIMetrics/src/MDCLayoutMetrics.m b/components/private/UIMetrics/src/MDCLayoutMetrics.m index b9d5791147e..d37c8363a01 100644 --- a/components/private/UIMetrics/src/MDCLayoutMetrics.m +++ b/components/private/UIMetrics/src/MDCLayoutMetrics.m @@ -26,10 +26,8 @@ static BOOL HasHardwareSafeAreas(void) { if (!hasCheckedForHardwareSafeAreas && [UIApplication mdc_safeSharedApplication].keyWindow) { dispatch_once(&onceToken, ^{ UIEdgeInsets insets = [UIApplication mdc_safeSharedApplication].keyWindow.safeAreaInsets; - hasHardwareSafeAreas = (insets.top > kFixedStatusBarHeightOnPreiPhoneXDevices - || insets.left > 0 - || insets.bottom > 0 - || insets.right > 0); + hasHardwareSafeAreas = (insets.top > kFixedStatusBarHeightOnPreiPhoneXDevices || + insets.left > 0 || insets.bottom > 0 || insets.right > 0); hasCheckedForHardwareSafeAreas = YES; }); diff --git a/components/schemes/Color/src/MDCLegacyColorScheme.m b/components/schemes/Color/src/MDCLegacyColorScheme.m index c53619dba4d..772754e636f 100644 --- a/components/schemes/Color/src/MDCLegacyColorScheme.m +++ b/components/schemes/Color/src/MDCLegacyColorScheme.m @@ -16,12 +16,12 @@ @interface MDCBasicColorScheme () -@property (nonatomic, strong, nonnull) UIColor *primaryColor; -@property (nonatomic, strong, nonnull) UIColor *primaryLightColor; -@property (nonatomic, strong, nonnull) UIColor *primaryDarkColor; -@property (nonatomic, strong, nonnull) UIColor *secondaryColor; -@property (nonatomic, strong, nonnull) UIColor *secondaryLightColor; -@property (nonatomic, strong, nonnull) UIColor *secondaryDarkColor; +@property(nonatomic, strong, nonnull) UIColor *primaryColor; +@property(nonatomic, strong, nonnull) UIColor *primaryLightColor; +@property(nonatomic, strong, nonnull) UIColor *primaryDarkColor; +@property(nonatomic, strong, nonnull) UIColor *secondaryColor; +@property(nonatomic, strong, nonnull) UIColor *secondaryLightColor; +@property(nonatomic, strong, nonnull) UIColor *secondaryDarkColor; @end diff --git a/components/schemes/Color/src/MDCLegacyTonalColorScheme.m b/components/schemes/Color/src/MDCLegacyTonalColorScheme.m index 55b46203656..14f051df681 100644 --- a/components/schemes/Color/src/MDCLegacyTonalColorScheme.m +++ b/components/schemes/Color/src/MDCLegacyTonalColorScheme.m @@ -18,16 +18,16 @@ @interface MDCTonalColorScheme () -@property (nonatomic, strong, nonnull) MDCTonalPalette *primaryTonalPalette; -@property (nonatomic, strong, nonnull) MDCTonalPalette *secondaryTonalPalette; +@property(nonatomic, strong, nonnull) MDCTonalPalette *primaryTonalPalette; +@property(nonatomic, strong, nonnull) MDCTonalPalette *secondaryTonalPalette; @end @implementation MDCTonalColorScheme - (nonnull instancetype)initWithPrimaryTonalPalette:(nonnull MDCTonalPalette *)primaryTonalPalette - secondaryTonalPalette:(nonnull MDCTonalPalette *)secondaryTonalPalette - { + secondaryTonalPalette: + (nonnull MDCTonalPalette *)secondaryTonalPalette { self = [super init]; if (self) { _primaryTonalPalette = primaryTonalPalette; diff --git a/components/schemes/Color/src/MDCLegacyTonalPalette.m b/components/schemes/Color/src/MDCLegacyTonalPalette.m index 9c9df0ebf09..964207397ea 100644 --- a/components/schemes/Color/src/MDCLegacyTonalPalette.m +++ b/components/schemes/Color/src/MDCLegacyTonalPalette.m @@ -16,10 +16,10 @@ @interface MDCTonalPalette () -@property (nonatomic, copy, nonnull) NSArray *colors; -@property (nonatomic) NSUInteger mainColorIndex; -@property (nonatomic) NSUInteger lightColorIndex; -@property (nonatomic) NSUInteger darkColorIndex; +@property(nonatomic, copy, nonnull) NSArray *colors; +@property(nonatomic) NSUInteger mainColorIndex; +@property(nonatomic) NSUInteger lightColorIndex; +@property(nonatomic) NSUInteger darkColorIndex; @end diff --git a/components/schemes/Color/src/MDCSemanticColorScheme.m b/components/schemes/Color/src/MDCSemanticColorScheme.m index 1802962df78..a3edad93456 100644 --- a/components/schemes/Color/src/MDCSemanticColorScheme.m +++ b/components/schemes/Color/src/MDCSemanticColorScheme.m @@ -17,7 +17,8 @@ static UIColor *ColorFromRGB(uint32_t colorValue) { return [UIColor colorWithRed:(CGFloat)(((colorValue >> 16) & 0xFF) / 255.0) green:(CGFloat)(((colorValue >> 8) & 0xFF) / 255.0) - blue:(CGFloat)((colorValue & 0xFF) / 255.0) alpha:1]; + blue:(CGFloat)((colorValue & 0xFF) / 255.0) + alpha:1]; } /** @@ -31,7 +32,7 @@ */ static CGFloat blendColorChannel(CGFloat value, CGFloat bValue, CGFloat alpha, CGFloat bAlpha) { - return ((1 - alpha) * bValue * bAlpha + alpha * value)/(alpha + bAlpha*(1 - alpha)); + return ((1 - alpha) * bValue * bAlpha + alpha * value) / (alpha + bAlpha * (1 - alpha)); } @implementation MDCSemanticColorScheme @@ -70,7 +71,7 @@ + (UIColor *)blendColor:(UIColor *)color withBackgroundColor:(UIColor *)backgrou return [UIColor colorWithRed:blendColorChannel(red, bRed, alpha, bAlpha) green:blendColorChannel(green, bGreen, alpha, bAlpha) blue:blendColorChannel(blue, bBlue, alpha, bAlpha) - alpha:alpha + bAlpha*(1 - alpha)]; + alpha:alpha + bAlpha * (1 - alpha)]; } #pragma mark - NSCopying @@ -92,4 +93,3 @@ - (id)copyWithZone:(NSZone *)zone { } @end - diff --git a/components/schemes/Color/tests/unit/MDCSemanticColorSchemeTests.m b/components/schemes/Color/tests/unit/MDCSemanticColorSchemeTests.m index 9b99faaad55..567fcae904e 100644 --- a/components/schemes/Color/tests/unit/MDCSemanticColorSchemeTests.m +++ b/components/schemes/Color/tests/unit/MDCSemanticColorSchemeTests.m @@ -14,13 +14,14 @@ #import -#import "MaterialColorScheme.h" #import "MDCMath.h" +#import "MaterialColorScheme.h" static UIColor *ColorFromRGB(uint32_t colorValue) { return [[UIColor alloc] initWithRed:(CGFloat)(((colorValue >> 16) & 0xFF) / 255.0) green:(CGFloat)(((colorValue >> 8) & 0xFF) / 255.0) - blue:(CGFloat)((colorValue & 0xFF) / 255.0) alpha:1]; + blue:(CGFloat)((colorValue & 0xFF) / 255.0) + alpha:1]; } @interface MDCSemanticColorSchemeTests : XCTestCase @@ -70,8 +71,8 @@ - (void)testColorMergeForOpaqueColor { UIColor *backgroundColor = [UIColor whiteColor]; UIColor *blendColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]; UIColor *expectedColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertEqualObjects(resultColor, expectedColor); } @@ -82,22 +83,23 @@ - (void)testColorMergeFor50OpacityBlackOnWhite { green:(CGFloat)0.5 blue:(CGFloat)0.5 alpha:1]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertEqualObjects(resultColor, expectedColor); } - (void)testColorMergeFor60GrayOpacityOnWhite { UIColor *backgroundColor = [UIColor whiteColor]; - UIColor *blendColor = - [UIColor colorWithRed:(CGFloat)0.9 green:(CGFloat)0.9 blue:(CGFloat)0.9 alpha:(CGFloat)0.6]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; - UIColor *expectedColor = - [UIColor colorWithRed:(CGFloat)0.94000000000000006 - green:(CGFloat)0.94000000000000006 - blue:(CGFloat)0.94000000000000006 - alpha:(CGFloat)1]; + UIColor *blendColor = [UIColor colorWithRed:(CGFloat)0.9 + green:(CGFloat)0.9 + blue:(CGFloat)0.9 + alpha:(CGFloat)0.6]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; + UIColor *expectedColor = [UIColor colorWithRed:(CGFloat)0.94000000000000006 + green:(CGFloat)0.94000000000000006 + blue:(CGFloat)0.94000000000000006 + alpha:(CGFloat)1]; XCTAssertTrue([self compareColorsWithFloatPrecisionFirstColor:resultColor secondColor:expectedColor]); @@ -110,23 +112,26 @@ - (void)testColorMergeFor50OpacityWhiteOnBlack { green:(CGFloat)0.5 blue:(CGFloat)0.5 alpha:1]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertEqualObjects(resultColor, expectedColor); } - (void)testBasicColorMergeTest { - UIColor *backgroundColor = - [UIColor colorWithRed:(CGFloat)0.4 green:(CGFloat)0.6 blue:(CGFloat)0.9 alpha:(CGFloat)0.8]; - UIColor *blendColor = - [UIColor colorWithRed:(CGFloat)0.1 green:(CGFloat)0.8 blue:(CGFloat)0.8 alpha:(CGFloat)0.2]; - UIColor *expectedColor = - [UIColor colorWithRed:(CGFloat)0.32857142857142863 - green:(CGFloat)0.64761904761904765 - blue:(CGFloat)0.87619047619047618 - alpha:(CGFloat)0.84000000000000008]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *backgroundColor = [UIColor colorWithRed:(CGFloat)0.4 + green:(CGFloat)0.6 + blue:(CGFloat)0.9 + alpha:(CGFloat)0.8]; + UIColor *blendColor = [UIColor colorWithRed:(CGFloat)0.1 + green:(CGFloat)0.8 + blue:(CGFloat)0.8 + alpha:(CGFloat)0.2]; + UIColor *expectedColor = [UIColor colorWithRed:(CGFloat)0.32857142857142863 + green:(CGFloat)0.64761904761904765 + blue:(CGFloat)0.87619047619047618 + alpha:(CGFloat)0.84000000000000008]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertTrue([self compareColorsWithFloatPrecisionFirstColor:resultColor secondColor:expectedColor]); } @@ -136,30 +141,32 @@ - (void)testHBSColorMergeTest { saturation:(CGFloat)0.6 brightness:(CGFloat)0.2 alpha:(CGFloat)0.7]; - UIColor *blendColor = - [UIColor colorWithRed:(CGFloat)0.3 green:(CGFloat)0.3 blue:(CGFloat)0.2 alpha:(CGFloat)0.8]; - UIColor *expectedColor = - [UIColor colorWithRed:(CGFloat)0.27080851063829786 - green:(CGFloat)0.2672340425531915 - blue:(CGFloat)0.20000000000000004 - alpha:(CGFloat)0.93999999999999994]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *blendColor = [UIColor colorWithRed:(CGFloat)0.3 + green:(CGFloat)0.3 + blue:(CGFloat)0.2 + alpha:(CGFloat)0.8]; + UIColor *expectedColor = [UIColor colorWithRed:(CGFloat)0.27080851063829786 + green:(CGFloat)0.2672340425531915 + blue:(CGFloat)0.20000000000000004 + alpha:(CGFloat)0.93999999999999994]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertTrue([self compareColorsWithFloatPrecisionFirstColor:resultColor secondColor:expectedColor]); } - (void)testGrayScaleColorMergeTest { - UIColor *backgroundColor = [UIColor colorWithWhite:(CGFloat)0.3 alpha:(CGFloat)0.8]; - UIColor *blendColor = - [UIColor colorWithRed:(CGFloat)0.9 green:(CGFloat)0.82 blue:(CGFloat)0.1 alpha:(CGFloat)0.6]; - UIColor *expectedColor = - [UIColor colorWithRed:(CGFloat)0.69130434782608696 - green:(CGFloat)0.63913043478260867 - blue:(CGFloat)0.16956521739130434 - alpha:(CGFloat)0.92000000000000004]; - UIColor *resultColor = - [MDCSemanticColorScheme blendColor:blendColor withBackgroundColor:backgroundColor]; + UIColor *backgroundColor = [UIColor colorWithWhite:(CGFloat)0.3 alpha:(CGFloat)0.8]; + UIColor *blendColor = [UIColor colorWithRed:(CGFloat)0.9 + green:(CGFloat)0.82 + blue:(CGFloat)0.1 + alpha:(CGFloat)0.6]; + UIColor *expectedColor = [UIColor colorWithRed:(CGFloat)0.69130434782608696 + green:(CGFloat)0.63913043478260867 + blue:(CGFloat)0.16956521739130434 + alpha:(CGFloat)0.92000000000000004]; + UIColor *resultColor = [MDCSemanticColorScheme blendColor:blendColor + withBackgroundColor:backgroundColor]; XCTAssertTrue([self compareColorsWithFloatPrecisionFirstColor:resultColor secondColor:expectedColor]); } @@ -171,10 +178,8 @@ - (BOOL)compareColorsWithFloatPrecisionFirstColor:(UIColor *)firstColor CGFloat sRed = 0.0, sGreen = 0.0, sBlue = 0.0, sAlpha = 0.0; [secondColor getRed:&sRed green:&sGreen blue:&sBlue alpha:&sAlpha]; - return (MDCCGFloatEqual(fRed, sRed) && - MDCCGFloatEqual(fGreen, sGreen) && - MDCCGFloatEqual(fBlue, sBlue) && - MDCCGFloatEqual(fAlpha, sAlpha)); + return (MDCCGFloatEqual(fRed, sRed) && MDCCGFloatEqual(fGreen, sGreen) && + MDCCGFloatEqual(fBlue, sBlue) && MDCCGFloatEqual(fAlpha, sAlpha)); } - (void)testColorSchemeCopy { diff --git a/components/schemes/Typography/examples/MDCTypographySchemeFontListExampleViewController.m b/components/schemes/Typography/examples/MDCTypographySchemeFontListExampleViewController.m index 5fa8962cd45..51325685866 100644 --- a/components/schemes/Typography/examples/MDCTypographySchemeFontListExampleViewController.m +++ b/components/schemes/Typography/examples/MDCTypographySchemeFontListExampleViewController.m @@ -189,11 +189,11 @@ @implementation MDCTypographySchemeFontListExampleViewController (CatlogByConven + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs": @[ @"Typography", @"TypographyScheme" ], - @"description": @"The Typography component provides methods for displaying text using the " - @"type sizes and opacities from the Material Design specifications.", - @"primaryDemo": @YES, - @"presentable": @YES, + @"breadcrumbs" : @[ @"Typography", @"TypographyScheme" ], + @"description" : @"The Typography component provides methods for displaying text using the " + @"type sizes and opacities from the Material Design specifications.", + @"primaryDemo" : @YES, + @"presentable" : @YES, }; } diff --git a/components/schemes/Typography/src/MDCLegacyFontScheme.m b/components/schemes/Typography/src/MDCLegacyFontScheme.m index 68a391343ad..3a8a137236f 100644 --- a/components/schemes/Typography/src/MDCLegacyFontScheme.m +++ b/components/schemes/Typography/src/MDCLegacyFontScheme.m @@ -14,5 +14,5 @@ #import "MDCLegacyFontScheme.h" -@implementation MDCBasicFontScheme +@implementation MDCBasicFontScheme @end