Minor test update to validate that the new property doesn't cause the view to load.
Also removed some unused imports found during code review.
PiperOrigin-RevId: 484516340
In iOS platform, text font are not strictly required to fit within the UIFont.lineHeight. Some Thai characters with diacritics are rendered outside the UILabel/UITextView's bounds.
One solution is to increase the top margin of the UILabel/UITextView so we leave extra padding between the parent view's top edge and the top edge of the UILabel/UITextView (Like the _titleLabel in MDCAlertControllerView).
closes#10161
PiperOrigin-RevId: 363491472
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
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
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
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
This CL demonstrates three different ways to present a message with a "Learn More" button under it in an alert. It also demonstrates accessory views with manual and auto layouts.
The 2 auto-layout tests create a view with a label and a button as subviews, and lay them out using constraints. One of them is testing a subclass, while the other adds the button/text directly to the accessory view.
The manual layout test uses the alert's default message property, and uses a button for the accessory view. It then uses the new 'accessoryViewVerticalInset' to customize the space between the message and the button.
Note: Using `sizeToFitContentInBounds:` for snapshot tests is now correctly resizing snapshot tests that were previously too wide (including the snapshot in b/147241131).
PiperOrigin-RevId: 307884732
A followup for cl/305814799 - replacing calls to all private APIs in MDCAlertControllerAccessoryTests.m with the new testing utilities in MDCAlertController+Testing.h
PiperOrigin-RevId: 305878401
A followup for cl/305814799 - replacing calls to all private APIs in MDCAlertControllerActionsTests.m with the new testing utilities in MDCAlertController+Testing.h
Removing the private header since it's no longer needed for testing.
PiperOrigin-RevId: 305865529