Commit 4bf6b514 authored by mgiuca's avatar mgiuca Committed by Commit bot

Experimental app list: Enforce a 24-pixel padding on the top and sides.

Applies to the horizontal divider line under the folder heading, and
above the contents switcher view, and the folder back button. Also set
the contents switcher background colour to the main background colour
(it doesn't make sense to have a different colour if the divider line
doesn't reach all the way to the edge).

BUG=411775

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

Cr-Commit-Position: refs/heads/master@{#295710}
parent 71a12a87
......@@ -7,7 +7,6 @@
namespace app_list {
const SkColor kContentsBackgroundColor = SkColorSetRGB(0xFB, 0xFB, 0xFB);
const SkColor kContentsSwitcherBackgroundColor = SK_ColorWHITE;
const SkColor kSearchBoxBackground = SK_ColorWHITE;
const SkColor kTopSeparatorColor = SkColorSetRGB(0xE5, 0xE5, 0xE5);
const SkColor kBottomSeparatorColor = SkColorSetRGB(0xE5, 0xE5, 0xE5);
......@@ -78,6 +77,9 @@ 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 = 23;
// Height of separator between the main view and contents switcher and of
// the launcher page indicator.
const int kContentsSwitcherSeparatorHeight = 1;
......
......@@ -13,7 +13,6 @@
namespace app_list {
APP_LIST_EXPORT extern const SkColor kContentsBackgroundColor;
APP_LIST_EXPORT extern const SkColor kContentsSwitcherBackgroundColor;
APP_LIST_EXPORT extern const SkColor kSearchBoxBackground;
APP_LIST_EXPORT extern const SkColor kTopSeparatorColor;
APP_LIST_EXPORT extern const SkColor kBottomSeparatorColor;
......@@ -59,6 +58,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 kContentsSwitcherSeparatorHeight;
APP_LIST_EXPORT extern size_t kMaxFolderItems;
......
......@@ -87,16 +87,11 @@ void AppListBackground::Paint(gfx::Canvas* canvas,
const gfx::Rect contents_view_view_bounds =
contents_view->ConvertRectToWidget(contents_view->GetLocalBounds());
gfx::Rect separator_rect(contents_rect);
separator_rect.Inset(
kExperimentalWindowPadding + main_view_->GetInsets().left(), 0);
separator_rect.set_y(contents_view_view_bounds.bottom());
separator_rect.set_height(kBottomSeparatorSize);
canvas->FillRect(separator_rect, kBottomSeparatorColor);
int contents_switcher_top = separator_rect.bottom();
gfx::Rect contents_switcher_rect(bounds.x(),
contents_switcher_top,
bounds.width(),
bounds.bottom() - contents_switcher_top);
paint.setColor(kContentsSwitcherBackgroundColor);
canvas->DrawRect(contents_switcher_rect, paint);
}
}
......
......@@ -42,9 +42,6 @@ const int kPadding = 1;
// The maximum allowed time to wait for icon loading in milliseconds.
const int kMaxIconLoadingWaitTimeInMs = 50;
// The padding around the search box in the experimental app list.
const int kSearchBoxViewPadding = 23;
// A view that holds another view and takes its preferred size. This is used for
// wrapping the search box view so it still gets laid out while hidden. This is
// a separate class so it can notify the main view on search box visibility
......@@ -118,17 +115,18 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
contents_view_(NULL),
contents_switcher_view_(NULL),
weak_ptr_factory_(this) {
SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical, kPadding, kPadding, 0));
SetBorder(
views::Border::CreateEmptyBorder(kPadding, kPadding, kPadding, kPadding));
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
search_box_view_ = new SearchBoxView(this, delegate);
views::View* container = new SearchBoxContainerView(this, search_box_view_);
if (switches::IsExperimentalAppListEnabled()) {
container->SetBorder(
views::Border::CreateEmptyBorder(kSearchBoxViewPadding,
kSearchBoxViewPadding,
views::Border::CreateEmptyBorder(kExperimentalWindowPadding,
kExperimentalWindowPadding,
0,
kSearchBoxViewPadding));
kExperimentalWindowPadding));
}
AddChildView(container);
AddContentsViews();
......
......@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_folder_item.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/views/app_list_folder_view.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
......@@ -26,8 +27,8 @@ namespace {
const int kPreferredWidth = 360;
const int kPreferredHeight = 48;
const int kIconDimension = 24;
const int kPadding = 14;
const int kBottomSeparatorPadding = 9;
const int kBackButtonPadding = 14;
const int kBottomSeparatorPadding = 9; // Non-experimental app list only.
const int kBottomSeparatorHeight = 1;
const int kMaxFolderNameWidth = 300;
......@@ -158,7 +159,13 @@ void FolderHeaderView::Layout() {
return;
gfx::Rect back_bounds(rect);
back_bounds.set_width(kIconDimension + 2 * kPadding);
back_bounds.set_width(kIconDimension + 2 * kBackButtonPadding);
if (app_list::switches::IsExperimentalAppListEnabled()) {
// Align the left edge of the button image with the left margin of the
// launcher window. Note that this means the physical button dimensions
// extends slightly into the margin.
back_bounds.set_x(kExperimentalWindowPadding - kBackButtonPadding);
}
back_button_->SetBoundsRect(back_bounds);
gfx::Rect text_bounds(rect);
......@@ -192,7 +199,10 @@ void FolderHeaderView::OnPaint(gfx::Canvas* canvas) {
return;
// Draw bottom separator line.
rect.Inset(kBottomSeparatorPadding, 0);
int horizontal_padding = app_list::switches::IsExperimentalAppListEnabled()
? kExperimentalWindowPadding
: kBottomSeparatorPadding;
rect.Inset(horizontal_padding, 0);
rect.set_y(rect.bottom() - kBottomSeparatorHeight);
rect.set_height(kBottomSeparatorHeight);
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