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

Side by Side Diff: ios/chrome/browser/ui/ntp/recent_tabs/views/panel_bar_view.mm

Issue 2912863005: Use MDCTypography instead of MDFRobotoFontLoader directly. (Closed)
Patch Set: Revert main_controller Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/ui/ntp/recent_tabs/views/panel_bar_view.h" 5 #include "ios/chrome/browser/ui/ntp/recent_tabs/views/panel_bar_view.h"
6 6
7 #import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h" 7 #import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h"
8 #include "ios/chrome/browser/ui/rtl_geometry.h" 8 #include "ios/chrome/browser/ui/rtl_geometry.h"
9 #include "ios/chrome/browser/ui/ui_util.h" 9 #include "ios/chrome/browser/ui/ui_util.h"
10 #import "ios/chrome/browser/ui/uikit_ui_util.h" 10 #import "ios/chrome/browser/ui/uikit_ui_util.h"
11 #include "ios/chrome/grit/ios_strings.h" 11 #include "ios/chrome/grit/ios_strings.h"
12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
13 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h"
14 #include "ui/base/l10n/l10n_util_mac.h" 13 #include "ui/base/l10n/l10n_util_mac.h"
15 14
16 #if !defined(__has_feature) || !__has_feature(objc_arc) 15 #if !defined(__has_feature) || !__has_feature(objc_arc)
17 #error "This file requires ARC support." 16 #error "This file requires ARC support."
18 #endif 17 #endif
19 18
20 namespace { 19 namespace {
21 20
22 const int kBackgroundColor = 0xf2f2f2; 21 const int kBackgroundColor = 0xf2f2f2;
23 const CGFloat kFontSize = 20;
24 22
25 } // namespace 23 } // namespace
26 24
27 @interface PanelBarView () { 25 @interface PanelBarView () {
28 UIButton* _closeButton; 26 UIButton* _closeButton;
29 NSLayoutConstraint* _statusBarSpacerConstraint; 27 NSLayoutConstraint* _statusBarSpacerConstraint;
30 } 28 }
31 // Whether the panel view extends throughout the whole screen. For example, 29 // Whether the panel view extends throughout the whole screen. For example,
32 // when presented fullscreen, the panel bar extends to the borders of the app 30 // when presented fullscreen, the panel bar extends to the borders of the app
33 // and the function returns YES. 31 // and the function returns YES.
34 // When presented modally as on iPad and iPhone 6 Plus landscape, it returns NO. 32 // When presented modally as on iPad and iPhone 6 Plus landscape, it returns NO.
35 - (BOOL)coversFullAppWidth; 33 - (BOOL)coversFullAppWidth;
36 @end 34 @end
37 35
38 @implementation PanelBarView 36 @implementation PanelBarView
39 37
40 - (instancetype)init { 38 - (instancetype)init {
41 self = [super initWithFrame:CGRectZero]; 39 self = [super initWithFrame:CGRectZero];
42 if (self) { 40 if (self) {
43 [self setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; 41 [self setBackgroundColor:UIColorFromRGB(kBackgroundColor)];
44 // Create and add the bar's title. 42 // Create and add the bar's title.
45 UILabel* title = [[UILabel alloc] initWithFrame:CGRectZero]; 43 UILabel* title = [[UILabel alloc] initWithFrame:CGRectZero];
46 [title setTranslatesAutoresizingMaskIntoConstraints:NO]; 44 [title setTranslatesAutoresizingMaskIntoConstraints:NO];
47 [title setFont:[[MDFRobotoFontLoader sharedInstance] 45 [title setFont:[MDCTypography titleFont]];
48 mediumFontOfSize:kFontSize]];
49 [title setTextColor:recent_tabs::GetTextColorGray()]; 46 [title setTextColor:recent_tabs::GetTextColorGray()];
50 [title setTextAlignment:NSTextAlignmentNatural]; 47 [title setTextAlignment:NSTextAlignmentNatural];
51 [title setText:l10n_util::GetNSString(IDS_IOS_NEW_TAB_RECENT_TABS)]; 48 [title setText:l10n_util::GetNSString(IDS_IOS_NEW_TAB_RECENT_TABS)];
52 [title setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; 49 [title setBackgroundColor:UIColorFromRGB(kBackgroundColor)];
53 [self addSubview:title]; 50 [self addSubview:title];
54 51
55 // Create and add the bar's close button. 52 // Create and add the bar's close button.
56 _closeButton = [[UIButton alloc] initWithFrame:CGRectZero]; 53 _closeButton = [[UIButton alloc] initWithFrame:CGRectZero];
57 [_closeButton setTranslatesAutoresizingMaskIntoConstraints:NO]; 54 [_closeButton setTranslatesAutoresizingMaskIntoConstraints:NO];
58 [_closeButton 55 [_closeButton
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 [self setNeedsUpdateConstraints]; 120 [self setNeedsUpdateConstraints];
124 [super layoutSubviews]; 121 [super layoutSubviews];
125 } 122 }
126 123
127 - (BOOL)coversFullAppWidth { 124 - (BOOL)coversFullAppWidth {
128 return self.traitCollection.horizontalSizeClass == 125 return self.traitCollection.horizontalSizeClass ==
129 self.window.traitCollection.horizontalSizeClass; 126 self.window.traitCollection.horizontalSizeClass;
130 } 127 }
131 128
132 @end 129 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698