Skip to content

Commit

Permalink
Merge branch 'release-candidate'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsecord committed Aug 9, 2017
2 parents 8f9e066 + 62aaea5 commit c2a357f
Show file tree
Hide file tree
Showing 47 changed files with 2,476 additions and 576 deletions.
61 changes: 61 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,64 @@
# 31.0.0

## API Diffs

### TextFields

* Added `MDCMultilineTextField`, a [Material Design-themed mutiline text field](https://www.google.com/design/spec/components/text-fields.html#text-fields-multi-line-text-field) (multiline text input).
* `[MDCTextFieldPositioningDelegate sizeThatFits:defaultSize:]` has been removed, see `[MDCTextFieldPositioningDelegate textInsets:]` instead.
* Added `MDCMultilineTextInput.minimumLines` and `.expandsOnOverflow` properties.

## Component changes

### Buttons

#### Changes

* [[Math] Align frames to pixel boundaries (#1730)](https://github.com/material-components/material-components-ios/commit/e03ad370c6fdfe23f35e4d3f61d2f55783be83c8) (Robert Moore)

### CollectionCells

#### Changes

* [[Collections] Making Disclosure indicator tinted (#1745)](https://github.com/material-components/material-components-ios/commit/e12db0f2ea806a3f64b3d4865b3402d66d8923b4) (Robert Moore)

### Collections

#### Changes

* [Fix for possible infinite recursion (#1711)](https://github.com/material-components/material-components-ios/commit/abb81d969b09c6baaf51997c04bcf384607ac8d0) (Justin Shephard)
* [Custom section insets call delegate (#1752)](https://github.com/material-components/material-components-ios/commit/0223d431e551e6afdbc33080ef815fef3794e79c) (Robert Moore)

### FeatureHighlight

#### Changes

* [Fix gesture recognizers (#1749)](https://github.com/material-components/material-components-ios/commit/6281b33d66029118c32693098f70d067ffb0b0fc) (Sam Morrison)
* [[Math] Align frames to pixel boundaries (#1730)](https://github.com/material-components/material-components-ios/commit/e03ad370c6fdfe23f35e4d3f61d2f55783be83c8) (Robert Moore)

### NavigationBar

#### Changes

* [Improve centering when barButtonItems are asymmetric (#1721)](https://github.com/material-components/material-components-ios/commit/65434fb244fd5997b84ddf6965404ce7c4cfe0bc) (Robert Moore)

### Slider

#### Changes

* [[Math] Align frames to pixel boundaries (#1730)](https://github.com/material-components/material-components-ios/commit/e03ad370c6fdfe23f35e4d3f61d2f55783be83c8) (Robert Moore)

### TextFields

#### Changes

* [Examples improvements. (#1734)](https://github.com/material-components/material-components-ios/commit/0922de660cfe7844e3d792ccfb03043030eed7ad) (Will Larche)
* [Fixing the ordering and labeling of 2 pragma marks. (#1731)](https://github.com/material-components/material-components-ios/commit/be703bc80037d9097c1704427321988d89045f3a) (Will Larche)
* [Formatting. (#1748)](https://github.com/material-components/material-components-ios/commit/980b9080f01fee0eed02e92a403a22828eb66fbc) (Will Larche)
* [Multiline textfields (#1756)](https://github.com/material-components/material-components-ios/commit/af964fe6706360b6c5bba839385133efe75bcba5) (Will Larche)
* [[Text fields] Simplification of height calculation. (#1733)](https://github.com/material-components/material-components-ios/commit/7d706cdddac80f42bc64d4276a3beda4b0ee935f) (Will Larche)


# 30.0.0

## API Diffs
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponents.podspec
Expand Up @@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb'

Pod::Spec.new do |s|
s.name = "MaterialComponents"
s.version = "30.0.0"
s.version = "31.0.0"
s.authors = "The Material Components authors."
s.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsCatalog.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsCatalog"
s.version = "30.0.0"
s.version = "31.0.0"
s.authors = "The Material Components authors."
s.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsEarlGreyTests.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsEarlGreyTests"
s.version = "30.0.0"
s.version = "31.0.0"
s.authors = "The Material Components authors."
s.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsUnitTests.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsUnitTests"
s.version = "30.0.0"
s.version = "31.0.0"
s.authors = "The Material Components authors."
s.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
Expand Up @@ -23,6 +23,7 @@

#import "ButtonsTypicalUseSupplemental.h"
#import "MaterialButtons.h"
#import "MaterialMath.h"
#import "MaterialTypography.h"

#pragma mark - ButtonsTypicalUseViewController
Expand Down Expand Up @@ -130,7 +131,8 @@ - (void)layoutButtonsInRange:(NSRange)range around:(CGFloat)centerX {
UILabel *label = self.labels[i];

button.frame = CGRectOffset(button.frame, 0, verticalCenterY);
label.frame = CGRectOffset(label.frame, 0, verticalCenterY);
label.frame = MDCRectAlignToScale(CGRectOffset(label.frame, 0, verticalCenterY),
[UIScreen mainScreen].scale);
}
}

Expand Down
1 change: 1 addition & 0 deletions components/Buttons/src/MDCButton.m
Expand Up @@ -299,6 +299,7 @@ - (void)layoutSubviews {
} else {
_inkView.frame = self.bounds;
}
self.titleLabel.frame = MDCRectAlignToScale(self.titleLabel.frame, [UIScreen mainScreen].scale);
}

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
Expand Down
2 changes: 1 addition & 1 deletion components/CollectionCells/src/MDCCollectionViewCell.m
Expand Up @@ -232,7 +232,7 @@ - (void)setAccessoryType:(MDCCollectionViewCellAccessoryType)accessoryType {
UIUserInterfaceLayoutDirectionRightToLeft) {
image = [image mdc_imageFlippedForRightToLeftLayoutDirection];
}
accessoryImageView.image = image;
accessoryImageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
break;
}
case MDCCollectionViewCellAccessoryCheckmark: {
Expand Down
65 changes: 47 additions & 18 deletions components/Collections/src/MDCCollectionViewController.m
Expand Up @@ -176,15 +176,15 @@ - (CGSize)collectionView:(UICollectionView *)collectionView
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewLayoutAttributes *attr =
[collectionViewLayout layoutAttributesForItemAtIndexPath:indexPath];
CGSize size = [self sizeWithAttribute:attr];
size = [self inlaidSizeAtIndexPath:indexPath withSize:size];
CGSize size = [self sizeWithAttribute:attr collectionView:collectionView];
size = [self inlaidSizeAtIndexPath:indexPath withSize:size collectionView:collectionView];
return size;
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout
insetForSectionAtIndex:(NSInteger)section {
return [self insetsAtSectionIndex:section];
return [self insetsAtSectionIndex:section collectionView:collectionView];
}

- (CGFloat)collectionView:(UICollectionView *)collectionView
Expand All @@ -199,24 +199,25 @@ - (CGFloat)collectionView:(UICollectionView *)collectionView
return 0;
}

- (CGSize)sizeWithAttribute:(UICollectionViewLayoutAttributes *)attr {
- (CGSize)sizeWithAttribute:(UICollectionViewLayoutAttributes *)attr
collectionView:(UICollectionView *)collectionView {
CGFloat height = MDCCellDefaultOneLineHeight;
if ([_styler.delegate respondsToSelector:@selector(collectionView:cellHeightAtIndexPath:)]) {
height =
[_styler.delegate collectionView:self.collectionView cellHeightAtIndexPath:attr.indexPath];
height = [_styler.delegate collectionView:collectionView cellHeightAtIndexPath:attr.indexPath];
}

CGFloat width = [self cellWidthAtSectionIndex:attr.indexPath.section];
CGFloat width =
[self cellWidthAtSectionIndex:attr.indexPath.section collectionView:collectionView];
return CGSizeMake(width, height);
}

- (CGFloat)cellWidthAtSectionIndex:(NSInteger)section {
CGFloat bounds = CGRectGetWidth(
UIEdgeInsetsInsetRect(self.collectionView.bounds, self.collectionView.contentInset));
UIEdgeInsets sectionInsets = [self collectionView:self.collectionView
layout:self.collectionView.collectionViewLayout
- (CGFloat)cellWidthAtSectionIndex:(NSInteger)section
collectionView:(UICollectionView *)collectionView {
CGFloat bounds =
CGRectGetWidth(UIEdgeInsetsInsetRect(collectionView.bounds, collectionView.contentInset));
UIEdgeInsets sectionInsets = [self collectionView:collectionView
layout:collectionView.collectionViewLayout
insetForSectionAtIndex:section];

CGFloat insets = sectionInsets.left + sectionInsets.right;
if (_styler.cellLayoutType == MDCCollectionViewCellLayoutTypeGrid) {
CGFloat cellWidth = bounds - insets - (_styler.gridPadding * (_styler.gridColumnCount - 1));
Expand All @@ -225,11 +226,12 @@ - (CGFloat)cellWidthAtSectionIndex:(NSInteger)section {
return bounds - insets;
}

- (UIEdgeInsets)insetsAtSectionIndex:(NSInteger)section {
- (UIEdgeInsets)insetsAtSectionIndex:(NSInteger)section
collectionView:(UICollectionView *)collectionView {
// Determine insets based on cell style.
CGFloat inset = (CGFloat)floor(MDCCollectionViewCellStyleCardSectionInset);
UIEdgeInsets insets = UIEdgeInsetsZero;
NSInteger numberOfSections = self.collectionView.numberOfSections;
NSInteger numberOfSections = collectionView.numberOfSections;
BOOL isTop = (section == 0);
BOOL isBottom = (section == numberOfSections - 1);
MDCCollectionViewCellStyle cellStyle = [_styler cellStyleAtSectionIndex:section];
Expand All @@ -248,9 +250,10 @@ - (UIEdgeInsets)insetsAtSectionIndex:(NSInteger)section {
return insets;
}

- (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath withSize:(CGSize)size {
- (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath
withSize:(CGSize)size
collectionView:(UICollectionView *)collectionView {
// If object is inlaid, return its adjusted size.
UICollectionView *collectionView = self.collectionView;
if ([_styler isItemInlaidAtIndexPath:indexPath]) {
CGFloat inset = MDCCollectionViewCellStyleCardSectionInset;
UIEdgeInsets inlayInsets = UIEdgeInsetsZero;
Expand All @@ -261,7 +264,7 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath withSize:(CGSize)size {
if ([self
respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)]) {
CGSize headerSize = [self collectionView:collectionView
layout:_collectionViewLayout
layout:collectionView.collectionViewLayout
referenceSizeForHeaderInSection:indexPath.section];
hasSectionHeader = !CGSizeEqualToSize(headerSize, CGSizeZero);
}
Expand Down Expand Up @@ -298,6 +301,32 @@ - (CGSize)inlaidSizeAtIndexPath:(NSIndexPath *)indexPath withSize:(CGSize)size {
return size;
}

#pragma mark - Subclassing Methods

/*
The below method is solely used for subclasses to retrieve width information in order to
calculate cell height. Not meant to call method cellWidthAtSectionIndex:collectionView as
that method recalculates section insets which we don't want to do.
*/
- (CGFloat)cellWidthAtSectionIndex:(NSInteger)section {
CGFloat bounds = CGRectGetWidth(
UIEdgeInsetsInsetRect(self.collectionView.bounds, self.collectionView.contentInset));
UIEdgeInsets sectionInsets = [self collectionView:self.collectionView
layout:self.collectionView.collectionViewLayout
insetForSectionAtIndex:section];

CGFloat insets = sectionInsets.left + sectionInsets.right;
if (_styler != nil) {
if (_styler.cellLayoutType == MDCCollectionViewCellLayoutTypeGrid) {
CGFloat cellWidth = bounds - insets - (_styler.gridPadding * (_styler.gridColumnCount - 1));
if (_styler.gridColumnCount > 0) {
return cellWidth / _styler.gridColumnCount;
}
}
}
return bounds - insets;
}

#pragma mark - <MDCInkTouchControllerDelegate>

- (BOOL)inkTouchController:(MDCInkTouchController *)inkTouchController
Expand Down
Expand Up @@ -17,6 +17,7 @@
#import "FeatureHighlightExampleSupplemental.h"

#import "MaterialButtons.h"
#import "MaterialMath.h"
#import "MaterialPalettes.h"
#import "MaterialTypography.h"

Expand Down Expand Up @@ -74,8 +75,10 @@ - (void)viewDidLayoutSubviews {
self.button.frame = frame;

CGSize labelSize = [self.infoLabel sizeThatFits:self.view.frame.size];
self.infoLabel.frame = CGRectMake(self.view.frame.size.width / 2 - labelSize.width / 2, 20,
labelSize.width, labelSize.height);
self.infoLabel.frame =
MDCRectAlignToScale(CGRectMake(self.view.frame.size.width / 2 - labelSize.width / 2, 20,
labelSize.width, labelSize.height),
[UIScreen mainScreen].scale);
}

- (void)didTapBackground:(UITapGestureRecognizer *)recognizer {
Expand Down
Expand Up @@ -33,7 +33,7 @@ typedef void (^MDCFeatureHighlightInteractionBlock)(BOOL accepted);

@end

@interface MDCFeatureHighlightView (Private)
@interface MDCFeatureHighlightView (Private) <UIGestureRecognizerDelegate>

- (void)layoutAppearing;
- (void)layoutDisappearing;
Expand Down

0 comments on commit c2a357f

Please sign in to comment.