Commit 8d741357 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Remove static UIColor initialization

Bug: none
Change-Id: Ie47a2e52ec4fa0ce82c0b794c8bc92259dd6899a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117113
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752833}
parent 16483da2
...@@ -68,10 +68,9 @@ const CGFloat kSelectionAnimationScale = 26; ...@@ -68,10 +68,9 @@ const CGFloat kSelectionAnimationScale = 26;
// The duration of the animations played when the threshold is met. // The duration of the animations played when the threshold is met.
const CGFloat kSelectionAnimationDuration = 0.5; const CGFloat kSelectionAnimationDuration = 0.5;
UIColor* const kPageBackgroundColor = [UIColor colorNamed:kBackgroundColor]; UIColor* SelectionCircleColor() {
UIColor* const kSelectionCircleColor = return [UIColor colorNamed:kTextfieldBackgroundColor];
[UIColor colorNamed:kTextfieldBackgroundColor]; }
UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor];
} }
@interface SideSwipeNavigationView () { @interface SideSwipeNavigationView () {
...@@ -107,14 +106,14 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor]; ...@@ -107,14 +106,14 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor];
image:(UIImage*)image { image:(UIImage*)image {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.backgroundColor = kPageBackgroundColor; self.backgroundColor = [UIColor colorNamed:kBackgroundColor];
_canNavigate = canNavigate; _canNavigate = canNavigate;
if (canNavigate) { if (canNavigate) {
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
const CGRect imageSize = CGRectMake(0, 0, 24, 24); const CGRect imageSize = CGRectMake(0, 0, 24, 24);
_arrowView = [[UIImageView alloc] initWithImage:image]; _arrowView = [[UIImageView alloc] initWithImage:image];
_arrowView.tintColor = kArrowColor; _arrowView.tintColor = [UIColor colorNamed:kToolbarButtonColor];
_selectionCircleLayer = [self newSelectionCircleLayer]; _selectionCircleLayer = [self newSelectionCircleLayer];
[_arrowView setFrame:imageSize]; [_arrowView setFrame:imageSize];
} }
...@@ -167,7 +166,7 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor]; ...@@ -167,7 +166,7 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor];
if ([self.traitCollection if ([self.traitCollection
hasDifferentColorAppearanceComparedToTraitCollection: hasDifferentColorAppearanceComparedToTraitCollection:
previousTraitCollection]) { previousTraitCollection]) {
_selectionCircleLayer.fillColor = kSelectionCircleColor.CGColor; _selectionCircleLayer.fillColor = SelectionCircleColor().CGColor;
} }
} }
} }
...@@ -243,7 +242,7 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor]; ...@@ -243,7 +242,7 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor];
[_selectionCircleLayer removeAnimationForKey:@"transform"]; [_selectionCircleLayer removeAnimationForKey:@"transform"];
[_selectionCircleLayer setOpacity:0]; [_selectionCircleLayer setOpacity:0];
[_arrowView setAlpha:0]; [_arrowView setAlpha:0];
self.backgroundColor = kSelectionCircleColor; self.backgroundColor = SelectionCircleColor();
block(); block();
}]; }];
...@@ -426,11 +425,11 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor]; ...@@ -426,11 +425,11 @@ UIColor* const kArrowColor = [UIColor colorNamed:kToolbarButtonColor];
selectionCircleLayer.bounds = bounds; selectionCircleLayer.bounds = bounds;
selectionCircleLayer.backgroundColor = UIColor.clearColor.CGColor; selectionCircleLayer.backgroundColor = UIColor.clearColor.CGColor;
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
UIColor* resolvedColor = [kSelectionCircleColor UIColor* resolvedColor = [SelectionCircleColor()
resolvedColorWithTraitCollection:self.traitCollection]; resolvedColorWithTraitCollection:self.traitCollection];
selectionCircleLayer.fillColor = resolvedColor.CGColor; selectionCircleLayer.fillColor = resolvedColor.CGColor;
} else { } else {
selectionCircleLayer.fillColor = kSelectionCircleColor.CGColor; selectionCircleLayer.fillColor = SelectionCircleColor().CGColor;
} }
selectionCircleLayer.opacity = 0; selectionCircleLayer.opacity = 0;
selectionCircleLayer.transform = selectionCircleLayer.transform =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment