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
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
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
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
* 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
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
* 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
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
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
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
Develop currently doesn't build in Xcode. One of the errors pertains to the use of UITextItemInteraction without availability checks.
PiperOrigin-RevId: 315491912
# 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
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
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
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
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
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