Skip to content

Commit b64b0ec

Browse files
Jeff Verkoeyenmaterial-automation
authored andcommitted
Internal change
PiperOrigin-RevId: 360230236
1 parent 9926ef2 commit b64b0ec

File tree

8 files changed

+43
-70
lines changed

8 files changed

+43
-70
lines changed

components/FeatureHighlight/src/MDCFeatureHighlightViewController.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ - (void)viewDidLoad {
6565
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
6666
self.featureHighlightView.mdc_adjustsFontForContentSizeCategory =
6767
_mdc_adjustsFontForContentSizeCategory;
68-
if (@available(iOS 10.0, *)) {
69-
self.featureHighlightView.adjustsFontForContentSizeCategory =
70-
_adjustsFontForContentSizeCategory;
71-
}
68+
self.featureHighlightView.adjustsFontForContentSizeCategory = _adjustsFontForContentSizeCategory;
7269
self.featureHighlightView.mdc_legacyFontScaling = _mdc_legacyFontScaling;
7370

7471
__weak MDCFeatureHighlightViewController *weakSelf = self;

components/List/examples/CollectionListCellExampleTypicalUse.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
static NSString *const kExampleDetailText =
2222
@"Pellentesque non quam ornare, porta urna sed, malesuada felis. Praesent at gravida felis, "
2323
"non facilisis enim. Proin dapibus laoreet lorem, in viverra leo dapibus a.";
24-
static const CGFloat kSmallestCellHeight = 40;
25-
static const CGFloat kSmallArbitraryCellWidth = 100;
2624

2725
@implementation CollectionListCellExampleTypicalUse {
2826
NSMutableArray *_content;
@@ -35,11 +33,7 @@ - (instancetype)init {
3533
flowLayout.minimumInteritemSpacing = 0;
3634
flowLayout.minimumLineSpacing = 1;
3735
flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
38-
if (@available(iOS 10.0, *)) {
39-
flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize;
40-
} else {
41-
flowLayout.estimatedItemSize = CGSizeMake(kSmallArbitraryCellWidth, kSmallestCellHeight);
42-
}
36+
flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize;
4337
return [self initWithCollectionViewLayout:flowLayout];
4438
}
4539

components/Tabs/src/private/MDCItemBarCell.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,9 @@ - (void)updateWithItem:(UITabBarItem *)item
228228
self.selectedImage = item.selectedImage;
229229
self.image = item.image;
230230
self.badgeValue = item.badgeValue;
231-
if (@available(iOS 10.0, *)) {
232-
if (item.badgeColor) {
233-
self.style.badgeColor = item.badgeColor;
234-
self.badge.badgeColor = item.badgeColor;
235-
}
231+
if (item.badgeColor) {
232+
self.style.badgeColor = item.badgeColor;
233+
self.badge.badgeColor = item.badgeColor;
236234
}
237235
self.accessibilityIdentifier = item.accessibilityIdentifier;
238236
self.accessibilityLabel = item.accessibilityLabel;

components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,18 @@ - (void)decreaseContentSizeForChildViewController:(UIViewController *)childViewC
131131

132132
- (void)setContentSizeCategory:(UIContentSizeCategory)contentSizeCategory
133133
onChildViewController:(UIViewController *)viewController {
134-
if (@available(iOS 10.0, *)) {
135-
UITraitCollection *contentSizeCategoryTraitCollection =
136-
[UITraitCollection traitCollectionWithPreferredContentSizeCategory:contentSizeCategory];
137-
UITraitCollection *currentTraitCollection = viewController.traitCollection;
138-
NSArray *traitCollections = @[ currentTraitCollection, contentSizeCategoryTraitCollection ];
139-
UITraitCollection *traitCollection =
140-
[UITraitCollection traitCollectionWithTraitsFromCollections:traitCollections];
141-
[self setOverrideTraitCollection:traitCollection forChildViewController:viewController];
142-
[self.view setNeedsLayout];
143-
}
134+
UITraitCollection *contentSizeCategoryTraitCollection =
135+
[UITraitCollection traitCollectionWithPreferredContentSizeCategory:contentSizeCategory];
136+
UITraitCollection *currentTraitCollection = viewController.traitCollection;
137+
NSArray *traitCollections = @[ currentTraitCollection, contentSizeCategoryTraitCollection ];
138+
UITraitCollection *traitCollection =
139+
[UITraitCollection traitCollectionWithTraitsFromCollections:traitCollections];
140+
[self setOverrideTraitCollection:traitCollection forChildViewController:viewController];
141+
[self.view setNeedsLayout];
144142
}
145143

146144
- (UIContentSizeCategory)contentSizeCategoryForViewController:(UIViewController *)viewController {
147-
if (@available(iOS 10.0, *)) {
148-
return viewController.traitCollection.preferredContentSizeCategory;
149-
}
150-
return nil;
145+
return viewController.traitCollection.preferredContentSizeCategory;
151146
}
152147

153148
- (void)setContainerScheme:(id<MDCContainerScheming>)containerScheme {

components/TextControls/examples/supplemental/MDCTextControlContentViewController.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ - (MDCButton *)createContentSizeButtonWithTitle:(NSString *)title selector:(SEL)
144144
[button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
145145
[button applyContainedThemeWithScheme:self.containerScheme];
146146
[button sizeToFit];
147-
button.enabled = NO;
148-
if (@available(iOS 10.0, *)) {
149-
button.enabled = YES;
150-
}
147+
button.enabled = YES;
151148
return button;
152149
}
153150

components/TextControls/examples/supplemental/MDCTextControlTextAreaContentViewController.m

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,18 @@ - (void)resizeScrollViewSubviews {
147147
- (void)enforcePreferredFonts {
148148
[super enforcePreferredFonts];
149149

150-
if (@available(iOS 10.0, *)) {
151-
[self.allTextAreas
152-
enumerateObjectsUsingBlock:^(MDCBaseTextArea *textArea, NSUInteger idx, BOOL *stop) {
153-
textArea.textView.adjustsFontForContentSizeCategory = YES;
154-
textArea.textView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody
155-
compatibleWithTraitCollection:textArea.traitCollection];
156-
textArea.leadingAssistiveLabel.font =
157-
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
158-
compatibleWithTraitCollection:textArea.traitCollection];
159-
textArea.trailingAssistiveLabel.font =
160-
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
161-
compatibleWithTraitCollection:textArea.traitCollection];
162-
}];
163-
}
150+
[self.allTextAreas
151+
enumerateObjectsUsingBlock:^(MDCBaseTextArea *textArea, NSUInteger idx, BOOL *stop) {
152+
textArea.textView.adjustsFontForContentSizeCategory = YES;
153+
textArea.textView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody
154+
compatibleWithTraitCollection:textArea.traitCollection];
155+
textArea.leadingAssistiveLabel.font =
156+
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
157+
compatibleWithTraitCollection:textArea.traitCollection];
158+
textArea.trailingAssistiveLabel.font =
159+
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
160+
compatibleWithTraitCollection:textArea.traitCollection];
161+
}];
164162
}
165163

