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
galiak11 committed Nov 13, 2019
2 parents 9a82b0c + 2b07220 commit d8409a3
Show file tree
Hide file tree
Showing 51 changed files with 542 additions and 207 deletions.
85 changes: 85 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@
# 94.1.0

This minor release introduces new APIs to FlexibleHeader and Ripple, and updates the appearance of `MDCSnackbar` to the latest style. The release also includes bug fixes for multiple components.

## New Features

### FlexibleHeader

FlexibleHeader can now inform the receiver that its view's tracking scroll view has changed through the `flexibleHeaderView:didChangeTrackingScrollViewAnimated:` API. Example:

**Swift**

```swift
class MyAnimationDelegate: NSObject, MDCFlexibleHeaderViewAnimationDelegate {
func flexibleHeaderView(_ flexibleHeaderView: MDCFlexibleHeaderView,
didChangeTrackingScrollViewAnimated animated: Bool) {
if animated {
// ...
}
}
```

**Objective-C**

```objc
-(BOOL)flexibleHeaderView:(MDCFlexibleHeaderView *)flexibleHeaderView
didChangeTrackingScrollViewAnimated:(BOOL)animated {
if (animated) {
// ...
}
}
```

Additionally, you can now animate your own changes alongside the default animations of the flexible header, by passing an animation sequence and a completion block to `animateWithAnimations:completion:`. Example:

**Swift**

```swift
myHeaderView.animate(animations: {
scrollView.contentOffset = CGPoint(x: 0, y: -100)
myHeaderView.maximumHeight = 100
})
```

**Objective-C**

```objc
[myHeaderView animate:^{
scrollView.contentOffset = CGPointMake(0, -100.f);
myHeaderView.maximumHeight = 100.f;
}];
```

## Component changes

### ActionSheet

