145 Commits

Author SHA1 Message Date
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
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
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
Galia Kaufman
89ddea0cf1 [Dialogs] Improved titleIconView example with animation.
PiperOrigin-RevId: 322791317
2020-07-23 08:32:40 -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
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
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
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
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
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
Jeff Verkoeyen
1920b96b2a [Dialogs] Add example snapshot tests.
PiperOrigin-RevId: 309275412
2020-04-30 12:22:43 -07:00
Galia Kaufman
78f2369dfb [Dialogs] Add accessory view examples
Adding examples for accessory view, including:
* A textfield accessory view. This example uses an accessory view with auto-layout.
* A default label with a button as an accessory view
* An accessory view with a label and a button subclasses. Using auto-layout.

PiperOrigin-RevId: 307889891
2020-04-22 13:55:47 -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
Robert Moore
8eb7296dab
[Catalog] Fix container scheme properties. (#9192)
Making remaining examples use protocol for container schemes to match the
project's expected convention.

Found while reviewing #9188
2019-12-09 10:48:25 -05:00
featherless
a331cb6a1a
[Dialogs] Fix bug in "Dismissing Dialogs" dialogs where the buttons were not themed. (#8967)
The dialog view controllers were not being provided with the container scheme.

Fixes https://github.com/material-components/material-components-ios/issues/8878

| Before | After |
|:--|:--|
| ![Simulator Screen Shot - iPhone Xʀ - 2019-11-15 at 14 41 13](https://user-images.githubusercontent.com/45670/68970747-fe96eb80-07b5-11ea-8c69-8e0df6ffd64e.png) | ![Simulator Screen Shot - iPhone Xʀ - 2019-11-15 at 14 40 46](https://user-images.githubusercontent.com/45670/68970733-f5a61a00-07b5-11ea-81c4-b7fa75a29f84.png) |
2019-11-15 16:44:46 -05:00
featherless
5d8e992963
[Dialogs] Implement the a11y escape gesture on all custom dialogs in the "Dismissing Dialogs" example. (#8965)
Part of https://github.com/material-components/material-components-ios/issues/8878
2019-11-15 16:14:45 -05:00
Robert Moore
32ba0c927e
[Dialogs] Provide accessibility traits for Input Field example (#8958)
Set the correct accessibility traits for the collection cell that presents a
Dialog.

|Before|After|
|---|---|
|![IMG_0065](https://user-images.githubusercontent.com/1753199/68968199-02c00a80-07b0-11ea-9cc4-59b98e31e4ba.PNG)|![IMG_0102](https://user-images.githubusercontent.com/1753199/68968219-0b184580-07b0-11ea-8c70-4273603e88e7.PNG)|



Closes #8879
2019-11-15 15:22:24 -05:00
Robert Moore
bde962e511
[Dialogs] More Material Alerts examples is more accessible. (#8960)
Provides accessibility traits to the cells and marks the cells as
accessibility elements.

|Before|After|
|---|---|
|![IMG_0104](https://user-images.githubusercontent.com/1753199/68968707-40716300-07b1-11ea-9227-539c7c6dfc3a.PNG)|![IMG_0103](https://user-images.githubusercontent.com/1753199/68968677-2cc5fc80-07b1-11ea-88db-1c0f5bb14652.PNG)|


Closes #8877
2019-11-15 15:22:03 -05:00
featherless
7cfb460a01
[Dialogs] Make all "Dismissing Dialogs" cells a11y buttons. (#8956)
Part of https://github.com/material-components/material-components-ios/issues/8878
2019-11-15 15:18:41 -05:00
featherless
34b0ad9ba2 [Dialogs] Make the "View with corner radius" example's dialog escapable in VoiceOver. (#8950)
This PR makes the dialog an accessibility button with a hint that tapping the dialog in VoiceOver will dismiss the dialog.

Fixes #8876
2019-11-15 11:40:04 -08:00
featherless
88d3bed28a
[Dialogs] Make the "Dialogs with accessory view" example's cells accessibility buttons. (#8939)
Fixes https://github.com/material-components/material-components-ios/issues/8880
2019-11-15 13:10:48 -05:00
Cody Weaver
524ca5cab9
[Dialogs] Remove usage of buttonFont in example (#8772)
The `buttonFont` API is deprecated within MDCAlertController. This change removes it's usage from the catalog example. This removal brings us closer to being able to delete the API.

## Screenshots

| Before | After |
| --- | --- |
|![Simulator Screen Shot - iPhone 7 - 2019-11-11 at 10 31 29](https://user-images.githubusercontent.com/7131294/68611204-6ecc0700-046e-11ea-9b8b-fe6ca39f18ee.png)|![Simulator Screen Shot - iPhone 7 - 2019-11-11 at 10 22 36](https://user-images.githubusercontent.com/7131294/68611214-72f82480-046e-11ea-8b26-50c693d791c1.png)|



Related to #6637
2019-11-11 11:27:04 -08:00
featherless
b0966cca86
[Dialogs] Add accessoryView to MDCAlertController (#8538)
[Dialogs] Add accessoryView to MDCAlertController
2019-10-01 10:21:06 -04:00
Yarden Eitan
90938fe59f
[Dialogs] Adds the Ripple behavior to Dialogs. (#7595)
## Related links
* Bug: Closes #7379 
* Ripple: [Ripple](https://github.com/material-components/material-components-ios/tree/develop/components/Ripple)

## Introduction
This PR allows enabling the Ripple Behavior for [`MDCAlertController and MDCAlertControllerView`](https://github.com/material-components/material-components-ios/tree/develop/components/Dialogs) by enabling the ripple behavior of the internal `MDCButton`. This behavior is an opt in flag property added to MDCAlertController, `enableRippleBehavior`.  This improves the visual touch feedback for our users as MDCInkView didn't support our current motion guidelines.

## Videos
| Before | After |
| - | - |
|![oldRipple](https://user-images.githubusercontent.com/4066863/59470021-81c9a500-8e04-11e9-8071-cdc2d3a81ceb.gif)|![newRipple](https://user-images.githubusercontent.com/4066863/59470027-85f5c280-8e04-11e9-834b-a180c8805e40.gif)|
2019-06-15 12:47:00 -04:00
Bryan Oltman
0ca3a4fe64
Update DialogWithInputFieldExample storyboard to reference correct class (#7524) 2019-06-12 13:30:23 -04:00
Andrew Overton
01c00a86c0
[MaskedTransition] Fix typo (#7541)
There was a typo in #7519. This PR fixes it, as well as some other occurrences of the same typo.
2019-06-06 11:20:31 -04:00
Andrew Overton
bf5d5e1c1d
[Dialogs] Graduate Dialogs theming extensions to ready (#7190)
This PR updates the dialogs theming extensions to ready.

Closes #7163.
2019-04-23 11:28:02 -04:00
Yarden Eitan
52da482fd2 [Catalog] Add @objc annotations to our containerScheme instances in Swift (#7243)
We need to add @objc annotations to the containerScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find the setContainerScheme: setter otherwise.
2019-04-23 10:07:56 +03:00
Andrew Overton
94e5a978d7
[Buttons] Graduate Buttons+Theming to ready (#7187)
This PR graduates the buttons theming extension to ready.

Closes #7158.
2019-04-19 13:57:00 -04:00
Yarden Eitan
5bed3961e6
[ContainerScheme] Graduate ContainerScheme to ready. (#7170)
This PR graduates ContainerScheme to ready.

This includes updating the podspecs, podfile, all the import statements related to ContainerScheme, updating .kokoro rewrite rules, and finally the readme to not have ContainerScheme regarded to as being in beta.

Ran locally kokoro with -b bazel successfully.

Resolves #6732
2019-04-18 09:25:02 -04:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -04:00
Andrew Overton
b38372192f
Update to Swift 4.2 (#7166)
This PR updates the Swift version to 4.2.

Partially resolves #6874.
2019-04-17 16:59:02 -04:00
Robert Moore
95705a7b6f
[Dialogs] Fix Tall Font example (#7151)
Adds a background color (no longer completely transparent) to the example's
view and applies theming to the button and dialog.

|Before|After|
|----|----|
|![dialog-tall-before](https://user-images.githubusercontent.com/1753199/56212182-80a81180-6027-11e9-812c-ff92c52eb758.gif)|![dialog-tall-after](https://user-images.githubusercontent.com/1753199/56212189-856cc580-6027-11e9-85b1-cec11940cc90.gif)|

Follow-up to #7062
Closes #7148
2019-04-16 10:16:01 -04:00
Wenyu Zhang
8c407c22c4
[Dialogs] Layout MDC Dialogs correctly for tall fonts. (#7126)
Closes https://github.com/material-components/material-components-ios/issues/7062

Reference: cl/241537224

Layout MDC Dialogs correctly for tall fonts

The MDC Dialog layout code had some hard coded assumptions about the amount of vertical space to allocate for action buttons that were violated when using taller fonts such as Urdu with large Dynamic Type sizes.
There was also a related bug where vertical vs. horizontal action button layout was calculated in two different places.

Snapshot test before change:
<img width="569" alt="snapshot_test_goldens_goldens_64_MDCAlertControllerLocalizationSnapshotTests_testPreferredContentSizeWithNotoNastaliqUrdu_11_2@2x_Before_01dd7fb1a36bc24b27e05c1079c6420994c9f904" src="https://user-images.githubusercontent.com/8836258/56166158-dc7c8700-5fa2-11e9-8fa1-ed4dbfdc947b.png">

Snapshot test result after change:
<img width="569" alt="snapshot_test_goldens_goldens_64_MDCAlertControllerLocalizationSnapshotTests_testPreferredContentSizeWithNotoNastaliqUrdu_11_2@2x_After_78d3fd9172a202641400c0536a9c2e3a33b0455b" src="https://user-images.githubusercontent.com/8836258/56166182-e7371c00-5fa2-11e9-976e-4f9c93efc98f.png">


Example screenshot before change:
![Simulator Screen Shot - iPhone 7 - 2019-04-15 at 17 42 09](https://user-images.githubusercontent.com/8836258/56167426-1dc26600-5fa6-11e9-9d5f-180f7960f458.png)


Example screenshot after change:
![Simulator Screen Shot - iPhone 7 - 2019-04-15 at 17 43 58](https://user-images.githubusercontent.com/8836258/56167432-2024c000-5fa6-11e9-8e44-5a88b48425f2.png)
2019-04-15 19:26:55 -04:00
Galia Kaufman
df2a4a8c1d
[Dialogs] Fix presented corner radius in custom view controllers (#6696)
DialogPresentationController changes the corner radius dynamically during presentation while ensuring that the presented view's corner radius always matches the corner radius of the tracking view which draws the shadow behind the presented view.
2019-03-02 10:03:55 -05:00
Cody Weaver
50307bb330
[Container] Fix colorScheme and typographyScheme to be nonnull. (#6699)
## Introduction
Before we move container scheme to ready we need to have both the `colorScheme` and `typographyScheme` nonnull. By making colorScheme and typographyScheme of MDCContainerScheming nonnull, clients will reduce the amount of conditional checks required in their apps and reduce a category of potential errors (accidentally passing nil to a nonnull parameter).

## The problem
Both `colorScheme` and `typographyScheme` were nullable in the container scheme making it harder for clients to use the container scheme throughout their app on non Material UIElements, i.e. UIView.backgroundColor

## The fix
Make both of these properties nonnull.

## Additional work
- [x]  I had to update the swift examples to not be optional and I additionally removed the nil checks from the ObjC examples.
2019-02-27 15:47:26 -05:00
Wenyu Zhang
6090cd6dad
[MDC Dialogs] add an example for custom dialog view controller themed by theming extension (#6601) 2019-02-15 16:03:36 -05:00
Wenyu Zhang
4629b52279
[MDC Dialogs] add an example for themed button with emphasis (#6600)
Part of Internal issue b/123214915.

Screenshot after adding this example:
![simulator screen shot - iphone xs - 2019-02-11 at 18 15 27](https://user-images.githubusercontent.com/8836258/52600278-14434300-2e29-11e9-82f0-b6b0a421b410.png)
2019-02-12 16:11:18 -05:00
Wenyu Zhang
e30b8b2b39
[Dialogs] hide non main examples in Catalog (#6576) 2019-02-08 15:34:55 -05:00
Andrew Overton
f90d42c00e
[Dialogs] Add DialogPresentationControllerDelegate (#6504)
* Add DialogPresentationControllerDelegate

* Consider nullability

* Address PR feedback

* Address a little bit more PR feedback

* Address another batch of PR feedback
2019-01-30 16:50:23 -05:00
Cody Weaver
754eeaff1c [Dialogs] Update examples to use theming extensions (#6497)
## Related links

* Bug: #6438 
* Component: [Dialogs](https://github.com/material-components/material-components-ios/tree/develop/components/Dialogs)

## Introduction

As we move to theming extensions all components that have a theming extension should use that within it's examples. Currently MDCAlertController has a theming extension and should use it in all examples. Additionally all components within the examples that have a theming extension should use it.

## The problem

Within MDCAlertController examples some components are using the old _Themers_.

## The fix

For all components being used in MDCAlertController examples use a theming extension if available.

## Additional notes

This also cleans up some ivar usage and import statements.
2019-01-30 14:31:14 -05:00
Andrew Overton
a006ff6e4f
Add MDCDialogPresentationController+MaterialTheming (#6286)
This PR adds `MDCDialogPresentationController+MaterialTheming`.

Closes #5968.
2019-01-14 13:35:04 -05:00
Robert Moore
f7cf6baeb7
[Dialogs] {bazel} Add reusable examples rules. (#6252)
Adding two new rules to our bazel definitions for examples. Objective-C
examples and Swift examples. Using these ensures we have a common set of
definitions for things like warnings, Swift version, and default
visibility.

Closes #6215
2019-01-09 12:59:09 -05:00
Galia Kaufman
f472cab956
[Dialogs] adding backgroundColor property for dark theme support (#6066)
Adding a backgroundColor property to MDCAlertController, which enables dark theming of MDCAlertController (b/121269110).
2019-01-08 10:29:31 -05:00
featherless
73bdc03c2b
[automated] Rename MaterialComponentsAlpha to MaterialComponentsBeta. (#6018)
This is an automated change generated by replacing all instances of MaterialComponentsAlpha with MaterialComponentsBeta. This is not a breaking change because changes to Alpha/Beta components (including renaming them) are not considered breaking.

The MaterialComponentsAlpha podspec was mistakenly named Alpha, when what we meant was more close to Beta. The distinction is that Alpha components are not expected to be used by clients, while Beta components are.
2018-12-14 10:47:31 -05:00
Yarden Eitan
8761898671 update imports for new theming 2018-12-11 12:04:10 -05:00
Cody Weaver
1ca10a8669
[Theming] Update our theming extensions (#5945)
### Context
All of our theming targets should be `MDC<#Component>+Theming` but all files should be `MDC<#Component>+MaterialTheming.m/h`. We got out of sync and caught this early.

### The problem
Our targets and file names weren't correct in some cases

### The fix
Update our targets and files to be what we have decided as a team.
2018-12-10 14:16:37 -05:00