456 Commits

Author SHA1 Message Date
Nobody
cbfa5400ed Fix an issue that alertController:didTapAction:withEvent: delegate method is not called if the action doesn't have completion handler.
PiperOrigin-RevId: 334301214
2020-09-28 21:54:37 -07:00
Galia Kaufman
9d9bd93847 [Dialogs] Adding accessoryViewHorizontalInset API
The API allows setting horizontal insets for the accessory view that are different from the message. This is most often used for dialogs that have both a message and an accessory view, as demonstrated in the attached example.

Additionally, this example demonstrates how to add an horizontal hairline as shown on the material.io spec for Confirmation Dialogs.

Note:
This new API is needed because clients do not always have control over the view that is being used as an accessory view, or that the view is used in multiple areas in the app, and cannot be customized.
Additionally, there's no way currently to set 0 insets for the accessory view, while still keeping the 24 value insets for the message, which is a relatively common scenario.
PiperOrigin-RevId: 334142026
2020-09-28 06:12:48 -07:00
Alyssa Weiss
bd6484925b Delete deprecated buttonFont for MDCAlert and make all appropriate changes following deletion
PiperOrigin-RevId: 333566191
2020-09-24 12:03:36 -07:00
Galia Kaufman
e9b0eee25d [Dialogs] Add an accessoryView with a collection example
This example demonstrates adding a collection view as an accessory view of a Material alert.  It also demonstrates adding a horizontal line above the actions, as shown on material.io's spec for Confirmation Dialogs. The line will be fixed to reach the edges of the dialogs in a followup PR (cl/331128888).

PiperOrigin-RevId: 333376220
2020-09-23 14:43:24 -07:00
Yarden Eitan
c5c231c879 [MDCAlertController] Deprecate button styling APIs.
PiperOrigin-RevId: 333366774
2020-09-23 14:06:39 -07:00
Alyssa Weiss
8842f55760 Update the testing for the localization snapshot tests.
PiperOrigin-RevId: 332912160
2020-09-21 12:52:20 -07:00
Alyssa Weiss
d40c6d8608 Remove iOS 10+ checks now that the minimum support contract is iOS 10.
PiperOrigin-RevId: 332836975
2020-09-21 06:28:30 -07:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Nobody
6e42102550 Issue:- We currently disable tap for message text view.
Fix:- Enabled the tap when voiceover is running.
PiperOrigin-RevId: 329953992
2020-09-03 11:09:21 -07:00
Alyssa Weiss
805a2af3a8 Update logic for using title insets in calculations
PiperOrigin-RevId: 328537570
2020-08-26 08:40:34 -07:00
Bryan Oltman
91a2953b0d Add isPointerInteractionEnabled availability check.
There are still some iOS 13.4 betas floating around that had not yet introduced this API. This
change should prevent those users from crashing when attempting to get/set this value.

PiperOrigin-RevId: 326248791
2020-08-12 09:38:07 -07:00
Galia Kaufman
89ddea0cf1 [Dialogs] Improved titleIconView example with animation.
PiperOrigin-RevId: 322791317
2020-07-23 08:32:40 -07:00
Galia Kaufman
81b5c39f7e [Dialogs] Disabling selection in alerts while allowing tappable links
Internally subclassing UITextView in order to disable selectability of text.

PiperOrigin-RevId: 321046270
2020-07-13 15:31:24 -07:00
Wenyu Zhang
0861811377 [Dialogs] Migrate Dialogs to use centerVisibleArea from visibleAreaInsets.
PiperOrigin-RevId: 320435293
2020-07-09 11:22:00 -07:00
Galia Kaufman
74cf720356 [Dialogs] Fix title icon resize on orientation change
The title icon image view size is updated after each orientation transition, causing the image to get smaller after each transition.
To fix this, we're using the original size of the titleIcon image, instead of the current size of the titleImageView to determine the actual size of the image.

PiperOrigin-RevId: 319127689
2020-06-30 17:04:03 -07:00
Galia Kaufman
d220234cef [Dialogs] Add title icon examples
Adding examples for the titleIcon APIs.

PiperOrigin-RevId: 319077424
2020-06-30 12:41:24 -07:00
Galia Kaufman
6f1b595d0d [Dialogs] Adding dynamic type to accessory view examples
PiperOrigin-RevId: 319075226
2020-06-30 12:31:18 -07:00
Galia Kaufman
6b124ad795 [Dialogs] Fixing alignment examples.
* Removing broken examples file (DialogsAlertCustomizationExampleViewController).
* Adding alignment examples in a new file.

PiperOrigin-RevId: 319072040
2020-06-30 12:15:57 -07:00
Andrew Overton
679abbe670 [Dialogs] Use API_AVAILABLE instead of #if defined (__IPHONE_10_0) etc
PiperOrigin-RevId: 319032200
2020-06-30 09:07:01 -07:00
Galia Kaufman
97b1a1f6ce [Dialogs] Moving attributed message example out from accessory view examples
* Moving attributed message example out from accessory view
  examples into its own examples file.
