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

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: address nits 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') | no next file with comments »
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 029ee3a0276ba6f18ce4b9d02151155eceb7433c..4aa83d37d0fa7b1f9214e2f9b4549d667d4c0f73 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_controller.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/tray_constants.h"
@@ -43,6 +44,12 @@ 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 kVerticalClockMinutesTopOffsetMD = -2;
+
+// Leading padding used to draw the tray background to the left of the clock
+// when the shelf is horizontally aligned, and on the top when the shelf is
+// vertically aligned.
+const int kClockLeadingPadding = 8;
base::string16 FormatDate(const base::Time& time) {
icu::UnicodeString date_string;
@@ -288,6 +295,7 @@ void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) {
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
AddChildView(horizontal_label_.get());
} else {
+ const bool is_material_design = MaterialDesignController::IsShelfMaterial();
RemoveChildView(horizontal_label_.get());
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
@@ -296,23 +304,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 ? kClockLeadingPadding
+ : 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) +
+ kVerticalClockMinutesTopOffsetMD
+ : 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 ? kClockLeadingPadding
+ : 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 {
SetBorder(views::Border::NullBorder());
+ }
}
void TimeView::SetupLabels() {
@@ -326,7 +347,10 @@ void TimeView::SetupLabels() {
vertical_label_minutes_->SetEnabledColor(kVerticalClockMinuteColor);
// Pull the minutes up closer to the hours by using a negative top border.
vertical_label_minutes_->SetBorder(views::Border::CreateEmptyBorder(
- kVerticalClockMinutesTopOffset, 0, 0, 0));
+ MaterialDesignController::IsShelfMaterial()
+ ? kVerticalClockMinutesTopOffsetMD
+ : kVerticalClockMinutesTopOffset,
+ 0, 0, 0));
}
void TimeView::SetupLabel(views::Label* label) {
« no previous file with comments | « no previous file | ash/common/system/tray/tray_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698