39 Commits

Author SHA1 Message Date
Wenyu Zhang
9fc1bebed8 Internal change
PiperOrigin-RevId: 492460942
2022-12-02 07:12:08 -08:00
Randall Li
1f91cf1320 [Elevation] Change deprecation warning to point at potential script.
PiperOrigin-RevId: 492353603
2022-12-01 18:55:49 -08:00
Randall Li
c2607a4213 [MDC Color] Graduated color blending component to public folder
PiperOrigin-RevId: 463647015
2022-07-27 12:14:33 -07:00
Jeff Verkoeyen
b2bbd50350 Mark all To Be Deprecated APIs as Deprecated.
PiperOrigin-RevId: 460478209
2022-07-12 09:13:52 -07:00
Jeff Verkoeyen
eeb188db10 [Elevation] Mark the library as To Be Deprecated.
Use Apple's elevation model via UIColor's dynamic color provider APIs and trait collections instead.

PiperOrigin-RevId: 457740473
2022-06-28 08:53:46 -07:00
Jeff Verkoeyen
c34de39e30 Internal change.
PiperOrigin-RevId: 397316843
2021-09-17 07:45:01 -07:00
Alyssa Weiss
924c49e43b Remove all iOS 10 availability checks from material_components_ios now that only iOS 10+ is supported.
PiperOrigin-RevId: 366437050
2021-04-02 06:33:16 -07:00
Jeff Verkoeyen
fbb1f20aa2 Internal change
PiperOrigin-RevId: 332151481
2020-09-16 21:01:21 -07:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