* Fixing examples:
   1. Using latest theming versions in examples.
   2. Enabling dynamic type.
   3. Renaming examples.

PiperOrigin-RevId: 319013022
2020-06-30 06:57:49 -07:00
Galia Kaufman
58c4a0e4e6 [Dialogs] Fix position of leading/trailing actions in vertical layout
When actions are in vertical layout, the first trailing or leading action is incorrectly positioned on top of the second action, instead of above it.
This is fixed by moving the calculations of the y position of the second button after the first button is positioned.

PiperOrigin-RevId: 318979889
2020-06-30 01:54:11 -07:00
Galia Kaufman
80685a5a00 [Dialogs] Merge typical use examples
* Merging the two material spec examples - typical use and styled actions.
* Fixing the typical use examples:
   1. Displaying actions in correct order.
   2. Using latest theming versions.
   3. Enabling dynamic type.
   4. Moving the DialogsThemedPresentationExampleViewController to dragons.
      Almost all diffs in this file are due to swift-format.

PiperOrigin-RevId: 318941737
2020-06-29 19:28:46 -07:00
Galia Kaufman
8bf81b7d0a [Dialogs] Testing trailing actions in reversed vertical order
When actions are vertically aligned, the first trailing or leading action is positioned incorrectly, hiding the second trailing/leading action. This is fixed in a followup change list.

PiperOrigin-RevId: 318875437
2020-06-29 12:59:03 -07:00
Jeff Verkoeyen
c16f0de9ab [Dialogs] Mark more apis as to-be-deprecated.
PiperOrigin-RevId: 318870196
2020-06-29 12:43:38 -07:00
Andrew Overton
9806cab151 [Dialogs] Modify dialogs docs
PiperOrigin-RevId: 318135341
2020-06-24 13:59:57 -07:00
Andrew Overton
b205164477 Delete obsolete markdown files
As I've gone through and replaced all the READMEs I haven't always been good at deleting the markdown files that were stitched together to make the old READMEs. This PR removes all the ones I forgot to remove. All the relevant material in these files is already in the new READMEs, so we're not losing anything by doing this.

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10029 from andrewoverton:delete-unused-docs 65ea55253af300ea7a4c13ea4ce14976097a6253
PiperOrigin-RevId: 318079032
2020-06-24 09:31:01 -07:00
Wenyu Zhang
313135ece2 [Dialogs] Add visibleAreaInsets support.
PiperOrigin-RevId: 317137957
2020-06-18 11:01:22 -07:00
Nobody
8b4e6058db [Dialogs] Voice over reads the message twice
Voice Over is reading both the accessibilityValue as well as the accessibilityLabel for UITextView when testing on a device with iOS 12. Clearing the `accessiblityValue` seems to have fixed the issue.

PiperOrigin-RevId: 316004548
2020-06-11 16:51:13 -07:00
Andrew Overton
aa95547953 [TextControls] Annotate API using UITextItemInteraction to be iOS 10 only
Develop currently doesn't build in Xcode. One of the errors pertains to the use of UITextItemInteraction without availability checks.

PiperOrigin-RevId: 315491912
2020-06-09 08:53:28 -07:00
Galia Kaufman
24ce1c979c [Dialogs] Disable UIDataDetectorTypeLink by default for attributed messages.
# Background
Email addresses in alert messages are highlighted when setting `dataDetectorTypes` to `UIDataDetectorTypeLink`. This is automatic in both attributed and non attributed messages.

# Fix
Removing assignment of `dataDetectorTypes` to links, which retain links without highlighting email addresses.

PiperOrigin-RevId: 315378755
2020-06-08 16:38:19 -07:00
Andrew Overton
226596fd7d [Dialogs] Improve Dialogs docs
Improve alt text and use string literals in Dialogs README examples.

PiperOrigin-RevId: 314943340
2020-06-05 09:44:03 -07:00
Iryna Berezan
5832985581 Fix mixed top and bottom insets for the actions.
PiperOrigin-RevId: 314852407
2020-06-04 19:57:40 -07:00
Galia Kaufman
ba359990d5 Setting orderVerticalActionsByEmphasis incorrectly calculates top and bottom insets for actions.
PiperOrigin-RevId: 314793489
2020-06-04 13:35:05 -07:00
Galia Kaufman
c273dfcfb4 [Dialogs] Header file comments cleanup
PiperOrigin-RevId: 314456429
2020-06-02 20:25:03 -07:00
Galia Kaufman
ea8887e284 [Dialogs] Adding attributed link color API and updating theming extension
PiperOrigin-RevId: 314453930
2020-06-02 20:00:28 -07:00
Galia Kaufman
6bb3ece393 [Dialogs] Adding tappable link support to the alert message
Adding an action API for notifying caller when a message link is tapped.

