Skip to content

Commit 800188a

Browse files
author
Robert Moore
authored
{clang-format} Format the components. (#6347)
This is a follow-up to #6027 ``` find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i ```
1 parent 3c94123 commit 800188a

File tree

331 files changed

+6445
-4230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+6445
-4230
lines changed

catalog/MaterialCatalog/MDCCatalogTiles.m

+2,993-572
Large diffs are not rendered by default.

components/ActionSheet/src/MDCActionSheetController.m

+18-19
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ @implementation MDCActionSheetAction
3434
+ (instancetype)actionWithTitle:(NSString *)title
3535
image:(UIImage *)image
3636
handler:(void (^__nullable)(MDCActionSheetAction *action))handler {
37-
return [[MDCActionSheetAction alloc] initWithTitle:title
38-
image:image
39-
handler:handler];
37+
return [[MDCActionSheetAction alloc] initWithTitle:title image:image handler:handler];
4038
}
4139

4240
- (instancetype)initWithTitle:(NSString *)title
@@ -63,7 +61,8 @@ - (id)copyWithZone:(__unused NSZone *)zone {
6361
@end
6462

6563
@interface MDCActionSheetController () <MDCBottomSheetPresentationControllerDelegate,
66-
UITableViewDelegate, UITableViewDataSource>
64+
UITableViewDelegate,
65+
UITableViewDataSource>
6766
@property(nonatomic, strong) UITableView *tableView;
6867
@property(nonatomic, strong) MDCActionSheetHeaderView *header;
6968
@end
@@ -100,8 +99,8 @@ - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message {
10099
super.modalPresentationStyle = UIModalPresentationCustom;
101100
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
102101
_transitionController.trackingScrollView = _tableView;
103-
_tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth
104-
| UIViewAutoresizingFlexibleHeight);
102+
_tableView.autoresizingMask =
103+
(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
105104
_tableView.delegate = self;
106105
_tableView.dataSource = self;
107106
_tableView.estimatedRowHeight = 56;
@@ -211,8 +210,7 @@ - (BOOL)accessibilityPerformEscape {
211210
- (void)preferredContentSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container {
212211
[super preferredContentSizeDidChangeForChildContentContainer:container];
213212

214-
[self.presentationController
215-
preferredContentSizeDidChangeForChildContentContainer:self];
213+
[self.presentationController preferredContentSizeDidChangeForChildContentContainer:self];
216214
}
217215

218216
- (UIScrollView *)trackingScrollView {
@@ -234,7 +232,7 @@ - (void)setDismissOnBackgroundTap:(BOOL)dismissOnBackgroundTap {
234232

235233
/* Disable setter. Always use internal transition controller */
236234
- (void)setTransitioningDelegate:
237-
(__unused id<UIViewControllerTransitioningDelegate>)transitioningDelegate {
235+
(__unused id<UIViewControllerTransitioningDelegate>)transitioningDelegate {
238236
NSAssert(NO, @"MDCActionSheetController.transitioningDelegate cannot be changed.");
239237
return;
240238
}
@@ -255,11 +253,12 @@ - (void)updateTable {
255253
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
256254
MDCActionSheetAction *action = self.actions[indexPath.row];
257255

258-
[self.presentingViewController dismissViewControllerAnimated:YES completion:^(void){
259-
if (action.completionHandler) {
260-
action.completionHandler(action);
261-
}
262-
}];
256+
[self.presentingViewController dismissViewControllerAnimated:YES
257+
completion:^(void) {
258+
if (action.completionHandler) {
259+
action.completionHandler(action);
260+
}
261+
}];
263262
}
264263

265264
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
@@ -364,12 +363,12 @@ - (void)mdc_setAdjustsFontForContentSizeCategory:(BOOL)adjusts {
364363
}
365364

366365
- (void)updateTableFonts {
367-
UIFont *finalActionsFont = _actionFont ?:
368-
[UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
366+
UIFont *finalActionsFont =
367+
_actionFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
369368
if (self.mdc_adjustsFontForContentSizeCategory) {
370-
finalActionsFont =
371-
[finalActionsFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline
372-
scaledForDynamicType:self.mdc_adjustsFontForContentSizeCategory];
369+
finalActionsFont = [finalActionsFont
370+
mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline
371+
scaledForDynamicType:self.mdc_adjustsFontForContentSizeCategory];
373372
}
374373
_actionFont = finalActionsFont;
375374
[self updateTable];

components/ActionSheet/src/private/MDCActionSheetHeaderView.m

+11-11
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ - (void)updateFonts {
152152
}
153153

154154
- (void)updateTitleFont {
155-
UIFont *titleFont = self.titleFont ?:
156-
[UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
155+
UIFont *titleFont =
156+
self.titleFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
157157
if (self.mdc_adjustsFontForContentSizeCategory) {
158158
self.titleLabel.font =
159159
[titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline
@@ -165,8 +165,8 @@ - (void)updateTitleFont {
165165
}
166166

167167
- (void)updateMessageFont {
168-
UIFont *messageFont = self.messageFont ?:
169-
[UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1];
168+
UIFont *messageFont =
169+
self.messageFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleBody1];
170170
if (self.mdc_adjustsFontForContentSizeCategory) {
171171
self.messageLabel.font =
172172
[messageFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleBody1
@@ -181,14 +181,14 @@ - (void)updateMessageFont {
181181
- (void)mdc_setAdjustsFontForContentSizeCategory:(BOOL)adjusts {
182182
_mdc_adjustsFontForContentSizeCategory = adjusts;
183183
if (_mdc_adjustsFontForContentSizeCategory) {
184-
[[NSNotificationCenter defaultCenter] addObserver:self
185-
selector:@selector(updateFonts)
186-
name:UIContentSizeCategoryDidChangeNotification
187-
object:nil];
184+
[[NSNotificationCenter defaultCenter] addObserver:self
185+
selector:@selector(updateFonts)
186+
name:UIContentSizeCategoryDidChangeNotification
187+
object:nil];
188188
} else {
189-
[[NSNotificationCenter defaultCenter] removeObserver:self
190-
name:UIContentSizeCategoryDidChangeNotification
191-
object:nil];
189+
[[NSNotificationCenter defaultCenter] removeObserver:self
190+
name:UIContentSizeCategoryDidChangeNotification
191+
object:nil];
192192
}
193193
[self updateFonts];
194194
}

components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ - (void)setActionFont:(UIFont *)actionFont {
176176
}
177177

178178
- (void)updateTitleFont {
179-
UIFont *titleFont = _actionFont ?:
180-
[UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
179+
UIFont *titleFont =
180+
_actionFont ?: [UIFont mdc_standardFontForMaterialTextStyle:MDCFontTextStyleSubheadline];
181181
if (self.mdc_adjustsFontForContentSizeCategory) {
182182
self.actionLabel.font =
183183
[titleFont mdc_fontSizedForMaterialTextStyle:MDCFontTextStyleSubheadline

components/ActivityIndicator/src/MDCActivityIndicator.m

+40-46
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
#import "MDCActivityIndicator.h"
1616

17-
#import <QuartzCore/QuartzCore.h>
1817
#import <MDFInternationalization/MDFInternationalization.h>
1918
#import <MotionAnimator/MotionAnimator.h>
19+
#import <QuartzCore/QuartzCore.h>
2020

2121
#import "MaterialApplication.h"
2222
#import "MaterialPalettes.h"
23-
#import "private/MDCActivityIndicatorMotionSpec.h"
2423
#import "private/MDCActivityIndicator+Private.h"
24+
#import "private/MDCActivityIndicatorMotionSpec.h"
2525
#import "private/MaterialActivityIndicatorStrings.h"
2626
#import "private/MaterialActivityIndicatorStrings_table.h"
2727

@@ -248,7 +248,7 @@ - (void)startAnimating {
248248
if (!self.window || _backgrounded) {
249249
return;
250250
}
251-
251+
252252
[self actuallyStartAnimating];
253253
}
254254

@@ -289,7 +289,8 @@ - (void)startAnimatingWithTransition:(nonnull MDCActivityIndicatorTransition *)s
289289

290290
[self actuallyStartAnimating];
291291

292-
self.cycleColorsIndex = self.cycleColors.count > 0 ? cycleStartIndex % self.cycleColors.count : 0;
292+
self.cycleColorsIndex =
293+
self.cycleColors.count > 0 ? cycleStartIndex % self.cycleColors.count : 0;
293294
[self applyPropertiesWithoutAnimation:^{
294295
[self updateStrokeColor];
295296
}];
@@ -523,10 +524,8 @@ - (void)setCycleColors:(NSArray<UIColor *> *)cycleColors {
523524
- (void)addStopAnimation {
524525
MDCActivityIndicatorTransition *stopTransition = self.stopTransition;
525526

526-
CGFloat innerRotation =
527-
[[_strokeLayer valueForKeyPath:MDMKeyPathRotation] floatValue];
528-
CGFloat outerRotation =
529-
[[_outerRotationLayer valueForKeyPath:MDMKeyPathRotation] floatValue];
527+
CGFloat innerRotation = [[_strokeLayer valueForKeyPath:MDMKeyPathRotation] floatValue];
528+
CGFloat outerRotation = [[_outerRotationLayer valueForKeyPath:MDMKeyPathRotation] floatValue];
530529
CGFloat totalRotation =
531530
(CGFloat)fmod(innerRotation + outerRotation, 2 * M_PI) / (CGFloat)(2 * M_PI);
532531

@@ -603,27 +602,29 @@ - (void)addStrokeRotationCycle {
603602

604603
[_animator animateWithTiming:timing.outerRotation
605604
toLayer:_outerRotationLayer
606-
withValues:@[@(kOuterRotationIncrement * _cycleCount),
607-
@(kOuterRotationIncrement * (_cycleCount + 1))]
605+
withValues:@[
606+
@(kOuterRotationIncrement * _cycleCount),
607+
@(kOuterRotationIncrement * (_cycleCount + 1))
608+
]
608609
keyPath:MDMKeyPathRotation];
609610

610611
CGFloat startRotation = _cycleCount * (CGFloat)M_PI;
611612
CGFloat endRotation = startRotation + kCycleRotation * (CGFloat)M_PI;
612613
[_animator animateWithTiming:timing.innerRotation
613614
toLayer:_strokeLayer
614-
withValues:@[@(startRotation), @(endRotation)]
615+
withValues:@[ @(startRotation), @(endRotation) ]
615616
keyPath:MDMKeyPathRotation];
616617

617618
[_animator animateWithTiming:timing.strokeStart
618619
toLayer:_strokeLayer
619-
withValues:@[@0, @(kStrokeLength)]
620+
withValues:@[ @0, @(kStrokeLength) ]
620621
keyPath:MDMKeyPathStrokeStart];
621622

622623
// Ensure the stroke never completely disappears on start by animating from non-zero start and
623624
// to a value slightly larger than the strokeStart's final value.
624625
[_animator animateWithTiming:timing.strokeEnd
625626
toLayer:_strokeLayer
626-
withValues:@[@(_minStrokeDifference), @(kStrokeLength + _minStrokeDifference)]
627+
withValues:@[ @(_minStrokeDifference), @(kStrokeLength + _minStrokeDifference) ]
627628
keyPath:MDMKeyPathStrokeEnd];
628629

629630
[CATransaction commit];
@@ -668,8 +669,8 @@ - (void)addTransitionToIndeterminateCycle {
668669
CGFloat pointCycleDuration = (CGFloat)MDCActivityIndicatorMotionSpec.pointCycleDuration;
669670
CGFloat pointCycleMinimumVariableDuration =
670671
(CGFloat)MDCActivityIndicatorMotionSpec.pointCycleMinimumVariableDuration;
671-
CGFloat normalizedDuration = 2 * (targetRotation + _currentProgress) / kSingleCycleRotation *
672-
pointCycleDuration;
672+
CGFloat normalizedDuration =
673+
2 * (targetRotation + _currentProgress) / kSingleCycleRotation * pointCycleDuration;
673674
CGFloat strokeEndTravelDistance = targetRotation - _currentProgress + _minStrokeDifference;
674675
CGFloat totalDistance = targetRotation + strokeEndTravelDistance;
675676
CGFloat strokeStartDuration =
@@ -698,14 +699,14 @@ - (void)addTransitionToIndeterminateCycle {
698699
timing.strokeStart.delay = strokeEndDuration;
699700
[_animator animateWithTiming:timing.strokeStart
700701
toLayer:_strokeLayer
701-
withValues:@[@0, @(targetRotation)]
702+
withValues:@[ @0, @(targetRotation) ]
702703
keyPath:MDMKeyPathStrokeStart];
703704

704705
timing.strokeEnd.duration = strokeEndDuration;
705706
timing.strokeEnd.delay = 0;
706707
[_animator animateWithTiming:timing.strokeEnd
707708
toLayer:_strokeLayer
708-
withValues:@[@(_currentProgress), @(targetRotation + _minStrokeDifference)]
709+
withValues:@[ @(_currentProgress), @(targetRotation + _minStrokeDifference) ]
709710
keyPath:MDMKeyPathStrokeEnd];
710711
}
711712
[CATransaction commit];
@@ -746,7 +747,8 @@ - (void)addTransitionToDeterminateCycle {
746747
[CATransaction setCompletionBlock:^{
747748
[self
748749
strokeRotationCycleFinishedFromState:MDCActivityIndicatorStateTransitionToDeterminate];
749-
if ([self.delegate respondsToSelector:@selector(activityIndicatorModeTransitionDidFinish:)]) {
750+
if ([self.delegate
751+
respondsToSelector:@selector(activityIndicatorModeTransitionDidFinish:)]) {
750752
[self.delegate activityIndicatorModeTransitionDidFinish:self];
751753
}
752754
}];
@@ -763,14 +765,14 @@ - (void)addTransitionToDeterminateCycle {
763765
CGFloat endRotation = startRotation + rotationDelta * 2 * (CGFloat)M_PI;
764766
[_animator animateWithTiming:spec.innerRotation
765767
toLayer:_strokeLayer
766-
withValues:@[@(startRotation), @(endRotation)]
768+
withValues:@[ @(startRotation), @(endRotation) ]
767769
keyPath:MDMKeyPathRotation];
768770

769771
_strokeLayer.strokeStart = 0;
770772

771773
[_animator animateWithTiming:spec.strokeEnd
772774
toLayer:_strokeLayer
773-
withValues:@[@(_minStrokeDifference), @(_currentProgress)]
775+
withValues:@[ @(_minStrokeDifference), @(_currentProgress) ]
774776
keyPath:MDMKeyPathStrokeEnd];
775777
}
776778
[CATransaction commit];
@@ -800,7 +802,7 @@ - (void)addProgressAnimation {
800802

801803
[_animator animateWithTiming:MDCActivityIndicatorMotionSpec.willChangeProgress.strokeEnd
802804
toLayer:_strokeLayer
803-
withValues:@[@(_lastProgress), @(_currentProgress)]
805+
withValues:@[ @(_lastProgress), @(_currentProgress) ]
804806
keyPath:MDMKeyPathStrokeEnd];
805807
}
806808

@@ -912,8 +914,8 @@ - (void)removeAnimations {
912914
[_strokeLayer removeAllAnimations];
913915
[_outerRotationLayer removeAllAnimations];
914916

915-
// Reset current and latest progress, to ensure addProgressAnimationIfRequired adds a progress animation
916-
// when returning from hidden.
917+
// Reset current and latest progress, to ensure addProgressAnimationIfRequired adds a progress
918+
// animation when returning from hidden.
917919
_currentProgress = 0;
918920
_lastProgress = 0;
919921

@@ -931,11 +933,10 @@ + (CGFloat)defaultHeight {
931933
static NSArray<UIColor *> *s_defaultCycleColors;
932934
static dispatch_once_t onceToken;
933935
dispatch_once(&onceToken, ^{
934-
s_defaultCycleColors =
935-
@[ MDCPalette.bluePalette.tint500,
936-
MDCPalette.redPalette.tint500,
937-
MDCPalette.yellowPalette.tint500,
938-
MDCPalette.greenPalette.tint500 ];
936+
s_defaultCycleColors = @[
937+
MDCPalette.bluePalette.tint500, MDCPalette.redPalette.tint500,
938+
MDCPalette.yellowPalette.tint500, MDCPalette.greenPalette.tint500
939+
];
939940
});
940941
return s_defaultCycleColors;
941942
}
@@ -967,7 +968,7 @@ + (NSString *)bundlePathWithName:(NSString *)bundleName {
967968
// not be in the main .app bundle, but rather in a nested framework, so figure out where we live
968969
// and use that as the search location.
969970
NSBundle *bundle = [NSBundle bundleForClass:[MDCActivityIndicator class]];
970-
NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle)resourcePath];
971+
NSString *resourcePath = [(nil == bundle ? [NSBundle mainBundle] : bundle) resourcePath];
971972
return [resourcePath stringByAppendingPathComponent:bundleName];
972973
}
973974

@@ -980,10 +981,8 @@ - (BOOL)isAccessibilityElement {
980981
- (NSString *)defaultAccessibilityLabel {
981982
MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorAccessibilityLabel;
982983
NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
983-
return NSLocalizedStringFromTableInBundle(key,
984-
kMaterialActivityIndicatorStringsTableName,
985-
[[self class] bundle],
986-
@"Activity Indicator");
984+
return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName,
985+
[[self class] bundle], @"Activity Indicator");
987986
}
988987

989988
- (NSString *)accessibilityValue {
@@ -992,29 +991,24 @@ - (NSString *)accessibilityValue {
992991
MaterialActivityIndicatorStringId keyIndex =
993992
kStr_MaterialActivityIndicatorInProgressAccessibilityValue;
994993
NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
995-
return NSLocalizedStringFromTableInBundle(key,
996-
kMaterialActivityIndicatorStringsTableName,
997-
[[self class] bundle],
998-
@"In Progress");
994+
return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName,
995+
[[self class] bundle], @"In Progress");
999996
} else {
1000997
NSUInteger percentage = (int)(self.progress * 100);
1001998
MaterialActivityIndicatorStringId keyIndex =
1002999
kStr_MaterialActivityIndicatorProgressCompletedAccessibilityValue;
10031000
NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
1004-
NSString *localizedString = NSLocalizedStringFromTableInBundle(key,
1005-
kMaterialActivityIndicatorStringsTableName,
1006-
[[self class] bundle],
1007-
@"{percentage} Percent Complete");
1001+
NSString *localizedString = NSLocalizedStringFromTableInBundle(
1002+
key, kMaterialActivityIndicatorStringsTableName, [[self class] bundle],
1003+
@"{percentage} Percent Complete");
10081004
return [NSString localizedStringWithFormat:localizedString, percentage];
10091005
}
10101006
} else {
10111007
MaterialActivityIndicatorStringId keyIndex =
10121008
kStr_MaterialActivityIndicatorProgressHaltedAccessibilityValue;
10131009
NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
1014-
return NSLocalizedStringFromTableInBundle(key,
1015-
kMaterialActivityIndicatorStringsTableName,
1016-
[[self class] bundle],
1017-
@"Progress Halted");
1010+
return NSLocalizedStringFromTableInBundle(key, kMaterialActivityIndicatorStringsTableName,
1011+
[[self class] bundle], @"Progress Halted");
10181012
}
10191013
}
10201014

@@ -1030,6 +1024,6 @@ - (nonnull instancetype)initWithAnimation:(_Nonnull MDCActivityIndicatorAnimatio
10301024
if (self) {
10311025
self.animation = animation;
10321026
}
1033-
return self;
1027+
return self;
10341028
}
10351029
@end

0 commit comments

Comments
 (0)