159 Commits

Author SHA1 Message Date
Nobody
5c9ba055ee Internal change now button height defined by the text size.
PiperOrigin-RevId: 713948536
2025-01-10 00:55:31 -08:00
Frank Wang
610c997d82 [Dialogs] Fix issue where the line break mode is set on the wrong title label. It should be set on the M3CButton's titleLabel, instead it is set on the dialog's titleLabel.
PiperOrigin-RevId: 704766381
2024-12-10 10:44:47 -08:00
Jan Philipp Sachse
1c85f89bbd Check whether a button is actually an M3CButton before assuming so.
PiperOrigin-RevId: 644396761
2024-06-18 08:35:38 -07:00
Frank Wang
2213969962 [Dialog/Codehealth] Allow M3CButton's title in the dialog to wrap to accommodate larger accessibility font sizes and longer strings.
PiperOrigin-RevId: 636960555
2024-05-24 10:24:30 -07:00
Nobody
582f031c70 Internal change
PiperOrigin-RevId: 606744858
2024-02-13 14:20:13 -08:00
Jake Rockland
3d505b98c4 Update MDCAlertControllerView to more explicitly expose the differentiated contentInsets that are used in the M3C variation of the component.
PiperOrigin-RevId: 579938835
2023-11-06 13:21:57 -08:00
Nobody
c3dc428f2a [Dialogs] Add an API that allows the accessory view to be placed on top of the message.
PiperOrigin-RevId: 555290003
2023-08-09 15:17:46 -07:00
Nobody
72d803f5b0 Update min touch target for M3CButton to 44pt to match spec. Previously was 48pt.
PiperOrigin-RevId: 537051415
2023-06-01 10:01:08 -07:00
Nobody
68b1737428 Update min touch target for M3CButton to 44pt to match spec. Previously was 48pt.
PiperOrigin-RevId: 529473500
2023-05-04 11:57:18 -07:00
Nobody
33a692f0dc Update min touch target for M3CButton to 44pt to match spec. Previously was 48pt.
PiperOrigin-RevId: 529416795
2023-05-04 08:33:14 -07:00
Nobody
5090e7835b Fix issue where dynamic type causes Dialogs with M3CButtons to violate insets.
PiperOrigin-RevId: 529118506
2023-05-03 09:54:49 -07:00
Cody Weaver
8fa0811d63 #Dialog Add an API for the Dialog insets
PiperOrigin-RevId: 525523575
2023-04-19 12:45:42 -07:00
Nobody
3ca78f989b [Dialogs/Accessibility] Add responds to user interaction to message text view in Dialogs.
PiperOrigin-RevId: 519729011
2023-03-27 08:29:39 -07:00
Nobody
2403497f0b [Dialogs] Fix issue with incorrectly locating attributed links in RTL languages.
PiperOrigin-RevId: 513828597
2023-03-03 08:04:43 -08:00
Nobody
58c100c3ed Adjust icon for dialogs to resize with dynamic type.
PiperOrigin-RevId: 496962646
2022-12-21 11:10:43 -08:00
Nobody
ff2b173f50 [GM3/Dialogs] Update bottom content inset for M3CButton enabled.
PiperOrigin-RevId: 493305621
2022-12-06 07:59:17 -08:00
Nobody
25c25ed49b [GM3/Dialogs] Fix issue with using incorrect min width for M3CButtons in Dialogs.
PiperOrigin-RevId: 492207399
2022-12-01 08:50:52 -08:00
Nobody
e6003808d0 [GM3] Add apply capsule corners to layoutSubviews.
PiperOrigin-RevId: 490540360
2022-11-23 10:54:43 -08:00
Jeff Verkoeyen
4c6aea2a4e [Buttons+Dialogs] Disable deprecation warnings in headers.
This avoids propagation of warnings to non-Material compilation units which may have deprecation warnings enabled as errors.

