forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AssistantZeroStateView to AssistantMainStage.
Currently AssistantZeroStateView's only child is the pre-existing greeting label. Moving forward, AssistantZeroStateView will conditionally show a richer view in lieu of greeting label. The changes in this CL should not be perceivable to the end user. Bug: b:157510546 Change-Id: I9e813a3d04a9ee9c734c9f5e2ff6913fd18b0ceb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2213925 Commit-Queue: David Black <dmblack@google.com> Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org> Cr-Commit-Position: refs/heads/master@{#772483}
- Loading branch information
David Black
authored and
Commit Bot
committed
May 28, 2020
1 parent
3b4458a
commit 784ed21
Showing
7 changed files
with
144 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2020 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/main_stage/assistant_zero_state_view.h" | ||
|
||
#include <memory> | ||
|
||
#include "ash/assistant/ui/assistant_ui_constants.h" | ||
#include "ash/assistant/ui/assistant_view_ids.h" | ||
#include "ash/strings/grit/ash_strings.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
#include "ui/views/background.h" | ||
#include "ui/views/controls/label.h" | ||
#include "ui/views/layout/fill_layout.h" | ||
|
||
namespace ash { | ||
|
||
AssistantZeroStateView::AssistantZeroStateView() { | ||
SetID(AssistantViewID::kZeroStateView); | ||
InitLayout(); | ||
} | ||
|
||
AssistantZeroStateView::~AssistantZeroStateView() = default; | ||
|
||
const char* AssistantZeroStateView::GetClassName() const { | ||
return "AssistantZeroStateView"; | ||
} | ||
|
||
gfx::Size AssistantZeroStateView::CalculatePreferredSize() const { | ||
return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); | ||
} | ||
|
||
void AssistantZeroStateView::ChildPreferredSizeChanged(views::View* child) { | ||
PreferredSizeChanged(); | ||
} | ||
|
||
void AssistantZeroStateView::InitLayout() { | ||
SetLayoutManager(std::make_unique<views::FillLayout>()); | ||
|
||
// Greeting label. | ||
auto greeting_label = std::make_unique<views::Label>( | ||
l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_PROMPT_DEFAULT)); | ||
greeting_label->SetID(AssistantViewID::kGreetingLabel); | ||
greeting_label->SetAutoColorReadabilityEnabled(false); | ||
greeting_label->SetBackground(views::CreateSolidBackground(SK_ColorWHITE)); | ||
greeting_label->SetEnabledColor(kTextColorPrimary); | ||
greeting_label->SetFontList(assistant::ui::GetDefaultFontList() | ||
.DeriveWithSizeDelta(8) | ||
.DeriveWithWeight(gfx::Font::Weight::MEDIUM)); | ||
greeting_label->SetHorizontalAlignment( | ||
gfx::HorizontalAlignment::ALIGN_CENTER); | ||
greeting_label->SetMultiLine(true); | ||
AddChildView(std::move(greeting_label)); | ||
} | ||
|
||
} // namespace ash |
Oops, something went wrong.