Closes https://github.com/material-components/material-components-ios/pull/9968

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Randall Li
fa62718bc5
add deps on availability for a bunch of components (#9679)
* add Availability build file

* add Button deps on availability

* added elevation

* corrected include statements to use import of the umbrella files

* revert unwanted changes

* spaces

* clangformat

* add availability dep

* added buttom nav deps on availibility

* Add FeatureHighlight build dep for Availability

* Add Availability build dep to FeatureHighlight private

* Add missing =

* fixed tabs spacing

Co-authored-by: Bryan Oltman <bryanoltman@gmail.com>
2020-02-11 13:14:09 -05:00
Nobody
98f8968ebe [Material][Availability] Migrates elevation to MDCAvailability.
PiperOrigin-RevId: 293812421
2020-02-07 07:49:46 -08:00
featherless
162a063bda
[bazel] Remove all unused mdc_objc_library loads. (#9376)
Found by searching for all references to `\bmdc_objc_library` and removing load statements from files that only returned one result.

Clean up as part of https://github.com/material-components/material-components-ios/issues/9363
2020-01-02 14:34:36 -05:00
featherless
b7cf0de915
[bazel] Remove all unused swift_library load statements. (#9369)
Found by searching for all references to `\bswift_library` and removing load statements from files that only returned one result.

Clean up as part of https://github.com/material-components/material-components-ios/issues/5491
2020-01-02 11:01:31 -05:00
Cody Weaver
614820316a
[Elevation] Fix spelling error (#8336)
Currently MaterialElevation object has a spelling error in an internal method, this addresses that issue.
2019-08-16 18:53:44 -04:00
Wenyu Zhang
ba2336c38e
[Color+Elevation] Add a convenience method to resolve dynamic color only when traitCollection's color appearance has changed. (#8315)
Add this convenience method would help supporting theming extension in an easier way that we don't need to check color difference on traitCollection every time like https://github.com/material-components/material-components-ios/pull/8285/files#diff-48ca693ee2870d02b06a42900a1dc69dR73.
2019-08-15 10:59:48 -04:00
Yarden Eitan
3f121b7014
[Elevation] Update mdc_resolvedColorWithTraitCollection:elevation: to support pre-iOS 13 (#8217)
By having mdc_resolvedColorWithTraitCollection:elevation be an iOS13 only API, it forces the client using this API to have iOS13 checks surrounding this method, when in fact we are already adding those checks inside the method itself, making clients have to do additional work that is unneeded.

Secondly, having the method return nil if it isn't iOS13 and not just return the original color causes clients (and our theming extensions) to add additional checks if its nil and apply the original color otherwise:
```
self.backgroundColor = [self.backgroundColor resolvedColorForTraitCollection:self.traitCollection elevation:elevation] ?: self.backgroundColor;
```

Instead of just doing:
```
self.backgroundColor = [self.backgroundColor resolvedColorForTraitCollection:self.traitCollection elevation:elevation];
```

Lastly, I don't believe it makes sense to make the method an iOS13 API only as in fact UITraitCollections exist since iOS8, and is legitimate to pass it to the function even though userInterfaceStyle is not there yet.

Closes: #8216
2019-08-04 19:22:34 -07:00
Yarden Eitan
7d6164356f
[Elevation] Add smooth continuous formula for values between 0 and 1 (#8212)
In the UIColor+MaterialElevation category the formula to convert elevation to alpha has a jump for elevations that are 0 to anything bigger than 0.

This means that elevation 0 returns an alpha that is 0, but any elevation that is above 0, even 0.000000001 will return an alpha of 2 or bigger. This causes 2 problems:

Some of our components return elevations that are very close to 0, like 0.0000000000005 (AppBar in particular). If we don't fix this, it will cause constant flickering of the background color of the AppBar as it transitions between 0 and something closer to 0.
There is a big jump when component elevations between 0 and anything larger than 0 occurs which makes it seem like a jump and not smooth to the observer.
The change provide a smooth function that occurs between values of 0 and 1. This formula has been thought out in collaboration with design.

Closes: #8213
2019-08-02 21:01:32 -07:00
Yarden Eitan
17f000a076
nsobject (#8188) 2019-08-02 13:36:59 -07:00
Robert Moore
9ea5f99c12
[Elevation] Fix spelling typos. (#8114) 2019-07-30 12:41:33 -04:00
Yarden Eitan
50ba836103
[Elevation] Doc clarification (#8074)
Explaining that the override property is ignored if set to a negative value.
2019-07-26 17:49:26 -04:00
Wenyu Zhang
c3f8c6adeb
[Elevation] Add a UIColor category to support resolving color with elevation. (#8085)
This PR provides two methods to allow users resolving color with elevation.

closes https://github.com/material-components/material-components-ios/issues/8086.
2019-07-26 16:48:56 -04:00
Wenyu Zhang
95047be49d Merge branch 'release-candidate' into develop 2019-07-24 16:50:27 -04:00
Yarden Eitan
c980a95d54
[Elevation] Add absoluteElevation property and clarify the elevationDidChange block param (#8071)
As clients will initialize their material components and want to provide a background color that fits the component's elevation, they will need to get its absolute elevation value. Therefore, currently they need to add mdc_currentElevation + mdc_baseElevation themselves to get that.

In this PR I am adding an mdc_absoluteElevation getter where clients can get that and not have to do unneeded calculation in their code. Furthermore, because elevationDidChangeBlock effectively returns the absolute elevation, it would be easier for clients to understand that concept by also providing an absoluteElevation property.

Added easier to understand description of what exactly the elevationDidChangeBlock elevation param it provides.
2019-07-24 14:30:08 -04:00
Yarden Eitan
0a270c3842 [Elevation] passing self to the elevationDidChangeBlock (#8058)
Similarly to `traitCollectionDidChangeBlock`, we want to pass `self` here in cases where the object is being injected, and also to remove the need from clients to weakify self and possibly cause retain cycles.

When our components conform to this block, they should be more type specific to what self is. As an example in the MDCCard header, I would expect conforming to this block would be declared like:
```
@property(nonatomic, copy, nullable) void (^mdc_elevationDidChangeBlock)
(MDCCard * elevatableSelf, CGFloat elevation);
```
2019-07-24 12:13:13 -04:00
Cody Weaver
96a2a60934 [Elevation] Add category to UIView (#7969)
Adds a category to UIView to get a mdc_baseElevation for a given view. This new property will allow views to know the elevation of everything below them.

Related to #7964
2019-07-24 12:12:29 -04:00
Cody Weaver
e312d88119
[Elevation] Add elevationDidChange method to UIView category (#8067)
This change adds a method to UIView elevationDidChange to inform all UIViews and their subviews that one of their _superview_s changed elevation and they may need to be re-themed.

Closes #8005
2019-07-24 08:26:26 -07:00
Yarden Eitan
0643370347
[Elevation] passing self to the elevationDidChangeBlock (#8058)
Similarly to `traitCollectionDidChangeBlock`, we want to pass `self` here in cases where the object is being injected, and also to remove the need from clients to weakify self and possibly cause retain cycles.

When our components conform to this block, they should be more type specific to what self is. As an example in the MDCCard header, I would expect conforming to this block would be declared like:
```
@property(nonatomic, copy, nullable) void (^mdc_elevationDidChangeBlock)
(MDCCard * elevatableSelf, CGFloat elevation);
```
2019-07-24 10:59:16 -04:00
Cody Weaver
f335b96277
[Elevation] Add category to UIView (#7969)
Adds a category to UIView to get a mdc_baseElevation for a given view. This new property will allow views to know the elevation of everything below them.

Related to #7964
2019-07-23 15:32:54 -07:00
Yarden Eitan
8a6db9599d [Elevation] Improve protocol naming (#8055)
To conform to proper Objective-C naming, I have updated the protocol names to use a gerund form "ing"

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html
2019-07-23 16:21:30 -04:00
Robert Moore
8077d5a56d [Elevation] Add MDCElevationOverride to umbrella header (#8052) 2019-07-23 16:21:18 -04:00
Yarden Eitan
d9d038130a
[Elevation] Improve protocol naming (#8055)
To conform to proper Objective-C naming, I have updated the protocol names to use a gerund form "ing"

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html
2019-07-23 16:12:16 -04:00
Wenyu Zhang
d087a8f29e [Elevation] fix a typo. 2019-07-23 15:23:07 -04:00
Robert Moore
eab643ea8c
[Elevation] Add MDCElevationOverride to umbrella header (#8052) 2019-07-23 15:08:15 -04:00
Cody Weaver
26a6a9139a
[Elevation] Add second protocol for overrides (#8034)
This change adds a second protocol for clients to override their base elevation. This additionally removes the property from MDCElevation.
2019-07-23 11:45:39 -07:00
Cody Weaver
0c0d26356b
[Elevation] Add property mdc_overrideElevation property (#7965)
Add an optional property for clients to override their elevation if they are using a UIPresentationController or another object that may not be in the view hierarchy but in the UIWindow.

Part of #7964
2019-07-18 16:17:44 -07:00
Cody Weaver
c1ab40b72f
[Elevation] Add elevationDidChangeBlock to MDCElevation protocol (#7962)
This change adds a block that to the MDCElevation protocol so that clients can react to elevation changes within this new block.

Related to #7964
2019-07-18 15:52:49 -07:00
Cody Weaver
63eda9bfa0
[Elevation] Add MDCElevation protocol. (#7955)
This change adds a protocol `MDCElevation` for clients to conform to so that their is a consistent API for getting a `UIView` elevation. This is in it's own folder because it can be used as a standalone protocol and is agnostic of ShadowElevations and schemes/Color.

For additional context please see go/material-dark-mode-elevation-support
Closes #7961
2019-07-18 14:16:55 -07:00