PiperOrigin-RevId: 460832988
2022-07-13 16:47:50 -07:00
Wenyu Zhang
2ff701bbbe [Dialogs] Fix the calculation for actionSize by removing the double counted actionsInsets and avoiding using fixed bounding width for justified layout, which causes multiple layout passes to stabilize the frame calculation - wrong frame.
PiperOrigin-RevId: 449314001
2022-05-17 14:22:06 -07:00
Janette James
505c27cd9f Fix dialog button layout on text size changes
PiperOrigin-RevId: 447858819
2022-05-10 16:48:06 -07:00
Cody Weaver
60493fce35 [Dialogs] Delete mdc_adjustsFontForContentSizeCategory API
PiperOrigin-RevId: 445175587
2022-04-28 09:45:32 -07:00
Alyssa Weiss
18c9da00e0 Add an option that allows the title to scroll with the message for a MDCAlertController.
PiperOrigin-RevId: 406822869
2021-11-01 07:45:03 -07:00
Alyssa Weiss
9e2d9356c6 Update logic to make sure buttons only take up 1/2 of the screen on a Dialog.
PiperOrigin-RevId: 405635450
2021-10-26 06:49:47 -07:00
Cody Weaver
08d01596df [MultipleComponents] Remove mdf_effectiveUserInterfaceLayoutDirection in favor of the system API effectiveUserInterfaceLayoutDirection that was added in iOS 10.
PiperOrigin-RevId: 391307973
2021-08-17 09:30:47 -07:00
Alyssa Weiss
57b98fffd5 Move mdc_adjustsFontForContentSizeCategory from MDCAlertControllerView to MDCAlertControllerView+Private.
PiperOrigin-RevId: 385189735
2021-07-16 11:36:56 -07:00
Andrew Overton
906a507ab0 [Dialogs] Enforce positive contentOffsets on the contentScrollView in MDCAlertControllerView
PiperOrigin-RevId: 378912351
2021-06-11 11:22:59 -07:00
Alyssa Weiss
420449a5c2 Remove adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable API from MDCAlertController.
PiperOrigin-RevId: 376847751
2021-06-01 09:15:56 -07:00
Alyssa Weiss
2844115021 Update Dialog's adjustFontForContentSizeCategory to set the property on the message and buttons, not just the title.
PiperOrigin-RevId: 371918504
2021-05-04 08:25:23 -07:00
Nobody
4998119a12 Fix accessory view content sizing in dialogs.
* Fixes an issue where accessory view content could fall outside of the scroll view content frame.
* The content sizing calculation now matches layoutSubviews for accessory view height.
* I initially replaced the first call to `systemLayoutSizeFittingSize` in `calculateContentSizeThatFitsWidth` however that impacted the final view width. I suspect this was a result of `calculateContentSizeThatFitsWidth` being used in multiple places for different purposes (layout vs preferredContentSize).

BEGIN_PUBLIC
Update dialog accessory view content sizing to fix scroll view content height issues.
END_PUBLIC

PiperOrigin-RevId: 371901672
2021-05-04 06:35:52 -07:00
Jeff Verkoeyen
9a49fd96f9 Internal change.
PiperOrigin-RevId: 366342462
2021-04-01 15:26:22 -07:00
Nobody
386923b424 [Dialogs] Groups MDCAlertController view's accessibility children.
PiperOrigin-RevId: 364336825
2021-03-22 09:37:07 -07:00
Nobody
08d42c18d8 [MDCAlertControllerView] Avoid cutting off the top of Thai characters with diacritics.
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
2021-03-17 13:16:58 -07:00
Jeff Verkoeyen
39c20e15f8 Optimizing imports
PiperOrigin-RevId: 356967514
2021-02-11 07:17:45 -08:00
Nobody
584294efff Support value comparison for MDCAlertAction
Implements isEqual in MDCAlertAction to support equality check.

PiperOrigin-RevId: 339687443
2020-10-29 09:50:10 -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
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
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
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
Jeff Verkoeyen
c16f0de9ab [Dialogs] Mark more apis as to-be-deprecated.
PiperOrigin-RevId: 318870196
2020-06-29 12:43:38 -07:00
Wenyu Zhang
313135ece2 [Dialogs] Add visibleAreaInsets support.
PiperOrigin-RevId: 317137957
2020-06-18 11:01:22 -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
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
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