Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm

Issue 2880803002: [ios clean] Toolbar UI improvements. (Closed)
Patch Set: Creates ToolbarConstants file Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
index a0fe3b0593da0fca168f317be91ed19062384509..076c0ab39c4998fd8abbd73f48adfcfc74a048a9 100644
--- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
+++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
@@ -12,6 +12,11 @@
#error "This file requires ARC support."
#endif
+namespace {
+// ToolbarButton fixed width.
+CGFloat kToolbarButtonWidth = 42.0f;
+} // namespace
+
@implementation ToolbarButton (Factory)
#pragma mark - ToolbarButton Setup
@@ -26,6 +31,8 @@
imageForDisabledState:
NativeReversableImage(
IDR_IOS_TOOLBAR_LIGHT_BACK_DISABLED, YES)];
+ [backButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return backButton;
}
@@ -40,21 +47,33 @@
imageForDisabledState:
NativeReversableImage(
IDR_IOS_TOOLBAR_LIGHT_FORWARD_DISABLED, YES)];
+ [forwardButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return forwardButton;
}
+ (instancetype)tabSwitcherStripToolbarButton {
- return [self toolbarButtonWithImageForNormalState:
- [UIImage imageNamed:@"tabswitcher_open_tabs"]
- imageForHighlightedState:nil
- imageForDisabledState:nil];
+ ToolbarButton* tabSwitcherStripButton =
+ [self toolbarButtonWithImageForNormalState:
+ [UIImage imageNamed:@"tabswitcher_open_tabs"]
+ imageForHighlightedState:nil
+ imageForDisabledState:nil];
+ [tabSwitcherStripButton.widthAnchor
+ constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
+ return tabSwitcherStripButton;
}
+ (instancetype)tabSwitcherGridToolbarButton {
- return [self toolbarButtonWithImageForNormalState:
- [UIImage imageNamed:@"tabswitcher_tab_switcher_button"]
- imageForHighlightedState:nil
- imageForDisabledState:nil];
+ ToolbarButton* tabSwitcherGridButton =
+ [self toolbarButtonWithImageForNormalState:
+ [UIImage imageNamed:@"tabswitcher_tab_switcher_button"]
+ imageForHighlightedState:nil
+ imageForDisabledState:nil];
+ [tabSwitcherGridButton.widthAnchor
+ constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
+ return tabSwitcherGridButton;
}
+ (instancetype)toolsMenuToolbarButton {
@@ -64,6 +83,8 @@
imageForHighlightedState:nil
imageForDisabledState:nil];
[toolsMenuButton setImageEdgeInsets:UIEdgeInsetsMakeDirected(0, -3, 0, 0)];
+ [toolsMenuButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return toolsMenuButton;
}
@@ -75,6 +96,8 @@
NativeImage(IDR_IOS_TOOLBAR_LIGHT_SHARE_PRESSED)
imageForDisabledState:
NativeImage(IDR_IOS_TOOLBAR_LIGHT_SHARE_DISABLED)];
+ [shareButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return shareButton;
}
@@ -89,6 +112,8 @@
imageForDisabledState:
NativeReversableImage(
IDR_IOS_TOOLBAR_LIGHT_RELOAD_DISABLED, YES)];
+ [reloadButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return reloadButton;
}
@@ -100,6 +125,8 @@
NativeImage(IDR_IOS_TOOLBAR_LIGHT_STOP_PRESSED)
imageForDisabledState:
NativeImage(IDR_IOS_TOOLBAR_LIGHT_STOP_DISABLED)];
+ [stopButton.widthAnchor constraintEqualToConstant:kToolbarButtonWidth]
+ .active = YES;
return stopButton;
}
« no previous file with comments | « ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm ('k') | ios/clean/chrome/browser/ui/toolbar/toolbar_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698