87 Commits

Author SHA1 Message Date
Jeff Verkoeyen
187f99a6f4 [ActionSheet] Delete flaky test.
PiperOrigin-RevId: 609118090
2024-02-21 14:12:50 -08:00
Jeff Verkoeyen
6eecf87910 [ActionSheet] Remove defunct tests.
These tests broke when upgrading to Xcode 15.0.1. We do not support this component anymore; UIMenu should be used instead.

PiperOrigin-RevId: 606824408
2024-02-13 19:28:18 -08:00
Janette James
8e490b68d2 Use UIViewController to override trait collection
PiperOrigin-RevId: 535048989
2023-05-24 18:19:00 -07:00
Nobody
cc509d193f Fixed up imports and nullability for ActionSheet
PiperOrigin-RevId: 495443445
2022-12-14 16:10:29 -08:00
Alyssa Weiss
057d1b2024 Have MDCActionSheetController conform to UIContentSizeAdjusting protocol, and implement adjustsFontForContentSizeCategory.
PiperOrigin-RevId: 372206277
2021-05-05 14:25:45 -07:00
Cody Weaver
1524182f7c [ActionSheet] Allow clients to get the view associated with a given action.
PiperOrigin-RevId: 366489478
2021-04-02 12:15:47 -07:00
Jeff Verkoeyen
8ce743ce8a Optimizing imports
PiperOrigin-RevId: 357185751
2021-02-12 07:33:30 -08:00
Jeff Verkoeyen
791596b851 [ActionSheet] Update all test and example files to match conventions.
PiperOrigin-RevId: 334822431
2020-10-01 08:54:27 -07:00
Jeff Verkoeyen
ab1ea86eef [ActionSheet] Flatten the unit tests into a single directory.
This aligns with our test directory organizational conventions.

PiperOrigin-RevId: 334808133
2020-10-01 07:21:20 -07:00
Jeff Verkoeyen
fbb1f20aa2 Internal change
PiperOrigin-RevId: 332151481
2020-09-16 21:01:21 -07:00
Andrew Overton
225cd3c0cb [BottomSheet] Ensure transition controller pass-through accessors work following presentation controller initialization
PiperOrigin-RevId: 326304121
2020-08-12 13:49:59 -07:00
Andrew Overton
e4805f0c2c [ActionSheet] Delete MDCActionSheetColorThemer
PiperOrigin-RevId: 321431638
2020-07-15 13:53:40 -07:00
Andrew Overton
742c7b3da7 [ActionSheet] Delete MDCActionSheetThemer and MDCActionSheetScheme
PiperOrigin-RevId: 321392126
2020-07-15 10:48:45 -07:00
Bryan Oltman
e5f4e3fcb0 [ActionSheet] Add actionSheetControllerDismissalAnimationCompleted method to MDCActionSheetControllerDelegate.
This function notifies MDCActionSheetController delegates that the (user-triggered) dismissal animation has completed and the action sheet is no longer on the screen.

PiperOrigin-RevId: 314974453
2020-06-05 12:27:52 -07:00
Cody Weaver
d30de4507c [MDC/ActionSheet] Add test showcasing how when an Action's image is set it does not update an ActionSheet.
Currently MDCActionSheetController does not support having clients add an image to an action after it has been displayed. This commit showcases that is not supported via the snapshot test. This requires a change in the MDCActionSheetAction header to allow the image to be readwrite.

PiperOrigin-RevId: 309443045
2020-05-01 11:37:25 -07:00
Wenyu Zhang
45671537f5 [ActionSheet] Add UIPointerInteraction support for actions..
PiperOrigin-RevId: 305871877
2020-04-10 07:17:38 -07:00
Cody Weaver
fdf87c5995 [MDC/ColorScheme] Remove usage of init within MDC.
We recommend using `initWithDefaults` and we should follow the recommendation. This change removes all usage of `init` within MDC components in order to let us remove that initializer from the public surface.

