Commit 60d3a92e authored by Rob Schonberger's avatar Rob Schonberger Committed by Commit Bot

In Search Result Tile View, Center Rating & Star when there is no price.

This can happen for reinstall candidates, but not for typical play
store candidates. UX from Shibasheikh@ .

Screenshots of before/after:

https://photos.app.goo.gl/sgnKe5pSYTX9AT5P9

Bug: 911427
Change-Id: Ia32be4956f734410b20e8102e755293f4d1b023e
Reviewed-on: https://chromium-review.googlesource.com/c/1469801Reviewed-by: default avatarJenny Zhang <jennyz@chromium.org>
Commit-Queue: Rob Schonberger <robsc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634736}
parent e86ed9b3
...@@ -57,6 +57,13 @@ constexpr int kIconSelectedCornerRadius = 4; ...@@ -57,6 +57,13 @@ constexpr int kIconSelectedCornerRadius = 4;
// Icon selected color, Google Grey 900 8%. // Icon selected color, Google Grey 900 8%.
constexpr int kIconSelectedColor = SkColorSetA(gfx::kGoogleGrey900, 0x14); constexpr int kIconSelectedColor = SkColorSetA(gfx::kGoogleGrey900, 0x14);
// Offset for centering star rating when there is no price.
constexpr int kSearchRatingCenteringOffset =
((kSearchTileWidth -
(kSearchRatingSize + kSearchRatingStarHorizontalSpacing +
kSearchRatingStarSize)) /
2);
constexpr SkColor kSearchTitleColor = gfx::kGoogleGrey900; constexpr SkColor kSearchTitleColor = gfx::kGoogleGrey900;
constexpr SkColor kSearchAppRatingColor = gfx::kGoogleGrey700; constexpr SkColor kSearchAppRatingColor = gfx::kGoogleGrey700;
constexpr SkColor kSearchAppPriceColor = gfx::kGoogleGreen600; constexpr SkColor kSearchAppPriceColor = gfx::kGoogleGreen600;
...@@ -526,9 +533,16 @@ void SearchResultTileItemView::Layout() { ...@@ -526,9 +533,16 @@ void SearchResultTileItemView::Layout() {
rect.set_height(title_->GetPreferredSize().height()); rect.set_height(title_->GetPreferredSize().height());
title_->SetBoundsRect(rect); title_->SetBoundsRect(rect);
// If there is no price set, we center the rating.
const bool center_rating =
rating_ && rating_star_ && price_ && price_->text().empty();
const int rating_horizontal_offset =
center_rating ? kSearchRatingCenteringOffset : 0;
if (rating_) { if (rating_) {
gfx::Rect rating_rect(rect); gfx::Rect rating_rect(rect);
rating_rect.Inset(0, title_->GetPreferredSize().height(), 0, 0); rating_rect.Inset(rating_horizontal_offset,
title_->GetPreferredSize().height(), 0, 0);
rating_rect.set_size(rating_->GetPreferredSize()); rating_rect.set_size(rating_->GetPreferredSize());
rating_rect.set_width(kSearchRatingSize); rating_rect.set_width(kSearchRatingSize);
rating_->SetBoundsRect(rating_rect); rating_->SetBoundsRect(rating_rect);
...@@ -536,11 +550,11 @@ void SearchResultTileItemView::Layout() { ...@@ -536,11 +550,11 @@ void SearchResultTileItemView::Layout() {
if (rating_star_) { if (rating_star_) {
gfx::Rect rating_star_rect(rect); gfx::Rect rating_star_rect(rect);
rating_star_rect.Inset( rating_star_rect.Inset(rating_horizontal_offset + kSearchRatingSize +
kSearchRatingSize + kSearchRatingStarHorizontalSpacing, kSearchRatingStarHorizontalSpacing,
title_->GetPreferredSize().height() + title_->GetPreferredSize().height() +
kSearchRatingStarVerticalSpacing, kSearchRatingStarVerticalSpacing,
0, 0); 0, 0);
rating_star_rect.set_size(rating_star_->GetPreferredSize()); rating_star_rect.set_size(rating_star_->GetPreferredSize());
rating_star_->SetBoundsRect(rating_star_rect); rating_star_->SetBoundsRect(rating_star_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