29 Commits

Author SHA1 Message Date
featherless
471936b842
[ButtonBar] Add a buttonBarDidInvalidateIntrinsicContentSize API to the delegate. (#4932)
This will allow the owner of a button bar to react to changes in the button bar's intrinsic size.

We need to add this delegate because I'm not aware of an equivalent UIKit mechanism that works with views that aren't using auto layout (the MDCNavigationBar uses manual layout).

In a follow-up change, MDCNavigationBar will implement this delegate and update the layout of its left/right button bars as a result.

Part of https://github.com/material-components/material-components-ios/issues/1717
2018-08-31 14:10:56 -04: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
5d0e7ccfa8
[ButtonBar] Add uppercasesButtonTitles API for modifying title casing behavior. (#4935)
This change enables us to expose a similar API in MDCNavigationBar that will enable configuration of title casing behaviors for navigation bar button bars.

Step 1/2 for https://github.com/material-components/material-components-ios/issues/2968
2018-08-29 09:41:03 -04:00
featherless
7f5f920493
[ButtonBar] Remove NSCoding support. (#4553)
Closes https://github.com/material-components/material-components-ios/issues/3947
2018-07-16 08:04:41 -04:00
featherless
c1b513ba9e
[ButtonBar] Add tintColor observation support. (#4380)
This allows button bar buttons to observe the following additional UIBarButtonItem properties:

 - accessibilityHint
 - accessibilityIdentifier
 - accessibilityLabel
 - accessibilityValue
- tag
- tintColor

Closes https://github.com/material-components/material-components-ios/issues/3692.
2018-06-07 16:23:34 -04:00
featherless
fc2671fe94
[ButtonBar] Add unit tests for KVO behavior. (#4379)
These tests verify that the following properties are observed:

- Title
- Image
- Enabled

This change is part of resolving https://github.com/material-components/material-components-ios/issues/3692
2018-06-07 11:23:09 -04:00
featherless
a448657a23
[ButtonBar] Add umbrella headers for all extension targets. (#3462)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 17:21:12 -04:00
Ali Rabbani
3c112ae350 [ButtonBar] Make left/right insets for image and text buttons consistent (#3397)
Internal testing of this PR is done in cl/193415210. This is a behavior change for text button insets in MDCButtonBar.

NOTE: This doesn't *change* insets for text buttons that are the only button in the bar on iPad, since it still adds a 12pt inset on both sides for it. on iPhone, the additional inset for edge buttons is 4pt, which results in a 16pt inset on the edge side(s).

Before screenshots:
[Text buttons on both sides](https://user-images.githubusercontent.com/2232489/38957009-57ca20fa-4327-11e8-9f62-a92a61c7f20f.png)
[Text button on one side](https://user-images.githubusercontent.com/2232489/38957010-57d6b784-4327-11e8-8971-2c565833052d.png)

After screenshots:
[Text buttons on both sides](https://user-images.githubusercontent.com/2232489/38957016-5c719ee4-4327-11e8-886c-a7b6bdece4b5.png)
[Text button on one side](https://user-images.githubusercontent.com/2232489/38957017-5c7ebd36-4327-11e8-868b-5fde087eb382.png)

closes #3342
2018-04-23 14:40:25 -04:00
featherless
5a372de8fc
[ButtonBar] Add a stateful buttons title color API. (#3414)
This API allows a client to customize the title color for buttons for a given control state.

Related to https://www.pivotaltracker.com/story/show/156934328

Screenshot shows a button with a custom normal and highlighted state. The button on the left is highlighted.

![simulator screen shot - iphone se - 2018-04-19 at 19 51 59](https://user-images.githubusercontent.com/45670/39024065-786db638-440c-11e8-97e8-f6bf3e6c2af7.png)
2018-04-20 10:17:16 -04:00
featherless
a400ff0b30
[ButtonBar] Fix layout behavior when using custom button title font. (#3410)
Button frames need to be updated after the font changes because their frames are not dynamically updated in any layoutSubviews pass.

It may be sensible to update layoutSubviews to do the frame calculations in a follow-up change, but this has the potential to be a behaviorally-breaking change so I've filed a follow-up story: https://www.pivotaltracker.com/story/show/156930078
2018-04-20 10:08:03 -04:00
featherless
289223a5bb
[ButtonBar] Add a Typography Themer. (#3395)
Pivotal story: https://www.pivotaltracker.com/n/projects/2150420/stories/156769836

![simulator screen shot - iphone se - 2018-04-18 at 12 07 32](https://user-images.githubusercontent.com/45670/38957691-396cc5ca-4329-11e8-8a18-5d76cd50b736.png)
2018-04-19 19:55:44 -04:00
featherless
e11d24a110
[ButtonBar] Expose APIs for setting custom button fonts. (#3389)
This introduces a new API to MDCButtonBar that allows the title font to be customized for a given state. This is part of the work required to allow MDCNavigationBar to support custom button title fonts.

Pivotal story: https://www.pivotaltracker.com/story/show/156769836

Example of customization:

![simulator screen shot - iphone se - 2018-04-18 at 12 07 32](https://user-images.githubusercontent.com/45670/38945147-b7971dea-4303-11e8-86ca-31eaf45f416f.png)
2018-04-18 16:47:23 -04:00
Ali Rabbani
9947b8fa2b [ButtonBar] Fix insets for the trailing button bar (#3324)
Fix button insets used in MDCNavigationBar's trailing button bar. 

Internal testing of this PR is done in cl/192473549.

closes #2851
closes #3315
2018-04-12 14:53:57 -04:00
featherless
58afde19c7
Update bazel workspace and version to latest. (#3052) 2018-03-07 10:17:12 -05:00
Mohammad Cazi
cdea5d6836
[MDCButtonBar] add NSSecureCoding. (#2976)
* MDCButtonBar add NSSecureCoding.

* [MDCButton] NSSecureCoding

* Added tests for MDCButtonBar Coding, validation that items respond the given protocol.

* typo
2018-02-23 14:22:43 -05:00
Robert Moore
5879c18c26
[ButtonBar, NavigationBar] Add BUILD file for kokoro (#2598)
* [ButtonBar, NavigationBar] Add BUILD file for kokoro

ButtonBar ColorThemer depends on NavigationBar
NavigationBar depends on ButtonBar
2017-12-11 17:49:26 -05:00
Robert Moore
0ee27517d0 [ButtonBar] Make ButtonBarButton insets in method (#1797)
Refactoring App Bar button builder to be more testable/modular.  Pulling
out a method to create the content edge insets for a button in a button
bar.
2017-08-14 16:36:01 -04:00
Robert Moore
1441a01113 [ButtonBar] Refactor ButtonBarBuilder for testing (#1796)
* [ButtonBar] Refactor ButtonBarBuilder for testing

Pulling out part of the ButtonBarBuilder logic to start making it more
testable.  Extracting the initial configuration of MDCButton from a
UIBarButtonItem into a class method and adding unit tests.
2017-08-14 14:59:12 -04:00
Adrian Secord
7ff646b58a [Swiftlint] Moar swiftlint fixes (#1155)
* Quieted swiftlint down in scripts/format_all.

* BONUS clang-format for ObjC code.

* Fixed two stray ObjC warnings (not swiftlint related).

* Fixed remaning swiftlint warnings.

* Fixed typos in Shrine fixes.

* Swift cleanups, again.

This reverts commit 7489fca4e4741ae02b406cdaacaf1dae26e19837.
2017-01-25 17:23:20 -05:00
Adrian Secord
7489fca4e4 Revert "Swift cleanups."
This reverts commit 129789c601a2bb6b09648af953c5433ebe3cebe0.
2017-01-25 16:58:40 -05:00
Adrian Secord
129789c601 Swift cleanups. 2017-01-25 16:56:24 -05:00
Sam Symons
bb561ac257 [Scripts] SwiftLint integration (#1129)
* Integrate SwiftLint in the Catalog.

* Update the disabled SwiftLint rules.

* Reference a local swiftlint.yml symlink.

This prevents us from getting warnings about code style violations from the other demos.

* Fix SwiftLint violations in the Catalog and Components.

* Ignore the `third_party` directory when running the linter.

We should not have to deal with warnings in code we may not be able to fix easily.

* Integrate SwiftLint into Shrine.

Additionally, fix a number of warnings introduced.

* Run SwiftLint on Travis.

* Enable many of the previously disabled rules and correct them.

* Fix control statement violations from SwiftLint.
2017-01-06 16:37:23 -05:00
Adrian Secord
4842a362f5 Convert component examples to Swift 3 (#1002)
* WIP

* WIP

* Simplified build script and fixed it to build all schemes.

* WIP

* Renamed script to build_all and added better output.

* Add scripts/list_xcode_workspaces.

* Filtered out the CocoaPods schemes.

* Use Xcode to update Swift to v3.

* Updated tracked touches map from NSNumber to Int.

* Fixed button sorting that was not actually sorting.

* targetContentOffset no longer allowed to be nil.

* "Fixed" failing test by reducing random number range?

* Swift 3 syntax change.

* Swift 3 syntax change.

* Removed invalid center-aligning tests.

Fixed default nav bar alignment test.
2016-12-12 09:55:36 -05:00
Adrian Secord
2997e50c4c Updated refs to GitHub repo with new location. (#885)
* Updated refs to GitHub repo with new location.

* Reverted chagnes to JSON files.
2016-11-22 14:32:50 -05:00
Adrian Secord
8c3af252be Adding AUTHORS and removing CONTRIBUTORS.txt.
We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has...

Summary:

We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has no legal change, since the contributors always retained their copyright despite the copyright notice, but it's a nice acknowledgement.

Changed copyright statement to include non-Google authors.

Command run:

find * \( -name '*\.m' -or -name '*\.h' -or -name '*\.swift' \) -and -not \( -path 'scripts/external*' -name Pods  \) -print0 | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'

Added non-source files.

Command run:

grep -Rl 'Copyright .* Google Inc' * --exclude-dir scripts/external --null | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'

Reviewers: featherless, O1 Material components iOS, randallli

Reviewed By: O1 Material components iOS, randallli

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1415
2016-08-08 08:16:37 -07:00
Louis Romero
56561b40b6 [ButtonBar]? Layout bar button items based on the layout position.
Summary:
When the layout position is trailing, button items are now laid out in the
reverse order, to match UINavigationBar implementation.

This closes https://github.com/google/material-components-ios/issues/516.

Test Plan:
Have a button bar with MDCButtonBarLayoutPositionTrailing and 2 buttons.
Buttons should be laid out in the reverse order.

Reviewers: junius, #mdc_ios_owners, ajsecord

Reviewed By: #mdc_ios_owners, ajsecord

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D875
2016-05-21 02:00:56 +02:00
Jeff Verkoeyen
916866a525 [ButtonBar] Update tests to reflect that titleTextAttributes appearance only works on iOS 9.
Summary: Part of https://github.com/google/material-components-ios/issues/370.

Reviewers: #mdc_ios_owners, junius, iangordon

Reviewed By: #mdc_ios_owners, junius, iangordon

Subscribers: iangordon

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D685
2016-04-20 12:49:11 -04:00
Jeff Verkoeyen
e3a56fe962 [ButtonBar] Check UIBarButtonItem global appearance configuration when creating the buttons.
Summary: Related to https://github.com/google/material-components-ios/issues/370.

Reviewers: randallli, #mdc_ios_owners, larche

Reviewed By: randallli, #mdc_ios_owners, larche

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D625
2016-04-16 00:10:05 -04:00
Jeff Verkoeyen
792c128c8b [ButtonBar] Icon-only buttons use unbounded ink. Buttons with text us bounded ink.
Summary: Closes https://github.com/google/material-components-ios/issues/328.

Reviewers: #mdc_ios_owners, ajsecord

Reviewed By: #mdc_ios_owners, ajsecord

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D576
2016-04-12 14:40:25 -04:00