Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/ui/suggestions/suggestions_favicon_internal_cell.h" | |
| 6 | |
| 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" | |
| 8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" | |
| 9 | |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 11 #error "This file requires ARC support." | |
| 12 #endif | |
| 13 | |
| 14 namespace { | |
| 15 const CGFloat kFaviconImageSize = 50; | |
| 16 } | |
| 17 | |
| 18 @implementation SuggestionsFaviconInternalCell | |
| 19 | |
| 20 @synthesize faviconView = _faviconView; | |
| 21 @synthesize title = _title; | |
| 22 | |
| 23 - (instancetype)initWithFrame:(CGRect)frame { | |
| 24 self = [super initWithFrame:frame]; | |
| 25 if (self) { | |
| 26 _faviconView = [[UIImageView alloc] init]; | |
| 27 _title = [[UILabel alloc] init]; | |
| 28 _title.numberOfLines = 2; | |
| 29 _title.font = [[MDFRobotoFontLoader sharedInstance] lightFontOfSize:10]; | |
|
lpromero
2017/01/18 09:34:38
It is not available via MDCTypography?
gambard
2017/01/18 12:37:57
Done.
It is but showcase does not load the roboto
lpromero
2017/01/18 15:10:42
https://codereview.chromium.org/2646483002/.
| |
| 30 _title.textAlignment = NSTextAlignmentCenter; | |
| 31 | |
| 32 [self.contentView addSubview:_faviconView]; | |
| 33 [self.contentView addSubview:_title]; | |
| 34 _faviconView.translatesAutoresizingMaskIntoConstraints = NO; | |
| 35 _title.translatesAutoresizingMaskIntoConstraints = NO; | |
| 36 | |
| 37 ApplyVisualConstraints(@[ @"V:|-[image]-[title]-|" ], | |
| 38 @{ @"image" : _faviconView, | |
| 39 @"title" : _title }); | |
| 40 | |
| 41 [NSLayoutConstraint activateConstraints:@[ | |
| 42 [_title.centerXAnchor | |
| 43 constraintEqualToAnchor:self.contentView.centerXAnchor], | |
|
lpromero
2017/01/18 09:34:38
Since you set the leading and trailing for the tit
gambard
2017/01/18 12:37:57
Done.
| |
| 44 [_faviconView.centerXAnchor | |
| 45 constraintEqualToAnchor:self.contentView.centerXAnchor], | |
| 46 [_title.leadingAnchor | |
| 47 constraintEqualToAnchor:self.contentView.leadingAnchor], | |
| 48 [_title.trailingAnchor | |
| 49 constraintEqualToAnchor:self.contentView.trailingAnchor], | |
| 50 [_faviconView.widthAnchor constraintEqualToConstant:kFaviconImageSize], | |
| 51 [_faviconView.heightAnchor | |
| 52 constraintEqualToAnchor:_faviconView.widthAnchor], | |
| 53 ]]; | |
| 54 } | |
| 55 return self; | |
| 56 } | |
| 57 | |
| 58 + (NSString*)reuseIdentifier { | |
| 59 return @"faviconInternalCell"; | |
| 60 } | |
| 61 | |
| 62 @end | |
| OLD | NEW |