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
andrewoverton committed Mar 10, 2020
2 parents 8a6d4f9 + 06cef30 commit ecb6de8
Show file tree
Hide file tree
Showing 48 changed files with 727 additions and 267 deletions.
100 changes: 100 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,103 @@
# 107.2.0

This minor release includes the introduction of a self-sizing mechanism to MDCBaseCell, a new layout style for MDCTabBarView, and numerous improvements and bug fixes for BottomSheet, Snackbar, Dialogs, Ink, and TextFields.

## New features

### List

Having the `UICollectionViewLayoutAttributes` you use with `MDCBaseCell` conform to `MDCSelfSizingLayoutAttributes` allows you to specify whether the height or the width should be fixed.

```objc
-(BOOL)isFixedWidth {
return 100;
}

-(BOOL)isFixedHeight {
return 100;
}
```

```swift
var isFixedWidth: Bool {
return 100;
}

var isFixedHeight: Bool {
return 100;
}
```

### Tabs

Setting the `preferredLayoutStyle` property on `MDCTabBarView` to `MDCTabBarViewLayoutStyleScrollableCentered` allows you to have a scrolling tab bar that centers the selected tab.

```objc
tabBarView.preferredLayoutStyle = MDCTabBarViewLayoutStyleScrollableCentered;
```

```swift
tabBarView.preferredLayoutStyle = .scrollableCentered
```

## Component changes

### BottomSheet