PiperOrigin-RevId: 314135831
2020-06-01 08:45:13 -07:00
Galia Kaufman
f4fd6d015f [Dialogs] replace the message UILabel type to UITextview
The type of the message in Material Dialogs was switched from UILabel to UITextView, That is done in order to support links in attributed text. We're seeing some differences in the text rendering in dialog snapshots. In some cases, the width of the dialog may also change, which can result in some other elements moving to maintain required spacing from the edges. Based on our testing, we're not expecting any other changes, so please let us know if you find anything unusual.

This change set includes:
* `messageLabel` was renamed to `messageTextView`.
* The UITextView has its editable flag set to false, and all internal padding set to
  zero, to ensure spacing remain the same as it was with UILabel.
* `scrollEnabled` was set to false to ensure text does't scroll when not needed (it
  still enables scrolling when needed: when there's more text than the visible area.)
* `backgroundColor` was set to `clear`. It seems UITextView's default is white, which
   breaks inverted/dark mode support.

Noticeable differences:
* `sizeThatFits` occasionally returns different width for some texts:
   -- Some texts result in a wider layout (ie: dialogs-presented-with-emphasis-buttons.png)
   -- Empty text views may have a non-zero height. Determining zero
      size based on `hasText` before calling `sizeThatFits` resolved the issue.
* Text rendering is slightly different in almost all snapshots.
* Links in attributed texts are rendered differently then before (ie: color).
* In a couple of RTL snapshot tests, I needed to set the RTL test direction before
  setting the message alignment for the test to work properly.

PiperOrigin-RevId: 313607718
2020-05-28 10:03:43 -07:00
Andrew Overton
112ea0d089 [Dialogs] Add additional theming screenshot to Dialogs docs
This PR adds a screenshot of a themed Dialog to the Dialogs README.

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/9997 from andrewoverton:add-theming-screenshot 03da851b3a5bcd4f696ea9ab84fbc35c3abf2f59
PiperOrigin-RevId: 312322585
2020-05-19 11:53:17 -07:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00:00
Galia Kaufman
e9802b3e14 [Dialogs] Fix UITextView accessory view example
Fixing incorrect sizing of accessoryView after returning from 3D Touch
Subclassing UITextView and implementing `systemLayoutSizeFittingSize:` so the alert's accessory view will be sized correctly during layout.

PiperOrigin-RevId: 310577286
2020-05-08 10:06:42 -07:00
Jake Rockland
776d028861 [Dialogs] Allow MDCAlertController to become first responder via its view.
PiperOrigin-RevId: 310506900
2020-05-07 23:07:58 -07:00
Galia Kaufman
b3bf62df4e [Dialogs] Include insets in alignment calculations of long actions
Include insets in horizontal calculations when determining if all buttons fit horizontally. This will allow actions whose title is nearly half of the dialog to be aligned horizontally.

PiperOrigin-RevId: 310331603
2020-05-07 04:10:24 -07:00
Galia Kaufman
67cb856040 [Dialogs] Fixing broken unit test
Fixing the error:
`error: implicit conversion from enumeration type 'enum MDCContentHorizontalAlignment' to different enumeration type 'NSTextAlignment' (aka 'enum NSTextAlignment') [-Werror,-Wenum-conversion]`

PiperOrigin-RevId: 310164335
2020-05-06 09:16:47 -07:00
Galia Kaufman
b3cf4e42e6 Consider the size of the longest action in horizontally justified action alignment - testing if it can fit the available horizontal space to determine if the actions should be aligned vertically.
PiperOrigin-RevId: 309943747
2020-05-05 07:45:14 -07:00
Wenyu Zhang
da54c6f67a [Dialogs] Allow MDCAlertController to become first responder.
PiperOrigin-RevId: 309437429
2020-05-01 11:06:19 -07:00
Iryna Berezan
99d6facc5b No public changes, just a test that reproduces the issue.
PiperOrigin-RevId: 309425831
2020-05-01 10:07:22 -07:00
Galia Kaufman
5b5156eab6 [Dialogs] Document icon image scaling condition
Update Dialogs API documentation to indicate when `titleIcon` is scaled.

PiperOrigin-RevId: 309395216
2020-05-01 05:56:32 -07:00
Jeff Verkoeyen
1920b96b2a [Dialogs] Add example snapshot tests.
PiperOrigin-RevId: 309275412
2020-04-30 12:22:43 -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
Galia Kaufman
bffc2c3d07 [Dialogs] Fix incorrect initialization of properties
Three MDCAlertController properties were not initialized during object initialization.
Their initialization during viewDidLoad caused values previously assigned to them to be reverted to default during presentation or theming.
Adding unit tests that reproduce the issue.

PiperOrigin-RevId: 308075191
2020-04-23 10:05:34 -07:00