166164
- (void)handleResignFirstResponderTapped {

components/TextControls/examples/supplemental/MDCTextControlTextFieldContentViewController.m

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,18 @@ - (void)resizeScrollViewSubviews {
172172
- (void)enforcePreferredFonts {
173173
[super enforcePreferredFonts];
174174

175-
if (@available(iOS 10.0, *)) {
176-
[self.allTextFields
177-
enumerateObjectsUsingBlock:^(MDCBaseTextField *textField, NSUInteger idx, BOOL *stop) {
178-
textField.adjustsFontForContentSizeCategory = YES;
179-
textField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody
180-
compatibleWithTraitCollection:textField.traitCollection];
181-
textField.leadingAssistiveLabel.font =
182-
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
183-
compatibleWithTraitCollection:textField.traitCollection];
184-
textField.trailingAssistiveLabel.font =
185-
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
186-
compatibleWithTraitCollection:textField.traitCollection];
187-
}];
188-
}
175+
[self.allTextFields
176+
enumerateObjectsUsingBlock:^(MDCBaseTextField *textField, NSUInteger idx, BOOL *stop) {
177+
textField.adjustsFontForContentSizeCategory = YES;
178+
textField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody
179+
compatibleWithTraitCollection:textField.traitCollection];
180+
textField.leadingAssistiveLabel.font =
181+
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
182+
compatibleWithTraitCollection:textField.traitCollection];
183+
textField.trailingAssistiveLabel.font =
184+
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2
185+
compatibleWithTraitCollection:textField.traitCollection];
186+
}];
189187
}
190188

191189
- (void)handleResignFirstResponderTapped {

components/TextControls/src/BaseTextAreas/MDCBaseTextArea.m

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,10 @@ - (CGFloat)numberOfLinesOfVisibleText {
398398
#pragma mark Dynamic Type
399399

400400
- (void)setAdjustsFontForContentSizeCategory:(BOOL)adjustsFontForContentSizeCategory {
401-
if (@available(iOS 10.0, *)) {
402-
_adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
403-
self.textView.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
404-
self.leadingAssistiveLabel.adjustsFontForContentSizeCategory =
405-
adjustsFontForContentSizeCategory;
406-
self.trailingAssistiveLabel.adjustsFontForContentSizeCategory =
407-
adjustsFontForContentSizeCategory;
408-
}
401+
_adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
402+
self.textView.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
403+
self.leadingAssistiveLabel.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
404+
self.trailingAssistiveLabel.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory;
409405
}
410406

411407
#pragma mark MDCTextControlState

0 commit comments

Comments
 (0)