* [Anchor movement of the bottom sheet along the y axis. (#9835)](https://github.com/material-components/material-components-ios/commit/2ca4e3e229a01ca0f4ce6b71496d8c311f489b5d) (featherless)

### Chips

* [Account for MDCChipField contentInset in placeholder width calculation (#9843)](https://github.com/material-components/material-components-ios/commit/d7906ec47b26916aad464592d0686c621973e273) (Bryan Oltman)
* [Add MDCChipField snapshot test for placeholder truncation (#9842)](https://github.com/material-components/material-components-ios/commit/0d00e58cd008ef139165d9e0a8097c45b16fcea0) (Bryan Oltman)
* [Add MDCChipField snapshot tests verifying text field placement (#9831)](https://github.com/material-components/material-components-ios/commit/a42a84cca9e9254ac56da2d4aed0ac03474d335e) (Bryan Oltman)
* [Add tips about "Adjusting chip sizes after changing the label". (#9852)](https://github.com/material-components/material-components-ios/commit/738e82aede3d3fc8cc16aefe7b6a3362141d3ef0) (featherless)
* [Do not include contentEdgeInsets for MDCChipField placeholder if no placeholder is present (#9847)](https://github.com/material-components/material-components-ios/commit/992d235d9b39075962cc6be6f14e1ff9a442b1d2) (Bryan Oltman)
* [Do not include insets in MDCChipField placeholder width if there is no placeholder (#9850)](https://github.com/material-components/material-components-ios/commit/975c7994fc8831e154f115e3879366492c2c7e84) (Bryan Oltman)
* [In MDCChipField, account for horizontal padding when calculating available width for text field (#9841)](https://github.com/material-components/material-components-ios/commit/2ceeb0ac73c85e116f4406cfe6980e9a9d6c074f) (Bryan Oltman)
* [Move MDCChipField text input to a new line if text is too wide (#9845)](https://github.com/material-components/material-components-ios/commit/4cc8c3ecbefc3f8fc13ef80122ca8e187586f4d4) (Bryan Oltman)
* [Resize MDCChipField's textField frame instead of using left insets to align with chips (#9827)](https://github.com/material-components/material-components-ios/commit/04567ba1653cb61927117160c3e8fd37e186d4b9) (Bryan Oltman)
* [Resize MDCChipField's textField frame instead of using left insets to align with chips (#9837)](https://github.com/material-components/material-components-ios/commit/e1aee8556d04a64cef5149d51897f44711a5b077) (Bryan Oltman)
* [Revert "Resize MDCChipField's textField frame instead of using left insets to align with chips" (#9828)](https://github.com/material-components/material-components-ios/commit/f8d520b4f1845e06af3f2256080a7629a16e3d68) (Bryan Oltman)
* [Update MDCChipField to move long text from a line with chips to a new line. (#9826)](https://github.com/material-components/material-components-ios/commit/8b7c2b696c1f1ea212817f38b75d47825f3deb39) (Bryan Oltman)

### Dialogs

* [Adding actions order tests (#9829)](https://github.com/material-components/material-components-ios/commit/42b2e1ec69642e37aee6a4efd2e9ad68b745b974) (Galia Kaufman)
* [Removing enableAdjustableInsets and fixed-insets calculations. (#9832)](https://github.com/material-components/material-components-ios/commit/130676fb1be0dc479116e59245400568235543cc) (Galia Kaufman)
* [Try to fix testActionsAreOrderedByEmphasis snapshot (#9862)](https://github.com/material-components/material-components-ios/commit/1f0f03526dab131db8d46a0eed78ab544edc54ed) (Andrew Overton)

### Ink

* [Conditionally maskToBounds on MDCInkView layer (a MDCLegacyInkLayer) when usesLegacyInkRipple is set to NO (#9818)](https://github.com/material-components/material-components-ios/commit/5862e5b7b6e4d8e38dbde59a2c9f1acf5c26c0f3) (Andrew Overton)

### List

* [Add MDCSelfSizingLayoutAttributes (#9823)](https://github.com/material-components/material-components-ios/commit/79c96ec26f66aea353e5c8ff39c1de808c44b45f) (Andrew Overton)

### Snackbar

* [Support orientation changes that respect safe area (#9838)](https://github.com/material-components/material-components-ios/commit/808bceac64b8cb90c5fe0bd6f474781f22c1aeb3) (Yarden Eitan)
* [add multi-window guessing support (#9830)](https://github.com/material-components/material-components-ios/commit/5a64f3ff1ebf0876b3727891139df3cd2729685f) (Yarden Eitan)

### Tabs

* [Add MDCTabBarViewLayoutStyleScrollableCentered (#9849)](https://github.com/material-components/material-components-ios/commit/898277ced1e9150b7713fb41cd4c437812781147) (Andrew Overton)

### TextControls

* [Update MDCBaseTextField docs (#9861)](https://github.com/material-components/material-components-ios/commit/f01ede70ed059ef9494cd2b1493c0686f6bfc9c6) (Andrew Overton)

### TextFields

* [Lower the error VoiceOver announcement delay to near zero. (#9822)](https://github.com/material-components/material-components-ios/commit/057bfd0b957bacff0257554a27ef277b5c587cfd) (featherless)

## Multi-component changes

* [Remove traitCollection overrides from examples. (#9851)](https://github.com/material-components/material-components-ios/commit/395ad9b3950a9dfa10e40d537f04292e6f70fb21) (Bryan Oltman)

---

# 107.1.0

This minor release includes additions to the `MDCSnackbarManagerDelegate` protocol, touch target improvements to Chips, alignment improvements to Dialogs, and various other bug fixes.
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 = "107.1.0"
mdc.version = "107.2.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 = "107.1.0"
mdc.version = "107.2.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 = "107.1.0"
s.version = "107.2.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 = "107.1.0"
s.version = "107.2.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 = "107.1.0"
s.version = "107.2.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 @@
107.1.0
107.2.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>107.1.0</string>
<string>107.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>107.1.0</string>
<string>107.2.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>107.1.0</string>
<string>107.2.0</string>
<key>CFBundleVersion</key>
<string>107.1.0</string>
<string>107.2.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 = "107.1.0"
s.version = "107.2.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
9 changes: 9 additions & 0 deletions components/BottomSheet/src/private/MDCSheetBehavior.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ - (instancetype)initWithItem:(id<UIDynamicItem>)item {
_attachmentBehavior.frequency = (CGFloat)3.5;
_attachmentBehavior.damping = (CGFloat)0.4;
_attachmentBehavior.length = 0;

// Anchor movement along the y-axis.
__weak MDCSheetBehavior *weakSelf = self;
_attachmentBehavior.action = ^{
MDCSheetBehavior *strongSelf = weakSelf;
CGPoint center = item.center;
center.x = strongSelf->_targetPoint.x;
item.center = center;
};
[self addChildBehavior:_attachmentBehavior];

_itemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[ self.item ]];
Expand Down
8 changes: 0 additions & 8 deletions components/Cards/examples/CardExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ class CardExampleViewController: UIViewController {
imageView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
}
}

override public var traitCollection: UITraitCollection {
if UIDevice.current.userInterfaceIdiom == .pad && UIDevice.current.orientation.isPortrait {
return UITraitCollection(traitsFrom:[UITraitCollection(horizontalSizeClass: .compact),
UITraitCollection(verticalSizeClass: .regular)])
}
return super.traitCollection
}
}

extension CardExampleViewController {
Expand Down
8 changes: 0 additions & 8 deletions components/Cards/examples/ShapedCardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,6 @@ class ShapedCardViewController: UIViewController {
}
}

override public var traitCollection: UITraitCollection {
if UIDevice.current.userInterfaceIdiom == .pad && UIDevice.current.orientation.isPortrait {
return UITraitCollection(traitsFrom:[UITraitCollection(horizontalSizeClass: .compact),
UITraitCollection(verticalSizeClass: .regular)])
}
return super.traitCollection
}

@objc func changeShape() {
primarySlider.isHidden = true
secondarySlider.isHidden = true
Expand Down
28 changes: 25 additions & 3 deletions components/Chips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Chips are compact elements that represent an input, attribute, or action.
- [Stateful properties](#stateful-properties)
- [Selected Image View](#selected-image-view)
- [Padding](#padding)
- [Adjusting chip sizes after changing the label](#adjusting-chip-sizes-after-changing-the-label)
- [Behavioral flags](#behavioral-flags)
- [Accessibility](#accessibility)
- [Examples](#examples)
Expand Down Expand Up @@ -287,6 +288,24 @@ the others (`contentPadding`). This is useful so that you can set each of the pa
ensure your chips look correct whether or not they have an image and/or accessory view. The chip
uses these property to determine `intrinsicContentSize` and `sizeThatFits`.

### Adjusting chip sizes after changing the label
If the label of a chip in a collection view can be changed dynamically (e.g. in reaction to a user's
tap), then you may notice that the chip's frame does not automatically update to accomodate the new
size of the chip's label. To force your chip to update its layout when this happens you can invoke
`invalidateIntrinsicContentSize` on the chip view. For example:

<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
chipView.invalidateIntrinsicContentSize()
```

#### Objective-C
```objc
[chipView invalidateIntrinsicContentSize];
```
<!--</div>-->

- - -


Expand Down Expand Up @@ -359,8 +378,10 @@ chipView.titleLabel.text = @"Tap me";
There are two variants for Material Theming of an MDCChipVIew, which are the default theme
and the outlined theme.
<!--<div class="material-code-render" markdown="1">-->
#### Swift
<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
// Import the Chips Theming Extensions module
import MaterialComponents.MaterialChips_MaterialTheming
Expand All @@ -373,7 +394,7 @@ chip.applyTheme(withScheme: containerScheme)
chip.applyOutlinedTheme(withScheme: containerScheme)
```

#### Objective-C
#### Objective-C

```objc
// Import the Tabs Theming Extensions header
Expand All @@ -388,3 +409,4 @@ MDCContainerScheme *containerScheme = [[MDCContainerScheme alloc] init];
```
<!--</div>-->
37 changes: 37 additions & 0 deletions components/Chips/docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,41 @@ the others (`contentPadding`). This is useful so that you can set each of the pa
ensure your chips look correct whether or not they have an image and/or accessory view. The chip
uses these property to determine `intrinsicContentSize` and `sizeThatFits`.

### Adjusting chip sizes after changing the label
If the label of a chip is changed, then you may notice that the chip's frame does not automatically
update to accomodate the new size of the chip's label. To force your chip to update its layout when
this happens you can invoke `invalidateIntrinsicContentSize` on the chip view. For example:

<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
chipView.invalidateIntrinsicContentSize()
```

#### Objective-C
```objc
[chipView invalidateIntrinsicContentSize];
```
<!--</div>-->

### Adjusting chip sizes in a collection after changing the label
Similar to the above, if your chip's label changes its size in a collection view you will need to
inform the collection view that the chip cell's dimensions have changed. You can do so by reloading
the cell whose label value may have changed (just be sure that your cell dequeue mechanism is
fetching the updated data!). For example:

<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
// After changing the label of a chip cell at `indexPath`:
collectionView.reloadItems(at: [indexPath])
```

#### Objective-C
```objc
// After changing the label of a chip cell at `indexPath`:
[collectionView reloadItemsAtIndexPaths:@[indexPath]];
```
<!--</div>-->
- - -
Loading

0 comments on commit ecb6de8

Please sign in to comment.