21 Commits

Author SHA1 Message Date
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

This was an automated change generated by running a find-and-replace regular expression:

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00
featherless
bbe4a23fe0
Remove all __IPHONE_11_0 checks now that we no longer support Xcode 8. (#4915)
We can now make use of @available throughout our codebase.

We support Xcode 9 and up, which includes the iOS 11 SDK. This means we can remove any guards for SDKs prior to iOS 11.

This was cleaned up by running a global find-and-replace with the following regular expression:

```
Find:#if defined\(__IPHONE_11_0\) && \(__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0\)\n(.+if \(@available\(iOS 11.0, \*\)\) \{(?:.|\n)*?)(?:#else(?:.|\n)*?)?\n#endif
Replace:$1
```

With some additional cleanup for stragglers that didn't match this pattern. Note that else clauses were intentionally dropped.

Closes https://github.com/material-components/material-components-ios/issues/4909
2018-08-28 09:57:30 -04:00
Robert Moore
7307a8c5c0
[BottomNavigation] Button for badge increment. (#4857)
The BottomNavigation main demo has an infinite loop of badgeValue
updates, making EarlGrey testing difficult. Instead, we can use the
AppBar's rightBarButton to provide a button for incrementing the badge
value manually.

|Before|After|
|--|--|
|![mdc-bn-before](https://user-images.githubusercontent.com/1753199/44378402-1d350680-a4cf-11e8-891d-b70d8fc395b4.gif)|![mdc-bn-after](https://user-images.githubusercontent.com/1753199/44378408-21612400-a4cf-11e8-88c9-6d6dde20b7aa.gif)|

Closes #4836
2018-08-21 08:32:03 -04:00
John Detloff
120c93d329
Fix safe area insets on bottom nav example (#4637) 2018-08-07 15:55:07 -04:00
Robert Moore
4975c38a41 [BottomNavigation] Correct long title layout (#4303)
When title strings are very long (as may be common in localization to
non-default languages), MDCBottomNavigationBar was incorrectly computing the
expected height of the title label. Instead of querying the NSString for its
bounding rect, we can allow the UILabel to size itself and simply restrict
its width to the tab's width.

Closes #4040
2018-05-29 18:27:00 -04:00
Robert Moore
7bf1c4ad8f
[BottomNavigation] Fix shadow elevation value (#4195)
The Bottom Navigation should have an elevation of 8 dps instead of 6 based on
the latest design guidance.

**Before**
![bottomnav-ex-original](https://user-images.githubusercontent.com/1753199/40240442-92c9976e-5a86-11e8-9972-e5b6bfe07736.png)

**After**
![bottomnav-ex-after](https://user-images.githubusercontent.com/1753199/40240450-96201af0-5a86-11e8-9e1b-8a488cdc96c3.png)
2018-05-18 13:48:36 -04:00
Yarden Eitan
7f7bc36202
[Catalog] Expose colorScheme + typographyScheme properties for all examples to use app wide theming (#3478)
Made colorScheme and typographyScheme properties in the class interfaces for all our examples.
Moved theming away from example inits and into viewDidLoad
Small update for slider example to allow it to grab the theming properly.
Related Pivotal: https://www.pivotaltracker.com/story/show/156616695
2018-04-25 15:15:17 -04:00
featherless
683d2f5e74
[BottomNavigation] Add umbrella headers for all extension targets. (#3460)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 16:20:43 -04:00
John Detloff
f31cd3010d
Update BottomNavigationBar color themer (#3316)
https://www.pivotaltracker.com/story/show/156171489

Before:

https://user-images.githubusercontent.com/1418389/38699258-8753b1b8-3e65-11e8-8681-6998b13b1307.png
https://user-images.githubusercontent.com/1418389/38699259-875ded04-3e65-11e8-81ff-1d75069d6b22.png
https://user-images.githubusercontent.com/1418389/38699260-8768d480-3e65-11e8-93d2-16ad46e816f5.png


After:

https://user-images.githubusercontent.com/1418389/38699244-7ca2f10c-3e65-11e8-8b58-ac385b89e658.png
https://user-images.githubusercontent.com/1418389/38699245-7cad2f46-3e65-11e8-94b6-e326d9ca6854.png
https://user-images.githubusercontent.com/1418389/38699246-7cb5fa86-3e65-11e8-88f2-7359d40a2490.png
2018-04-12 16:14:49 -04:00
Mohammad Cazi
fe10c83c5d
BottomNavigationBar Typography Implementation, (#3311)
Tests and example added.
2018-04-10 14:20:17 -04:00
Robert Moore
a7ecc0b650
[BottomNavigation] Add barTintColor to replace backgroundColor (#3085)
Closes #2832
2018-03-21 15:49:55 -04:00
Robert Moore
a2e31fc7f6
[BottomNavigation] Fix memory leak in example (#3017)
The `BottomNavigationTypicalUseExample` has a retain cycle in the
`dispatch_after` block it uses to update the badge value. This causes
example VCs to be accumulated if they are opened repeatedly. A simple
fix is to keep a weak reference in the dispatched block making the next
update call a no-op.
2018-02-28 13:07:01 -05:00
Randall Li
b1ec22207f
Fixed float conversion build errors (#2602)
* Fixed float conversion build errors
Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

Found by turning on warnings via: https://github.com/material-components/material-components-ios/pull/2480

* More Fixed float conversion build errors
Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

Found by turning on warnings via: https://github.com/material-components/material-components-ios/pull/2480
2017-12-06 15:57:04 -05:00
Junius Gunaratne
36cf023a96 Implement viewSafeAreaInsetsDidChange (#2465) 2017-11-17 09:19:04 -05:00
Junius Gunaratne
a7e0a01636
Adding app bar navigation to demo (#2430)
kokoro-macos-bazel and kokoro-macos-cocoapods appear to be stuck.
2017-11-16 10:26:01 -05:00
Junius Gunaratne
106de4a6bf Update bottom navigation bar defaults to match native component height and orientation behavior (#2411) 2017-11-14 08:26:38 -05:00
Robert Moore
798f44762d [BottomNavigation] Fix example using iOS 10 API (#2357)
The typical use example uses an iOS 10-only API and needs to check for the
selector to be present.

Closes #2355
2017-11-08 16:20:33 -05:00
Junius Gunaratne
9788a65695 [BottomNavigation] Add protocol for responding to item selection (#2372)
* Add protocol for responding to item selection

* Update comments

* Update comments

* Changing protocol to only be called when user initiates action
2017-11-08 07:50:16 -05:00
Junius Gunaratne
4ada8e028a
[BottomNavigation] Add color themer to bottom navigation bar (#2239)
* Adding bottom nav component

* Add bottom navigation item

* Add nav item and cell badge classes

* Add badge color

* Update Bottom Nav Item

* Use KVO

* Update centering for orientation change

* Update badgeValue property

* Add nav bar container view for items

* Check text height when setting frame

* Update badge height calculation

* Add select and unselected color, add icons for demo, RTL support

* Add MDCMath as dependency

* Add demo description to example

* Add selection states for hiding item titles on select

* Change hide state name to default

* Rename view to bar

* Update nullability

* Rename properties for consistency with UITabBar

* Rename container view

* Update selected item property name

* Rename properties for consistency with UITabBar

* Rename classes, formatting

* Replace custom badge layer path with corner radius

* Remove MDCMath as dependency, update formatting

* Update layout to accommodate iPhone X

* Remove unused constant

* Move autoresizing to init

* Update landscape mode layout, add interim selection state

* Remove safeAreaInsetsDidChange

* Separate layout from setSelected

* Update landscape item layout

* Add landscape layout states, update sizeThatFits

* Update some setters, properties and formatting

* Update to dot setter syntax

* Change how image tintColor is modified

* Add i18n and a11y support for VoiceOver

* Update s/copy/strong

* Add a11y selected indicator

* Minor formatting updates

* Minor formatting

* Fix order of operations for remove item views

* Only permit badge color change if iOS 10 or higher.

* Add support for RTL for item adjacent titles

* Spelling correction in comments.

* Update title visibility enum names

* Update title visibility enum names

* Update title visibility names

* Remove 3-5 item requirement and change to recommendation

* nullability updates, distribution mode updates

* Add UIAppearance

* Lower bottom nav height when using adjacent titles

* Changing color/font properties to nonnull.

* Add bottom navigation color themer

* Update bottom nav bar main view so it's not an a11y element

* Add shadow to bottom nav

* Make imageview non a11y element.

* Adding tab a11y string

* Remove comment

* Rename distribution enum to alignment, stylistic updates

* Move badgeValue out of setters section

* Add check for iOS 10 when using badge color

* Remove newer availability checks

* Remove unncessary call to viewSafeAreaInsetsDidChange

* Add @available(iOS 11.0, *) check

* Fix badge color iOS version check

* Fix minor typo

* Add shadow layer and elevation dependency to podspec

* Remove (@available(iOS 10.0, *))

* Remove code diff

* Update podspec

* Code style updates, improve comments

* Add theming to swift example
2017-11-01 09:10:42 -04:00
Junius Gunaratne
58ecc3e8e1
[BottomNavigation] Adding bottom navigation component (#2088)
* Adding bottom nav component

* Add bottom navigation item

* Add nav item and cell badge classes

* Add badge color

* Update Bottom Nav Item

* Use KVO

* Update centering for orientation change

* Update badgeValue property

* Add nav bar container view for items

* Check text height when setting frame

* Update badge height calculation

* Add select and unselected color, add icons for demo, RTL support

* Add MDCMath as dependency

* Add demo description to example

* Add selection states for hiding item titles on select

* Change hide state name to default

* Rename view to bar

* Update nullability

* Rename properties for consistency with UITabBar

* Rename container view

* Update selected item property name

* Rename properties for consistency with UITabBar

* Rename classes, formatting

* Replace custom badge layer path with corner radius

* Remove MDCMath as dependency, update formatting

* Update layout to accommodate iPhone X

* Remove unused constant

* Move autoresizing to init

* Update landscape mode layout, add interim selection state

* Remove safeAreaInsetsDidChange

* Separate layout from setSelected

* Update landscape item layout

* Add landscape layout states, update sizeThatFits

* Update some setters, properties and formatting

* Update to dot setter syntax

* Change how image tintColor is modified

* Add i18n and a11y support for VoiceOver

* Update s/copy/strong

* Add a11y selected indicator

* Minor formatting updates

* Minor formatting

* Fix order of operations for remove item views

* Only permit badge color change if iOS 10 or higher.

* Add support for RTL for item adjacent titles

* Spelling correction in comments.

* Update title visibility enum names

* Update title visibility enum names

* Update title visibility names

* Remove 3-5 item requirement and change to recommendation

* nullability updates, distribution mode updates

* Add UIAppearance

* Lower bottom nav height when using adjacent titles

* Changing color/font properties to nonnull.

* Update bottom nav bar main view so it's not an a11y element

* Add shadow to bottom nav

* Make imageview non a11y element.

* Adding tab a11y string

* Remove comment

* Rename distribution enum to alignment, stylistic updates

* Move badgeValue out of setters section

* Add check for iOS 10 when using badge color

* Remove newer availability checks

* Remove unncessary call to viewSafeAreaInsetsDidChange

* Add @available(iOS 11.0, *) check

* Fix badge color iOS version check

* Fix minor typo

* Add shadow layer and elevation dependency to podspec

* Remove (@available(iOS 10.0, *))
2017-10-27 13:04:54 -04:00