| Index: ui/app_list/views/apps_grid_view.cc
|
| diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc
|
| index 096ea70802192126420f1f25ceebe14cda7b2707..768c4aae45b21876444bf26470937004e680fd07 100644
|
| --- a/ui/app_list/views/apps_grid_view.cc
|
| +++ b/ui/app_list/views/apps_grid_view.cc
|
| @@ -16,6 +16,7 @@
|
| #include "ui/app_list/app_list_switches.h"
|
| #include "ui/app_list/pagination_model.h"
|
| #include "ui/app_list/views/app_list_drag_and_drop_host.h"
|
| +#include "ui/app_list/views/app_list_folder_view.h"
|
| #include "ui/app_list/views/app_list_item_view.h"
|
| #include "ui/app_list/views/apps_grid_view_delegate.h"
|
| #include "ui/app_list/views/page_switcher.h"
|
| @@ -347,7 +348,12 @@ AppsGridView::AppsGridView(AppsGridViewDelegate* delegate,
|
| page_flip_target_(-1),
|
| page_flip_delay_in_ms_(kPageFlipDelayInMs),
|
| bounds_animator_(this),
|
| - is_root_level_(true) {
|
| + is_root_level_(true),
|
| + activated_item_view_(NULL),
|
| + animate_to_show_(false) {
|
| + SetPaintToLayer(true);
|
| + SetFillsBoundsOpaquely(false);
|
| +
|
| pagination_model_->AddObserver(this);
|
| AddChildView(page_switcher_view_);
|
|
|
| @@ -658,6 +664,37 @@ void AppsGridView::StopPageFlipTimer() {
|
| page_flip_target_ = -1;
|
| }
|
|
|
| +AppListItemView* AppsGridView::GetItemViewAt(int index) const {
|
| + DCHECK(index >= 0 && index < view_model_.view_size());
|
| + return static_cast<AppListItemView*>(view_model_.view_at(index));
|
| +}
|
| +
|
| +void AppsGridView::ShowTopItemViews(bool show) {
|
| + int top_item_count = std::min(static_cast<int>(kNumFolderTopItems),
|
| + view_model_.view_size());
|
| + for (int i = 0; i < top_item_count; ++i)
|
| + GetItemViewAt(i)->SetVisible(show);
|
| +}
|
| +
|
| +void AppsGridView::ScheduleAnimationToShow(bool show) {
|
| + // Stop any previous animation.
|
| + layer()->GetAnimator()->StopAnimating();
|
| +
|
| + animate_to_show_ = show;
|
| +
|
| + // Set initial state.
|
| + SetVisible(true);
|
| + layer()->SetOpacity(show ? 0.0f : 1.0f);
|
| +
|
| + ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator());
|
| + animation.AddObserver(this);
|
| + animation.SetTweenType(gfx::Tween::EASE_IN_2);
|
| + animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
|
| + show ? kFolderTransitionInDurationMs : kFolderTransitionOutDurationMs));
|
| +
|
| + layer()->SetOpacity(show ? 1.0f : 0.0f);
|
| +}
|
| +
|
| bool AppsGridView::IsDraggedView(const views::View* view) const {
|
| return drag_view_ == view;
|
| }
|
| @@ -1401,6 +1438,7 @@ void AppsGridView::ButtonPressed(views::Button* sender,
|
| return;
|
|
|
| if (delegate_) {
|
| + activated_item_view_ = static_cast<AppListItemView*>(sender);
|
| delegate_->ActivateApp(static_cast<AppListItemView*>(sender)->item(),
|
| event.flags());
|
| }
|
| @@ -1508,6 +1546,11 @@ void AppsGridView::SetViewHidden(views::View* view, bool hide, bool immediate) {
|
| #endif
|
| }
|
|
|
| +void AppsGridView::OnImplicitAnimationsCompleted() {
|
| + if (!animate_to_show_)
|
| + SetVisible(false);
|
| +}
|
| +
|
| bool AppsGridView::EnableFolderDragDropUI() {
|
| // Enable drag and drop folder UI only if it is at the app list root level
|
| // and the switch is on and the target folder can still accept new items.
|
|
|