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