| OLD | NEW |
| 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/bookmarks/bookmark_collection_view_background.h" | 5 #include "ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.h" |
| 6 | 6 |
| 7 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 7 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 NSString* const kBookmarkGrayStar = @"bookmark_gray_star_large"; | 14 NSString* const kBookmarkGrayStar = @"bookmark_gray_star_large"; |
| 15 const CGFloat kEmptyBookmarkTextSize = 16.0; | 15 const CGFloat kEmptyBookmarkTextSize = 16.0; |
| 16 // Offset of the image view on top of the text. | 16 // Offset of the image view on top of the text. |
| 17 const CGFloat kImageViewOffsetFromText = 5.0; | 17 const CGFloat kImageViewOffsetFromText = 5.0; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 - (void)setText:(NSString*)text { | 55 - (void)setText:(NSString*)text { |
| 56 self.emptyBookmarksLabel.text = text; | 56 self.emptyBookmarksLabel.text = text; |
| 57 [self setNeedsLayout]; | 57 [self setNeedsLayout]; |
| 58 } | 58 } |
| 59 | 59 |
| 60 #pragma mark - Private | 60 #pragma mark - Private |
| 61 | 61 |
| 62 - (UILabel*)newEmptyBookmarkLabel { | 62 - (UILabel*)newEmptyBookmarkLabel { |
| 63 UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; | 63 UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 64 label.backgroundColor = [UIColor clearColor]; | 64 label.backgroundColor = [UIColor clearColor]; |
| 65 label.font = [[MDFRobotoFontLoader sharedInstance] | 65 label.font = |
| 66 mediumFontOfSize:kEmptyBookmarkTextSize]; | 66 [[MDCTypography fontLoader] mediumFontOfSize:kEmptyBookmarkTextSize]; |
| 67 label.textColor = [UIColor colorWithWhite:0 alpha:110.0 / 255]; | 67 label.textColor = [UIColor colorWithWhite:0 alpha:110.0 / 255]; |
| 68 label.textAlignment = NSTextAlignmentCenter; | 68 label.textAlignment = NSTextAlignmentCenter; |
| 69 return label; | 69 return label; |
| 70 } | 70 } |
| 71 | 71 |
| 72 - (UIImageView*)newBookmarkImageView { | 72 - (UIImageView*)newBookmarkImageView { |
| 73 UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; | 73 UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; |
| 74 imageView.image = [UIImage imageNamed:kBookmarkGrayStar]; | 74 imageView.image = [UIImage imageNamed:kBookmarkGrayStar]; |
| 75 return imageView; | 75 return imageView; |
| 76 } | 76 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 - (CGRect)bookmarkImageViewFrame { | 89 - (CGRect)bookmarkImageViewFrame { |
| 90 const CGRect labelRect = [self emptyBookmarkLabelFrame]; | 90 const CGRect labelRect = [self emptyBookmarkLabelFrame]; |
| 91 const CGSize imageViewSize = self.emptyBookmarksImageView.image.size; | 91 const CGSize imageViewSize = self.emptyBookmarksImageView.image.size; |
| 92 return CGRectMake((CGRectGetWidth(self.bounds) - imageViewSize.width) / 2.0, | 92 return CGRectMake((CGRectGetWidth(self.bounds) - imageViewSize.width) / 2.0, |
| 93 CGRectGetMinY(labelRect) - kImageViewOffsetFromText - | 93 CGRectGetMinY(labelRect) - kImageViewOffsetFromText - |
| 94 imageViewSize.height, | 94 imageViewSize.height, |
| 95 imageViewSize.width, imageViewSize.height); | 95 imageViewSize.width, imageViewSize.height); |
| 96 } | 96 } |
| 97 | 97 |
| 98 @end | 98 @end |
| OLD | NEW |