Commit 001698f7 authored by Jiaquan He's avatar Jiaquan He Committed by Commit Bot

Realign rating and price labels for Play Store results.

Currently rating and price labels seem to belong to neighbor items.
This commit changes the alignment as the new spec shows to fix this issue.

Bug: 757603
Change-Id: Id05320ee6bf6a9856c9540b0b9e39915cfc0b790
Reviewed-on: https://chromium-review.googlesource.com/627122Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jiaquan He <hejq@google.com>
Cr-Commit-Position: refs/heads/master@{#496512}
parent b1435685
......@@ -25,6 +25,8 @@ namespace {
constexpr int kSearchTileWidth = 80;
constexpr int kSearchTileTopPadding = 4;
constexpr int kSearchTitleSpacing = 6;
constexpr int kSearchPriceSize = 37;
constexpr int kSearchRatingSize = 26;
constexpr int kSearchRatingStarSize = 12;
constexpr int kSearchRatingStarHorizontalSpacing = 1;
constexpr int kSearchRatingStarVerticalSpacing = 2;
......@@ -62,7 +64,7 @@ SearchResultTileItemView::SearchResultTileItemView(
rating_ = new views::Label;
rating_->SetEnabledColor(kSearchAppRatingColor);
rating_->SetFontList(base_font);
rating_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
rating_->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
rating_->SetVisible(false);
AddChildView(rating_);
......@@ -77,7 +79,7 @@ SearchResultTileItemView::SearchResultTileItemView(
price_ = new views::Label;
price_->SetEnabledColor(kSearchAppPriceColor);
price_->SetFontList(base_font);
price_->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
price_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
price_->SetVisible(false);
AddChildView(price_);
}
......@@ -305,23 +307,24 @@ void SearchResultTileItemView::Layout() {
gfx::Rect rating_rect(rect);
rating_rect.Inset(0, title()->GetPreferredSize().height(), 0, 0);
rating_rect.set_size(rating_->GetPreferredSize());
rating_rect.set_width(kSearchRatingSize);
rating_->SetBoundsRect(rating_rect);
}
if (rating_star_) {
gfx::Rect rating_star_rect(rect);
rating_star_rect.Inset(rating_->GetPreferredSize().width() +
kSearchRatingStarHorizontalSpacing,
title()->GetPreferredSize().height() +
kSearchRatingStarVerticalSpacing,
0, 0);
rating_star_rect.Inset(
kSearchRatingSize + kSearchRatingStarHorizontalSpacing,
title()->GetPreferredSize().height() +
kSearchRatingStarVerticalSpacing,
0, 0);
rating_star_rect.set_size(rating_star_->GetPreferredSize());
rating_star_->SetBoundsRect(rating_star_rect);
}
if (price_) {
gfx::Rect price_rect(rect);
price_rect.Inset(rect.width() - price_->GetPreferredSize().width(),
price_rect.Inset(rect.width() - kSearchPriceSize,
title()->GetPreferredSize().height(), 0, 0);
price_rect.set_size(price_->GetPreferredSize());
price_->SetBoundsRect(price_rect);
......
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