255 Commits

Author SHA1 Message Date
Yarden Eitan
40453fe9d2 [ButtonBar] Fix use of wrong enum values (using FloatingBar rather than ButtonBar)
PiperOrigin-RevId: 366253794
2021-04-01 08:18:50 -07:00
Jeff Verkoeyen
1abdf16760 Optimizing imports
PiperOrigin-RevId: 357185990
2021-02-12 07:36:41 -08:00
Jeff Verkoeyen
63988b35da Optimizing imports
PiperOrigin-RevId: 356966165
2021-02-11 07:09:58 -08:00
Yarden Eitan
30b6cc1703 [ButtonBar] Deprecate inkColor API.
Please use rippleColor instead.

PiperOrigin-RevId: 333366306
2020-09-23 13:57:08 -07:00
Nobody
4511a9f5e4 [ButtonBar] Removes nullability modifiers from file.
PiperOrigin-RevId: 327016891
2020-08-17 07:35:05 -07:00
Yarden Eitan
ae3fc08aac [ButtonBar] Fall back to accessibilityLabel for UILargeContentView when there is an image and no title.
PiperOrigin-RevId: 327013666
2020-08-17 07:08:15 -07:00
Yarden Eitan
7f9d2cc350 [ButtonBar] Adds Large Content Viewer support to MDCButtonBar, MDCNavigationBar, and MDCAppBar.
PiperOrigin-RevId: 326652230
2020-08-14 07:35:52 -07:00
Bryan Oltman
f75ff1a02f Add checks for existence of UIPointerInteraction class to avoid iOS 13 beta crashes
PiperOrigin-RevId: 323838787
2020-07-29 12:10:16 -07:00
Wenyu Zhang
0a0f7347fa [ButtonBar] Fix ButtonBar typical example's crash by making containerScheme a property.
PiperOrigin-RevId: 322179582
2020-07-20 10:58:56 -07:00
Jan Philipp Sachse
3002e9a73f Add UIMenu support to MDCButtonBar.
This will keep the primary action and menu properties of the UIBarButtonItem and apply them to the button.
If no primary action is set, the menu will be used as primary action automatically.

PiperOrigin-RevId: 321320327
2020-07-15 02:03:57 -07:00
Jeff Verkoeyen
b9e978c6e5 [ButtonBar] Remove excess iPad insets from the button bar buttons.
PiperOrigin-RevId: 314924625
2020-06-05 07:31:50 -07:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

Closes https://github.com/material-components/material-components-ios/pull/9968

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Bryan Oltman
e95d65a96c [ButtonBar] Set inkOffset when given asymmetric contentEdgeInsets.
PiperOrigin-RevId: 304397722
2020-04-02 07:40:55 -07:00
Bryan Oltman
57f98a60f2 [ButtonBar] Remove custom shape for MDCButtonBarButton highlight effect.
By default, UIPointerStyle uses the target view's frame for a highlight effect. Providing view.bounds caused the highlight effect to use a zero-origin frame.

