diff --git a/components/BottomNavigation/src/MDCBottomNavigationBar.h b/components/BottomNavigation/src/MDCBottomNavigationBar.h index df810deef82..7fa1fee5563 100644 --- a/components/BottomNavigation/src/MDCBottomNavigationBar.h +++ b/components/BottomNavigation/src/MDCBottomNavigationBar.h @@ -139,14 +139,6 @@ typedef NS_ENUM(NSInteger, MDCBottomNavigationBarAlignment) { */ @property(nonatomic, assign, getter=isBackgroundBlurEnabled) BOOL backgroundBlurEnabled; -/** - The inset applied to each items bounds to determine the rect in which the items' contents will be - centered. The contents are centered in this rect, but not compressed, so they may still extend - beyond these bounds. Defaults to {0, 0, 0, 0}. The inset is flipped for RTL. - */ -@property(nonatomic, assign) - UIEdgeInsets itemsContentInsets __deprecated_msg("This API will be removed."); - /** The margin between the item's icon and title when alignment is either Justified or Centered. Defaults to 0. diff --git a/components/BottomNavigation/src/MDCBottomNavigationBar.m b/components/BottomNavigation/src/MDCBottomNavigationBar.m index bc7de8e302b..98827bc2876 100644 --- a/components/BottomNavigation/src/MDCBottomNavigationBar.m +++ b/components/BottomNavigation/src/MDCBottomNavigationBar.m @@ -445,10 +445,6 @@ - (void)setItems:(NSArray *)items { itemView.accessibilityLabel = item.accessibilityLabel; itemView.accessibilityHint = item.accessibilityHint; itemView.isAccessibilityElement = item.isAccessibilityElement; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - itemView.contentInsets = self.itemsContentInsets; -#pragma clang diagnostic pop itemView.contentVerticalMargin = self.itemsContentVerticalMargin; itemView.contentHorizontalMargin = self.itemsContentHorizontalMargin; MDCInkTouchController *controller = [[MDCInkTouchController alloc] initWithView:itemView]; @@ -517,18 +513,6 @@ - (void)setSelectedItem:(UITabBarItem *)selectedItem animated:(BOOL)animated { } } -- (void)setItemsContentInsets:(UIEdgeInsets)itemsContentInsets { - if (UIEdgeInsetsEqualToEdgeInsets(_itemsContentInsets, itemsContentInsets)) { - return; - } - _itemsContentInsets = itemsContentInsets; - for (NSUInteger i = 0; i < self.items.count; i++) { - MDCBottomNavigationItemView *itemView = self.itemViews[i]; - itemView.contentInsets = itemsContentInsets; - } - [self setNeedsLayout]; -} - - (void)setItemsContentVerticalMargin:(CGFloat)itemsContentsVerticalMargin { if (MDCCGFloatEqual(_itemsContentVerticalMargin, itemsContentsVerticalMargin)) { return; diff --git a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.h b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.h index 72244f45206..3c9089a2e2c 100644 --- a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.h +++ b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.h @@ -37,8 +37,6 @@ @property(nonatomic, strong) UIColor *unselectedItemTintColor UI_APPEARANCE_SELECTOR; @property(nonatomic, strong) UIColor *selectedItemTitleColor; -@property(nonatomic, assign) UIEdgeInsets contentInsets; - @property(nonatomic, assign) CGFloat contentVerticalMargin; @property(nonatomic, assign) CGFloat contentHorizontalMargin; diff --git a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m index 9d3e27c2ee9..b3bc82e5173 100644 --- a/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m +++ b/components/BottomNavigation/src/private/MDCBottomNavigationItemView.m @@ -217,7 +217,7 @@ - (void)layoutSubviews { } - (void)centerLayoutAnimated:(BOOL)animated { - CGRect contentBoundingRect = UIEdgeInsetsInsetRect(self.bounds, self.contentInsets); + CGRect contentBoundingRect = CGRectStandardize(self.bounds); CGFloat centerY = CGRectGetMidY(contentBoundingRect); CGFloat centerX = CGRectGetMidX(contentBoundingRect); UIUserInterfaceLayoutDirection layoutDirection = self.mdf_effectiveUserInterfaceLayoutDirection; diff --git a/components/BottomNavigation/tests/snapshot/MDCBottomNavigationItemViewSnapshotTests.m b/components/BottomNavigation/tests/snapshot/MDCBottomNavigationItemViewSnapshotTests.m index 17b8ebad1e0..2cc09489b29 100644 --- a/components/BottomNavigation/tests/snapshot/MDCBottomNavigationItemViewSnapshotTests.m +++ b/components/BottomNavigation/tests/snapshot/MDCBottomNavigationItemViewSnapshotTests.m @@ -299,90 +299,4 @@ - (void)testTypicalWidthTallHeightLongTitleEmptyBadgeAdjacentRTL { [self generateAndVerifySnapshot]; } -#pragma mark - ContentInsets - -- (void)testContentInsetsStackedLTR { - // When - // Shift DOWN and RIGHT - self.itemView.titleBelowIcon = YES; - self.itemView.contentInsets = UIEdgeInsetsMake(10, 5, -10, -5); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsStackedRTL { - // When - // Shift DOWN and LEFT - [self changeToRTLAndArabicWithBadgeValue:kBadgeTitleEmpty]; - self.itemView.titleBelowIcon = YES; - self.itemView.contentInsets = UIEdgeInsetsMake(10, 5, -10, -5); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsNoopStackedLTR { - // When - self.itemView.titleBelowIcon = YES; - self.itemView.contentInsets = UIEdgeInsetsMake(kHeightTypical / 2, kWidthTypical / 2, - kHeightTypical / 2, kWidthTypical / 2); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsNoopStackedRTL { - // When - [self changeToRTLAndArabicWithBadgeValue:kBadgeTitleEmpty]; - self.itemView.titleBelowIcon = YES; - self.itemView.contentInsets = UIEdgeInsetsMake(kHeightTypical / 2, kWidthTypical / 2, - kHeightTypical / 2, kWidthTypical / 2); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsAdjacentLTR { - // When - // Shift UP and LEFT - self.itemView.titleBelowIcon = NO; - self.itemView.contentInsets = UIEdgeInsetsMake(-5, -10, 5, 10); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsAdjacentRTL { - // When - // Shift UP and RIGHT - [self changeToRTLAndArabicWithBadgeValue:kBadgeTitleEmpty]; - self.itemView.titleBelowIcon = NO; - self.itemView.contentInsets = UIEdgeInsetsMake(-5, -10, 5, 10); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsNoopAdjacentLTR { - // When - self.itemView.titleBelowIcon = NO; - self.itemView.contentInsets = UIEdgeInsetsMake(kHeightTypical / 2, kWidthTypical / 2, - kHeightTypical / 2, kWidthTypical / 2); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - -- (void)testContentInsetsNoopAdjacentRTL { - // When - [self changeToRTLAndArabicWithBadgeValue:kBadgeTitleEmpty]; - self.itemView.titleBelowIcon = NO; - self.itemView.contentInsets = UIEdgeInsetsMake(kHeightTypical / 2, kWidthTypical / 2, - kHeightTypical / 2, kWidthTypical / 2); - self.itemView.frame = CGRectMake(0, 0, kWidthTypical, kHeightTypical); - - [self generateAndVerifySnapshot]; -} - @end diff --git a/components/BottomNavigation/tests/unit/BottomNavigationItemViewTests.m b/components/BottomNavigation/tests/unit/BottomNavigationItemViewTests.m index 0d039461a92..c7460383435 100644 --- a/components/BottomNavigation/tests/unit/BottomNavigationItemViewTests.m +++ b/components/BottomNavigation/tests/unit/BottomNavigationItemViewTests.m @@ -86,30 +86,6 @@ - (void)testHorizontalMarginLayout { (CGFloat)0.001); } -- (void)testContentInsetLayout { - // Given - MDCBottomNavigationItemView *view = [[MDCBottomNavigationItemView alloc] init]; - view.title = @"Test Content"; - view.image = fakeImage(); - view.bounds = CGRectMake(0, 0, 100, 100); - view.contentVerticalMargin = 20; - view.contentHorizontalMargin = 20; - view.titleVisibility = MDCBottomNavigationBarTitleVisibilityAlways; - - // When - view.titleBelowIcon = YES; - view.contentInsets = UIEdgeInsetsMake(10, 10, 5, 5); - [view layoutSubviews]; - - // Then - CGRect contentRect = UIEdgeInsetsInsetRect(view.bounds, view.contentInsets); - XCTAssert(view.label.center.x == CGRectGetMidX(contentRect)); - XCTAssert(view.iconImageView.center.x == CGRectGetMidX(contentRect)); - CGFloat contentSpan = CGRectGetMaxY(view.label.frame) - CGRectGetMinY(view.iconImageView.frame); - XCTAssertEqualWithAccuracy(CGRectGetMinY(view.iconImageView.frame) + contentSpan / 2, - CGRectGetMidY(contentRect), (CGFloat)0.001); -} - - (void)testSetSelectedItemTintColorUpdatesInkColor { // Given MDCBottomNavigationItemView *item1 = [[MDCBottomNavigationItemView alloc] init]; diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentLTR_11_2@2x.png deleted file mode 100644 index 6257f799e5b..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentLTR_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentRTL_11_2@2x.png deleted file mode 100644 index 2a4b06170e9..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsAdjacentRTL_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentLTR_11_2@2x.png deleted file mode 100644 index 3a6d5017ea2..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentLTR_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentRTL_11_2@2x.png deleted file mode 100644 index 616c140805a..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopAdjacentRTL_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedLTR_11_2@2x.png deleted file mode 100644 index 123357bc96c..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedLTR_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedRTL_11_2@2x.png deleted file mode 100644 index 6543752bfc0..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsNoopStackedRTL_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedLTR_11_2@2x.png deleted file mode 100644 index 4569261ae4d..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedLTR_11_2@2x.png and /dev/null differ diff --git a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedRTL_11_2@2x.png deleted file mode 100644 index 448b2c6840a..00000000000 Binary files a/snapshot_test_goldens/goldens_64/MDCBottomNavigationItemViewSnapshotTests/testContentInsetsStackedRTL_11_2@2x.png and /dev/null differ