Commit a0c84543 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][DarkMode] Update autofill cells to support dark mode

Use dynamic colors instead of static ones.

Bug: 976675, 991209
Change-Id: I5750a55eb00de7ae510c9561c7bace2f1fac63c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1749089
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686446}
parent 38ce7176
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
#import "ios/chrome/browser/ui/autofill/cells/cvc_item.h" #import "ios/chrome/browser/ui/autofill/cells/cvc_item.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -110,7 +109,7 @@ const CGFloat kDateTextFieldWidth = 40; ...@@ -110,7 +109,7 @@ const CGFloat kDateTextFieldWidth = 40;
_instructionsTextLabel = [[UILabel alloc] init]; _instructionsTextLabel = [[UILabel alloc] init];
_instructionsTextLabel.font = _instructionsTextLabel.font =
[[MDCTypography fontLoader] mediumFontOfSize:14]; [[MDCTypography fontLoader] mediumFontOfSize:14];
_instructionsTextLabel.textColor = [[MDCPalette greyPalette] tint500]; _instructionsTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
_instructionsTextLabel.numberOfLines = 0; _instructionsTextLabel.numberOfLines = 0;
_instructionsTextLabel.lineBreakMode = NSLineBreakByWordWrapping; _instructionsTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
_instructionsTextLabel.translatesAutoresizingMaskIntoConstraints = NO; _instructionsTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -118,7 +117,7 @@ const CGFloat kDateTextFieldWidth = 40; ...@@ -118,7 +117,7 @@ const CGFloat kDateTextFieldWidth = 40;
_errorLabel = [[UILabel alloc] init]; _errorLabel = [[UILabel alloc] init];
_errorLabel.font = [[MDCTypography fontLoader] regularFontOfSize:12]; _errorLabel.font = [[MDCTypography fontLoader] regularFontOfSize:12];
_errorLabel.textColor = [[MDCPalette cr_redPalette] tint500]; _errorLabel.textColor = [UIColor colorNamed:kRedColor];
_errorLabel.numberOfLines = 0; _errorLabel.numberOfLines = 0;
_errorLabel.lineBreakMode = NSLineBreakByWordWrapping; _errorLabel.lineBreakMode = NSLineBreakByWordWrapping;
_errorLabel.translatesAutoresizingMaskIntoConstraints = NO; _errorLabel.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -157,6 +156,7 @@ const CGFloat kDateTextFieldWidth = 40; ...@@ -157,6 +156,7 @@ const CGFloat kDateTextFieldWidth = 40;
[contentView addSubview:_CVCContainerView]; [contentView addSubview:_CVCContainerView];
_CVCInput = ios::GetChromeBrowserProvider()->CreateStyledTextField(); _CVCInput = ios::GetChromeBrowserProvider()->CreateStyledTextField();
_CVCInput.textColor = [UIColor colorNamed:kTextPrimaryColor];
_CVCInput.placeholder = _CVCInput.placeholder =
l10n_util::GetNSString(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC); l10n_util::GetNSString(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC);
_CVCInput.accessibilityIdentifier = @"CVC_textField"; _CVCInput.accessibilityIdentifier = @"CVC_textField";
...@@ -175,7 +175,7 @@ const CGFloat kDateTextFieldWidth = 40; ...@@ -175,7 +175,7 @@ const CGFloat kDateTextFieldWidth = 40;
[_buttonForNewCard [_buttonForNewCard
setTitle:l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_NEW_CARD_LINK) setTitle:l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_NEW_CARD_LINK)
forState:UIControlStateNormal]; forState:UIControlStateNormal];
[_buttonForNewCard setTitleColor:[[MDCPalette cr_bluePalette] tint500] [_buttonForNewCard setTitleColor:[UIColor colorNamed:kBlueColor]
forState:UIControlStateNormal]; forState:UIControlStateNormal];
_buttonForNewCard.translatesAutoresizingMaskIntoConstraints = NO; _buttonForNewCard.translatesAutoresizingMaskIntoConstraints = NO;
[contentView addSubview:_buttonForNewCard]; [contentView addSubview:_buttonForNewCard];
......
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
#import "ios/chrome/browser/ui/autofill/cells/legacy_autofill_edit_item.h" #import "ios/chrome/browser/ui/autofill/cells/legacy_autofill_edit_item.h"
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h" #include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/util/rtl_geometry.h" #import "ios/chrome/browser/ui/util/rtl_geometry.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -79,8 +78,8 @@ const CGFloat kLabelAndFieldGap = 5; ...@@ -79,8 +78,8 @@ const CGFloat kLabelAndFieldGap = 5;
} }
cell.textField.enabled = self.textFieldEnabled; cell.textField.enabled = self.textFieldEnabled;
cell.textField.textColor = self.textFieldEnabled cell.textField.textColor = self.textFieldEnabled
? [[MDCPalette cr_bluePalette] tint500] ? [UIColor colorNamed:kBlueColor]
: [[MDCPalette greyPalette] tint500]; : [UIColor colorNamed:kTextSecondaryColor];
[cell.textField addTarget:self [cell.textField addTarget:self
action:@selector(textFieldChanged:) action:@selector(textFieldChanged:)
forControlEvents:UIControlEventEditingChanged]; forControlEvents:UIControlEventEditingChanged];
...@@ -182,11 +181,11 @@ const CGFloat kLabelAndFieldGap = 5; ...@@ -182,11 +181,11 @@ const CGFloat kLabelAndFieldGap = 5;
} else { } else {
MaybeSetUILabelScaledFont(withFontScaling, self.textLabel, MaybeSetUILabelScaledFont(withFontScaling, self.textLabel,
[[MDCTypography fontLoader] mediumFontOfSize:14]); [[MDCTypography fontLoader] mediumFontOfSize:14]);
self.textLabel.textColor = [[MDCPalette greyPalette] tint900]; self.textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
MaybeSetUITextFieldScaledFont( MaybeSetUITextFieldScaledFont(
withFontScaling, self.textField, withFontScaling, self.textField,
[[MDCTypography fontLoader] lightFontOfSize:16]); [[MDCTypography fontLoader] lightFontOfSize:16]);
self.textField.textColor = [[MDCPalette greyPalette] tint500]; self.textField.textColor = [UIColor colorNamed:kTextSecondaryColor];
} }
} }
......
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
#import "ios/chrome/browser/ui/autofill/cells/status_item.h" #import "ios/chrome/browser/ui/autofill/cells/status_item.h"
#include "base/logging.h" #include "base/logging.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/grit/ios_theme_resources.h" #include "ios/chrome/grit/ios_theme_resources.h"
#import "ios/third_party/material_components_ios/src/components/ActivityIndicator/src/MaterialActivityIndicator.h" #import "ios/third_party/material_components_ios/src/components/ActivityIndicator/src/MaterialActivityIndicator.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -66,7 +65,7 @@ const CGFloat kHorizontalPadding = 16; ...@@ -66,7 +65,7 @@ const CGFloat kHorizontalPadding = 16;
[contentView addSubview:verticalCenteringView]; [contentView addSubview:verticalCenteringView];
_activityIndicator = [[MDCActivityIndicator alloc] init]; _activityIndicator = [[MDCActivityIndicator alloc] init];
_activityIndicator.cycleColors = @[ [[MDCPalette cr_bluePalette] tint500] ]; _activityIndicator.cycleColors = @[ [UIColor colorNamed:kBlueColor] ];
[_activityIndicator setRadius:10]; [_activityIndicator setRadius:10];
_activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
[verticalCenteringView addSubview:_activityIndicator]; [verticalCenteringView addSubview:_activityIndicator];
...@@ -169,21 +168,21 @@ const CGFloat kHorizontalPadding = 16; ...@@ -169,21 +168,21 @@ const CGFloat kHorizontalPadding = 16;
- (void)configureForState:(StatusItemState)state { - (void)configureForState:(StatusItemState)state {
switch (state) { switch (state) {
case StatusItemState::VERIFYING: case StatusItemState::VERIFYING:
self.textLabel.textColor = [[MDCPalette cr_bluePalette] tint500]; self.textLabel.textColor = [UIColor colorNamed:kBlueColor];
[self.activityIndicator startAnimating]; [self.activityIndicator startAnimating];
self.activityIndicator.hidden = NO; self.activityIndicator.hidden = NO;
self.verifiedImageView.hidden = YES; self.verifiedImageView.hidden = YES;
self.errorImageView.hidden = YES; self.errorImageView.hidden = YES;
break; break;
case StatusItemState::VERIFIED: case StatusItemState::VERIFIED:
self.textLabel.textColor = [[MDCPalette cr_bluePalette] tint500]; self.textLabel.textColor = [UIColor colorNamed:kBlueColor];
[self.activityIndicator stopAnimating]; [self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES; self.activityIndicator.hidden = YES;
self.verifiedImageView.hidden = NO; self.verifiedImageView.hidden = NO;
self.errorImageView.hidden = YES; self.errorImageView.hidden = YES;
break; break;
case StatusItemState::ERROR: case StatusItemState::ERROR:
self.textLabel.textColor = [[MDCPalette cr_redPalette] tint500]; self.textLabel.textColor = [UIColor colorNamed:kRedColor];
[self.activityIndicator stopAnimating]; [self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES; self.activityIndicator.hidden = YES;
self.verifiedImageView.hidden = YES; self.verifiedImageView.hidden = YES;
......
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