Commit 94bff093 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Adjust the page switcher's position

Changes:
1. Enlarges the width of the AppsGridView to make 24px horizontal
padding for page switcher.
2. In the meanwhile, keeps the AppsGridView horizontally centered by
adding equal space to left and right side.

Specs: https://screenshot.googleplex.com/vdLmFvaJSdR
Screenshot: https://screenshot.googleplex.com/SWec2Jeqhon

BUG=741007

Change-Id: If74cc65099385580b8955825febcd39526a05992
Reviewed-on: https://chromium-review.googlesource.com/578723
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Reviewed-by: default avatarQiang(Joe) Xu <warx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488305}
parent 2a1c24fe
...@@ -122,6 +122,11 @@ const int kReorderDroppingCircleRadius = 35; ...@@ -122,6 +122,11 @@ const int kReorderDroppingCircleRadius = 35;
// The padding around the outside of the apps grid (sides). // The padding around the outside of the apps grid (sides).
const int kAppsGridPadding = 24; const int kAppsGridPadding = 24;
// The left and right side padding of the apps grid in fullscreen mode. The
// space is used for page switcher on the right side. Left side should have the
// same space to keep the apps grid horizontally centered.
const int kAppsGridLeftRightPaddingFullscreen = 28;
// The padding around the outside of the search box (top and sides). // The padding around the outside of the search box (top and sides).
const int kSearchBoxPadding = 16; const int kSearchBoxPadding = 16;
const int kSearchBoxTopPadding = 24; const int kSearchBoxTopPadding = 24;
......
...@@ -93,6 +93,7 @@ APP_LIST_EXPORT extern const size_t kMaxSearchResults; ...@@ -93,6 +93,7 @@ APP_LIST_EXPORT extern const size_t kMaxSearchResults;
APP_LIST_EXPORT extern const int kReorderDroppingCircleRadius; APP_LIST_EXPORT extern const int kReorderDroppingCircleRadius;
APP_LIST_EXPORT extern const int kAppsGridPadding; APP_LIST_EXPORT extern const int kAppsGridPadding;
APP_LIST_EXPORT extern const int kAppsGridLeftRightPaddingFullscreen;
APP_LIST_EXPORT extern const int kSearchBoxPadding; APP_LIST_EXPORT extern const int kSearchBoxPadding;
APP_LIST_EXPORT extern const int kSearchBoxTopPadding; APP_LIST_EXPORT extern const int kSearchBoxTopPadding;
APP_LIST_EXPORT extern const int kSearchBoxBottomPadding; APP_LIST_EXPORT extern const int kSearchBoxBottomPadding;
......
...@@ -663,7 +663,11 @@ bool AppsGridView::IsAnimatingView(AppListItemView* view) { ...@@ -663,7 +663,11 @@ bool AppsGridView::IsAnimatingView(AppListItemView* view) {
gfx::Size AppsGridView::CalculatePreferredSize() const { gfx::Size AppsGridView::CalculatePreferredSize() const {
const gfx::Insets insets(GetInsets()); const gfx::Insets insets(GetInsets());
gfx::Size size = GetTileGridSize(); gfx::Size size = GetTileGridSize();
if (!is_fullscreen_app_list_enabled_) { if (is_fullscreen_app_list_enabled_) {
// Add padding to both side of the apps grid to keep it horizontally
// centered.
size.Enlarge(kAppsGridLeftRightPaddingFullscreen * 2, 0);
} else {
// If we are in a folder, ignore the page switcher for height calculations. // If we are in a folder, ignore the page switcher for height calculations.
int page_switcher_height = int page_switcher_height =
folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height(); folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height();
...@@ -2152,6 +2156,8 @@ gfx::Rect AppsGridView::GetExpectedTileBounds(int row, int col) const { ...@@ -2152,6 +2156,8 @@ 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);
if (is_fullscreen_app_list_enabled_)
tile_bounds.Offset(kAppsGridLeftRightPaddingFullscreen, 0);
tile_bounds.Inset(-GetTilePadding()); tile_bounds.Inset(-GetTilePadding());
return tile_bounds; return tile_bounds;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/app_list_folder_item.h" #include "ui/app_list/app_list_folder_item.h"
#include "ui/app_list/app_list_switches.h" #include "ui/app_list/app_list_switches.h"
#include "ui/app_list/views/app_list_folder_view.h" #include "ui/app_list/views/app_list_folder_view.h"
...@@ -24,10 +25,10 @@ namespace app_list { ...@@ -24,10 +25,10 @@ namespace app_list {
namespace { namespace {
const int kPreferredWidth = 360; constexpr int kPreferredWidth = 360;
const int kPreferredHeight = 48; constexpr int kPreferredHeight = 48;
const int kBottomSeparatorHeight = 1; constexpr int kBottomSeparatorHeight = 1;
const int kMaxFolderNameWidth = 300; constexpr int kMaxFolderNameWidth = 300;
} // namespace } // namespace
...@@ -177,7 +178,10 @@ void FolderHeaderView::OnPaint(gfx::Canvas* canvas) { ...@@ -177,7 +178,10 @@ void FolderHeaderView::OnPaint(gfx::Canvas* canvas) {
return; return;
// Draw bottom separator line. // Draw bottom separator line.
rect.Inset(kAppsGridPadding, 0); rect.Inset(features::IsFullscreenAppListEnabled()
? kAppsGridLeftRightPaddingFullscreen * 2
: kAppsGridPadding,
0);
rect.set_y(rect.bottom() - kBottomSeparatorHeight); rect.set_y(rect.bottom() - kBottomSeparatorHeight);
rect.set_height(kBottomSeparatorHeight); rect.set_height(kBottomSeparatorHeight);
canvas->FillRect(rect, kTopSeparatorColor); canvas->FillRect(rect, kTopSeparatorColor);
......
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