PiperOrigin-RevId: 302958447
2020-03-25 13:36:51 -07:00
copybara-service[bot]
542261e405
[ActionSheet] Move protocol definitions into separate header files (#9926)
[ActionSheet] Move protocol definitions into separate header files
2020-03-18 14:05:12 -04:00
Bryan Oltman
652077c779
[Material][Availability] Migrates Action sheet to MDCAvailability. (#9733)
[Material][Availability] Migrates Action sheet to MDCAvailability.
2020-02-14 11:40:36 -05:00
Bryan Oltman
42b004fcd7
[ActionSheet] Add delegate to support dismissal notification (#9475)
Add `MDCActionSheetControllerDelegate` to `MDCActionSheetController` with `actionSheetControllerDidDismiss:` so users of the ActionSheet component can react to dismissal.

Fixes #9147
2020-01-23 15:12:39 -05:00
Cody Weaver
0d632ff762
[ActionSheet] Action sheet divider (#9449)
This adds the ability for MDCActionSheet to add dividers on a per action basis. The dividers are always represented above the action and respect the `contentInsets` property of the `MDCActionSheetController`. 

Any update to the action before the `MDCActionSheetController` is presented will be displayed when presented. If an ActionSheetController is presented then this property is changed those changes will not be present. I've filed #9465 to track that work. I choose not to add this functionality since similar properties, (tintColor, titleColor, title, image) on MDCActionSheetAction also follow this pattern. 

Closes #9331
2020-01-23 09:57:53 -08:00
Bryan Oltman
eb46b2810e
[ActionSheet] Delete inkColor and enableRippleBehavior from MDCActionSheetItemTableViewCell (#9240)
Because inkColor and enableRippleBehavior no longer exist on MDCActionSheetController
and MDCActionSheetItemTableViewCell is private, these properties are unused and can safely be deleted. This change also properly marks MDCActionSheetItemTableViewCell's rippleColor as null_resettable.

Fixes #9239
2019-12-11 10:03:05 -05:00
Bryan Oltman
4d945c06b1
[ActionSheet] Delete inkColor and enableRippleBehavior properties (#9238)
MDCActionSheetController's inkColor and enableRippleBehavior properties are deprecated and have no internal usage. inkColor and enableRippleBehavior properties still exist in MDCActionSheetItemTableViewCell and will be deleted in a future PR.

Fixes #9128
2019-12-10 15:49:39 -05:00
Bryan Oltman
30df338682
Remove equality check when setting rippleColor to prevent crashes stemming from CIColor (#9237)
Comparing a non-`UICIColor` (e.g., a `UIExtendedSRGBColorSpace` UIColor) with a `UICIColor` crashes with the message:

> error: -[MDCActionSheetTableCellTest testSetRippleColor] : failed: caught "NSInvalidArgumentException", "-[UICIColor colorSpaceName]: unrecognized selector sent to instance 0x7ff1c02595b0"

Because of this, and the fact that this check is likely an unnecessary optimization (and because `isEqual:` does not return YES for UIColors from different color spaces, even if they have the same RGBA values), this PR removes the equality check.

Fixes #9236
2019-12-10 15:00:33 -05:00
Bryan Oltman
0107d70d28
[ActionSheet] Deprecate MDCActionSheetAction inkColor (#9127)
Part of b/145204880, will link to the mirrored Github issue once it has been created.
2019-12-06 11:43:46 -05:00
Bryan Oltman
96cebca8cd
[ActionSheet] Action sheet enable ripple (#9135)
* [ActionSheet] Enable ripple by default

* Update ripple/ink tests
2019-12-05 16:26:23 -05:00
Robert Moore
c87d65330f
[ActionSheet] Refactor edge insets API snapshot tests. (#9035)
Refactor the edge insets API snapshot tests to have more reusable code.

This is a partial roll-forward of #9029. `imageEdgeInsets` was rolled-back and
so that part of the original PR is not part if this change.
2019-12-02 10:11:38 -05:00
Wenyu Zhang
06d6327c9b Revert "[ActionSheet] Add imageEdgeInsets API. (#9024)"
This reverts commit 52dbc6c0b7eec2cdb7214b3b146450ab9fec2f0e.
2019-11-27 10:49:58 -05:00
Wenyu Zhang
1233b9684b Revert "[ActionSheet] Refactor insets snapshot test. (#9029)"
This reverts commit 55c4ab9b8b100f83a117a9e985f1a74b8ce20fa6.
2019-11-27 10:49:40 -05:00
Robert Moore
55c4ab9b8b
[ActionSheet] Refactor insets snapshot test. (#9029)
Refactors the "edge insets" snapshot test class to reuse more code and reduce
boilerplate.

Identified in #9024
2019-11-26 06:47:45 -05:00
Robert Moore
52dbc6c0b7
[ActionSheet] Add imageEdgeInsets API. (#9024)
Creates a new API to allow adjusting each action's image edge insets.  Clients can now resize/position the action image's container view to adjust the layout of each action row. The image container view is part of the overall content container view, so adjustments to its size may affect the overall content size as well.

Part of #8709
2019-11-25 19:20:58 -05:00
Robert Moore
c33be81182
[ActionSheet] Split "insets" API snapshot tests to separate file. (#9020)
Moves the `contentEdgeInsets` API snapshot tests to a separate file. The
upcoming APIs `titleEdgeInsets` and `imageEdgeInsets` will have their tests
added in the new file.

Follow-up from #9008
Part of #8709
2019-11-22 08:58:06 -05:00
Robert Moore
06ea8732d2
[ActionSheet] Name unit tests to match class. (#9003)
MDCActionSheetController's unit tests were not easily discoverable because the
names did not match the expected pattern for Xcode.

Clean-up for #8709
2019-11-22 07:27:25 -05:00
Robert Moore
8fb17f7b0a
[ActionSheet] Add contentEdgeInsets API. (#9008)
This is the first of three APIs required to support customized action cell
layouts necessary for internal design guidelines.  The `contentEdgeInsets` API
allows configuring the inset/outset values of the content rectangle of each
action cell.

Part of #8709
2019-11-22 07:19:49 -05:00
Robert Moore
8405097173
[Action Sheet] Correct RTL snapshot tests. (#9011)
Fixes snapshot test RTL layout to more accurately reflect layout on device.

Preparation for #8709
2019-11-20 21:34:12 -05:00
Robert Moore
a14720f7d7
[ActionSheet] Refactor snapshot tests. (#8999)
Refactoring snapshot tests to reduce duplicated code.

Preparation for #8709
2019-11-20 07:04:41 -05:00
Robert Moore
dede397d7e
[ActionSheet] Fix behavior of alwaysAlignTitleLeadingEdges. (#8610)
The `alwaysAlignTitleLeadingEdges` API was incorrectly functioning as a
one-way switch that only worked after actions were added. Instead, it should
work at any point and be able to be disabled.

Fixes #8609
2019-10-18 22:37:28 -04:00
Wenyu Zhang
bca3610740
[ActionSheet] set elevation value in theming extension. (#8466)
Part of https://github.com/material-components/material-components-ios/issues/8456.

Set elevation value to 8 in action sheet's theming extension.
2019-09-19 18:17:31 -04:00
Wenyu Zhang
efe0592ff7
[ActionSheet] Add elevation property to ActionSheet. (#8465)
Part of https://github.com/material-components/material-components-ios/issues/8456.

This PR added a custom property for setting elevation.
2019-09-18 19:12:15 -04:00
Cody Weaver
693d01a06a
[ActionSheet] Add ability to add a divider between header and table (#8230)
This PR adds an API 

*new property* `*headerDividerColor` on _MDCActionSheetController_
*new property* `*showHeaderDivider` on _MDCActionSheetController_

that will allow clients to add a divider to the action sheet between the header and the table. If a client wants to show a header divider they would need to set `showHeaderDivider` and then set an appropriate color for their use case, by default it is `clearColor`. By default the property `showHeaderDivider` view is `NO` so that we do not break clients. This matches a pattern outlined in [`MDCBannerView`](ac114b4bda/components/Banner/src/MDCBannerView.h (L76-L88)).

Closes #7395
2019-09-11 15:11:29 -04:00
Wenyu Zhang
05d01faa2c
[ActionSheet] Add snapshot tests to ensure the default presentation behavior doesn't change under iOS 13. (#8365)
Part of b/135017125.

Added a snapshot test to ensure ActionSheet's appearance doesn't change when presented under iOS 13.
2019-08-27 10:28:09 -04:00
Cody Weaver
d73d498d7e
[ActionSheet] Add dark mode support to theming extension (#8245)
This PR adds dark mode support to the theming extension for MDCActionSheetController. In order to support dark mode clients will need to set dynamic colors in their color scheme. 

There is no change to `mdc_elevationDidChangeBlock` because the elevation on an MDCActionSheetController should never change since it is not a settable property. If we later expose a setter then we will need to add that functionality. Additionally unit test were added but since MDCActionSheetController doesn't allow for subclassing I could not test for traitCollection changes. In order to test this more thoroughly do the steps as follows.

1. Launch MDCCatalog on an iOS 13 simulator.
2. Open the ActionSheet example.
3. Switch between light and dark mode in Xcode 11.

Following the steps above, this should be the result.
![actionSheet](https://user-images.githubusercontent.com/7131294/62724608-61bbf980-b9e1-11e9-8979-d586b49d2c58.gif)
2019-08-12 14:33:27 -04:00
Wenyu Zhang
a25909f77d
[ActionSheet] Disable a iOS13 failing test. (#8246)
Part of `testDefaultBackgroundColor` is failing because of XCode beta. Disable this test to make iOS13 bot happy.

Error description:
Setting `UIColor.white` as backgroundColor on a tableView causes `<UIDynamicSystemColor: 0x7fab88c49d50; name = tableBackgroundColor>` to be set in the end. It seems to be an XCode 11 beta issue.
2019-08-08 18:06:32 -04:00
Cody Weaver
7d208af246
[ActionSheet] Allow clients to customize the tint color of actions (#8227)
Allows clients to customize the tint of individual actions. Currently MDCActionSheetController allows clients to customize the tint color on the controller itself but this allows for each action to have its own color. The controller will maintain its API so that clients can have a convenience of coloring all actions but also the ability to customize each individual action if that is what their design asks for.

Closes to #7549
2019-08-06 14:10:32 -04:00
Cody Weaver
efc2f9214e
[ActionSheet] Allow clients to customize the title color of actions (#8226)
Allows clients to customize the title of individual actions. Currently MDCActionSheetController allows clients to customize the title color on the controller itself but this allows for each action to have its own color. The controller will maintain its API so that clients can have a convenience of coloring all actions but also the ability to customize each individual action if that is what their design asks for.

Related to #7549
2019-08-06 10:57:35 -04:00
Cody Weaver
2feb8f96cd
[ActionSheet] Add MaterialElevation support (#8111)
Adds conformance to MDCElevatable and MDCElevationOverriding to
MDCActionSheetController.

Closes #8030
2019-07-31 10:22:30 -07:00
Robert Moore
7bc09cdf8b
[ActionSheet] Drop iOS 8 work-arounds. (#8120)
We no longer support iOS 8 so don't need the pragmas hanging around.

Part of #1296
2019-07-30 12:41:15 -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
Cody Weaver
fdc9631dfa
[ActionSheet] Add traitCollectionDidChange block (#7929)
The action sheet needs an API so clients can hook-in to trait collection changes. This additionally passes the action sheet as a parameter so clients can modify the action sheet within the block.
2019-07-16 07:33:34 -07:00
Yarden Eitan
c64b90d844
[ActionSheet] Adds the Ripple behavior to ActionSheet. (#7594)
## Related links
* Bug: Closes #7383  
* Ripple: [MDCRippleTouchController](https://github.com/material-components/material-components-ios/tree/develop/components/Ripple)

## Introduction
This PR integrates [`MDCRippleTouchController`](https://github.com/material-components/material-components-ios/blob/develop/components/Ripple/src/MDCRippleTouchController.h) into [`MDCActionSheetController`](https://github.com/material-components/material-components-ios/tree/develop/components/ActionSheet). This behavior is an opt in flag property added to MDCActionSheetController, `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/59469373-a7ee4580-8e02-11e9-9200-5ca939a42f42.gif)|![newRipple](https://user-images.githubusercontent.com/4066863/59469387-ad4b9000-8e02-11e9-8df6-c5263b15239d.gif)|
2019-06-15 15:34:53 -04:00