Skip to content

Commit

Permalink
[Buttons] Rename MDCFloatingButton updateShapeForcingLayout (#2625)
Browse files Browse the repository at this point in the history
"Forcing" wasn't the right phrasing, it only prevents layout updates if "NO".
Using a gerund, "forcing", also doesn't match the style of methods. Gerunds are preferred for
protocols.

Closes #2571
  • Loading branch information
Robert Moore authored and ianegordon committed Dec 8, 2017
1 parent 8399448 commit 6469bad
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/Buttons/src/MDCFloatingButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ - (instancetype)initWithFrame:(CGRect)frame shape:(MDCFloatingButtonShape)shape
[self commonMDCFloatingButtonInit];
// The superclass sets contentEdgeInsets from defaultContentEdgeInsets before the _shape is set.
// Set contentEdgeInsets again to ensure the defaults are for the correct shape.
[self updateShapeForcingResize:NO];
[self updateShapeAndAllowResize:NO];
}
return self;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
[aDecoder decodeObjectForKey:MDCFloatingButtonHitAreaInsetsDictionaryKey];
}

[self updateShapeForcingResize:NO];
[self updateShapeAndAllowResize:NO];
}
return self;
}
Expand Down Expand Up @@ -366,7 +366,7 @@ - (void)setMode:(MDCFloatingButtonMode)mode {
BOOL needsShapeUpdate = self.mode != mode;
_mode = mode;
if (needsShapeUpdate) {
[self updateShapeForcingResize:YES];
[self updateShapeAndAllowResize:YES];
}
}

Expand All @@ -380,7 +380,7 @@ - (void)setMinimumSize:(CGSize)size
}
modeToMinimumSize[@(mode)] = [NSValue valueWithCGSize:size];
if (shape == _shape && mode == self.mode) {
[self updateShapeForcingResize:YES];
[self updateShapeAndAllowResize:YES];
}
}

Expand Down Expand Up @@ -417,7 +417,7 @@ - (void)setMaximumSize:(CGSize)size
}
modeToMaximumSize[@(mode)] = [NSValue valueWithCGSize:size];
if (shape == _shape && mode == self.mode) {
[self updateShapeForcingResize:YES];
[self updateShapeAndAllowResize:YES];
}
}

Expand Down Expand Up @@ -454,7 +454,7 @@ - (void)setContentEdgeInsets:(UIEdgeInsets)contentEdgeInsets
}
modeToContentEdgeInsets[@(mode)] = [NSValue valueWithUIEdgeInsets:contentEdgeInsets];
if (shape == _shape && mode == self.mode) {
[self updateShapeForcingResize:YES];
[self updateShapeAndAllowResize:YES];
}
}

Expand Down Expand Up @@ -486,7 +486,7 @@ - (void)setHitAreaInsets:(UIEdgeInsets)insets
}
modeToHitAreaInsets[@(mode)] = [NSValue valueWithUIEdgeInsets:insets];
if (shape == _shape && mode == self.mode) {
[self updateShapeForcingResize:NO];
[self updateShapeAndAllowResize:NO];
}
}

Expand All @@ -508,13 +508,13 @@ - (void)updateHitAreaInsets {
super.hitAreaInsets = [self hitAreaInsetsForMode:self.mode];
}

- (void)updateShapeForcingResize:(BOOL)forceResize {
- (void)updateShapeAndAllowResize:(BOOL)allowsResize {
BOOL minimumSizeChanged = [self updateMinimumSize];
BOOL maximumSizeChanged = [self updateMaximumSize];
[self updateContentEdgeInsets];
[self updateHitAreaInsets];

if (forceResize && (minimumSizeChanged || maximumSizeChanged)) {
if (allowsResize && (minimumSizeChanged || maximumSizeChanged)) {
[self invalidateIntrinsicContentSize];
[self setNeedsLayout];
}
Expand Down

0 comments on commit 6469bad

Please sign in to comment.