Commit e675805c authored by Thomas Tellier's avatar Thomas Tellier Committed by Commit Bot

[CrOs] Visual revamp of login/lock screen pin pad

Bug: 1006433
Change-Id: I314c0a76c080a59322c72ee388b4b50a1d88b6bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422943
Commit-Queue: Thomas Tellier <tellier@google.com>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809820}
parent d1029baf
...@@ -4,20 +4,33 @@ ...@@ -4,20 +4,33 @@
#include "ash/login/ui/login_palette.h" #include "ash/login/ui/login_palette.h"
#include "ash/public/cpp/login_constants.h" #include "ash/public/cpp/login_constants.h"
#include "ash/style/ash_color_provider.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
namespace ash { namespace ash {
LoginPalette CreateDefaultLoginPalette() { LoginPalette CreateDefaultLoginPalette() {
auto* color_provider = AshColorProvider::Get();
auto background_color = color_provider->GetBackgroundColor();
const AshColorProvider::RippleAttributes ripple_attributes =
color_provider->GetRippleAttributes(background_color);
// Convert transparency level from [0 ; 1] to [0 ; 255].
U8CPU inkdrop_opacity = 255 * ripple_attributes.inkdrop_opacity;
U8CPU highlight_opacity = 255 * ripple_attributes.highlight_opacity;
return LoginPalette( return LoginPalette(
{.password_text_color = SK_ColorWHITE, {.password_text_color = color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary),
.password_placeholder_text_color = .password_placeholder_text_color =
login_constants::kAuthMethodsTextColor, login_constants::kAuthMethodsTextColor,
.password_background_color = SK_ColorTRANSPARENT, .password_background_color = SK_ColorTRANSPARENT,
.button_enabled_color = login_constants::kButtonEnabledColor, .button_enabled_color = color_provider->GetContentLayerColor(
.pin_ink_drop_highlight_color = SkColorSetA(SK_ColorWHITE, 0x0A), AshColorProvider::ContentLayerType::kIconColorPrimary),
.pin_ink_drop_ripple_color = SkColorSetA(SK_ColorWHITE, 0x0F), .button_annotation_color = color_provider->GetContentLayerColor(
.pin_backspace_icon_color = gfx::kGoogleGrey200}); AshColorProvider::ContentLayerType::kTextColorSecondary),
.pin_ink_drop_highlight_color =
SkColorSetA(ripple_attributes.base_color, highlight_opacity),
.pin_ink_drop_ripple_color =
SkColorSetA(ripple_attributes.base_color, inkdrop_opacity)});
} }
LoginPalette CreateInSessionAuthPalette() { LoginPalette CreateInSessionAuthPalette() {
...@@ -26,9 +39,9 @@ LoginPalette CreateInSessionAuthPalette() { ...@@ -26,9 +39,9 @@ LoginPalette CreateInSessionAuthPalette() {
.password_placeholder_text_color = SK_ColorDKGRAY, .password_placeholder_text_color = SK_ColorDKGRAY,
.password_background_color = SK_ColorTRANSPARENT, .password_background_color = SK_ColorTRANSPARENT,
.button_enabled_color = SK_ColorDKGRAY, .button_enabled_color = SK_ColorDKGRAY,
.button_annotation_color = SK_ColorDKGRAY,
.pin_ink_drop_highlight_color = SkColorSetA(SK_ColorDKGRAY, 0x0A), .pin_ink_drop_highlight_color = SkColorSetA(SK_ColorDKGRAY, 0x0A),
.pin_ink_drop_ripple_color = SkColorSetA(SK_ColorDKGRAY, 0x0F), .pin_ink_drop_ripple_color = SkColorSetA(SK_ColorDKGRAY, 0x0F)});
.pin_backspace_icon_color = SK_ColorDKGRAY});
} }
} // namespace ash } // namespace ash
...@@ -19,9 +19,9 @@ struct LoginPalette { ...@@ -19,9 +19,9 @@ struct LoginPalette {
SkColor password_placeholder_text_color; SkColor password_placeholder_text_color;
SkColor password_background_color; SkColor password_background_color;
SkColor button_enabled_color; SkColor button_enabled_color;
SkColor button_annotation_color;
SkColor pin_ink_drop_highlight_color; SkColor pin_ink_drop_highlight_color;
SkColor pin_ink_drop_ripple_color; SkColor pin_ink_drop_ripple_color;
SkColor pin_backspace_icon_color;
}; };
// For login screen and lock screen. // For login screen and lock screen.
......
...@@ -209,20 +209,19 @@ class DigitPinButton : public BasePinButton { ...@@ -209,20 +209,19 @@ class DigitPinButton : public BasePinButton {
label->SetEnabledColor(palette.button_enabled_color); label->SetEnabledColor(palette.button_enabled_color);
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
label->SetSubpixelRenderingEnabled(false); label->SetSubpixelRenderingEnabled(false);
label->SetFontList(base_font_list.Derive(8, gfx::Font::FontStyle::NORMAL, label->SetFontList(base_font_list.Derive(8 /*size_delta*/, gfx::Font::FontStyle::NORMAL,
gfx::Font::Weight::LIGHT)); gfx::Font::Weight::NORMAL));
AddChildView(label); AddChildView(label);
if (show_sub_label) { if (show_sub_label) {
views::Label* sub_label = new views::Label( views::Label* sub_label = new views::Label(
GetButtonSubLabelForNumber(value), views::style::CONTEXT_BUTTON, GetButtonSubLabelForNumber(value), views::style::CONTEXT_BUTTON,
views::style::STYLE_PRIMARY); views::style::STYLE_SECONDARY);
sub_label->SetEnabledColor(SkColorSetA( sub_label->SetEnabledColor(palette.button_annotation_color);
palette.button_enabled_color, login_constants::kButtonDisabledAlpha));
sub_label->SetAutoColorReadabilityEnabled(false); sub_label->SetAutoColorReadabilityEnabled(false);
sub_label->SetSubpixelRenderingEnabled(false); sub_label->SetSubpixelRenderingEnabled(false);
sub_label->SetFontList(base_font_list.Derive( sub_label->SetFontList(base_font_list.Derive(-1 /*size_delta*/, gfx::Font::FontStyle::NORMAL,
-3, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL)); gfx::Font::Weight::NORMAL));
AddChildView(sub_label); AddChildView(sub_label);
} }
} }
...@@ -249,7 +248,7 @@ class LoginPinView::BackspacePinButton : public BasePinButton { ...@@ -249,7 +248,7 @@ class LoginPinView::BackspacePinButton : public BasePinButton {
palette_(palette) { palette_(palette) {
image_ = new views::ImageView(); image_ = new views::ImageView();
image_->SetImage(gfx::CreateVectorIcon(kLockScreenBackspaceIcon, image_->SetImage(gfx::CreateVectorIcon(kLockScreenBackspaceIcon,
palette_.pin_backspace_icon_color)); palette_.button_enabled_color));
AddChildView(image_); AddChildView(image_);
SetEnabled(false); SetEnabled(false);
} }
...@@ -263,7 +262,7 @@ class LoginPinView::BackspacePinButton : public BasePinButton { ...@@ -263,7 +262,7 @@ class LoginPinView::BackspacePinButton : public BasePinButton {
} }
void OnEnabledChanged() { void OnEnabledChanged() {
SkColor color = palette_.pin_backspace_icon_color; SkColor color = palette_.button_enabled_color;
if (!GetEnabled()) { if (!GetEnabled()) {
AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr);
color = SkColorSetA(color, login_constants::kButtonDisabledAlpha); color = SkColorSetA(color, login_constants::kButtonDisabledAlpha);
......
...@@ -54,9 +54,6 @@ constexpr float kClearBlurSigma = 0.0f; ...@@ -54,9 +54,6 @@ constexpr float kClearBlurSigma = 0.0f;
// show/hide animation. // show/hide animation.
constexpr int kChangeUserAnimationDurationMs = 300; constexpr int kChangeUserAnimationDurationMs = 300;
// Color of enabled buttons.
constexpr SkColor kButtonEnabledColor = SK_ColorWHITE;
// An alpha value for disabled buttons. // An alpha value for disabled buttons.
// In specs this is listed as 34% = 0x57 / 0xFF. // In specs this is listed as 34% = 0x57 / 0xFF.
constexpr SkAlpha kButtonDisabledAlpha = 0x57; constexpr SkAlpha kButtonDisabledAlpha = 0x57;
......
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