Commit f1a39520 authored by Min Chen's avatar Min Chen Committed by Commit Bot

ash: Adjust power menu size and bounds.

new spec:
https://drive.google.com/file/d/1JNH0ZDknXSvV00C7TeT4xT_rFx48OdZd/view

Except this, UX asked to move icons 8px up and text 3px up.

Bug: 826064
Change-Id: Iad0b2df7e396f5563c3f8d6f9858750920561c8a
Reviewed-on: https://chromium-review.googlesource.com/990676
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarQiang Xu <warx@google.com>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547781}
parent ac2b2c65
...@@ -16,6 +16,9 @@ namespace ash { ...@@ -16,6 +16,9 @@ namespace ash {
namespace { namespace {
// Color of the image icon.
constexpr SkColor kItemIconColor = SkColorSetARGBMacro(0xFF, 0x20, 0x21, 0x24);
// Color of the title of the label. // Color of the title of the label.
constexpr SkColor kItemTitleColor = SkColorSetARGBMacro(0xFF, 0x5F, 0x63, 0x68); constexpr SkColor kItemTitleColor = SkColorSetARGBMacro(0xFF, 0x5F, 0x63, 0x68);
...@@ -27,10 +30,10 @@ constexpr int kTitleFontSizeDelta = -1; ...@@ -27,10 +30,10 @@ constexpr int kTitleFontSizeDelta = -1;
constexpr int kIconSize = 24; constexpr int kIconSize = 24;
// Top padding of the image icon to the top of the item view. // Top padding of the image icon to the top of the item view.
constexpr int kIconTopPadding = 24; constexpr int kIconTopPadding = 16;
// Top padding of the label of title to the top of the item view. // Top padding of the label of title to the top of the item view.
constexpr int kTitleTopPadding = 50; constexpr int kTitleTopPadding = 53;
} // namespace } // namespace
...@@ -42,7 +45,7 @@ PowerButtonMenuItemView::PowerButtonMenuItemView( ...@@ -42,7 +45,7 @@ PowerButtonMenuItemView::PowerButtonMenuItemView(
icon_view_(new views::ImageView), icon_view_(new views::ImageView),
title_(new views::Label) { title_(new views::Label) {
SetPaintToLayer(); SetPaintToLayer();
icon_view_->SetImage(gfx::CreateVectorIcon(icon, gfx::kChromeIconGrey)); icon_view_->SetImage(gfx::CreateVectorIcon(icon, kItemIconColor));
AddChildView(icon_view_); AddChildView(icon_view_);
title_->SetBackgroundColor(SK_ColorTRANSPARENT); title_->SetBackgroundColor(SK_ColorTRANSPARENT);
......
...@@ -26,9 +26,9 @@ namespace ash { ...@@ -26,9 +26,9 @@ namespace ash {
class ASH_EXPORT PowerButtonMenuItemView : public views::ImageButton { class ASH_EXPORT PowerButtonMenuItemView : public views::ImageButton {
public: public:
// Height of the menu item in pixels. // Height of the menu item in pixels.
static constexpr int kMenuItemHeight = 96; static constexpr int kMenuItemHeight = 84;
// Width of the menu item in pixels. // Width of the menu item in pixels.
static constexpr int kMenuItemWidth = 96; static constexpr int kMenuItemWidth = 84;
PowerButtonMenuItemView(views::ButtonListener* listener, PowerButtonMenuItemView(views::ButtonListener* listener,
const gfx::VectorIcon& icon, const gfx::VectorIcon& icon,
......
...@@ -28,6 +28,9 @@ constexpr int kMenuItemVerticalPadding = 16; ...@@ -28,6 +28,9 @@ constexpr int kMenuItemVerticalPadding = 16;
// The amount of rounding applied to the corners of the menu view. // The amount of rounding applied to the corners of the menu view.
constexpr int kMenuViewRoundRectRadiusDp = 16; constexpr int kMenuViewRoundRectRadiusDp = 16;
// Horizontal padding between two menu items.
constexpr int kPaddingBetweenMenuItems = 8;
} // namespace } // namespace
using PowerButtonPosition = PowerButtonController::PowerButtonPosition; using PowerButtonPosition = PowerButtonController::PowerButtonPosition;
...@@ -151,7 +154,8 @@ void PowerButtonMenuView::Layout() { ...@@ -151,7 +154,8 @@ void PowerButtonMenuView::Layout() {
sign_out_rect.set_size(sign_out_item_->GetPreferredSize()); sign_out_rect.set_size(sign_out_item_->GetPreferredSize());
sign_out_rect.Offset( sign_out_rect.Offset(
gfx::Vector2d(kMenuItemHorizontalPadding + gfx::Vector2d(kMenuItemHorizontalPadding +
power_off_item_->GetPreferredSize().width(), power_off_item_->GetPreferredSize().width() +
kPaddingBetweenMenuItems,
kMenuItemVerticalPadding)); kMenuItemVerticalPadding));
sign_out_item_->SetBoundsRect(sign_out_rect); sign_out_item_->SetBoundsRect(sign_out_rect);
} }
...@@ -177,7 +181,8 @@ gfx::Size PowerButtonMenuView::CalculatePreferredSize() const { ...@@ -177,7 +181,8 @@ gfx::Size PowerButtonMenuView::CalculatePreferredSize() const {
2 * kMenuItemVerticalPadding); 2 * kMenuItemVerticalPadding);
menu_size.set_width(sign_out_item_ menu_size.set_width(sign_out_item_
? 2 * PowerButtonMenuItemView::kMenuItemWidth + ? 2 * PowerButtonMenuItemView::kMenuItemWidth +
2 * kMenuItemHorizontalPadding 2 * kMenuItemHorizontalPadding +
kPaddingBetweenMenuItems
: PowerButtonMenuItemView::kMenuItemWidth + : PowerButtonMenuItemView::kMenuItemWidth +
2 * kMenuItemHorizontalPadding); 2 * kMenuItemHorizontalPadding);
return menu_size; return menu_size;
......
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