26 Commits

Author SHA1 Message Date
Nobody
8aa3c4f1a3 Fixed up imports and nullability for BottomAppBar
PiperOrigin-RevId: 490346819
2022-11-22 15:09:29 -08:00
Jeff Verkoeyen
86a8c97dc7 Remove all pre-iOS 12 logic.
PiperOrigin-RevId: 400788645
2021-10-04 12:41:07 -07:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Cody Weaver
cd30e764c2 [MDC/BottomAppBar] Add MDCRipple support to MDCBottomAppBarView
Clients may want to support ripple throughout their application and be using MDCBottomAppBar. Since the bottom app bar does not expose it's navigation bar we need to have a pass through property to enable the ripple in the navigation bar. Users shouldn't get any ripple effect on the bar itself so we don't need any additional support other than what the navigation bar has. If clients want to enable it on the floating action button that is exposed so they can do so. This change also allows them to customize the ripple color.

PiperOrigin-RevId: 306278679
2020-04-13 12:00:45 -07:00
Bryan Oltman
68a65d33d3
[BottomAppBar] Delete deprecated MDCBottomAppBarColorThemer (#9166)
MDCBottomAppBarColorThemer has no internal use and is deprecated.

Fixes #9164
Fixes #9165
2019-12-06 17:10:33 -05:00
Robert Moore
8cebc56185
[*] Suppress deprecation warnings. (#8481)
Suppresses deprecation warnings either for implementations of our own
deprecated APIs or for their use in tests and elsewhere.

Part of #7537
2019-09-23 12:48:42 -04:00
Bryan Oltman
02a707a5b4
[BottomAppBar] Add conformance to MDCElevatable, MDCElevationOverriding (#8094)
* [BottomAppBar] Add conformance to MDCElevatable, MDCElevationOverriding

* PR feedback
2019-07-26 14:49:26 -04:00
Robert Moore
db4b31e1ed
[BottomAppBar] Remove no-op tests. (#8072) 2019-07-24 14:59:23 -04:00
Cody Weaver
ce0ab9122e
[BottomAppBar] Add traitCollectionDidChange block (#7930)
The bottom app bar needs an API so clients can hook-in to trait collection changes. This additionally passes the bottom app bar as a parameter so clients can modify the bottom app bar within the block.

Closes #7927
2019-07-16 05:13:16 -07:00
Yarden Eitan
71512ff72e reverting 2019-02-26 11:50:30 -05:00
Robert Moore
f1b5318d5e
[ColorScheme] Add test schemes. (#6690)
Adding test schemes useful for unit/snapshot tests where the baseline
scheme is insufficient (for example to verify bindings).
2019-02-22 09:43:42 -05:00
Peter Friese
e1008e5206 [BottomAppBar] Fix it/bottom app bar cut out (#6420)
[BottomAppBar] Fix it/bottom app bar cut out (#5958)

### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-02-04 11:16:43 -05:00
Yarden Eitan
e30327f8a7 Revert "[BottomAppBar] Fix it/bottom app bar cut out (#5958)"
This reverts commit 068786a9c620e6e760b8f30d414067b1da203808.
2019-01-08 14:59:06 -05:00
Peter Friese
068786a9c6 [BottomAppBar] Fix it/bottom app bar cut out (#5958)
### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-01-07 17:06:13 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
Robert Moore
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

Regex used:
```
([0-9]*\.)([0-9]*?)([1-9]+)([0-9]*?)[fF]
```

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -05:00
Robert Moore
74a27253e8
Global replace of integral single-precision literals with integer literals. (#5709)
Global replace of integral single-precision literals with integer literals.

Regular expression used:
```perl
/[^\w]([0-9]+)\.[0]*[fF]/$1/
```
2018-11-08 14:02:04 -05:00
Cody Weaver
7b51a89030
[BottomAppBar] Fix path animation (#5611)
### Context
As of #5155 our animation didn't have an equal number of points in the bezierPath when there was or wasn't a FAB. When doing an animation between two `CGPath`s the points need to be the same in order to animate correctly.
### The problem
There were not an equal number of points between both paths so the animation didn't know how to map the values in each path to each other.
### The fix
Update the path to render correctly by adding a point to the `withoutCut` function.
### Related bug
#5603 
### Videos
| Before | After |
| - | - |
|![before](https://user-images.githubusercontent.com/7131294/48082558-f4183e00-e1c0-11e8-9439-ff8bcd9337ff.gif)|![after](https://user-images.githubusercontent.com/7131294/48082568-f9758880-e1c0-11e8-925b-c663c20f4865.gif)|

**_note_** Example Code snippet

```objc
// In MDCBottomAppBarAttributes.h
kMDCFloatingButtonExitDuration = 2.180
kMDCFloatingButtonEnterDuration = 2.270

// In example file
[bottomAppBar.floatingButton removeFromSuperview];
// toggle between
BOOL animate = true
[bottomAppBar setFloatingButtonHidden:animate animated:YES];
animate = !animate
```
2018-11-06 19:28:47 -05:00
Robert Moore
675235ed05
{Tests} Deallocate test objects at the end of tests. (#5397)
Deallocating many of the properties created for each unit test. Since all
XCTestCase instances survive until the end of the test suite, any properties
created for a test will be preserved as well. This frees up around 3.7 MB
(~6%) of memory from the entire test suite, as measured on my desktop.

|Before|After|
|----|----|
|![test-objcs-before](https://user-images.githubusercontent.com/1753199/46813473-c3b9bd00-cd44-11e8-990c-28dff4ab5ad2.png)|![test-objcs-after](https://user-images.githubusercontent.com/1753199/46813481-c7e5da80-cd44-11e8-90e4-2e6d532ebbfb.png)|

See also: https://qualitycoding.org/xctestcase-teardown/

Closes #5395
2018-10-12 08:33:58 -04:00
Wenyu Zhang
766a6a7697
[BottomAppBar] enable customizing the vertical position of FAB (#5138)
This change provides a `floatingButtonCenterToNavigationBarTopOffset` property in `MDCBottomAppBarView` to customize the vertical position of FAB. You can use it on an `MDCBottomAppBarView` instance once it is initialized. 

Example:
```
MDCBottomAppBarView *appBarView = [[MDCBottomAppBarView alloc] init];
appBarView.floatingButtonCenterToNavigationBarTopOffset = 20.0f
```


closes #5011 and #5012

Before the change:
![simulator screen shot - iphone x - 2018-09-14 at 17 06 10](https://user-images.githubusercontent.com/8836258/45575161-7e3aca80-b840-11e8-9b40-31f1b7e8de68.png)


After the change:
![pc3](https://user-images.githubusercontent.com/8836258/45640281-31ddcd80-ba80-11e8-818d-eb02ecea3c02.gif)
2018-09-19 15:53:36 -04:00
Robert Moore
1ce4467321
[BottomAppBar] Add surface variant color themer. (#5068)
The BottomAppBar needs to support the "surface variant" of Material
color theming. A new method on MDCBottomAppBarColorThemer now allows
clients to apply the surface variant theme to their MDCBottomAppBarView
instances.

**Change demonstration**
These changes are not in this PR, but will be made in a follow-up PR. These screenshots are to show the before/after effect of using the new themer.

|Example|Before|After|
|--|--|--|
|Catalog (Objc)|![bab-objc-catalog-before](https://user-images.githubusercontent.com/1753199/45260529-566ae300-b3b8-11e8-95c8-a258bf95c3ca.png)|![bab-objc-catalog-after](https://user-images.githubusercontent.com/1753199/45260530-5b2f9700-b3b8-11e8-993d-449eb1c4c47e.png)|
|Dragons (Objc)|![bab-objc-dragon-before](https://user-images.githubusercontent.com/1753199/45260532-6256a500-b3b8-11e8-961e-106da28a3db2.png)|![bab-objc-dragon-after](https://user-images.githubusercontent.com/1753199/45260535-67b3ef80-b3b8-11e8-8f03-b2c808ec9b86.png)|
|Dragons (Swift)|![bab-swift-dragon-before](https://user-images.githubusercontent.com/1753199/45260537-6f739400-b3b8-11e8-8796-b94779018b63.png)|![bab-swift-dragon-after](https://user-images.githubusercontent.com/1753199/45260762-88327880-b3bd-11e8-9896-be55dd96d515.png)|

Closes #3928
2018-09-10 16:07:16 -04:00
Robert Moore
1ae450095f
[BottomAppBar] Tint leading, trailing bar items. (#5065)
The BottomAppBar should support different tint colors for the leading
and trailing items.

**Extreme Example**
<img width="371" alt="screen shot 2018-09-08 at 11 30 49 pm" src="https://user-images.githubusercontent.com/1753199/45260822-44407300-b3bf-11e8-85e0-a962ff969d97.png">


Part of #3928
2018-09-10 14:38:28 -04:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

This was an automated change generated by running a find-and-replace regular expression:

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00
featherless
d6e1110e56
[BottomAppBar] Add umbrella headers for all extension targets. (#3459)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 15:53:00 -04:00
Robert Moore
c82fafba3e [BottomAppBar] Add simple color themer (#3094)
* [BottomAppBar] Add simple color themer

Adding a color themer that can apply an id<MDCColorScheme> to the
BottomAppBar.  Uses the `primaryColor` as the bar's background color to
match the behavior of MDCNavigationBarColorThemer.

Closes #2279

* Adjusting documentation
2018-03-15 17:45:06 -04:00
Robert Moore
60c4e169c2
[BottomAppBar] Add BUILD file and no-op test (#2700) 2017-12-13 21:17:13 -05:00