diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 13:58:29 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 13:58:29 +0000 |
commit | 4e2cc1b7e88c22fe3d3346d81021520735cbfb2d (patch) | |
tree | b4eb35140dee2b770bf4ab1782f758a8c89a6ca5 /athena | |
parent | 4de2d663dc36f977dad9a1c142031b5a7ebb8b19 (diff) | |
download | chromium_src-4e2cc1b7e88c22fe3d3346d81021520735cbfb2d.zip chromium_src-4e2cc1b7e88c22fe3d3346d81021520735cbfb2d.tar.gz chromium_src-4e2cc1b7e88c22fe3d3346d81021520735cbfb2d.tar.bz2 |
athena: Make some UI changes to the home-card bottom-view to match the mocks.
. Add a shadow around the bottom-view of the home-card.
. Make the background slightly transparent.
. Make the bottom-view slightly narrower.
. Remove the borders around the apps.
BUG=none
R=mukai@chromium.org
TBR=sky@chromium.org for DEPS on ui/gfx/ from athena/home
Review URL: https://codereview.chromium.org/439673002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'athena')
-rw-r--r-- | athena/home/DEPS | 2 | ||||
-rw-r--r-- | athena/home/bottom_home_view.cc | 46 | ||||
-rw-r--r-- | athena/home/home_card_impl.cc | 27 |
3 files changed, 67 insertions, 8 deletions
diff --git a/athena/home/DEPS b/athena/home/DEPS index 63e9180..9074623 100644 --- a/athena/home/DEPS +++ b/athena/home/DEPS @@ -6,7 +6,7 @@ include_rules = [ "+ui/aura", "+ui/app_list", "+ui/events", - "+ui/gfx/image", + "+ui/gfx", "+ui/views", "+ui/wm/core", "+ui/wm/public", diff --git a/athena/home/bottom_home_view.cc b/athena/home/bottom_home_view.cc index 98cbc13..8170761 100644 --- a/athena/home/bottom_home_view.cc +++ b/athena/home/bottom_home_view.cc @@ -9,18 +9,51 @@ #include "ui/app_list/app_list_view_delegate.h" #include "ui/app_list/views/search_box_view.h" #include "ui/app_list/views/tile_item_view.h" +#include "ui/gfx/canvas.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/layout/box_layout.h" +#include "ui/views/painter.h" +#include "ui/views/shadow_border.h" + +namespace { + +class BottomHomeBackground : public views::Background { + public: + explicit BottomHomeBackground(views::View* search_box) + : search_box_(search_box), + painter_(views::Painter::CreateVerticalGradient( + SkColorSetA(SK_ColorWHITE, 0x7f), + SK_ColorWHITE)) {} + virtual ~BottomHomeBackground() {} + + private: + // views::Background: + virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { + CHECK_EQ(view, search_box_->parent()); + views::Painter::PaintPainterAt( + canvas, + painter_.get(), + gfx::Rect(0, 0, view->width(), search_box_->y())); + canvas->FillRect(gfx::Rect(0, + search_box_->y(), + view->width(), + view->height() - search_box_->y()), + SK_ColorWHITE); + } + + views::View* search_box_; + scoped_ptr<views::Painter> painter_; + DISALLOW_COPY_AND_ASSIGN(BottomHomeBackground); +}; + +} // namespace namespace athena { BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) : view_delegate_(view_delegate) { - set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); - SetBorder(views::Border::CreateSolidBorder(1, SK_ColorBLACK)); - SetLayoutManager(new views::BoxLayout( - views::BoxLayout::kVertical, 0, 0, 0)); + SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); app_list::AppListModel* model = view_delegate->GetModel(); app_list::AppListItemList* top_level = model->top_level_item_list(); @@ -36,11 +69,16 @@ BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) app_list::TileItemView* tile_item_view = new app_list::TileItemView(); tile_item_view->SetAppListItem(top_level->item_at(i)); items_container->AddChildView(tile_item_view); + tile_item_view->set_background(NULL); } app_list::SearchBoxView* search_box = new app_list::SearchBoxView( this, view_delegate); AddChildView(search_box); + search_box->SetBorder( + views::Border::CreateSolidSidedBorder(1, 0, 0, 0, SK_ColorGRAY)); + + set_background(new BottomHomeBackground(search_box)); } BottomHomeView::~BottomHomeView() {} diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc index 9a71414..714875a 100644 --- a/athena/home/home_card_impl.cc +++ b/athena/home/home_card_impl.cc @@ -25,6 +25,7 @@ #include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" +#include "ui/wm/core/shadow.h" #include "ui/wm/core/visibility_controller.h" #include "ui/wm/core/window_animations.h" #include "ui/wm/public/activation_change_observer.h" @@ -101,14 +102,14 @@ class HomeCardView : public views::WidgetDelegateView { HomeCardView(app_list::AppListViewDelegate* view_delegate, aura::Window* container, MinimizedHomeDragDelegate* minimized_delegate) { - set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); - bottom_view_ = new BottomHomeView(view_delegate); AddChildView(bottom_view_); main_view_ = new app_list::AppListMainView( view_delegate, 0 /* initial_apps_page */, container); AddChildView(main_view_); + main_view_->set_background( + views::Background::CreateSolidBackground(SK_ColorWHITE)); minimized_view_ = CreateMinimizedHome(minimized_delegate); AddChildView(minimized_view_); @@ -123,6 +124,12 @@ class HomeCardView : public views::WidgetDelegateView { contents_view->SetActivePage(contents_view->GetPageIndexForNamedPage( app_list::ContentsView::NAMED_PAGE_START)); } + + if (state != HomeCard::VISIBLE_BOTTOM) + shadow_.reset(); + // Do not create the shadow yet. Instead, create it in OnWidgetMove(), to + // make sure that widget has been resized correctly (because the size of the + // shadow depends on the size of the widget). } // views::View: @@ -141,6 +148,19 @@ class HomeCardView : public views::WidgetDelegateView { private: // views::WidgetDelegate: + virtual void OnWidgetMove() OVERRIDE { + if (bottom_view_->visible() && !shadow_) { + aura::Window* window = GetWidget()->GetNativeWindow(); + shadow_.reset(new wm::Shadow()); + shadow_->Init(wm::Shadow::STYLE_ACTIVE); + shadow_->SetContentBounds(gfx::Rect(window->bounds().size())); + shadow_->layer()->SetVisible(true); + + ui::Layer* layer = window->layer(); + layer->Add(shadow_->layer()); + } + } + virtual views::View* GetContentsView() OVERRIDE { return this; } @@ -148,6 +168,7 @@ class HomeCardView : public views::WidgetDelegateView { app_list::AppListMainView* main_view_; BottomHomeView* bottom_view_; views::View* minimized_view_; + scoped_ptr<wm::Shadow> shadow_; DISALLOW_COPY_AND_ASSIGN(HomeCardView); }; @@ -213,7 +234,7 @@ class HomeCardImpl : public HomeCard, virtual int GetHorizontalMargin() const OVERRIDE { CHECK_NE(HIDDEN, state_); - const int kHomeCardHorizontalMargin = 50; + const int kHomeCardHorizontalMargin = 100; return state_ == VISIBLE_BOTTOM ? kHomeCardHorizontalMargin : 0; } |