Commit ba3c2e37 authored by calamity's avatar calamity Committed by Commit bot

Update apps grid view layout to match latest mocks.

This CL updates the experimental app list's apps grid view layout to
precisely match mocks. The experimental app list is now 768x570.

BUG=442022

Review URL: https://codereview.chromium.org/898253002

Cr-Commit-Position: refs/heads/master@{#315270}
parent 2ea6dbe3
......@@ -98,8 +98,13 @@ const int kExperimentalPreferredRows = 4;
// Radius of the circle, in which if entered, show re-order preview.
const int kReorderDroppingCircleRadius = 35;
// The padding around the outside of the experimental app list (top and sides).
const int kExperimentalWindowPadding = 24;
// The padding around the outside of the experimental app list apps grid
// (sides).
const int kExperimentalAppsGridPadding = 24;
// The padding around the outside of the experimental app list search box (top
// and sides).
const int kExperimentalSearchBoxPadding = 16;
// Max items allowed in a folder.
size_t kMaxFolderItems = 16;
......
......@@ -69,7 +69,8 @@ APP_LIST_EXPORT extern const int kExperimentalPreferredRows;
APP_LIST_EXPORT extern const int kReorderDroppingCircleRadius;
APP_LIST_EXPORT extern const int kExperimentalWindowPadding;
APP_LIST_EXPORT extern const int kExperimentalAppsGridPadding;
APP_LIST_EXPORT extern const int kExperimentalSearchBoxPadding;
APP_LIST_EXPORT extern size_t kMaxFolderItems;
APP_LIST_EXPORT extern const size_t kNumFolderTopItems;
......
......@@ -39,8 +39,8 @@ namespace app_list {
namespace {
const int kTopPadding = 20;
const int kIconTitleSpacing = 7;
const int kTopPadding = 18;
const int kIconTitleSpacing = 6;
const int kProgressBarHorizontalPadding = 12;
// Radius of the folder dropping preview circle.
......
......@@ -309,8 +309,7 @@ void AppListViewTestContext::RunDisplayTest() {
EXPECT_EQ("576x402", view_->bounds().size().ToString());
break;
case EXPERIMENTAL:
// TODO(calamity): This should be 768x560, to match the most recent mocks.
EXPECT_EQ("768x577", view_->bounds().size().ToString());
EXPECT_EQ("768x570", view_->bounds().size().ToString());
break;
default:
NOTREACHED();
......
......@@ -60,7 +60,7 @@ namespace {
const int kDragBufferPx = 20;
// Padding space in pixels for fixed layout.
const int kBottomPadding = 3;
const int kBottomPadding = 2;
const int kLeftRightPadding = 24;
// Padding space in pixels between pages.
......@@ -70,12 +70,13 @@ const int kPagePadding = 40;
const int kPreferredTileWidth = 88;
const int kPreferredTileHeight = 98;
const int kExperimentalPreferredTileWidth = 90;
const int kExperimentalPreferredTileHeight = 90;
const int kExperimentalPreferredTileWidth = 100;
const int kExperimentalPreferredTileHeight = 100;
// Padding on each side of a tile.
const int kExperimentalTileLeftRightPadding = 15;
const int kExperimentalTileTopBottomPadding = 11;
const int kExperimentalTileLeftRightPadding = 10;
const int kExperimentalTileBottomPadding = 12;
const int kExperimentalTileTopPadding = 6;
// Width in pixels of the area on the sides that triggers a page flip.
const int kPageFlipZoneSize = 40;
......@@ -111,6 +112,16 @@ gfx::Size GetTileViewSize() {
: gfx::Size(kPreferredTileWidth, kPreferredTileHeight);
}
// Returns the padding around a tile view.
gfx::Insets GetTilePadding() {
if (!switches::IsExperimentalAppListEnabled())
return gfx::Insets();
return gfx::Insets(
-kExperimentalTileLeftRightPadding, -kExperimentalTileTopPadding,
-kExperimentalTileLeftRightPadding, -kExperimentalTileBottomPadding);
}
// RowMoveAnimationDelegate is used when moving an item into a different row.
// Before running the animation, the item's layer is re-created and kept in
// the original position, then the item is moved to just before its target
......@@ -407,7 +418,7 @@ void AppsGridView::SetLayout(int cols, int rows_per_page) {
if (switches::IsExperimentalAppListEnabled()) {
SetBorder(views::Border::CreateEmptyBorder(
0, kExperimentalWindowPadding, 0, kExperimentalWindowPadding));
0, kExperimentalAppsGridPadding, 0, kExperimentalAppsGridPadding));
} else {
SetBorder(views::Border::CreateEmptyBorder(
0, kLeftRightPadding, kBottomPadding, kLeftRightPadding));
......@@ -419,7 +430,7 @@ gfx::Size AppsGridView::GetTotalTileSize() {
gfx::Size size = GetTileViewSize();
if (switches::IsExperimentalAppListEnabled()) {
size.Enlarge(2 * kExperimentalTileLeftRightPadding,
2 * kExperimentalTileTopBottomPadding);
kExperimentalTileBottomPadding);
}
return size;
}
......@@ -2120,9 +2131,7 @@ AppsGridView::Index AppsGridView::GetNearestTileIndexForPoint(
gfx::Size AppsGridView::GetTileGridSize() const {
gfx::Rect bounds = GetExpectedTileBounds(0, 0);
bounds.Union(GetExpectedTileBounds(rows_per_page_ - 1, cols_ - 1));
if (switches::IsExperimentalAppListEnabled())
bounds.Inset(-kExperimentalTileLeftRightPadding,
-kExperimentalTileTopBottomPadding);
bounds.Inset(GetTilePadding());
return bounds.size();
}
......@@ -2136,7 +2145,7 @@ gfx::Rect AppsGridView::GetExpectedTileBounds(int row, int col) const {
gfx::Rect tile_bounds(gfx::Point(bounds.x() + col * total_tile_size.width(),
bounds.y() + row * total_tile_size.height()),
total_tile_size);
tile_bounds.ClampToCenteredSize(GetTileViewSize());
tile_bounds.Inset(-GetTilePadding());
return tile_bounds;
}
......
......@@ -356,8 +356,8 @@ gfx::Rect ContentsView::GetDefaultSearchBoxBounds() const {
gfx::Rect search_box_bounds(0, 0, GetDefaultContentsSize().width(),
GetSearchBoxView()->GetPreferredSize().height());
if (switches::IsExperimentalAppListEnabled()) {
search_box_bounds.set_y(kExperimentalWindowPadding);
search_box_bounds.Inset(kExperimentalWindowPadding, 0);
search_box_bounds.set_y(kExperimentalSearchBoxPadding);
search_box_bounds.Inset(kExperimentalSearchBoxPadding, 0);
}
return search_box_bounds;
}
......
......@@ -201,7 +201,7 @@ void FolderHeaderView::OnPaint(gfx::Canvas* canvas) {
// Draw bottom separator line.
int horizontal_padding = app_list::switches::IsExperimentalAppListEnabled()
? kExperimentalWindowPadding
? kExperimentalAppsGridPadding
: kBottomSeparatorPadding;
rect.Inset(horizontal_padding, 0);
rect.set_y(rect.bottom() - kBottomSeparatorHeight);
......
......@@ -20,7 +20,7 @@ namespace app_list {
namespace {
const int kPreferredHeight = 57;
const int kPreferredHeight = 58;
const int kMaxButtonSpacing = 18;
const int kMinButtonSpacing = 4;
......
......@@ -51,8 +51,8 @@ SearchResultPageView::SearchResultPageView() : selected_index_(0) {
gfx::ShadowValue shadow = GetShadowForZHeight(1);
scoped_ptr<views::Border> border(new views::ShadowBorder(shadow));
gfx::Insets insets = gfx::Insets(kTopPadding, kExperimentalWindowPadding, 0,
kExperimentalWindowPadding);
gfx::Insets insets = gfx::Insets(kTopPadding, kExperimentalSearchBoxPadding,
0, kExperimentalSearchBoxPadding);
insets += -border->GetInsets();
views::BoxLayout* layout =
......
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