PiperOrigin-RevId: 304177779
2020-04-01 07:07:19 -07:00
Bryan Oltman
b05945db18 [ButtonBar] Add highlight pointer effect to MDCButtonBarButtons
PiperOrigin-RevId: 303980616
2020-03-31 09:30:06 -07:00
Bryan Oltman
0da64e1315 [ButtonBar] Move protocol definitions into separate header files
PiperOrigin-RevId: 301653848
2020-03-18 13:25:19 -07:00
featherless
2897baaafb
[ButtonBar] Do not allow implicit downcasting of item views. (#9761)
Prior to this change, it was possible to implicitly downcast item views to UIButton or MDCButton, potentially causing crashes by treating custom views incorrectly as a button and invoking UIButton selectors on it.

This change removes the `__kindof` implicit casting for the _buttonViews ivar so that the buttonViews need to be explicitly casted to a button type.

Related to https://github.com/material-components/material-components-ios/issues/9760
2020-02-19 13:09:33 -05:00
featherless
e3df3459fc
[ButtonBar] Fix crash when assigning tint color, title, or image to bar button item with custom view. (#9759)
When a bar button item with a custom view is provided to the button bar, the custom view is used in place of an MDCButton instance.  6ec9f334f0e093e1d2bf04165895ca725455150e introduced a change that unconditionally called a UIButton API on the views when the tintColor was changed, resulting in a crash when a custom view was used.

This change adds a test that, prior to this fix in this change, crashed, but after the fix included in this change now passes.

Upon inspection of the culprit code, it was revealed that image and title similarly could result in crashes, so those crashes have been fixed as part of this change as well.

Closes https://github.com/material-components/material-components-ios/issues/9760
2020-02-19 09:30:19 -05:00
Jeff Verkoeyen
169cd386a6 [ButtonBar] Assign the UIBarButtonItem's tintColor to the button's text color.
Prior to this change, UIBarButtonItem's tintColor property would not change the title color of the corresponding button. This differs from the UIKit behavior, which does result in the title color being changed.

After this change, changing a UIBarButtonItem's tintColor will result in the corresponding button's title color being updated as well.

PiperOrigin-RevId: 293848033
2020-02-07 16:03:52 -05:00
Jeff Verkoeyen
b30d4c9162 [FlexibleHeader] Add missing self-> within a block.
Resolves the following error:
"Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior"

PiperOrigin-RevId: 293801599
2020-02-07 06:24:51 -08:00
Jeff Verkoeyen
aca8bbd5e2 [ButtonBar] Rolling back "Assign the UIBarButtonItem's tintColor to the button's text color."
PiperOrigin-RevId: 293609216
2020-02-06 09:33:45 -08:00
Jeff Verkoeyen
eb528a9349 [ButtonBar] Assign the UIBarButtonItem's tintColor to the button's text color.
Prior to this change, UIBarButtonItem's tintColor property would not change the title color of the corresponding button. This differs from the UIKit behavior, which does result in the title color being changed.

After this change, changing a UIBarButtonItem's tintColor will result in the corresponding button's title color being updated as well.

PiperOrigin-RevId: 293583337
2020-02-06 06:56:22 -08:00
Jeff Verkoeyen
6ec9f334f0 [ButtonBar] Refactor title color logic to a single location.
The title color logic was previously being applied in three different places in slightly different ways each time. This change consolidates the logic into a single method and invokes this new method from each place where the title color can change; namely:

1. When initially creating the button.
2. When the button's tintColor context changes.
3. When the button item's tintColor property changes.

PiperOrigin-RevId: 293580183
2020-02-06 06:33:14 -08:00
Jeff Verkoeyen
e91b5bfb9f [ButtonBar] Use CGSizeZero instead of CGSizeMake(0, 0).
CGSizeZero is more idiomatic when referring to an empty size.

PiperOrigin-RevId: 293222031
2020-02-04 13:57:22 -08:00
Jeff Verkoeyen
45b435c70c [ButtonBar] Add snapshot tests for title color behavior.
These snapshot tests will be used to verify changes in behavior to the title color of buttons.

PiperOrigin-RevId: 293219347
2020-02-04 13:46:20 -08:00
featherless
b7cf0de915
[bazel] Remove all unused swift_library load statements. (#9369)
Found by searching for all references to `\bswift_library` and removing load statements from files that only returned one result.

Clean up as part of https://github.com/material-components/material-components-ios/issues/5491
2020-01-02 11:01:31 -05:00
featherless
0a0bc4b47b
[automated] Ran buildifier on all BUILD files. (#9366)
```
find . -name BUILD | xargs buildifier
```

This is in preparation of https://github.com/material-components/material-components-ios/issues/9363
2020-01-02 10:05:07 -05:00
Andrew Overton
8814a6f55c
Revert "Revert "Delete MDCButtonBarColorThemer (#9235)"" (#9272)
This PR brings back https://github.com/material-components/material-components-ios/pull/9235, which was reverted because [cl/285188391](http://cl/285188391) had not actually been submitted when #9235 was merged. It is now safe to merge.
2019-12-16 09:45:32 -05:00
Randall Li
798352bf09 Revert "Delete MDCButtonBarColorThemer (#9235)"
This reverts commit d0c581e993a7de09c95a2b6c067733fed0239c0b.
2019-12-12 07:21:10 -05:00
Andrew Overton
d0c581e993
Delete MDCButtonBarColorThemer (#9235)
Delete MDCButtonBarColorThemer. Closes #9137.
2019-12-10 14:52:17 -05:00
Andrew Overton
1e167e2376
[ButtonBar] Deprecate MDCButtonBarColorThemer (#9155)
Associated CL: [cl/284204381](http://cl/284204381)
Related to #9138
Related to #9137
2019-12-06 15:17:32 -05:00
Andrew Overton
7ece2c1187
delete-MDCButtonBarTypographyThemer (#9117)
Related to #9105.
2019-12-05 15:37:31 -05:00
Bryan Oltman
4baa770fde
[Catalog] Darken ButtonBarIconExample icon colors (#8826)
* [Catalog] Darken ButtonBarIconExample icon colors

* Update BUILD file
2019-11-14 15:45:18 -05:00
featherless
fb36f304ba [ButtonBar] Delete the Theming extension. (#8696)
This target is deprecated and unused internally.

Part of #8429
2019-11-12 13:19:19 -08:00
Robert Moore
8cebc56185
[*] Suppress deprecation warnings. (#8481)
Suppresses deprecation warnings either for implementations of our own
deprecated APIs or for their use in tests and elsewhere.

Part of #7537
2019-09-23 12:48:42 -04:00
featherless
0f7ee59f13 [ButtonBar] Deprecate Theming and TypographyThemer. (#8432)
Part of #8429

These targets have no internal usage.
2019-09-10 11:21:00 -04:00
Wenyu Zhang
f837b91407
[ButtonBar] Stop running swift tests on Autobot. (#8267)
Closes https://github.com/material-components/material-components-ios/issues/8266.

This change only affects Autobot runner. The work to re-enable this flag for Autobot is tracked in https://github.com/material-components/material-components-ios/issues/8249.

### Context
Error occurs when testing using Bazel.

```
Test Case '-[components_ButtonBar_unit_test_swift_sources.ButtonBarButtonTitleCasingTests testButtonTitlesAreNotUppercasedWhenFlagIsDisabledAfterAssignment]' started.
Child process terminated with signal 11: Segmentation fault
```
2019-08-12 11:42:03 -04:00
Eric Lee
d389bcc346 [Beta] Fixes beta components CocoaPods build. (#8134)
I was seeing build errors when compiling the beta components after installing using CocoaPods.  This appeared to fix those issues.
2019-08-09 13:14:21 -04:00
Robert Moore
cab960098b
[ButtonBar] Use Starlark macros. (#8161)
Adds more Starlark macro usage in the BUILD file. This makes releasing easier.

Part of #8150
2019-08-01 15:46:42 -04:00
Robert Moore
8dcf1e4a56
[*] Remove RTL snapshot method overrides. (#7996)
With #7986, most snapshot tests began overriding a method that had nearly the
same behavior.
2019-07-22 21:11:17 -07:00
Wenyu Zhang
1d03b28fb6
[ButtonBar] add traitCollectionDidChangeBlock support. (#7976)
closes #7979
2019-07-22 13:56:09 -04:00
Yarden Eitan
19ef3dd2c2
[ButtonBar] Adds the Ripple behavior to ButtonBar. (#7593)
## Related links
* Bug: Closes #7379 
* Ripple: [Ripple](https://github.com/material-components/material-components-ios/tree/develop/components/Ripple)

## Introduction
This PR allows enabling the Ripple Behavior for `MDCButtonBar` by enabling the ripple behavior of the internal `MDCButton`s. This behavior is an opt in flag property added to MDCButtonBar, `enableRippleBehavior`.  This improves the visual touch feedback for our users as MDCInkView didn't support our current motion guidelines. We are also marking any of the Ink APIs ToBeDeprecated as part of the [Deprecation Policy](cb6b8e9599/contributing/deprecation_policy.md (step-4-add-a-comment-to-the-api-indicating-that-it-will-be-deprecated)).

## Videos
| Before | After |
| - | - |
|![oldRipple](https://user-images.githubusercontent.com/4066863/59468585-707e9980-8e00-11e9-8eb4-f6709ea3af94.gif)|![newRipple](https://user-images.githubusercontent.com/4066863/59468588-72e0f380-8e00-11e9-992f-9fecc8383dd7.gif)|
2019-06-15 14:33:13 -04:00
Robert Moore
225decbfb0
[Buttons] Fix fallback behavior for Dynamic Type. (#7514)
The `titleFontForState:` API did not correctly reflect the rendered font
when no explicit fonts were set via the MDCButton APIs. As a result,
calling `updateTitleFont` internally could result in a different font
being returned than what was displayed.

Moving the "fall back" and Dynamic Type behavior into the
`titleFontForState:` method allows more consistent behavior (reduces the
risk of deviations) and corrects the APIs to reflect what is rendered.
This change should result in no visible changes to clients (the rendered
fonts should remain the same), but will result in non-`nil` results
being returned from `titleFontForState:` to correctly reflect the
rendered font for a given state.

Part of #7492
2019-05-30 10:25:13 -04:00
featherless
0d8d010ed1 [ButtonBar] Fix a typo in the docs for rectForItem:inCoordinateSpace:. (#7496)
Part of #7248
2019-05-25 01:53:02 -04:00
featherless
631779545e
[ButtonBar] Expose a rectForItem:inCoordinateSpace: API. (#7438)
This API will allow clients to present overlay views that point to views in an MDCButtonBar.

Expected usage:

```swift
@objc func didTapButton(_ item: UIBarButtonItem) {
  let rect = buttonBar.rect(for: item, in: view)
  // Present an overlay pointing at `rect`
}
```

Closes https://github.com/material-components/material-components-ios/issues/7248
2019-05-22 14:00:19 -04:00
Yarden Eitan
efe61588a6
update (#7246)
We need to add @objc annotations to colorScheme and typographyScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find `setColorScheme:` and `setTypographyScheme:` setters otherwise.
2019-04-23 10:21:14 -04:00
featherless
59e1577ca3
[ButtonBar] Annotate themer APIs with the recommended APIs. (#7217)
Part of https://github.com/material-components/material-components-ios/issues/7108
2019-04-22 19:56:00 +03:00
Yarden Eitan
5bed3961e6
[ContainerScheme] Graduate ContainerScheme to ready. (#7170)
This PR graduates ContainerScheme to ready.

This includes updating the podspecs, podfile, all the import statements related to ContainerScheme, updating .kokoro rewrite rules, and finally the readme to not have ContainerScheme regarded to as being in beta.

Ran locally kokoro with -b bazel successfully.

Resolves #6732
2019-04-18 09:25:02 -04:00