OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/reading_list/number_badge_view.h" | 5 #import "ios/chrome/browser/ui/reading_list/number_badge_view.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #import "ios/chrome/common/material_timing.h" | 10 #import "ios/chrome/common/material_timing.h" |
11 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 11 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
12 | 12 |
13 #if !defined(__has_feature) || !__has_feature(objc_arc) | 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
14 #error "This file requires ARC support." | 14 #error "This file requires ARC support." |
15 #endif | 15 #endif |
16 | 16 |
17 namespace { | 17 namespace { |
18 const CGFloat kAnimationDuration = ios::material::kDuration3; | 18 const CGFloat kAnimationDuration = ios::material::kDuration3; |
19 const CGFloat labelMargin = 2.5f; | 19 const CGFloat labelMargin = 2.5f; |
20 } // namespace | 20 } // namespace |
21 | 21 |
(...skipping 17 matching lines...) Expand all Loading... |
39 if (self) { | 39 if (self) { |
40 self.backgroundColor = [UIColor clearColor]; | 40 self.backgroundColor = [UIColor clearColor]; |
41 | 41 |
42 UIView* backgroundCircleView = [[UIView alloc] initWithFrame:CGRectZero]; | 42 UIView* backgroundCircleView = [[UIView alloc] initWithFrame:CGRectZero]; |
43 _backgroundCircleView = backgroundCircleView; | 43 _backgroundCircleView = backgroundCircleView; |
44 [backgroundCircleView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 44 [backgroundCircleView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
45 [self addSubview:backgroundCircleView]; | 45 [self addSubview:backgroundCircleView]; |
46 | 46 |
47 UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; | 47 UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; |
48 _label = label; | 48 _label = label; |
49 [label setFont:[[MDFRobotoFontLoader sharedInstance] boldFontOfSize:10]]; | 49 [label setFont:[[MDCTypography fontLoader] boldFontOfSize:10]]; |
50 [label setTranslatesAutoresizingMaskIntoConstraints:NO]; | 50 [label setTranslatesAutoresizingMaskIntoConstraints:NO]; |
51 [label setTextColor:[UIColor whiteColor]]; | 51 [label setTextColor:[UIColor whiteColor]]; |
52 [self addSubview:label]; | 52 [self addSubview:label]; |
53 | 53 |
54 [NSLayoutConstraint activateConstraints:@[ | 54 [NSLayoutConstraint activateConstraints:@[ |
55 // Position bubble. | 55 // Position bubble. |
56 [backgroundCircleView.trailingAnchor | 56 [backgroundCircleView.trailingAnchor |
57 constraintEqualToAnchor:self.trailingAnchor], | 57 constraintEqualToAnchor:self.trailingAnchor], |
58 [backgroundCircleView.centerYAnchor | 58 [backgroundCircleView.centerYAnchor |
59 constraintEqualToAnchor:self.centerYAnchor], | 59 constraintEqualToAnchor:self.centerYAnchor], |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 animations:^{ | 121 animations:^{ |
122 [self.backgroundCircleView | 122 [self.backgroundCircleView |
123 setBackgroundColor:backgroundColor]; | 123 setBackgroundColor:backgroundColor]; |
124 }]; | 124 }]; |
125 } else { | 125 } else { |
126 [self.backgroundCircleView setBackgroundColor:backgroundColor]; | 126 [self.backgroundCircleView setBackgroundColor:backgroundColor]; |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 @end | 130 @end |
OLD | NEW |