Skip to content

Commit

Permalink
[Buttons] Deletes deprecated MDCFloatingButtonShapeThemer (#9746)
Browse files Browse the repository at this point in the history
* [Buttons] Deletes deprecated MDCFloatingButtonShapeThemer

* Remove MDCFloatingButtonShapeThemer from tests

* Update docs

* clang
  • Loading branch information
bryanoltman committed Feb 18, 2020
1 parent e2bff76 commit 14c9d90
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 272 deletions.
47 changes: 0 additions & 47 deletions components/Buttons/README.md
Expand Up @@ -671,50 +671,3 @@ id<MDCTypographyScheming> typographyScheme = [[MDCTypographyScheme alloc] init];
toButton:component];
```
<!--</div>-->
<!-- Extracted from docs/shape-theming.md -->
### Shape Theming
Note: This documentation refers to legacy APIs that will eventually be deprecated. Please consider
reading the updated [theming documentation](docs/theming.md) instead.
You can theme buttons with your app's shape scheme using the ShapeThemer extension.
You must first add the ShapeThemer extension to your project:
```bash
pod 'MaterialComponents/Buttons+ShapeThemer'
```

<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
// Step 1: Import the ShapeThemer extension
import MaterialComponents.MaterialButtons_ShapeThemer

// Step 2: Create or get a shape scheme
let shapeScheme = MDCShapeScheme()

// Step 3: Apply the shape scheme to your component
MDCButtonShapeThemer.applyShapeScheme(shapeScheme, to: component)
MDCFloatingButtonShapeThemer.applyShapeScheme(shapeScheme, to: component)
```

#### Objective-C

```objc
// Step 1: Import the ShapeThemer extension
#import "MaterialButtons+ShapeThemer.h"

// Step 2: Create or get a shape scheme
id<MDCShapeScheming> shapeScheme = [[MDCShapeScheme alloc] init];

// Step 3: Apply the shape scheme to your component
[MDCButtonShapeThemer applyShapeScheme:shapeScheme
toButton:component];
[MDCFloatingButtonShapeThemer applyShapeScheme:shapeScheme
toButton:component];
```
<!--</div>-->
43 changes: 0 additions & 43 deletions components/Buttons/docs/shape-theming.md

This file was deleted.

46 changes: 0 additions & 46 deletions components/Buttons/src/ShapeThemer/MDCFloatingButtonShapeThemer.h

This file was deleted.

36 changes: 0 additions & 36 deletions components/Buttons/src/ShapeThemer/MDCFloatingButtonShapeThemer.m

This file was deleted.

Expand Up @@ -13,4 +13,3 @@
// limitations under the License.

#import "MDCButtonShapeThemer.h"
#import "MDCFloatingButtonShapeThemer.h"
Expand Up @@ -15,6 +15,7 @@
#import "MDCFloatingButton+MaterialTheming.h"

#import <MaterialComponents/MaterialButtons+ShapeThemer.h>
#import "MaterialShapeLibrary.h"

static const CGFloat kFloatingButtonBaselineShapePercentageValue = (CGFloat)0.5;

Expand Down
21 changes: 0 additions & 21 deletions components/Buttons/tests/unit/ButtonsShapeThemerTests.m
Expand Up @@ -57,27 +57,6 @@ - (void)testMDCButtonShapeThemer {
self.shapeScheme.smallComponentShape.bottomRightCorner);
}

- (void)testMDCFloatingButtonShapeThemer {
// Given
MDCFloatingButton *FAB = [[MDCFloatingButton alloc] initWithFrame:CGRectZero
shape:MDCFloatingButtonShapeDefault];
self.shapeScheme.smallComponentShape =
[[MDCShapeCategory alloc] initCornersWithFamily:MDCShapeCornerFamilyCut andSize:10];
FAB.shapeGenerator = [[MDCRectangleShapeGenerator alloc] init];

// When
[MDCFloatingButtonShapeThemer applyShapeScheme:self.shapeScheme toButton:FAB];

// Then
MDCRectangleShapeGenerator *rect = (MDCRectangleShapeGenerator *)FAB.shapeGenerator;
MDCCornerTreatment *corner = [MDCCornerTreatment cornerWithRadius:(CGFloat)0.5];
corner.valueType = MDCCornerTreatmentValueTypePercentage;
XCTAssertEqualObjects(rect.topLeftCorner, corner);
XCTAssertEqualObjects(rect.topRightCorner, corner);
XCTAssertEqualObjects(rect.bottomLeftCorner, corner);
XCTAssertEqualObjects(rect.bottomRightCorner, corner);
}

