Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: ash/common/system/date/date_view.cc

Issue 2390003002: [Chrome OS MD] Update spacing between material design icons in the system tray (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/common/system/tray/tray_constants.h » ('j') | ash/common/system/tray/tray_constants.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/date/date_view.cc
diff --git a/ash/common/system/date/date_view.cc b/ash/common/system/date/date_view.cc
index 716a61fea402fb205d3b736313df776cada84e19..6850f414c4ce98a9d6b791e30e6fc2cf1b2a1bb1 100644
--- a/ash/common/system/date/date_view.cc
+++ b/ash/common/system/date/date_view.cc
@@ -4,6 +4,7 @@
#include "ash/common/system/date/date_view.h"
+#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
@@ -41,7 +42,10 @@ const int kVerticalClockLeftPadding = 9;
// Offset used to bring the minutes line closer to the hours line in the
// vertical clock.
-const int kVerticalClockMinutesTopOffset = -4;
+const int kVerticalClockMinutesTopOffset = -2;
tdanderson 2016/10/05 21:34:29 This constant is used on line 346 which can be exe
yiyix 2016/10/05 22:46:47 You are right. I forget about the non-md path.
+
+// Padding used to draw the tray background around the clock.
+const int kClockOnTrayBackgroundPadding = 8;
tdanderson 2016/10/05 21:34:28 Since this is only used for a vertical shelf, can
yiyix 2016/10/05 22:46:47 It is used for both horizontal and vertical aligne
base::string16 FormatDate(const base::Time& time) {
icu::UnicodeString date_string;
@@ -287,6 +291,7 @@ void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) {
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
AddChildView(horizontal_label_.get());
} else {
+ bool is_material_design = MaterialDesignController::IsShelfMaterial();
tdanderson 2016/10/05 21:34:28 nit: const
yiyix 2016/10/05 22:46:47 Done.
RemoveChildView(horizontal_label_.get());
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
@@ -295,23 +300,36 @@ void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) {
columns->AddPaddingColumn(0, kVerticalClockLeftPadding);
columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
0, views::GridLayout::USE_PREF, 0, 0);
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
+ layout->AddPaddingRow(
+ 0, is_material_design ? kClockOnTrayBackgroundPadding
+ : kTrayLabelItemVerticalPaddingVerticalAlignment);
layout->StartRow(0, kColumnId);
layout->AddView(vertical_label_hours_.get());
layout->StartRow(0, kColumnId);
layout->AddView(vertical_label_minutes_.get());
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
+ layout->AddPaddingRow(0,
+ is_material_design
+ ? GetTrayConstant(TRAY_IMAGE_ITEM_PADDING) +
+ kVerticalClockMinutesTopOffset
+ : kTrayLabelItemVerticalPaddingVerticalAlignment);
}
Layout();
}
void TimeView::SetBorderFromLayout(TrayDate::ClockLayout clock_layout) {
- if (clock_layout == TrayDate::HORIZONTAL_CLOCK)
- SetBorder(views::Border::CreateEmptyBorder(
- 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0,
- kTrayLabelItemHorizontalPaddingBottomAlignment));
- else
+ if (clock_layout == TrayDate::HORIZONTAL_CLOCK) {
+ bool is_material_design = MaterialDesignController::IsShelfMaterial();
+ const int time_view_left_padding =
+ is_material_design ? kClockOnTrayBackgroundPadding
+ : kTrayLabelItemHorizontalPaddingBottomAlignment;
+ const int time_view_right_padding =
+ is_material_design ? GetTrayConstant(TRAY_IMAGE_ITEM_PADDING)
+ : kTrayLabelItemHorizontalPaddingBottomAlignment;
+ SetBorder(views::Border::CreateEmptyBorder(0, time_view_left_padding, 0,
+ time_view_right_padding));
+ } else {
tdanderson 2016/10/05 21:34:28 Thanks for adding the {} !
yiyix 2016/10/05 22:46:47 :)
SetBorder(views::Border::NullBorder());
+ }
}
void TimeView::SetupLabels() {
« no previous file with comments | « no previous file | ash/common/system/tray/tray_constants.h » ('j') | ash/common/system/tray/tray_constants.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698