Prior to this change, error VoiceOver announcements would be initiated half a second after the error state was set, potentially resulting in about half a second of other VoiceOver notifications being announced before being interrupted by the error announcement.
The error announcement is intended to take precedent over the other informative announcements (such as character counts). Unfortunately, the error state is often set before the internal textInputDidChange: event which means that if we fire the error announcement immediately, then the error announcement will be cut off by the textInputDidChange: announcement for character counts. To combat this, https://github.com/material-components/material-components-ios/pull/7256 had introduced a dispatch_after to kick off the error event half a second later.
To address the first problem without breaking the second, this change reduces the delay of the error announcement to 0.05 seconds, a window of time small enough to avoid hearing any of the character count announcement, but large enough to happen after the character count announcement is posted, resulting in the error announcement being the one that is read out.
Closes https://github.com/material-components/material-components-ios/issues/7625
This PR adds an identity check in `-setTextColor:` in MDCTextField. This identity check short circuits an infinite loop triggered by `-setTextColor:` under certain mysterious circumstances involving the MDCTextField layout pass and MDCFlexibleHeaderView KVO stuff surrounding safeAreaInset changes. I don't fully understand what's going on tbh :)
The internal bug ([b/148159587](http://b/148159587)) has links to before and after gifs in the comments.
Closes#9470
### Update: The internal client who reported the bug was unable to reproduce it with these changes.
This PR contains the changes from #9258. CI didn't seem to be working on the original PR, and then it got messy as a result of bad merges, so I just copied the changes here.
UITextField verbalizes the placeholder in a lower pitch when no text has been entered. This change incorporates this behavior into what values get added to the MDCTextField's accessibilityLabel.
Before after videos:
[singleFix.zip](https://github.com/material-components/material-components-ios/files/3853326/singleFix.zip)
QA=Notice that "state" is verbalized when it is not visible on screen in the after.
more info at #7513
[TextFields] Add check for placeholder before adding to the accessibility strings spoken by voice over.
Also added changed example to remove the floating label so that we can check that voice over correctly verbalizes only the visible text.
Before and After zip:
[BeforeAfterVideos.zip](https://github.com/material-components/material-components-ios/files/3843558/BeforeAfterVideos.zip)
QA=Notice that "state" is verbalized when it is not visible on screen in the after.
more info at #7513
In this PR I extract the new TextFields from the old TextFields directory. In the future, if we bring over the input chip view and text area, they will go under this new TextControls directory as well.
Closes#8684.
This PR makes it so that textcontrol snapshot test cases validate UIView snapshots of text controls inside container views as opposed to validating just UIView snapshots of text controls themselves. This is so that when floating labels go outside the bounds, as they partially do with the outline style, that can be captured in the snapshot.
It also (I think) gets rid of some flakiness in the MDCOutlinedTextFieldSnapshotTests with the changes to MDCTextControlStyleOutlined.
Here's an example snapshot diff:
<img width="868" alt="Screen Shot 2019-11-04 at 4 48 31 PM" src="https://user-images.githubusercontent.com/8020010/68161034-ff608f80-ff22-11e9-8a64-1234635f3681.png">
This PR adds the outlined textfields. The snapshots look a little weird because the way the snapshot tests are currently implemented they only get an image that's as big as the frame of the view. In a follow up PR I'm going to change that, so the images will have the entire floating label (which goes above the top of the view) for example.

Closes#6942.
In a recent PR I made the floating label the same size as the non-floating label because I thought it brought the MDCBaseTextField closer to being the "absence of style." In this PR I make it smaller again because I decided I think it just looks bad.
I also added an override for `-setBorderStyle:` that will prevent non-base textfields from having border styles like `.roundedRect`.
Related to #6942.
There's been this bug for a long time now with the floating label animation (only on simulators using below iOS 13, and not on devices, for some reason) where the animation is sometimes skipped entirely. I thought I had a fix for it with #8700, but when I started preparing the PR for the outlined textfields (which is blocked on #8674) I noticed that it was still a problem for them, for some reason. This PR I _think_ fixes it for everything though, despite being more complicated than I'd like.
Related to #6942.
This PR adds MDCFilledTextField, updates the example to include it, and adds some unit tests for MDCFilledTextField's public API. I will add snapshot tests to this PR after #8670 is merged in.
Related to #6942.
This PR adds an `animationDuration` property to MDCBaseTextField. I'm doing this because I ran into problems snapshot testing MDCFilledTextField. Its style object uses Core Animation, so the `[UIView setAnimationsEnabled:{NO/YES}]` calls I'm making in `-setUp`/`-tearDown` don't have any effect on it. However, they do have an effect on the label animation, which uses UIView animations. This PR has no behavioral or public API changes.
On one hand, this change goes against the idea that you shouldn't change source code for the sake of testing. On the other hand, there's nothing wrong with rewriting existing code so that it's more testable.
Related to #6942.
If numberOfLines == 1 (which is the current default), I prefer we don't go into the logic of calculation at all, due to the recently found bug with Apple's generated attributedText removing the textAlignment Natural logic.