Skip to content

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Nov 6, 2020
2 parents f971683 + 31b227b commit ddfc3b8
Show file tree
Hide file tree
Showing 33 changed files with 375 additions and 168 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# 119.0.0

This major release removes a deprecated MDCFloatingButton API, deprecates MDCTabBar, and provides
enhancements to MDCButton and Tabs.

## Breaking changes

MDCFloatingButton's `setVisibleAreaInsets:forShape:inMode:` API has been removed. Use
`setCenterVisibleArea:forShape:InMode:` instead.

## New deprecations

MDCTabBar has been deprecated. Please use MDCTabBarView instead.

## New features

MDCFloatingButton now has a `shape` property that can be used to change the button's shape.

MDCButton now has a `visibleAreaLayoutGuide` property that can be used to align content against the
button's visible area using AutoLayout.

## Component changes

### Buttons

* [Add shape API to allow changing FAB's shape after it is initialized.](https://github.com/material-components/material-components-ios/commit/a25c55ee80eb00b633228614cdb5b27ea229b2d5) (Wenyu Zhang)
* [Add visibleAreaLayoutGuide for providing anchors to the visible area when centerVisibleArea is set to YES.](https://github.com/material-components/material-components-ios/commit/0de498c394d21db7fb824b046bf405091fcfbc24) (Yarden Eitan)
* [Apply centerVisibleArea to a FAB with default shape example to reproduce shapeGenerator not getting updated issue on FAB.](https://github.com/material-components/material-components-ios/commit/d40ec950c35324985587f264805eeb72b80da6fd) (Wenyu Zhang)
* [Fix cornerRadius change not triggering the update on shapeGenerator when centerVisibleArea is YES.](https://github.com/material-components/material-components-ios/commit/d4e0da5ce430325e13b1490deac030ce8e7eead0) (Wenyu Zhang)
* [Migrate deprecated visibleAreaInsets API to centerVisibleArea API in FAB typical example.](https://github.com/material-components/material-components-ios/commit/7cdcc53b5b1ac75c6e03094b25aeeb02b16fb5b1) (Wenyu Zhang)
* [Remove deprecated setVisibleAreaInsets:forShape:inMode: API.](https://github.com/material-components/material-components-ios/commit/615f273a419196225007cf0bcef47a478284b377) (Wenyu Zhang)
* [Update note on visibleAreaInsets to indicate it will be deprecated explicitly to prevent future usage.](https://github.com/material-components/material-components-ios/commit/c371dd4169d3400dc37199732aa4fc46cd106225) (Wenyu Zhang)

### Tabs

* [Fallback to scrollable when scrollableCentered is set and VoiceOver is running](https://github.com/material-components/material-components-ios/commit/67e70a63c9fe47a5632e5fdbe83ce2e60ea77ecb) (Andrew Overton)
* [Mark MDCTabBar as deprecated.](https://github.com/material-components/material-components-ios/commit/b5bd0e39417bcecc14cb24a90ae8bf73d358fd4e) (Alyssa Weiss)
* [Update handling of ripple so that, for non scroll layout styles, it shows ripple on touch down rather than touch up.](https://github.com/material-components/material-components-ios/commit/b8dccb0965b97d0799aaae6bb3c45a1f33357641) (Alyssa Weiss)

### TextControls

* [add RTL snapshot tests](https://github.com/material-components/material-components-ios/commit/9e8c6cc75c6d7ec0a9f9ee716d12e608f043e64c) (Andrew Overton)

---

# 118.2.0

In this minor release, we have made several improvements to the Dialogs, Snackbar, and Tabs components. We also improved the Banner component's documentation.
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponents.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb'

Pod::Spec.new do |mdc|
mdc.name = "MaterialComponents"
mdc.version = "118.2.0"
mdc.version = "119.0.0"
mdc.authors = "The Material Components authors."
mdc.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
mdc.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsEarlGreyTests.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsEarlGreyTests"
s.version = "118.2.0"
s.version = "119.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components EarlGrey tests."
s.description = "This spec is made for use in the MDC Catalog."
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsExamples.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsExamples"
s.version = "118.2.0"
s.version = "119.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components examples."
s.description = "This spec is made for use in the MDC Catalog. Used in conjunction with CatalogByConvention we create our Material Catalog."
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsSnapshotTests.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end

Pod::Spec.new do |s|
s.name = "MaterialComponentsSnapshotTests"
s.version = "118.2.0"
s.version = "119.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components snapshot tests."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
118.2.0
119.0.0
4 changes: 2 additions & 2 deletions catalog/MDCCatalog/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>118.2.0</string>
<string>119.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>118.2.0</string>
<string>119.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
Expand Down
4 changes: 2 additions & 2 deletions catalog/MDCDragons/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>118.2.0</string>
<string>119.0.0</string>
<key>CFBundleVersion</key>
<string>118.2.0</string>
<string>119.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion catalog/MaterialCatalog/MaterialCatalog.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialCatalog"
s.version = "118.2.0"
s.version = "119.0.0"
s.summary = "Helper Objective-C classes for the MDC catalog."
s.description = "This spec is made for use in the MDC Catalog."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
20 changes: 17 additions & 3 deletions components/Buttons/examples/FloatingButtonTypicalUseExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,22 @@ - (void)viewDidLoad {
[self.miniFloatingButton setMinimumSize:CGSizeMake(96, 40)
forShape:MDCFloatingButtonShapeMini
inMode:MDCFloatingButtonModeExpanded];
[self.miniFloatingButton setVisibleAreaInsets:UIEdgeInsetsMake(2, 2, 2, 2)
[self.miniFloatingButton setCenterVisibleArea:YES
forShape:MDCFloatingButtonShapeMini
inMode:MDCFloatingButtonModeNormal];
[self.miniFloatingButton setCenterVisibleArea:YES
forShape:MDCFloatingButtonShapeMini
inMode:MDCFloatingButtonModeExpanded];

self.defaultFloatingButton = [[MDCFloatingButton alloc] init];
[self.defaultFloatingButton setImage:plusImage forState:UIControlStateNormal];
self.defaultFloatingButton.accessibilityLabel = kButtonLabel;
[self.defaultFloatingButton setCenterVisibleArea:YES
forShape:MDCFloatingButtonShapeDefault
inMode:MDCFloatingButtonModeNormal];
[self.defaultFloatingButton setCenterVisibleArea:YES
forShape:MDCFloatingButtonShapeDefault
inMode:MDCFloatingButtonModeExpanded];

self.largeIconFloatingButton = [[MDCFloatingButton alloc] init];
[self.largeIconFloatingButton setImage:plusImage36 forState:UIControlStateNormal];
Expand All @@ -90,9 +99,14 @@ - (void)viewDidLayoutSubviews {
[self.largeIconFloatingButton sizeToFit];
[self.defaultFloatingButton sizeToFit];
[self.miniFloatingButton sizeToFit];
// Minimum touch target size (44, 44).
self.miniFloatingButton.frame = CGRectMake(
CGRectGetMinX(self.miniFloatingButton.frame), CGRectGetMinY(self.miniFloatingButton.frame),
MAX(44, CGRectGetWidth(self.miniFloatingButton.frame)),
MAX(44, CGRectGetHeight(self.miniFloatingButton.frame)));

CGFloat totalUsedHeight = self.iPadLabel.intrinsicContentSize.height +
self.miniFloatingButton.intrinsicContentSize.height +
CGRectGetHeight(self.miniFloatingButton.frame) +
self.defaultFloatingButton.intrinsicContentSize.height +
self.largeIconFloatingButton.intrinsicContentSize.height;

Expand All @@ -107,7 +121,7 @@ - (void)viewDidLayoutSubviews {
CGFloat interViewSpacing = MIN(20, remainingMargins / interViewGapCount);
CGFloat viewYOffset = (remainingMargins - interViewSpacing * interViewGapCount) / 2;

CGSize miniFabSize = self.miniFloatingButton.intrinsicContentSize;
CGSize miniFabSize = self.miniFloatingButton.bounds.size;
CGSize defaultFabSize = self.defaultFloatingButton.intrinsicContentSize;
CGSize largeIconFabSize = self.largeIconFloatingButton.intrinsicContentSize;

Expand Down
12 changes: 9 additions & 3 deletions components/Buttons/src/MDCButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
*/
@property(nonatomic, assign) BOOL centerVisibleArea;

/**
The edges of this guide are constrained to equal the edges of the visible area
when @c centerVisibleArea is @c YES.
@note If centerVisibleArea is @c NO then visibleAreaLayoutGuide is nil.
*/
@property(nonatomic, readonly, strong, nullable) UILayoutGuide *visibleAreaLayoutGuide;

/**
The default content edge insets of the button. They are set at initialization time.
*/
Expand Down Expand Up @@ -369,9 +377,7 @@
The button uses this property to determine intrinsicContentSize and sizeThatFits:.
@note This property sets the @c shapeGenerator. Therefore you cannot use both properties
simultaneously. If you do wish to use a custom shape with visibleAreaInsets, please set your own
shapeGenerator that is inset from the frame instead of setting this property directly.
@note This API will be deprecated and removed. Consider using @c centerVisibleArea.
Default is UIEdgeInsetsZero.
*/
Expand Down
38 changes: 36 additions & 2 deletions components/Buttons/src/MDCButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ @interface MDCButton () {
@property(nonatomic, assign) BOOL accessibilityTraitsIncludesButton;
@property(nonatomic, assign) BOOL enableTitleFontForState;
@property(nonatomic, assign) UIEdgeInsets visibleAreaInsets;
@property(nonatomic, strong) UIView *visibleAreaLayoutGuideView;
@property(nonatomic) UIEdgeInsets hitAreaInsets;
@property(nonatomic, assign) UIEdgeInsets currentVisibleAreaInsets;
@end
Expand All @@ -132,6 +133,7 @@ @implementation MDCButton
@synthesize mdc_overrideBaseElevation = _mdc_overrideBaseElevation;
@synthesize mdc_elevationDidChangeBlock = _mdc_elevationDidChangeBlock;
@synthesize visibleAreaInsets = _visibleAreaInsets;
@synthesize visibleAreaLayoutGuide = _visibleAreaLayoutGuide;
@dynamic layer;

+ (Class)layerClass {
Expand Down Expand Up @@ -325,6 +327,10 @@ - (void)layoutSubviews {
[self generateShapeWithCornerRadius:self.layer.cornerRadius
visibleAreaInsets:visibleAreaInsets];
[self configureLayerWithShapeGenerator:shapeGenerator];
if (self.visibleAreaLayoutGuideView) {
self.visibleAreaLayoutGuideView.frame =
UIEdgeInsetsInsetRect(self.bounds, visibleAreaInsets);
}
}
}

Expand Down Expand Up @@ -1146,9 +1152,10 @@ - (void)setCenterVisibleArea:(BOOL)centerVisibleArea {
_cornerRadiusObserverAdded = NO;
}
} else {
UIEdgeInsets visibleAreaInsets = self.visibleAreaInsets;
MDCRectangleShapeGenerator *shapeGenerator =
[self generateShapeWithCornerRadius:self.layer.cornerRadius
visibleAreaInsets:self.visibleAreaInsets];
visibleAreaInsets:visibleAreaInsets];
[self configureLayerWithShapeGenerator:shapeGenerator];

if (!_cornerRadiusObserverAdded) {
Expand Down Expand Up @@ -1215,12 +1222,39 @@ - (UIEdgeInsets)visibleAreaInsets {
return visibleAreaInsets;
}

- (UILayoutGuide *)visibleAreaLayoutGuide {
if (!_visibleAreaLayoutGuide) {
_visibleAreaLayoutGuide = [[UILayoutGuide alloc] init];
[self addLayoutGuide:_visibleAreaLayoutGuide];
_visibleAreaLayoutGuideView = [[UIView alloc] init];
_visibleAreaLayoutGuideView.userInteractionEnabled = NO;
[self insertSubview:_visibleAreaLayoutGuideView atIndex:0];
self.visibleAreaLayoutGuideView.frame =
UIEdgeInsetsInsetRect(self.bounds, self.visibleAreaInsets);

[_visibleAreaLayoutGuide.leftAnchor
constraintEqualToAnchor:_visibleAreaLayoutGuideView.leftAnchor]
.active = YES;
[_visibleAreaLayoutGuide.rightAnchor
constraintEqualToAnchor:_visibleAreaLayoutGuideView.rightAnchor]
.active = YES;
[_visibleAreaLayoutGuide.topAnchor
constraintEqualToAnchor:_visibleAreaLayoutGuideView.topAnchor]
.active = YES;
[_visibleAreaLayoutGuide.bottomAnchor
constraintEqualToAnchor:_visibleAreaLayoutGuideView.bottomAnchor]
.active = YES;
}
return _visibleAreaLayoutGuide;
}

- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
if (context == kKVOContextCornerRadius) {
if (!UIEdgeInsetsEqualToEdgeInsets(self.visibleAreaInsets, UIEdgeInsetsZero) &&
if ((!UIEdgeInsetsEqualToEdgeInsets(self.visibleAreaInsets, UIEdgeInsetsZero) ||
self.centerVisibleArea) &&
self.shapeGenerator) {
MDCRectangleShapeGenerator *shapeGenerator =
[self generateShapeWithCornerRadius:self.layer.cornerRadius
Expand Down
20 changes: 7 additions & 13 deletions components/Buttons/src/MDCFloatingButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ typedef NS_ENUM(NSInteger, MDCFloatingButtonImageLocation) {
*/
@property(nonatomic, assign) MDCFloatingButtonMode mode;

/**
The shape of the floating button.
The default value is decided by the @c -initWithFrame:shape: initializer.
*/
@property(nonatomic, assign) MDCFloatingButtonShape shape;

/**
Changes the mode (with animation, if desired).
Expand Down Expand Up @@ -249,17 +256,4 @@ typedef NS_ENUM(NSInteger, MDCFloatingButtonImageLocation) {
forShape:(MDCFloatingButtonShape)shape
inMode:(MDCFloatingButtonMode)mode;

/**
Sets the @c visibleAreaInsets value when the button has the specified @c shape and @c mode.
@param visibleAreaInsets The insets to the visual representation of the button.
@param shape The floating action button's shape (Default, Mini).
@param mode The floating action button's mode (Normal, Expanded).
*/
- (void)setVisibleAreaInsets:(UIEdgeInsets)visibleAreaInsets
forShape:(MDCFloatingButtonShape)shape
inMode:(MDCFloatingButtonMode)mode
__attribute__((deprecated(
"Consider using setCenterVisibleArea:forShape:InMode: to adjust visible area.")));

@end
Loading

0 comments on commit ddfc3b8

Please sign in to comment.