Commit a68c3e66 authored by David Black's avatar David Black Committed by Commit Bot

Change font for Assistant.

See bug for additional details.

Bug: b:110416447
Change-Id: Id5323c5040e1b32326a8caa8d06a41749f0d92fa
Reviewed-on: https://chromium-review.googlesource.com/1151714
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578499}
parent ecb28473
......@@ -126,7 +126,6 @@ component("ash") {
"assistant/ui/assistant_main_view.h",
"assistant/ui/assistant_mini_view.cc",
"assistant/ui/assistant_mini_view.h",
"assistant/ui/assistant_ui_constants.h",
"assistant/ui/assistant_web_view.cc",
"assistant/ui/assistant_web_view.h",
"assistant/ui/caption_bar.cc",
......@@ -1329,6 +1328,7 @@ component("ash") {
]
deps = [
"//ash/app_menu",
"//ash/assistant/ui:constants",
"//ash/autoclick/common:autoclick",
"//ash/components/autoclick/public/mojom",
"//ash/components/cursor",
......
......@@ -99,6 +99,7 @@ component("app_list") {
deps = [
"//ash/app_list/resources",
"//ash/app_menu",
"//ash/assistant/ui:constants",
"//ash/public/cpp/app_list/vector_icons",
"//base",
"//base:i18n",
......
......@@ -6,6 +6,7 @@
#include <memory>
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/gfx/canvas.h"
......@@ -27,7 +28,7 @@ namespace {
constexpr SkColor kAssistantBackgroundColor = SK_ColorWHITE;
constexpr SkColor kAssistantStrokeColor =
SkColorSetA(gfx::kGoogleGrey900, 0x24);
constexpr SkColor kAssistantTextColor = gfx::kGoogleGrey900;
constexpr SkColor kAssistantTextColor = gfx::kGoogleGrey700;
constexpr int kAssistantStrokeWidthDip = 1;
// App list specific style:
......@@ -114,8 +115,9 @@ void SuggestionChipView::InitLayout(const Params& params) {
text_view_->SetAutoColorReadabilityEnabled(false);
text_view_->SetEnabledColor(assistant_style_ ? kAssistantTextColor
: kAppListTextColor);
text_view_->SetFontList(assistant_style_
? text_view_->font_list().DeriveWithSizeDelta(2)
text_view_->SetFontList(
assistant_style_
? ash::assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(2)
: AppListConfig::instance().app_title_font());
text_view_->SetText(params.text);
AddChildView(text_view_);
......
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
assert(is_chromeos)
source_set("constants") {
sources = [
"assistant_ui_constants.cc",
"assistant_ui_constants.h",
]
deps = [
"//base",
"//skia",
"//ui/gfx",
]
}
......@@ -77,7 +77,7 @@ void AssistantMiniView::InitLayout() {
// Label.
label_->SetAutoColorReadabilityEnabled(false);
label_->SetFontList(
views::Label::GetDefaultFontList().DeriveWithSizeDelta(4));
assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(4));
label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
AddChildView(label_);
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "base/no_destructor.h"
#include "ui/gfx/font_list.h"
namespace ash {
namespace assistant {
namespace ui {
const gfx::FontList& GetDefaultFontList() {
static const base::NoDestructor<gfx::FontList> font_list("Google Sans, 12px");
return *font_list;
}
} // namespace ui
} // namespace assistant
} // namespace ash
\ No newline at end of file
......@@ -8,6 +8,10 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_palette.h"
namespace gfx {
class FontList;
} // namespace gfx
namespace ash {
// Appearance.
......@@ -21,6 +25,16 @@ constexpr SkColor kTextColorHint = gfx::kGoogleGrey500;
constexpr SkColor kTextColorPrimary = gfx::kGoogleGrey900;
constexpr SkColor kTextColorSecondary = gfx::kGoogleGrey700;
// TODO(dmblack): Move the other constants into ash::assistant::ui.
namespace assistant {
namespace ui {
// Returns the default font list for Assistant UI.
const gfx::FontList& GetDefaultFontList();
} // namespace ui
} // namespace assistant
} // namespace ash
#endif // ASH_ASSISTANT_UI_ASSISTANT_UI_CONSTANTS_H_
......@@ -154,7 +154,7 @@ void DialogPlate::InitKeyboardLayoutContainer(
views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_CENTER);
gfx::FontList font_list =
views::Textfield::GetDefaultFontList().DeriveWithSizeDelta(4);
assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(4);
// Textfield.
textfield_ = new views::Textfield();
......
......@@ -84,7 +84,7 @@ void AssistantHeaderView::InitLayout() {
greeting_label_->SetAutoColorReadabilityEnabled(false);
greeting_label_->SetEnabledColor(kTextColorPrimary);
greeting_label_->SetFontList(
views::Label::GetDefaultFontList()
assistant::ui::GetDefaultFontList()
.DeriveWithSizeDelta(8)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM));
greeting_label_->SetHorizontalAlignment(
......
......@@ -9,7 +9,6 @@
#include "ash/assistant/model/assistant_query.h"
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
namespace ash {
......@@ -23,7 +22,8 @@ constexpr int kMinHeightDip = 32;
views::StyledLabel::RangeStyleInfo CreateStyleInfo(SkColor color) {
views::StyledLabel::RangeStyleInfo style;
style.custom_font = views::Label::GetDefaultFontList().DeriveWithSizeDelta(2);
style.custom_font =
assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(2);
style.override_color = color;
return style;
}
......
......@@ -17,7 +17,7 @@ AssistantTextElementView::AssistantTextElementView(
: views::Label(base::UTF8ToUTF16(text_element->text())) {
SetAutoColorReadabilityEnabled(false);
SetEnabledColor(kTextColorPrimary);
SetFontList(views::Label::GetDefaultFontList()
SetFontList(assistant::ui::GetDefaultFontList()
.DeriveWithSizeDelta(2)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM));
SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
......
......@@ -14,35 +14,35 @@ namespace ash {
namespace assistant {
namespace util {
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), nullptr, nullptr, nullptr,
params);
}
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), std::move(b), nullptr,
nullptr, params);
}
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<::ui::LayerAnimationElement> c,
const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), std::move(b), std::move(c),
nullptr, params);
}
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c,
std::unique_ptr<ui::LayerAnimationElement> d,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<::ui::LayerAnimationElement> c,
std::unique_ptr<::ui::LayerAnimationElement> d,
const LayerAnimationSequenceParams& params) {
ui::LayerAnimationSequence* layer_animation_sequence =
new ui::LayerAnimationSequence();
......@@ -63,32 +63,32 @@ ui::LayerAnimationSequence* CreateLayerAnimationSequence(
return layer_animation_sequence;
}
std::unique_ptr<ui::LayerAnimationElement> CreateOpacityElement(
std::unique_ptr<::ui::LayerAnimationElement> CreateOpacityElement(
float opacity,
const base::TimeDelta& duration,
const gfx::Tween::Type& tween) {
std::unique_ptr<ui::LayerAnimationElement> layer_animation_element =
ui::LayerAnimationElement::CreateOpacityElement(opacity, duration);
std::unique_ptr<::ui::LayerAnimationElement> layer_animation_element =
::ui::LayerAnimationElement::CreateOpacityElement(opacity, duration);
layer_animation_element->set_tween_type(tween);
return layer_animation_element;
}
std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement(
std::unique_ptr<::ui::LayerAnimationElement> CreateTransformElement(
const gfx::Transform& transform,
const base::TimeDelta& duration,
const gfx::Tween::Type& tween) {
std::unique_ptr<ui::LayerAnimationElement> layer_animation_element =
ui::LayerAnimationElement::CreateTransformElement(transform, duration);
std::unique_ptr<::ui::LayerAnimationElement> layer_animation_element =
::ui::LayerAnimationElement::CreateTransformElement(transform, duration);
layer_animation_element->set_tween_type(tween);
return layer_animation_element;
}
void StartLayerAnimationSequencesTogether(
ui::LayerAnimator* layer_animator,
::ui::LayerAnimator* layer_animator,
const std::vector<ui::LayerAnimationSequence*>& layer_animation_sequences,
ui::LayerAnimationObserver* observer) {
::ui::LayerAnimationObserver* observer) {
if (observer) {
for (ui::LayerAnimationSequence* layer_animation_sequence :
for (::ui::LayerAnimationSequence* layer_animation_sequence :
layer_animation_sequences) {
layer_animation_sequence->AddObserver(observer);
}
......
......@@ -34,46 +34,46 @@ struct LayerAnimationSequenceParams {
// Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<::ui::LayerAnimationElement> c,
const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c,
std::unique_ptr<ui::LayerAnimationElement> d,
::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<::ui::LayerAnimationElement> c,
std::unique_ptr<::ui::LayerAnimationElement> d,
const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationElement to animate opacity with the given parameters.
std::unique_ptr<ui::LayerAnimationElement> CreateOpacityElement(
std::unique_ptr<::ui::LayerAnimationElement> CreateOpacityElement(
float opacity,
const base::TimeDelta& duration,
const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR);
// Creates a LayerAnimationElement to animate transform with the given
// parameters.
std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement(
::std::unique_ptr<::ui::LayerAnimationElement> CreateTransformElement(
const gfx::Transform& transform,
const base::TimeDelta& duration,
const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR);
......@@ -82,9 +82,9 @@ std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement(
// |layer_animator|. If an optional |observer| is supplied, it will be added
// to each sequence in the animation set.
void StartLayerAnimationSequencesTogether(
ui::LayerAnimator* layer_animator,
const std::vector<ui::LayerAnimationSequence*>& layer_animation_sequences,
ui::LayerAnimationObserver* observer = nullptr);
::ui::LayerAnimator* layer_animator,
const std::vector<::ui::LayerAnimationSequence*>& layer_animation_sequences,
::ui::LayerAnimationObserver* observer = nullptr);
} // namespace util
} // namespace assistant
......
......@@ -39,7 +39,7 @@ constexpr char kAssistantExploreWebUrl[] =
// TODO(dmblack): Wire up actual Assistant Reminders URL.
constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html,
<html>
<body style="padding:0 32px;">
<body style="font-family:Google Sans,sans-serif;padding:0 32px;">
<h3>Assistant Reminders</h3>
<p>Coming soon. Meanwhile, please use your Android/iOS phone to access reminders.</p>
</body>
......@@ -49,7 +49,7 @@ constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html,
// TODO(dmblack): Wire up actual Assistant Settings URL.
constexpr char kAssistantSettingsWebUrl[] = R"(data:text/html,
<html>
<body style="padding:0 32px;">
<body style="font-family:Google Sans,sans-serif;padding:0 32px;">
<h3>Assistant Settings</h3>
<p>Coming soon. Meanwhile, please use your Android/iOS phone to access settings.</p>
</body>
......
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