Commit 731d4185 authored by Meilin Wang's avatar Meilin Wang Committed by Commit Bot

ambient: add text shadow.

Bug: b/165829625.
Test: manually.
Change-Id: Iabee17198e1887b7498bb01e45c03a133f0df800
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352518
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800638}
parent cc545be0
...@@ -97,6 +97,7 @@ void AmbientBackgroundImageView::InitLayout() { ...@@ -97,6 +97,7 @@ void AmbientBackgroundImageView::InitLayout() {
details_label_->SetFontList( details_label_->SetFontList(
ambient::util::GetDefaultFontlist().DeriveWithSizeDelta( ambient::util::GetDefaultFontlist().DeriveWithSizeDelta(
kDetailsFontSizeDip - kDefaultFontSizeDip)); kDetailsFontSizeDip - kDefaultFontSizeDip));
details_label_->SetShadows(ambient::util::GetTextShadowValues());
details_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); details_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
details_label_->SetVerticalAlignment(gfx::VerticalAlignment::ALIGN_BOTTOM); details_label_->SetVerticalAlignment(gfx::VerticalAlignment::ALIGN_BOTTOM);
} }
......
...@@ -139,6 +139,7 @@ void GlanceableInfoView::InitLayout() { ...@@ -139,6 +139,7 @@ void GlanceableInfoView::InitLayout() {
time_view_->SetTextFont(GetTimeFontList()); time_view_->SetTextFont(GetTimeFontList());
time_view_->SetTextColor(kTextColor, time_view_->SetTextColor(kTextColor,
/*auto_color_readability_enabled=*/false); /*auto_color_readability_enabled=*/false);
time_view_->SetTextShadowValues(ambient::util::GetTextShadowValues());
// Inits and layouts the weather info. // Inits and layouts the weather info.
weather_info_ = AddChildView(std::make_unique<views::View>()); weather_info_ = AddChildView(std::make_unique<views::View>());
...@@ -166,6 +167,7 @@ void GlanceableInfoView::InitLayout() { ...@@ -166,6 +167,7 @@ void GlanceableInfoView::InitLayout() {
temperature_->SetAutoColorReadabilityEnabled(false); temperature_->SetAutoColorReadabilityEnabled(false);
temperature_->SetEnabledColor(kTextColor); temperature_->SetEnabledColor(kTextColor);
temperature_->SetFontList(GetWeatherTemperatureFontList()); temperature_->SetFontList(GetWeatherTemperatureFontList());
temperature_->SetShadows(ambient::util::GetTextShadowValues());
} }
} // namespace ash } // namespace ash
...@@ -90,6 +90,7 @@ void MediaStringView::InitLayout() { ...@@ -90,6 +90,7 @@ void MediaStringView::InitLayout() {
SetEnabledColor(kTextColor); SetEnabledColor(kTextColor);
SetFontList(ambient::util::GetDefaultFontlist().DeriveWithSizeDelta( SetFontList(ambient::util::GetDefaultFontlist().DeriveWithSizeDelta(
kMediaStringFontSizeDip - kDefaultFontSizeDip)); kMediaStringFontSizeDip - kDefaultFontSizeDip));
SetShadows(ambient::util::GetTextShadowValues());
BindMediaControllerObserver(); BindMediaControllerObserver();
} }
......
...@@ -6,11 +6,18 @@ ...@@ -6,11 +6,18 @@
#include "ash/public/cpp/ambient/ambient_client.h" #include "ash/public/cpp/ambient/ambient_client.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/shadow_value.h"
namespace ash { namespace ash {
namespace ambient { namespace ambient {
namespace util { namespace util {
// Appearance of the text shadow.
constexpr int kTextShadowElevation = 2;
constexpr SkColor kTextShadowColor = gfx::kGoogleGrey800;
bool IsShowing(LockScreen::ScreenType type) { bool IsShowing(LockScreen::ScreenType type) {
return LockScreen::HasInstance() && LockScreen::Get()->screen_type() == type; return LockScreen::HasInstance() && LockScreen::Get()->screen_type() == type;
} }
...@@ -20,6 +27,11 @@ const gfx::FontList& GetDefaultFontlist() { ...@@ -20,6 +27,11 @@ const gfx::FontList& GetDefaultFontlist() {
return *font_list; return *font_list;
} }
gfx::ShadowValues GetTextShadowValues() {
return gfx::ShadowValue::MakeRefreshShadowValues(kTextShadowElevation,
kTextShadowColor);
}
} // namespace util } // namespace util
} // namespace ambient } // namespace ambient
} // namespace ash } // namespace ash
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/login/ui/lock_screen.h" #include "ash/login/ui/lock_screen.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/gfx/shadow_value.h"
namespace ash { namespace ash {
...@@ -20,6 +21,9 @@ ASH_EXPORT bool IsShowing(LockScreen::ScreenType type); ...@@ -20,6 +21,9 @@ ASH_EXPORT bool IsShowing(LockScreen::ScreenType type);
// Returns the default fontlist for Ambient Mode. // Returns the default fontlist for Ambient Mode.
ASH_EXPORT const gfx::FontList& GetDefaultFontlist(); ASH_EXPORT const gfx::FontList& GetDefaultFontlist();
// Returns the default static text shadow for Ambient Mode.
ASH_EXPORT gfx::ShadowValues GetTextShadowValues();
} // namespace util } // namespace util
} // namespace ambient } // namespace ambient
} // namespace ash } // namespace ash
......
...@@ -106,6 +106,13 @@ void TimeView::SetTextFont(const gfx::FontList& font_list) { ...@@ -106,6 +106,13 @@ void TimeView::SetTextFont(const gfx::FontList& font_list) {
vertical_label_minutes_->SetFontList(font_list); vertical_label_minutes_->SetFontList(font_list);
} }
void TimeView::SetTextShadowValues(const gfx::ShadowValues& shadows) {
horizontal_label_->SetShadows(shadows);
vertical_label_hours_->SetShadows(shadows);
vertical_label_minutes_->SetShadows(shadows);
}
void TimeView::OnDateFormatChanged() { void TimeView::OnDateFormatChanged() {
UpdateTimeFormat(); UpdateTimeFormat();
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/session_manager/session_manager_types.h" #include "components/session_manager/session_manager_types.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/gfx/shadow_value.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace base { namespace base {
...@@ -53,6 +54,9 @@ class ASH_EXPORT TimeView : public ActionableView, public ClockObserver { ...@@ -53,6 +54,9 @@ class ASH_EXPORT TimeView : public ActionableView, public ClockObserver {
// Updates the time text fontlist. // Updates the time text fontlist.
void SetTextFont(const gfx::FontList& font_list); void SetTextFont(const gfx::FontList& font_list);
// Updates the time text shadow values.
void SetTextShadowValues(const gfx::ShadowValues& shadows);
// ClockObserver: // ClockObserver:
void OnDateFormatChanged() override; void OnDateFormatChanged() override;
void OnSystemClockTimeUpdated() override; void OnSystemClockTimeUpdated() override;
......
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