Commit 4556ad77 authored by jennyz@chromium.org's avatar jennyz@chromium.org

Remove the animation delay for showing the top level apps when user opens app...

Remove the animation delay for showing the top level apps when user opens app list launcher. The animation will be performed only when user return to the top level apps grid view from a folder view.

BUG=336187

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251299 0039d316-1c4b-4281-b951-d872f2087c98
parent 60a07bec
......@@ -269,6 +269,12 @@ void AppListFolderView::DispatchEndDragEventForReparent(
EndDragFromReparentItemInRootLevel(events_forwarded_to_drag_drop_host);
}
void AppListFolderView::HideViewImmediately() {
SetVisible(false);
hide_for_reparent_ = false;
}
void AppListFolderView::NavigateBack(AppListFolderItem* item,
const ui::Event& event_flags) {
container_view_->ShowApps(item);
......
......@@ -81,6 +81,9 @@ class AppListFolderView : public views::View,
// to the drag_drop_host, eg. dropped on shelf.
void DispatchEndDragEventForReparent(bool events_forwarded_to_drag_drop_host);
// Hides the view immediately without animation.
void HideViewImmediately();
// views::View overrides:
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
......@@ -93,7 +96,6 @@ class AppListFolderView : public views::View,
virtual void OnImplicitAnimationsCompleted() OVERRIDE;
AppsGridView* items_grid_view() { return items_grid_view_; }
bool hide_for_reparent() const { return hide_for_reparent_; }
private:
void CalculateIdealBounds();
......
......@@ -44,6 +44,8 @@ AppsContainerView::AppsContainerView(AppListMainView* app_list_main_view,
apps_grid_view_->SetModel(model_);
apps_grid_view_->SetItemList(model_->item_list());
SetShowState(SHOW_APPS,
false); /* show apps without animation */
}
AppsContainerView::~AppsContainerView() {
......@@ -51,14 +53,15 @@ AppsContainerView::~AppsContainerView() {
void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) {
app_list_folder_view_->SetAppListFolderItem(folder_item);
SetShowState(SHOW_ACTIVE_FOLDER);
SetShowState(SHOW_ACTIVE_FOLDER, false);
CreateViewsForFolderTopItemsAnimation(folder_item, true);
}
void AppsContainerView::ShowApps(AppListFolderItem* folder_item) {
PrepareToShowApps(folder_item);
SetShowState(SHOW_APPS);
SetShowState(SHOW_APPS,
true); /* show apps with animation */
}
void AppsContainerView::SetDragAndDropHostOfCurrentAppList(
......@@ -71,7 +74,7 @@ void AppsContainerView::SetDragAndDropHostOfCurrentAppList(
void AppsContainerView::ReparentFolderItemTransit(
AppListFolderItem* folder_item) {
PrepareToShowApps(folder_item);
SetShowState(SHOW_ITEM_REPARENT);
SetShowState(SHOW_ITEM_REPARENT, false);
}
gfx::Size AppsContainerView::GetPreferredSize() {
......@@ -90,24 +93,13 @@ void AppsContainerView::Layout() {
switch (show_state_) {
case SHOW_APPS:
folder_background_view_->SetVisible(false);
app_list_folder_view_->ScheduleShowHideAnimation(false, false);
apps_grid_view_->SetBoundsRect(rect);
apps_grid_view_->ScheduleShowHideAnimation(true);
break;
case SHOW_ACTIVE_FOLDER:
folder_background_view_->SetBoundsRect(rect);
folder_background_view_->SetVisible(true);
apps_grid_view_->ScheduleShowHideAnimation(false);
app_list_folder_view_->SetBoundsRect(rect);
app_list_folder_view_->ScheduleShowHideAnimation(true, false);
break;
case SHOW_ITEM_REPARENT:
folder_background_view_->SetVisible(false);
folder_background_view_->UpdateFolderContainerBubble(
FolderBackgroundView::NO_BUBBLE);
app_list_folder_view_->ScheduleShowHideAnimation(false, true);
apps_grid_view_->ScheduleShowHideAnimation(true);
break;
default:
NOTREACHED();
......@@ -136,11 +128,40 @@ void AppsContainerView::OnTopIconAnimationsComplete() {
}
}
void AppsContainerView::SetShowState(ShowState show_state) {
void AppsContainerView::SetShowState(ShowState show_state,
bool show_apps_with_animation) {
if (show_state_ == show_state)
return;
show_state_ = show_state;
switch (show_state_) {
case SHOW_APPS:
folder_background_view_->SetVisible(false);
if (show_apps_with_animation) {
app_list_folder_view_->ScheduleShowHideAnimation(false, false);
apps_grid_view_->ScheduleShowHideAnimation(true);
} else {
app_list_folder_view_->HideViewImmediately();
apps_grid_view_->SetVisible(true);
}
break;
case SHOW_ACTIVE_FOLDER:
folder_background_view_->SetVisible(true);
apps_grid_view_->ScheduleShowHideAnimation(false);
app_list_folder_view_->ScheduleShowHideAnimation(true, false);
break;
case SHOW_ITEM_REPARENT:
folder_background_view_->SetVisible(false);
folder_background_view_->UpdateFolderContainerBubble(
FolderBackgroundView::NO_BUBBLE);
app_list_folder_view_->ScheduleShowHideAnimation(false, true);
apps_grid_view_->ScheduleShowHideAnimation(true);
break;
default:
NOTREACHED();
}
Layout();
}
......
......@@ -74,7 +74,7 @@ class AppsContainerView : public views::View,
SHOW_ITEM_REPARENT,
};
void SetShowState(ShowState show_state);
void SetShowState(ShowState show_state, bool show_apps_with_animation);
// Calculates the top item icon bounds in the active folder icon. The bounds
// is relative to AppsContainerView.
......
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