- (void)testBackgroundColorAfterButtonTheming {
// Given
UIColor *bgColor = [UIColor blueColor];
Expand Down
Expand Up @@ -15,7 +15,6 @@
#import "MDCShapeSchemeExampleViewController.h"

#import "supplemental/MDCBottomSheetControllerShapeThemerDefaultMapping.h"
#import "supplemental/MDCFloatingButtonShapeThemerDefaultMapping.h"
#import "supplemental/MDCShapeExamplesDummyCollectionViewController.h"

#import "MaterialAppBar+ColorThemer.h"
Expand Down Expand Up @@ -57,7 +56,6 @@ @interface MDCShapeSchemeExampleViewController ()

@property(strong, nonatomic) MDCButton *containedButton;
@property(strong, nonatomic) MDCButton *outlinedButton;
@property(strong, nonatomic) MDCFloatingButton *floatingButton;
@property(strong, nonatomic) MDCChipView *chipView;
@property(strong, nonatomic) MDCCard *card;
@property(strong, nonatomic) MDCButton *presentBottomSheetButton;
Expand Down Expand Up @@ -113,15 +111,6 @@ - (void)initializeComponentry {
self.containedButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.componentContentView addSubview:self.containedButton];

self.floatingButton = [[MDCFloatingButton alloc] init];
UIImage *plusImage =
[[UIImage imageNamed:@"Plus"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.floatingButton setImage:plusImage forState:UIControlStateNormal];
[self.floatingButton applySecondaryThemeWithScheme:[self containerScheme]];
[self.floatingButton sizeToFit];
self.floatingButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.componentContentView addSubview:self.floatingButton];

self.card = [[MDCCard alloc] init];
self.card.translatesAutoresizingMaskIntoConstraints = NO;
[self.card applyThemeWithScheme:self.containerScheme];
Expand Down Expand Up @@ -161,13 +150,12 @@ - (void)initializeComponentry {
[self.view addConstraints:bottomSheetConstraints];

NSArray<NSLayoutConstraint *> *componentConstraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"V:|-(30)-[containedButton]-(20)-[floatingButton]-(20)-["
constraintsWithVisualFormat:@"V:|-(30)-[containedButton]-(20)-["
@"chipView]-(20)-[card(80)]-(20)-[presentBottomSheetButton]"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:@{
@"containedButton" : self.containedButton,
@"floatingButton" : self.floatingButton,
@"chipView" : self.chipView,
@"card" : self.card,
@"presentBottomSheetButton" : self.presentBottomSheetButton
Expand Down Expand Up @@ -334,14 +322,11 @@ - (void)updateComponentShapesWithBaselineOverrides:(BOOL)baselineOverrides {
[MDCBottomSheetControllerShapeThemerDefaultMapping applyShapeScheme:_shapeScheme
toBottomSheetController:self.bottomSheetController];
[MDCShapeSchemeExampleViewController applyShapeScheme:_shapeScheme toChipView:self.chipView];
[MDCFloatingButtonShapeThemerDefaultMapping applyShapeScheme:_shapeScheme
toButton:self.floatingButton];
} else {
// We do want baseline overrides.
[MDCBottomSheetControllerShapeThemer applyShapeScheme:_shapeScheme
toBottomSheetController:self.bottomSheetController];
[self.chipView applyThemeWithScheme:self.containerScheme];
[MDCFloatingButtonShapeThemer applyShapeScheme:_shapeScheme toButton:self.floatingButton];
}
}

Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 14c9d90

Please sign in to comment.