Commit 6f5f9ae0 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Rename some constants in lock_contents_view.cc

Bug: 719015
Change-Id: I464db646324b3ff9da3ecb203b36f82b8edc81ae
Reviewed-on: https://chromium-review.googlesource.com/563977Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486920}
parent e2cc88c0
...@@ -19,22 +19,28 @@ namespace ash { ...@@ -19,22 +19,28 @@ namespace ash {
namespace { namespace {
// Any non-zero value used for separator height. Makes debugging easier. // Any non-zero value used for separator height. Makes debugging easier; this
// should not affect visual appearance.
constexpr int kNonEmptyHeightDp = 30; constexpr int kNonEmptyHeightDp = 30;
// Horizontal distance between the two users in the two-user layout. // Horizontal distance between two users in the low density layout.
constexpr int kDistanceBetweenUsersInTwoUserModeDp = 118; constexpr int kLowDensityDistanceBetweenUsersDp = 118;
// Margin left of the auth user in the small layout. // Margin left of the auth user in the medium density layout.
constexpr int kSmallMarginLeftOfAuthUserDp = 98; constexpr int kMediumDensityMarginLeftOfAuthUserDp = 98;
// The horizontal distance between the auth user and the small user row.
constexpr int kSmallDistanceBetweenAuthUserAndUsersDp = 220; // Horizontal distance between the auth user and the medium density user row.
// The vertical padding between each entry in the small user row constexpr int kMediumDensityDistanceBetweenAuthUserAndUsersDp = 220;
constexpr int kSmallVerticalDistanceBetweenUsersDp = 53;
// The horizontal padding left of and right of the extra-small user list. // Vertical padding between each entry in the medium density user row
constexpr int kExtraSmallHorizontalPaddingLeftOfRightOfUserListDp = 72; constexpr int kMediumDensityVerticalDistanceBetweenUsersDp = 53;
// Horizontal padding left and right of the high density user list.
constexpr int kHighDensityHorizontalPaddingLeftOfUserListDp = 72;
constexpr int kHighDensityHorizontalPaddingRightOfUserListDp = 72;
// The vertical padding between each entry in the extra-small user row // The vertical padding between each entry in the extra-small user row
constexpr int kExtraSmallVerticalDistanceBetweenUsersDp = 32; constexpr int kHighDensityVerticalDistanceBetweenUsersDp = 32;
// Duration (in milliseconds) of the auth user view animation, ie, when enabling // Duration (in milliseconds) of the auth user view animation, ie, when enabling
// or disabling the PIN keyboard. // or disabling the PIN keyboard.
...@@ -149,7 +155,7 @@ void LockContentsView::CreateLowDensityLayout( ...@@ -149,7 +155,7 @@ void LockContentsView::CreateLowDensityLayout(
const std::vector<ash::mojom::UserInfoPtr>& users) { const std::vector<ash::mojom::UserInfoPtr>& users) {
// Space between auth user and alternative user. // Space between auth user and alternative user.
AddChildView(MakePreferredSizeView( AddChildView(MakePreferredSizeView(
gfx::Size(kDistanceBetweenUsersInTwoUserModeDp, 30))); gfx::Size(kLowDensityDistanceBetweenUsersDp, kNonEmptyHeightDp)));
auto* alt_user_view = auto* alt_user_view =
new LoginUserView(LoginDisplayStyle::kLarge, false /*show_dropdown*/); new LoginUserView(LoginDisplayStyle::kLarge, false /*show_dropdown*/);
alt_user_view->UpdateForUser(users[1]); alt_user_view->UpdateForUser(users[1]);
...@@ -159,19 +165,20 @@ void LockContentsView::CreateLowDensityLayout( ...@@ -159,19 +165,20 @@ void LockContentsView::CreateLowDensityLayout(
void LockContentsView::CreateMediumDensityLayout( void LockContentsView::CreateMediumDensityLayout(
const std::vector<ash::mojom::UserInfoPtr>& users) { const std::vector<ash::mojom::UserInfoPtr>& users) {
// Insert spacing before auth and also between the auth and user list. // Insert spacing before (left of) auth.
AddChildViewAt(MakePreferredSizeView(gfx::Size(kSmallMarginLeftOfAuthUserDp, AddChildViewAt(MakePreferredSizeView(gfx::Size(
kNonEmptyHeightDp)), kMediumDensityMarginLeftOfAuthUserDp, kNonEmptyHeightDp)),
0); 0);
AddChildView(MakePreferredSizeView( // Insert spacing between auth and user list.
gfx::Size(kSmallDistanceBetweenAuthUserAndUsersDp, kNonEmptyHeightDp))); AddChildView(MakePreferredSizeView(gfx::Size(
kMediumDensityDistanceBetweenAuthUserAndUsersDp, kNonEmptyHeightDp)));
// Add additional users. // Add additional users.
auto* row = new views::View(); auto* row = new views::View();
AddChildView(row); AddChildView(row);
auto* layout = auto* layout =
new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(),
kSmallVerticalDistanceBetweenUsersDp); kMediumDensityVerticalDistanceBetweenUsersDp);
row->SetLayoutManager(layout); row->SetLayoutManager(layout);
for (std::size_t i = 1u; i < users.size(); ++i) { for (std::size_t i = 1u; i < users.size(); ++i) {
auto* view = auto* view =
...@@ -196,12 +203,15 @@ void LockContentsView::CreateHighDensityLayout( ...@@ -196,12 +203,15 @@ void LockContentsView::CreateHighDensityLayout(
AddChildView(fill); AddChildView(fill);
layout->SetFlexForView(fill, 1); layout->SetFlexForView(fill, 1);
// Add additional users. // Padding left of user list.
AddChildView(MakePreferredSizeView(gfx::Size(
kHighDensityHorizontalPaddingLeftOfUserListDp, kNonEmptyHeightDp)));
// Add user list.
auto* row = new views::View(); auto* row = new views::View();
auto* row_layout = new views::BoxLayout( auto* row_layout =
views::BoxLayout::kVertical, new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(),
gfx::Insets(kExtraSmallHorizontalPaddingLeftOfRightOfUserListDp, 0), kHighDensityVerticalDistanceBetweenUsersDp);
kExtraSmallVerticalDistanceBetweenUsersDp);
row_layout->set_minimum_cross_axis_size( row_layout->set_minimum_cross_axis_size(
LoginUserView::WidthForLayoutStyle(LoginDisplayStyle::kExtraSmall)); LoginUserView::WidthForLayoutStyle(LoginDisplayStyle::kExtraSmall));
row->SetLayoutManager(row_layout); row->SetLayoutManager(row_layout);
...@@ -217,6 +227,10 @@ void LockContentsView::CreateHighDensityLayout( ...@@ -217,6 +227,10 @@ void LockContentsView::CreateHighDensityLayout(
scroller_->SetContents(row); scroller_->SetContents(row);
scroller_->ClipHeightTo(size().height(), size().height()); scroller_->ClipHeightTo(size().height(), size().height());
AddChildView(scroller_); AddChildView(scroller_);
// Padding right of user list.
AddChildView(MakePreferredSizeView(gfx::Size(
kHighDensityHorizontalPaddingRightOfUserListDp, kNonEmptyHeightDp)));
} }
LockContentsView::UserState* LockContentsView::FindStateForUser( LockContentsView::UserState* LockContentsView::FindStateForUser(
......
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