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 Dec 3, 2020
2 parents 435b109 + f1dd2fd commit 7c796eb
Show file tree
Hide file tree
Showing 25 changed files with 405 additions and 127 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# 119.1.3

In this patch release we updated the Tabs API and made documentation updates for Slider and other components.

## API changes

### Tabs

*new* property: `itemViewContentInsets` in `MDCTabBarView`.
*new* property: `minItemWidth` in `MDCTabBarView` and `MDCTabBarViewItemViewDelegate`
*new* property: `itemViewDelegate` in `MDCTabBarViewItemView`.
*new* property: `itemViewStyle` in `MDCTabBarViewItemViewDelegate`.

## Component changes

### Banner

* [Updated documentation](https://github.com/material-components/material-components-ios/commit/62863b262e31c43ef0aa355ae9d299a13fd040a4) (Cristina De Rito)

### Tabs

* [Add and expose property to MDCTabBarView for setting the edge insets for each item in the tab bar.](https://github.com/material-components/material-components-ios/commit/58431831194f7bd4c7acb49722f4aa15c873776d) (Alyssa Weiss)
* [Create and expose a minItemWidth property for MDCTabBarView to set the min width of items on the tab bar. This is done by adding a MDCTabBarViewItemViewDelegate protocol that MDCTabBarView conforms to.](https://github.com/material-components/material-components-ios/commit/a07df1ee5a64ac60cfeadd67caf1d43883ac2c7d) (Alyssa Weiss)
* [When building with -Wnullability-completeness, either no property should specify a nullability (nullable/nonnull) or all of them must specify one. If this is not the case, the compilation will fail.](https://github.com/material-components/material-components-ios/commit/d391e7a2bc91bea4ef0cf75cd02a34cd17de960f) (Sylvain Defresne)

## Multi-component changes

* [Miscellaneous doc fixes](https://github.com/material-components/material-components-ios/commit/0c7a12b0c7f2de8c6aaf4bd107289a89551aef34) (Andrew Overton)

---

# 119.1.2

In this patch release we made improvements to TextControls and Slider and fixed a bug in Tabs.
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 = "119.1.2"
mdc.version = "119.1.3"
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 = "119.1.2"
s.version = "119.1.3"
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 = "119.1.2"
s.version = "119.1.3"
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 = "119.1.2"
s.version = "119.1.3"
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 @@
119.1.2
119.1.3
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>119.1.2</string>
<string>119.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>119.1.2</string>
<string>119.1.3</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>119.1.2</string>
<string>119.1.3</string>
<key>CFBundleVersion</key>
<string>119.1.2</string>
<string>119.1.3</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 = "119.1.2"
s.version = "119.1.3"
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
14 changes: 10 additions & 4 deletions components/Banner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Banners should be displayed at the top of the screen, below a top app bar. They

By default, `MDCBannerView` is configured to display an image view, a text label and two buttons. To hide the image view on `MDCBannerView`, users can set the `hidden` property on `imageView` to be true. Similarly, users can hide a button on the banner view by setting the `hidden` property on `trailingButton` to be true.

By default, `MDCBannerView` is configured to display items with black text and white background with a gray divider at the bottom of the view. To customize the color and style of the text, image view and buttons displayed on `MDCBannerView`, directly set the relevant properties, such as `tintColor`, on `textView`, `imageView`, `leadingButton` and `trailingButton`. `showsDivider` and `dividerColor` can be used to control the divider's visibility and color.
By default, `MDCBannerView` is configured to display items with black text and white background with a grey divider at the bottom of the view. To customize the color and style of the text, image view and buttons displayed on `MDCBannerView`, directly set the relevant properties, such as `tintColor`, on `textView`, `imageView`, `leadingButton` and `trailingButton`. `showsDivider` and `dividerColor` can be used to control the divider's visibility and color.

`MDCBannerView` layouts are configurable through the `bannerViewLayoutStyle` property. This property can be set to either `MDCBannerViewLayoutStyleAutomatic`, `MDCBannerViewLayoutStyleSingleRow`, `MDCBannerViewLayoutStyleMultiRowStackedButton`, or `MDCBannerViewLayoutStyleMultiRowAlignedButton`.

Expand Down Expand Up @@ -164,12 +164,18 @@ Here is an example of a Banner with the Shrine theme applied to it.
![Banner with dummy text description and text button labeled "dismiss"](docs/assets/shrine-banner.png)
Add the following to your Podfile
```ruby
pod 'MaterialComponents/Banner+Theming'
```

<!--<div class="material-code-render" markdown="1">-->
#### Swift

```swift
// Import the Banner theming module
import MaterialComponents.MaterialBanner_MaterialTheming
import MaterialComponents.MaterialBanner_Theming
...
// Create or use your app's Container Scheme
let containerScheme = MDCContainerScheme()
Expand All @@ -181,11 +187,11 @@ banner.applyTheme(withScheme: containerScheme)

```objc
// Import the Tabs Theming Extensions header
#import <MaterialComponents/MaterialBanner+MaterialTheming.h>
#import <MaterialComponents/MaterialBanner+Theming.h>
...
// Create or use your app's Container Scheme
MDCContainerScheme *containerScheme = [[MDCContainerScheme alloc] init];
// Theme the banner with either default theme
[self.bannerView applyThemeWithScheme:containerScheme];
```
<!--</div>-->
<!--</div>-->
4 changes: 2 additions & 2 deletions components/Dialogs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ MDCAlertAction *alertAction =
The following is an anatomy diagram of a Material dialog:
![anatomy](docs/assets/dialogs-anatomy.png)
![Dialog anatomy diagram with title, description, and Cancel and Accept buttons](docs/assets/dialogs-anatomy.png)
1. Container
1. Title (optional)
Expand Down Expand Up @@ -217,7 +217,7 @@ The following is an anatomy diagram of a Material dialog:
### Theming dialogs
![Alert dialog with Shrine theming](docs/assets/shrine_dialog.png)
![Shrine-themed dummy dialog with Accept and Cancel buttons](docs/assets/shrine_dialog.png)
You can theme a Material Dialog using a container scheme and the Dialogs theming extension. To achieve something like the
Shrine theming above first add the Dialogs theming extension to your project by adding the following line to your Podfile:
Expand Down
2 changes: 1 addition & 1 deletion components/LibraryInfo/src/MDCLibraryInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// This string is updated automatically as a part of the release process and should not be edited
// manually. Do not rename this constant or change the formatting without updating the release
// scripts.
static NSString* const kMDCLibraryInfoVersionString = @"119.1.2";
static NSString* const kMDCLibraryInfoVersionString = @"119.1.3";

@implementation MDCLibraryInfo

Expand Down
2 changes: 1 addition & 1 deletion components/LibraryInfo/tests/unit/LibraryInfoTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ - (void)testVersionFormat {
// Given

// This regex pattern does the following:
// Accept: "119.1.2", etc.
// Accept: "119.1.3", etc.
// Reject: "0.0.0", "1.2", "1", "-1.2.3", "Hi, I'm a version 1.2.3", "1.2.3 is my version", etc.
//
// Note the major version must be >= 1 since "0.0.0" is used as the version when something goes
Expand Down
8 changes: 4 additions & 4 deletions components/Tabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Material tabs can be broken into two main categories: fixed and scrollable.

### Fixed tabs

![fixed tab example](docs/assets/tabs-fixed-hero.png)
![Fixed tabs for dog, cats, birds. Birds tab selected](docs/assets/tabs-fixed-hero.png)

### Scrollable tabs

![scrollabe tab example](docs/assets/tabs-scrollable-hero.png)
![Scrollable tabs for pitbulls, terrier, poodle. Pitbulls tab selected](docs/assets/tabs-scrollable-hero.png)

## Contents

Expand Down Expand Up @@ -102,7 +102,7 @@ From there, initialize an `MDCTabBarView` and add it to your view controller's v

Tab bars contain tab bar items with optional icons and text labels. Tab bar items can be selected or unselected. The selection indicator appears below the currently selected tab bar item.

![Tabs anatomy diagram](docs/assets/tabs-anatomy.png)
![Tabs anatomy diagram with Recents, Favorites and Nearby text labels and icons](docs/assets/tabs-anatomy.png)

1. Container
2. Selected icon (optional if there’s a label)
Expand Down Expand Up @@ -150,7 +150,7 @@ Tab bars contain tab bar items with optional icons and text labels. Tab bar item

Tabs supports Material Theming using a Container Scheme. To learn more about theming extensions, see [here](https://github.com/material-components/material-components-ios/blob/develop/docs/theming.md). Below is a screenshot of an `MDCTabBarView` with the Material Design Shrine theme:

![Shrine card](docs/assets/shrine-tabs.png)
![Shrine tab with Home, Settings, Email and Search text labels and icons](docs/assets/shrine-tabs.png)

### Tabs theming example

Expand Down
17 changes: 17 additions & 0 deletions components/Tabs/src/TabBarView/MDCTabBarView.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,23 @@ __attribute__((objc_subclassing_restricted)) @interface MDCTabBarView : UIScroll
*/
- (UIEdgeInsets)contentPaddingForLayoutStyle:(MDCTabBarViewLayoutStyle)layoutStyle;

/**
The minimum width for each item in the tab bar view. Defaults to 90. This property is only used
when the tab bar view's items are @c UITabBarItems and not @c MDCTabBarItems, or any other custom
@c UITabBarItem subclasses that conform to @c MDCTabBarItemCustomViewing.
*/
@property(nonatomic, assign) CGFloat minItemWidth;

/** The edge insets between for each item in the tab bar view. Defaults to:
* {.top = 8, .right = 16, .bottom = 8, .left = 16} for text only,
* {.top = 12, .right = 16, .bottom = 12, .left = 16} for image only, and
* {.top = 12, .right = 16, .bottom = 12, .left = 16} for text and image. Setting this property
* overrides all three defualts. This property is only used when the tab bar view's items are @c
* UITabBarItems and not @c MDCTabBarItems, or any other custom @c UITabBarItem subclasses that
* conform to @c MDCTabBarItemCustomViewing.
*/
@property(nonatomic) UIEdgeInsets itemViewContentInsets;

/**
Returns the @c UIAccessibility element associated with the provided item.
Expand Down
50 changes: 49 additions & 1 deletion components/Tabs/src/TabBarView/MDCTabBarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import "private/MDCTabBarViewIndicatorView.h"
#import "private/MDCTabBarViewItemView.h"
#import "private/MDCTabBarViewItemViewDelegate.h"
#import "private/MDCTabBarViewPrivateIndicatorContext.h"
#import "MaterialRipple.h"
#import "MDCTabBarItemCustomViewing.h"
Expand All @@ -35,6 +36,24 @@
/** Minimum (typical) height of a Material Tab bar. */
static const CGFloat kMinHeight = 48;

/** Default minimum width of an item in the Tab bar */
static const CGFloat kDefaultMinItemWidth = 90;

/// Outer edge padding from spec: https://material.io/go/design-tabs#spec.
static const UIEdgeInsets kDefaultItemViewContentInsetsTextAndImage = {
.top = 12, .right = 16, .bottom = 12, .left = 16};

/**
Edge insets for text-only Tabs. Although top and bottom are not specified, we insert some
minimal (8 points) padding so things don't look awful.
*/
static const UIEdgeInsets kDefaultItemViewContentInsetsTextOnly = {
.top = 8, .right = 16, .bottom = 8, .left = 16};

/** Edge insets for image-only Tabs. */
static const UIEdgeInsets kDefaultItemViewContentInsetsImageOnly = {
.top = 12, .right = 16, .bottom = 12, .left = 16};

/** The leading edge inset for scrollable tabs. */
static const CGFloat kScrollableTabsLeadingEdgeInset = 52;

Expand All @@ -56,7 +75,8 @@
static NSString *const kLargeContentSizeImageInsets = @"largeContentSizeImageInsets";

#ifdef __IPHONE_13_4
@interface MDCTabBarView (PointerInteractions) <UIPointerInteractionDelegate>
@interface MDCTabBarView (PointerInteractions) <UIPointerInteractionDelegate,
MDCTabBarViewItemViewDelegate>
@end
#endif

Expand Down Expand Up @@ -94,6 +114,8 @@ The content padding (as UIEdgeInsets) for each layout style. The layout style is
@property(nonnull, nonatomic, strong)
NSMutableDictionary<NSNumber *, NSValue *> *layoutStyleToContentPadding;

@property(nonatomic) BOOL useDefaultItemViewContentInsets;

#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
/**
The last large content viewer item displayed by the content viewer while the interaction is
Expand Down Expand Up @@ -140,6 +162,8 @@ - (void)commonMDCTabBarViewInit {
_layoutStyleToContentPadding = [NSMutableDictionary dictionary];
_layoutStyleToContentPadding[@(MDCTabBarViewLayoutStyleScrollable)] =
[NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(0, kScrollableTabsLeadingEdgeInset, 0, 0)];
_minItemWidth = kDefaultMinItemWidth;
_useDefaultItemViewContentInsets = YES;
self.backgroundColor = UIColor.whiteColor;
self.showsHorizontalScrollIndicator = NO;

Expand Down Expand Up @@ -224,6 +248,11 @@ - (void)setPreferredLayoutStyle:(MDCTabBarViewLayoutStyle)preferredLayoutStyle {
[self invalidateIntrinsicContentSize];
}

- (void)setItemViewContentInsets:(UIEdgeInsets)itemViewContentInsets {
_itemViewContentInsets = itemViewContentInsets;
_useDefaultItemViewContentInsets = NO;
}

- (void)setItems:(NSArray<UITabBarItem *> *)items {
NSParameterAssert(items);

Expand Down Expand Up @@ -251,6 +280,7 @@ - (void)setItems:(NSArray<UITabBarItem *> *)items {
}
if (!itemView) {
MDCTabBarViewItemView *mdcItemView = [[MDCTabBarViewItemView alloc] init];
mdcItemView.itemViewDelegate = self;
mdcItemView.titleLabel.text = item.title;
mdcItemView.accessibilityLabel = item.accessibilityLabel;
mdcItemView.accessibilityHint = item.accessibilityHint;
Expand Down Expand Up @@ -505,6 +535,24 @@ - (UIEdgeInsets)contentPaddingForLayoutStyle:(MDCTabBarViewLayoutStyle)layoutSty
return UIEdgeInsetsZero;
}

#pragma mark - MDCTabBarViewItemViewDelegate

- (UIEdgeInsets)contentInsetsForItemViewStyle:(MDCTabBarViewItemViewStyle)itemViewStyle {
if (self.useDefaultItemViewContentInsets) {
switch (itemViewStyle) {
case 0:
return kDefaultItemViewContentInsetsTextOnly;
case 1:
return kDefaultItemViewContentInsetsImageOnly;
case 2:
return kDefaultItemViewContentInsetsTextAndImage;
}
return self.itemViewContentInsets;
} else {
return self.itemViewContentInsets;
}
}

#pragma mark - UIAccessibility

- (BOOL)isAccessibilityElement {
Expand Down
17 changes: 10 additions & 7 deletions components/Tabs/src/TabBarView/private/MDCTabBarViewItemView.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,42 @@
#import <UIKit/UIKit.h>

#import "MDCTabBarViewCustomViewable.h"
#import "MDCTabBarViewItemViewDelegate.h"

#import <MaterialComponents/MaterialRipple.h>

/** A basic view that displays a title and image for a tab bar item within MDCTabBarView. */
@interface MDCTabBarViewItemView : UIView <MDCTabBarViewCustomViewable>

@property(nonatomic, strong, nullable) id<MDCTabBarViewItemViewDelegate> itemViewDelegate;

/** The image to display when unselected. */
@property(nonatomic, strong) UIImage *image;
@property(nonatomic, strong, nullable) UIImage *image;

/** The image to display when selected. */
@property(nonatomic, strong) UIImage *selectedImage;
@property(nonatomic, strong, nullable) UIImage *selectedImage;

/** The image view to display the icon. */
@property(nonatomic, strong) UIImageView *iconImageView;
@property(nonatomic, strong, nonnull) UIImageView *iconImageView;

/** The label to display the title. */
@property(nonatomic, strong) UILabel *titleLabel;
@property(nonatomic, strong, nonnull) UILabel *titleLabel;

/** The ripple contronller to display the ripple touch effect. */
@property(nonatomic, strong) MDCRippleTouchController *rippleTouchController;
@property(nonatomic, strong, nonnull) MDCRippleTouchController *rippleTouchController;

#pragma mark - UILargeContentViewerItem

/**
The title to display in the large content viewer. If set to nil, this property will return
@c title.
*/
@property(nonatomic, copy) NSString *largeContentTitle NS_AVAILABLE_IOS(13_0);
@property(nonatomic, copy, nullable) NSString *largeContentTitle NS_AVAILABLE_IOS(13_0);

/**
The image to display in the large content viwer. If set to nil, the property will return
@c image . If set to nil (or not set) @c scalesLargeContentImage will return YES otherwise NO.
*/
@property(nonatomic) UIImage *largeContentImage NS_AVAILABLE_IOS(13_0);
@property(nonatomic, nullable) UIImage *largeContentImage NS_AVAILABLE_IOS(13_0);

@end
Loading

0 comments on commit 7c796eb

Please sign in to comment.