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..0782bd3ce58de4463f3f31991d0bce5f698b969b 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,11 @@ 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) { |
+ SetPaintToLayer(true); |
+ SetFillsBoundsOpaquely(false); |
+ |
pagination_model_->AddObserver(this); |
AddChildView(page_switcher_view_); |
@@ -658,6 +663,35 @@ 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::SetTopItemViewsVisible(bool visible) { |
+ 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(visible); |
+} |
+ |
+void AppsGridView::ScheduleShowHideAnimation(bool show) { |
+ // Stop any previous animation. |
+ layer()->GetAnimator()->StopAnimating(); |
+ |
+ // 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 +1435,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 +1543,11 @@ void AppsGridView::SetViewHidden(views::View* view, bool hide, bool immediate) { |
#endif |
} |
+void AppsGridView::OnImplicitAnimationsCompleted() { |
+ if (layer()->opacity() == 0.0f) |
+ 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. |