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 { ...@@ -124,7 +124,7 @@ class OnboardingDismissPromptView : public PhoneHubInterstitialView {
public: public:
explicit OnboardingDismissPromptView( explicit OnboardingDismissPromptView(
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker) chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker)
: PhoneHubInterstitialView(/*show_progress=*/false), : PhoneHubInterstitialView(/*show_progress=*/false, /*show_image=*/false),
onboarding_ui_tracker_(onboarding_ui_tracker) { onboarding_ui_tracker_(onboarding_ui_tracker) {
SetID(PhoneHubViewID::kOnboardingDismissPromptView); SetID(PhoneHubViewID::kOnboardingDismissPromptView);
InitLayout(); InitLayout();
......
...@@ -34,7 +34,8 @@ namespace ash { ...@@ -34,7 +34,8 @@ namespace ash {
namespace { namespace {
// Appearance. // Appearance.
constexpr int kImageHeightDip = 256; constexpr gfx::Size kImageSizeDip = {216, 216};
constexpr int kImageRowHeightDip = 256;
constexpr int kButtonSpacingDip = 8; constexpr int kButtonSpacingDip = 8;
constexpr int kButtonContainerTopPaddingDip = 16; constexpr int kButtonContainerTopPaddingDip = 16;
constexpr int kProgressBarHeightDip = 2; constexpr int kProgressBarHeightDip = 2;
...@@ -57,38 +58,8 @@ void AddColumnWithSidePadding(views::GridLayout* layout, int padding, int id) { ...@@ -57,38 +58,8 @@ void AddColumnWithSidePadding(views::GridLayout* layout, int padding, int id) {
} // namespace } // namespace
PhoneHubInterstitialView::PhoneHubInterstitialView(bool show_progress) { PhoneHubInterstitialView::PhoneHubInterstitialView(bool show_progress,
InitLayout(show_progress); bool show_image) {
}
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) {
SetPaintToLayer(); SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
...@@ -119,9 +90,15 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) { ...@@ -119,9 +90,15 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) {
progress_bar_->SetValue(kInfiniteLoadingProgressValue); progress_bar_->SetValue(kInfiniteLoadingProgressValue);
} }
// Set up layout row for the image view. // Set up layout row for the image if any.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId); if (show_image) {
image_ = layout->AddView(std::make_unique<views::ImageView>()); 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. // Set up layout row for the title view, which should be left-aligned.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId); layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId);
...@@ -162,6 +139,32 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) { ...@@ -162,6 +139,32 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) {
kButtonSpacingDip)); 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) BEGIN_METADATA(PhoneHubInterstitialView, views::View)
END_METADATA END_METADATA
......
...@@ -30,7 +30,7 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView { ...@@ -30,7 +30,7 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
public: public:
METADATA_HEADER(PhoneHubInterstitialView); METADATA_HEADER(PhoneHubInterstitialView);
explicit PhoneHubInterstitialView(bool show_progress); explicit PhoneHubInterstitialView(bool show_progress, bool show_image = true);
PhoneHubInterstitialView(const PhoneHubInterstitialView&) = delete; PhoneHubInterstitialView(const PhoneHubInterstitialView&) = delete;
PhoneHubInterstitialView& operator=(const PhoneHubInterstitialView&) = delete; PhoneHubInterstitialView& operator=(const PhoneHubInterstitialView&) = delete;
~PhoneHubInterstitialView() override; ~PhoneHubInterstitialView() override;
...@@ -41,8 +41,6 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView { ...@@ -41,8 +41,6 @@ class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
void AddButton(std::unique_ptr<views::Button> button); void AddButton(std::unique_ptr<views::Button> button);
private: private:
void InitLayout(bool show_progress);
// A progress bar will be shown under the title row if |show_progress| is // A progress bar will be shown under the title row if |show_progress| is
// true. // true.
views::ProgressBar* progress_bar_ = nullptr; 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