Commit ffecec38 authored by Meilin Wang's avatar Meilin Wang Committed by Commit Bot

[CrOS PhoneHub] Update assets for interstitial views.

Updates assets to finalized images.

Fixed: 1146563
Bug: 1106937

Change-Id: I6a1f1ccf26f187832a1a7128e96f7d4f1ccb683c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533410Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827125}
parent c7a54ab0
......@@ -124,7 +124,7 @@ class OnboardingDismissPromptView : public PhoneHubInterstitialView {
public:
explicit OnboardingDismissPromptView(
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker)
: PhoneHubInterstitialView(/*show_progress=*/false),
: PhoneHubInterstitialView(/*show_progress=*/false, /*show_image=*/false),
onboarding_ui_tracker_(onboarding_ui_tracker) {
SetID(PhoneHubViewID::kOnboardingDismissPromptView);
InitLayout();
......
......@@ -34,7 +34,8 @@ namespace ash {
namespace {
// Appearance.
constexpr int kImageHeightDip = 256;
constexpr gfx::Size kImageSizeDip = {216, 216};
constexpr int kImageRowHeightDip = 256;
constexpr int kButtonSpacingDip = 8;
constexpr int kButtonContainerTopPaddingDip = 16;
constexpr int kProgressBarHeightDip = 2;
......@@ -57,38 +58,8 @@ void AddColumnWithSidePadding(views::GridLayout* layout, int padding, int id) {
} // namespace
PhoneHubInterstitialView::PhoneHubInterstitialView(bool show_progress) {
InitLayout(show_progress);
}
PhoneHubInterstitialView::~PhoneHubInterstitialView() = default;
void PhoneHubInterstitialView::SetImage(const gfx::ImageSkia& image) {
// Expect a non-empty string for the title.
DCHECK(!image.isNull());
image_->SetImage(image);
image_->SetImageSize(gfx::Size(
kTrayMenuWidth - 2 * kBubbleHorizontalSidePaddingDip, kImageHeightDip));
}
void PhoneHubInterstitialView::SetTitle(const base::string16& title) {
// Expect a non-empty string for the title.
DCHECK(!title.empty());
title_->SetText(title);
}
void PhoneHubInterstitialView::SetDescription(const base::string16& desc) {
// Expect a non-empty string for the description.
DCHECK(!desc.empty());
description_->SetText(desc);
}
void PhoneHubInterstitialView::AddButton(
std::unique_ptr<views::Button> button) {
button_container_->AddChildView(std::move(button));
}
void PhoneHubInterstitialView::InitLayout(bool show_progress) {
PhoneHubInterstitialView::PhoneHubInterstitialView(bool show_progress,
bool show_image) {
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
......@@ -119,9 +90,15 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) {
progress_bar_->SetValue(kInfiniteLoadingProgressValue);
}
// Set up layout row for the image view.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId);
image_ = layout->AddView(std::make_unique<views::ImageView>());
// Set up layout row for the image if any.
if (show_image) {
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId,
kImageRowHeightDip);
image_ =
layout->AddView(std::make_unique<views::ImageView>(), 1, 1,
views::GridLayout::CENTER, views::GridLayout::CENTER);
image_->SetImageSize(kImageSizeDip);
}
// Set up layout row for the title view, which should be left-aligned.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId);
......@@ -162,6 +139,32 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) {
kButtonSpacingDip));
}
PhoneHubInterstitialView::~PhoneHubInterstitialView() = default;
void PhoneHubInterstitialView::SetImage(const gfx::ImageSkia& image) {
// Expect an initialized |image_| view and a non-empty image.
DCHECK(image_);
DCHECK(!image.isNull());
image_->SetImage(image);
}
void PhoneHubInterstitialView::SetTitle(const base::string16& title) {
// Expect a non-empty string for the title.
DCHECK(!title.empty());
title_->SetText(title);
}
void PhoneHubInterstitialView::SetDescription(const base::string16& desc) {
// Expect a non-empty string for the description.
DCHECK(!desc.empty());
description_->SetText(desc);
}
void PhoneHubInterstitialView::AddButton(
std::unique_ptr<views::Button> button) {
button_container_->AddChildView(std::move(button));
}
BEGIN_METADATA(PhoneHubInterstitialView, views::View)
END_METADATA
......
......@@ -30,7 +30,7 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
public:
METADATA_HEADER(PhoneHubInterstitialView);
explicit PhoneHubInterstitialView(bool show_progress);
explicit PhoneHubInterstitialView(bool show_progress, bool show_image = true);
PhoneHubInterstitialView(const PhoneHubInterstitialView&) = delete;
PhoneHubInterstitialView& operator=(const PhoneHubInterstitialView&) = delete;
~PhoneHubInterstitialView() override;
......@@ -41,8 +41,6 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
void AddButton(std::unique_ptr<views::Button> button);
private:
void InitLayout(bool show_progress);
// A progress bar will be shown under the title row if |show_progress| is
// true.
views::ProgressBar* progress_bar_ = nullptr;
......
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