{"push_id":3110184728,"size":1,"distinct_size":1,"ref":"refs/heads/match-uicolor-states","head":"25a2117687c99a9ee597464a6337dbc4780bb0d6","before":"def3b071cac6ef1ca29018523fc10309f39f3692","commits":[{"sha":"25a2117687c99a9ee597464a6337dbc4780bb0d6","author":{"name":"Robert Moore","email":"d76984251d810523c9ec7e1983ca0e45ed714290@google.com"},"message":"[Buttons] Match backgroundColor to titleColor API\n\nMDCButton's `backgroundColor:forState:` API will now handle the special\ncase of `(UIControlStateHighlighted | UIControlStateDisabled)` the same\nway that UIButton's `titleColor:forState:` API does. With the exception\nof fallback behavior in state handling, their behavior should be\nidentical.\n\nContext and Background\n----------------------\n\nWhen `UIControlStateDisabled` and `UIControlStateHighlighted` are\nincluded in the same argument for the `state` parameter in\n`setTitleColor:forState:`, the `UIControlStateDisabled` bit is ignored.\nThis means that when setting a `titleColor` for the `(.selected |\n.highlighted | .disabled)` state, UIButton will actually store it as the\n`(.highlighted | .selected)` state. There is an additional exception\nthat if there is no current value for the \"adjusted\" UIControlState,\nthen no assignment is made.\n\n**Example 1: Fallback to `.highlighted` state**\n\nThe following example verifies that UIButton will ignore the\n`UIControlStateDisabled` bit in the UIControlState parameter when\ncombined with `UIControlStateHighlighted`. The result is a \"fallback\" to\nthe value for `UIControlStateHighlighted`.\n\n```objc\n UIButton *buttonSetHighlighted = [[UIButton alloc] init];\n  [buttonSetHighlighted setTitleColor:UIColor.orangeColor forState:UIControlStateHighlighted];\n  XCTAssertEqualObjects([buttonSetHighlighted titleColorForState:(UIControlStateDisabled | UIControlStateHighlighted)],\n                        [buttonSetHighlighted titleColorForState:UIControlStateHighlighted]);\n  XCTAssertEqualObjects([buttonSetHighlighted titleColorForState:(UIControlStateSelected | UIControlStateDisabled | UIControlStateHighlighted)],\n                        [buttonSetHighlighted titleColorForState:UIControlStateNormal]);\n```\n\n**Example 2: Failure to store value for `(.highlighted | .disabled)`**\n\nThe following example verifies that UIButton will discard the assigned\nvalue for `(UIControlStateDisabled | UIControlStateHighlighted)` when no\nprevious value for `UIControlStateHighlighted` has been set.\n\n```objc\nUIButton *buttonSetHighlightedDisabled = [[UIButton alloc] init];\n  [buttonSetHighlightedDisabled setTitleColor:UIColor.orangeColor forState:(UIControlStateDisabled | UIControlStateHighlighted)];\n  XCTAssertEqualObjects([buttonSetHighlightedDisabled titleColorForState:(UIControlStateDisabled | UIControlStateHighlighted)],\n                        [buttonSetHighlightedDisabled titleColorForState:UIControlStateNormal]);\n  XCTAssertEqualObjects([buttonSetHighlightedDisabled titleColorForState:(UIControlStateSelected | UIControlStateDisabled | UIControlStateHighlighted)],\n                        [buttonSetHighlightedDisabled titleColorForState:UIControlStateNormal]);\n```\n\n**Example 3: Assigning value for `(.disabled | .highlighted)` overwrites\nprevious value for `.highlighted`**\n\nThe following example verifies that UIButton will overwrite any previous\nvalue for the `UIControlStateHighlighted` state when a value for\n`(UIControlStateDisabled | UIControlStateHighlighted)` is later\nassigned.\n\n```objc\nUIButton *buttonSetHighlightedDisabled = [[UIButton alloc] init];\n[buttonSetHighlightedDisabled setTitleColor:UIColor.purpleColor forState:UIControlStateHighlighted];\n[buttonSetHighlightedDisabled setTitleColor:UIColor.orangeColor forState:(UIControlStateDisabled | UIControlStateHighlighted)];\nXCTAssertEqualObjects([buttonSetHighlightedDisabled titleColorForState:(UIControlStateDisabled | UIControlStateHighlighted)],\n                      UIColor.orangeColor);\nXCTAssertEqualObjects([buttonSetHighlightedDisabled titleColorForState:UIControlStateHighlighted],\n                      UIColor.orangeColor);\n```\n\nPart of #3411","distinct":true,"url":"https://api.github.com/repos/romoore/material-components-ios/commits/25a2117687c99a9ee597464a6337dbc4780bb0d6"}]}
{"actor":{"display_login":"romoore"}}