* [Fix crash in example (#8734)](https://github.com/material-components/material-components-ios/commit/762ef5e4840234233a22514cb1eb79553f8df707) (Cody Weaver)
* [Move layout code to `viewDidLayoutSubviews` (#8735)](https://github.com/material-components/material-components-ios/commit/9fc4f0afbc4b6fd11a0620b10905e30f76dc5075) (Cody Weaver)
* [Use anchor-based constraints. (#8731)](https://github.com/material-components/material-components-ios/commit/779ca64b7e36654d446e88fbad074919602aeff3) (Robert Moore)

### Banner

* [Use lastBaseLineAnchor to align buttons if they are on the same line. (#8752)](https://github.com/material-components/material-components-ios/commit/628b2ecb9020b0287f44b384b93946977fd07b8a) (Wenyu Zhang)
* [stop updating custom constraints before bound size is set. (#8749)](https://github.com/material-components/material-components-ios/commit/35188a5d5cc81d70ae059fbf9b0b12b00adbac11) (Wenyu Zhang)

### FlexibleHeader

* [Add a flexibleHeaderView:didChangeTrackingScrollViewAnimated: event to MDCFlexibleHeaderViewAnimationDelegate. (#8757)](https://github.com/material-components/material-components-ios/commit/e3aa7eace2a1528110fad59ef9dce2d745e790c6) (featherless)
* [Add an animateWithAnimations:completion: API. (#8739)](https://github.com/material-components/material-components-ios/commit/1bcdfc77ca2a5df0034c3ae038193df73859b911) (featherless)

### Ripple

* [Improve MDCRippleTouchController (#8631)](https://github.com/material-components/material-components-ios/commit/3b4c9d170a9f1d9760d7da147f30832bc1e78398) (Michael Schneider)

### Snackbar

* [Update documentation on default. #8736](https://github.com/material-components/material-components-ios/commit/5516c5f6c9a8267020369eb5c55eaf4225b9d679) (Yarden Eitan)

### TextFields

* [Capture snapshots outside of view (#8718)](https://github.com/material-components/material-components-ios/commit/dec1670f8b34b75f2d78b27e460a72567326cb07) (Andrew Overton)

---

# 94.0.0

This major release adds a new configuration block to MDCSnackBarMessage and moves the currently in development MDCTextControl based TextFields from the TextFields component directory to their own TextControls directory. While there are no API changes associated with this move, it does have the potential to break anyone importing these textfields from their old location, hence the major version bump.
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 = "94.0.0"
mdc.version = "94.1.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 MaterialComponentsBeta.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |mdc|
mdc.name = "MaterialComponentsBeta"
mdc.version = "94.0.0"
mdc.version = "94.1.0"
mdc.authors = "The Material Components authors."
mdc.summary = "A collection of stand-alone alpha UI libraries that are not yet guaranteed to be ready for general production use. Use with caution."
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 = "94.0.0"
s.version = "94.1.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 = "94.0.0"
s.version = "94.1.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 = "94.0.0"
s.version = "94.1.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 @@
94.0.0
94.1.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>94.0.0</string>
<string>94.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>94.0.0</string>
<string>94.1.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>94.0.0</string>
<string>94.1.0</string>
<key>CFBundleVersion</key>
<string>94.0.0</string>
<string>94.1.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 = "94.0.0"
s.version = "94.1.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
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ - (void)showUIKitActionSheet {
style:UIAlertActionStyleDefault
handler:nil];
[alertController addAction:emailAction];

if (self.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
alertController.modalPresentationStyle = UIModalPresentationPopover;
alertController.popoverPresentationController.sourceView = self.showUIKitButton;
}
[self presentViewController:alertController animated:YES completion:nil];
}

Expand Down
4 changes: 2 additions & 2 deletions components/ActionSheet/src/MDCActionSheetController.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ - (void)viewDidLoad {
[self.view addSubview:self.headerDividerView];
}

- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];

if (self.tableView.contentSize.height > (CGRectGetHeight(self.view.bounds) / 2)) {
self.mdc_bottomSheetPresentationController.preferredSheetHeight = [self openingSheetHeight];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,19 @@ - (void)commonMDCActionSheetItemViewInit {
} else {
leadingConstant = kImageLeadingPadding;
}
[NSLayoutConstraint constraintWithItem:_actionLabel
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1
constant:kActionItemTitleVerticalPadding]
[_actionLabel.topAnchor constraintEqualToAnchor:self.contentView.topAnchor
constant:kActionItemTitleVerticalPadding]
.active = YES;
[NSLayoutConstraint constraintWithItem:_actionLabel
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeBottom
multiplier:1
constant:-kActionItemTitleVerticalPadding]
[_actionLabel.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor
constant:-kActionItemTitleVerticalPadding]
.active = YES;
_titleLeadingConstraint = [NSLayoutConstraint constraintWithItem:_actionLabel
attribute:NSLayoutAttributeLeadingMargin
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeadingMargin
multiplier:1
constant:leadingConstant];
_titleLeadingConstraint = [_actionLabel.layoutMarginsGuide.leadingAnchor
constraintEqualToAnchor:self.contentView.layoutMarginsGuide.leadingAnchor
constant:leadingConstant];
_titleLeadingConstraint.active = YES;
_titleTrailingConstraint = [NSLayoutConstraint constraintWithItem:self.contentView
attribute:NSLayoutAttributeTrailingMargin
relatedBy:NSLayoutRelationEqual
toItem:_actionLabel
attribute:NSLayoutAttributeTrailingMargin
multiplier:1
constant:kTitleTrailingPadding];
_titleTrailingConstraint = [self.contentView.layoutMarginsGuide.trailingAnchor
constraintEqualToAnchor:_actionLabel.layoutMarginsGuide.trailingAnchor
constant:kTitleTrailingPadding];
_titleTrailingConstraint.active = YES;
if (!_inkTouchController) {
_inkTouchController = [[MDCInkTouchController alloc] initWithView:self];
Expand All @@ -115,38 +97,15 @@ - (void)commonMDCActionSheetItemViewInit {
_actionImageView = [[UIImageView alloc] init];
[self.contentView addSubview:_actionImageView];
_actionImageView.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint constraintWithItem:_actionImageView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1
constant:kImageTopPadding]
[_actionImageView.topAnchor constraintEqualToAnchor:self.contentView.topAnchor
constant:kImageTopPadding]
.active = YES;
[NSLayoutConstraint constraintWithItem:_actionImageView
attribute:NSLayoutAttributeLeadingMargin
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeadingMargin
multiplier:1
constant:kImageLeadingPadding]
.active = YES;
[NSLayoutConstraint constraintWithItem:_actionImageView
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:kImageHeightAndWidth]
.active = YES;
[NSLayoutConstraint constraintWithItem:_actionImageView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:kImageHeightAndWidth]
[_actionImageView.layoutMarginsGuide.leadingAnchor
constraintEqualToAnchor:self.contentView.layoutMarginsGuide.leadingAnchor
constant:kImageLeadingPadding]
.active = YES;
[_actionImageView.widthAnchor constraintEqualToConstant:kImageHeightAndWidth].active = YES;
[_actionImageView.heightAnchor constraintEqualToConstant:kImageHeightAndWidth].active = YES;
}

- (void)layoutSubviews {
Expand Down
14 changes: 11 additions & 3 deletions components/Banner/src/MDCBannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ @interface MDCBannerView ()
@property(nonatomic, readwrite, strong) NSLayoutConstraint *leadingButtonConstraintTop;
@property(nonatomic, readwrite, strong) NSLayoutConstraint *leadingButtonConstraintTrailing;
@property(nonatomic, readwrite, strong) NSLayoutConstraint *leadingButtonConstraintCenterY;
@property(nonatomic, readwrite, strong)
NSLayoutConstraint *leadingButtonConstraintBaseLineWithTrailingButton;
@property(nonatomic, readwrite, strong)
NSLayoutConstraint *leadingButtonConstraintTrailingWithTrailingButton;
@property(nonatomic, readwrite, strong) NSLayoutConstraint *trailingButtonConstraintBottom;
Expand Down Expand Up @@ -275,6 +277,8 @@ - (void)setUpButtonsConstraints {
constraintEqualToAnchor:self.buttonContainerView.trailingAnchor];
self.leadingButtonConstraintCenterY = [self.leadingButton.centerYAnchor
constraintEqualToAnchor:self.buttonContainerView.centerYAnchor];
self.leadingButtonConstraintBaseLineWithTrailingButton = [self.leadingButton.lastBaselineAnchor
constraintEqualToAnchor:self.trailingButton.lastBaselineAnchor];
self.leadingButtonConstraintTrailingWithTrailingButton =
[self.leadingButton.trailingAnchor constraintEqualToAnchor:self.trailingButton.leadingAnchor
constant:-kButtonHorizontalIntervalSpace];
Expand Down Expand Up @@ -327,6 +331,7 @@ - (void)deactivateAllConstraints {
self.leadingButtonConstraintTop.active = NO;
self.leadingButtonConstraintTrailing.active = NO;
self.leadingButtonConstraintCenterY.active = NO;
self.leadingButtonConstraintBaseLineWithTrailingButton.active = NO;
self.leadingButtonConstraintTrailingWithTrailingButton.active = NO;
self.trailingButtonConstraintBottom.active = NO;
self.trailingButtonConstraintTop.active = NO;
Expand Down Expand Up @@ -395,8 +400,10 @@ - (CGSize)intrinsicContentSize {
}

- (void)updateConstraints {
MDCBannerViewLayoutStyle layoutStyle = [self layoutStyleForSizeToFit:self.bounds.size];
[self updateConstraintsWithLayoutStyle:layoutStyle];
if (!CGSizeEqualToSize(self.bounds.size, CGSizeZero)) {
MDCBannerViewLayoutStyle layoutStyle = [self layoutStyleForSizeToFit:self.bounds.size];
[self updateConstraintsWithLayoutStyle:layoutStyle];
}

[super updateConstraints];
}
Expand Down Expand Up @@ -455,12 +462,13 @@ - (void)updateButtonsConstraintsWithLayoutStyle:(MDCBannerViewLayoutStyle)layout
self.leadingButtonConstraintCenterY.active = YES;
} else {
if (layoutStyle == MDCBannerViewLayoutStyleMultiRowStackedButton) {
self.leadingButtonConstraintTop.active = YES;
self.leadingButtonConstraintTrailing.active = YES;
self.trailingButtonConstraintTop.active = YES;
} else {
self.leadingButtonConstraintTrailingWithTrailingButton.active = YES;
self.leadingButtonConstraintBaseLineWithTrailingButton.active = YES;
}
self.leadingButtonConstraintTop.active = YES;
}
self.leadingButtonConstraintLeading.active = YES;
self.trailingButtonConstraintTrailing.active = YES;
Expand Down
30 changes: 29 additions & 1 deletion components/FlexibleHeader/src/MDCFlexibleHeaderView.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ IB_DESIGNABLE
*/
- (void)changeContentInsets:(nonnull MDCFlexibleHeaderChangeContentInsetsBlock)block;

#pragma mark - Animating changes to the header

/**
Animates any changes resulting from executing the @c animations block.
Use this method to animate changes alongside animations to the flexible header.
The following occurs when this method is invoked:
1. The provided @c animations block is invoked within a @code [UIView animate...:] @endcode block.
2. Within that same animation block and after invoking @c animations, the flexible header updates
any relevant aspects of its layout including its height, offset, and shadow layer frames.
3. Upon completion of the resulting animation, the provided completion block is invoked if one was
provided.
*/
- (void)animateWithAnimations:(void (^_Nonnull)(void))animations
completion:(void (^_Nullable)(BOOL))completion;

#pragma mark Forwarding Touch Events

/**
Expand Down Expand Up @@ -443,7 +461,17 @@ IB_DESIGNABLE
MDCFlexibleHeaderView.
*/
@protocol MDCFlexibleHeaderViewAnimationDelegate <NSObject>
@required
@optional

/**
Informs the receiver that the flexible header view's tracking scroll view has changed.
@param animated If YES, then this method is being invoked from within an animation block. Changes
made to the flexible header as a result of this invocation will be animated alongside the header's
animation.
*/
- (void)flexibleHeaderView:(nonnull MDCFlexibleHeaderView *)flexibleHeaderView
didChangeTrackingScrollViewAnimated:(BOOL)animated;

/**
Informs the receiver that the flexible header view's animation changing to a new tracking scroll
Expand Down
Loading

0 comments on commit d8409a3

Please sign in to comment.