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

Side by Side Diff: ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm

Issue 2912863005: Use MDCTypography instead of MDFRobotoFontLoader directly. (Closed)
Patch Set: Tentative fix for ManualTextFramerTest 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/first_run/welcome_to_chrome_view.h" 5 #import "ios/chrome/browser/ui/first_run/welcome_to_chrome_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #import "ios/chrome/browser/ui/UIView+SizeClassSupport.h" 10 #import "ios/chrome/browser/ui/UIView+SizeClassSupport.h"
11 #include "ios/chrome/browser/ui/fancy_ui/primary_action_button.h" 11 #include "ios/chrome/browser/ui/fancy_ui/primary_action_button.h"
12 #include "ios/chrome/browser/ui/first_run/first_run_util.h" 12 #include "ios/chrome/browser/ui/first_run/first_run_util.h"
13 #include "ios/chrome/browser/ui/ui_util.h" 13 #include "ios/chrome/browser/ui/ui_util.h"
14 #import "ios/chrome/browser/ui/uikit_ui_util.h" 14 #import "ios/chrome/browser/ui/uikit_ui_util.h"
15 #import "ios/chrome/browser/ui/util/CRUILabel+AttributeUtils.h" 15 #import "ios/chrome/browser/ui/util/CRUILabel+AttributeUtils.h"
16 #import "ios/chrome/browser/ui/util/label_link_controller.h" 16 #import "ios/chrome/browser/ui/util/label_link_controller.h"
17 #import "ios/chrome/browser/ui/util/label_observer.h" 17 #import "ios/chrome/browser/ui/util/label_observer.h"
18 #include "ios/chrome/common/string_util.h" 18 #include "ios/chrome/common/string_util.h"
19 #include "ios/chrome/grit/ios_chromium_strings.h" 19 #include "ios/chrome/grit/ios_chromium_strings.h"
20 #include "ios/chrome/grit/ios_strings.h" 20 #include "ios/chrome/grit/ios_strings.h"
21 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 21 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 #if !defined(__has_feature) || !__has_feature(objc_arc) 25 #if !defined(__has_feature) || !__has_feature(objc_arc)
26 #error "This file requires ARC support." 26 #error "This file requires ARC support."
27 #endif 27 #endif
28 28
29 namespace { 29 namespace {
30 30
31 // Accessibility identifier for the checkbox button. 31 // Accessibility identifier for the checkbox button.
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 [self configureContainerView]; 478 [self configureContainerView];
479 [self configureTitleLabel]; 479 [self configureTitleLabel];
480 [self configureImageView]; 480 [self configureImageView];
481 [self configureTOSLabel]; 481 [self configureTOSLabel];
482 [self configureOptInLabel]; 482 [self configureOptInLabel];
483 [self configureOKButton]; 483 [self configureOKButton];
484 [self setNeedsLayout]; 484 [self setNeedsLayout];
485 } 485 }
486 486
487 - (void)configureTitleLabel { 487 - (void)configureTitleLabel {
488 self.titleLabel.font = [[MDFRobotoFontLoader sharedInstance] 488 self.titleLabel.font = [[MDCTypography fontLoader]
489 regularFontOfSize:kTitleLabelFontSize[self.cr_widthSizeClass]]; 489 regularFontOfSize:kTitleLabelFontSize[self.cr_widthSizeClass]];
490 } 490 }
491 491
492 - (void)configureImageView { 492 - (void)configureImageView {
493 CGFloat sideLength = self.imageView.image.size.width; 493 CGFloat sideLength = self.imageView.image.size.width;
494 if (self.cr_widthSizeClass == COMPACT) { 494 if (self.cr_widthSizeClass == COMPACT) {
495 sideLength = self.bounds.size.width * kAppLogoProportionMultiplier; 495 sideLength = self.bounds.size.width * kAppLogoProportionMultiplier;
496 } else if (self.cr_heightSizeClass == COMPACT) { 496 } else if (self.cr_heightSizeClass == COMPACT) {
497 sideLength = self.bounds.size.height * kAppLogoProportionMultiplier; 497 sideLength = self.bounds.size.height * kAppLogoProportionMultiplier;
498 } 498 }
499 self.imageView.bounds = AlignRectOriginAndSizeToPixels( 499 self.imageView.bounds = AlignRectOriginAndSizeToPixels(
500 CGRectMake(self.imageView.bounds.origin.x, self.imageView.bounds.origin.y, 500 CGRectMake(self.imageView.bounds.origin.x, self.imageView.bounds.origin.y,
501 sideLength, sideLength)); 501 sideLength, sideLength));
502 } 502 }
503 503
504 - (void)configureTOSLabel { 504 - (void)configureTOSLabel {
505 self.TOSLabel.font = [[MDFRobotoFontLoader sharedInstance] 505 self.TOSLabel.font = [[MDCTypography fontLoader]
506 regularFontOfSize:kTOSLabelFontSize[self.cr_widthSizeClass]]; 506 regularFontOfSize:kTOSLabelFontSize[self.cr_widthSizeClass]];
507 self.TOSLabel.cr_lineHeight = kTOSLabelLineHeight[self.cr_widthSizeClass]; 507 self.TOSLabel.cr_lineHeight = kTOSLabelLineHeight[self.cr_widthSizeClass];
508 } 508 }
509 509
510 - (void)configureOptInLabel { 510 - (void)configureOptInLabel {
511 self.optInLabel.font = [[MDFRobotoFontLoader sharedInstance] 511 self.optInLabel.font = [[MDCTypography fontLoader]
512 regularFontOfSize:kOptInLabelFontSize[self.cr_widthSizeClass]]; 512 regularFontOfSize:kOptInLabelFontSize[self.cr_widthSizeClass]];
513 self.optInLabel.cr_lineHeight = kOptInLabelLineHeight[self.cr_widthSizeClass]; 513 self.optInLabel.cr_lineHeight = kOptInLabelLineHeight[self.cr_widthSizeClass];
514 } 514 }
515 515
516 - (void)configureContainerView { 516 - (void)configureContainerView {
517 CGFloat containerViewWidth = 517 CGFloat containerViewWidth =
518 self.cr_widthSizeClass == COMPACT 518 self.cr_widthSizeClass == COMPACT
519 ? kContainerViewCompactWidthPercentage * CGRectGetWidth(self.bounds) 519 ? kContainerViewCompactWidthPercentage * CGRectGetWidth(self.bounds)
520 : kContainerViewRegularWidth; 520 : kContainerViewRegularWidth;
521 self.containerView.frame = 521 self.containerView.frame =
522 CGRectMake(0.0, 0.0, containerViewWidth, CGFLOAT_MAX); 522 CGRectMake(0.0, 0.0, containerViewWidth, CGFLOAT_MAX);
523 } 523 }
524 524
525 - (void)configureOKButton { 525 - (void)configureOKButton {
526 self.OKButton.titleLabel.font = [[MDFRobotoFontLoader sharedInstance] 526 self.OKButton.titleLabel.font = [[MDCTypography fontLoader]
527 mediumFontOfSize:kOKButtonTitleLabelFontSize[self.cr_widthSizeClass]]; 527 mediumFontOfSize:kOKButtonTitleLabelFontSize[self.cr_widthSizeClass]];
528 CGSize size = [self.OKButton 528 CGSize size = [self.OKButton
529 sizeThatFits:CGSizeMake(CGFLOAT_MAX, 529 sizeThatFits:CGSizeMake(CGFLOAT_MAX,
530 kOKButtonHeight[self.cr_widthSizeClass])]; 530 kOKButtonHeight[self.cr_widthSizeClass])];
531 [self.OKButton setBounds:CGRectMake(0, 0, size.width, 531 [self.OKButton setBounds:CGRectMake(0, 0, size.width,
532 kOKButtonHeight[self.cr_widthSizeClass])]; 532 kOKButtonHeight[self.cr_widthSizeClass])];
533 } 533 }
534 534
535 #pragma mark - 535 #pragma mark -
536 536
537 - (void)checkBoxButtonWasTapped { 537 - (void)checkBoxButtonWasTapped {
538 self.checkBoxButton.selected = !self.checkBoxButton.selected; 538 self.checkBoxButton.selected = !self.checkBoxButton.selected;
539 self.checkBoxButton.accessibilityValue = 539 self.checkBoxButton.accessibilityValue =
540 self.checkBoxButton.selected 540 self.checkBoxButton.selected
541 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) 541 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON)
542 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); 542 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
543 } 543 }
544 544
545 - (void)OKButtonWasTapped { 545 - (void)OKButtonWasTapped {
546 [self.delegate welcomeToChromeViewDidTapOKButton:self]; 546 [self.delegate welcomeToChromeViewDidTapOKButton:self];
547 } 547 }
548 548
549 - (void)TOSLinkWasTapped { 549 - (void)TOSLinkWasTapped {
550 [self.delegate welcomeToChromeViewDidTapTOSLink:self]; 550 [self.delegate welcomeToChromeViewDidTapTOSLink:self];
551 } 551 }
552 552
553 @end 553 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/downloads/download_manager_controller.mm ('k') | ios/chrome/browser/ui/history/favicon_view_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698