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

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

Issue 2455183002: Simplify layout of tray items and fix spacing for MD. (Closed)
Patch Set: more fixes 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 | « ash/common/system/chromeos/power/tray_power.cc ('k') | ash/common/system/date/tray_date.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 ad21c9146a45d487293692233650239102e62449..107ffb220ce0265a032cb5b456f0e782b73b20a4 100644
--- a/ash/common/system/date/date_view.cc
+++ b/ash/common/system/date/date_view.cc
@@ -19,9 +19,11 @@
#include "third_party/icu/source/i18n/unicode/smpdtfmt.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
+#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/widget/widget.h"
@@ -45,7 +47,6 @@ const int kVerticalClockLeftPadding = 9;
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
tdanderson 2016/10/27 23:58:41 Looks like you deleted some of this comment by mis
Evan Stade 2016/10/28 18:07:49 Done.
// vertically aligned.
const int kClockLeadingPadding = 8;
@@ -290,9 +291,8 @@ void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) {
if (clock_layout == TrayDate::HORIZONTAL_CLOCK) {
RemoveChildView(vertical_label_hours_.get());
RemoveChildView(vertical_label_minutes_.get());
- SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
AddChildView(horizontal_label_.get());
+ SetLayoutManager(new views::FillLayout());
} else {
const bool is_material_design = MaterialDesignController::IsShelfMaterial();
RemoveChildView(horizontal_label_.get());
@@ -320,16 +320,11 @@ void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) {
}
void TimeView::SetBorderFromLayout(TrayDate::ClockLayout clock_layout) {
- 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));
+ if (!MaterialDesignController::IsShelfMaterial() &&
+ clock_layout == TrayDate::HORIZONTAL_CLOCK) {
+ SetBorder(views::Border::CreateEmptyBorder(
+ 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0,
+ kTrayLabelItemHorizontalPaddingBottomAlignment));
} else {
SetBorder(views::Border::NullBorder());
tdanderson 2016/10/27 23:58:41 Double-checking: this will set a null border if MD
Evan Stade 2016/10/28 18:07:49 It's not harmful, but I guess it's not really nece
}
« no previous file with comments | « ash/common/system/chromeos/power/tray_power.cc ('k') | ash/common/system/date/tray_date.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698