Commit e7a43306 authored by Maajid's avatar Maajid Committed by Commit Bot

Fix animation issues due to inconsistent ways of dismissing the view.

Bug: 763147
Change-Id: I208cb359494aec7c49faa1ced7586532f96b4708
Reviewed-on: https://chromium-review.googlesource.com/656757
Commit-Queue: Maajid <maajid@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501542}
parent b52144f5
...@@ -309,6 +309,13 @@ void AppListView::ShowWhenReady() { ...@@ -309,6 +309,13 @@ void AppListView::ShowWhenReady() {
app_list_main_view_->ShowAppListWhenReady(); app_list_main_view_->ShowAppListWhenReady();
} }
void AppListView::Dismiss() {
app_list_main_view_->Close();
delegate_->Dismiss();
SetState(CLOSED);
GetWidget()->Deactivate();
}
void AppListView::UpdateBounds() { void AppListView::UpdateBounds() {
// if the AppListView is a bubble // if the AppListView is a bubble
if (!is_fullscreen_app_list_enabled_) if (!is_fullscreen_app_list_enabled_)
...@@ -562,7 +569,7 @@ void AppListView::HandleClickOrTap(ui::LocatedEvent* event) { ...@@ -562,7 +569,7 @@ void AppListView::HandleClickOrTap(ui::LocatedEvent* event) {
} }
if (!search_box_view_->is_search_box_active()) { if (!search_box_view_->is_search_box_active()) {
SetState(CLOSED); Dismiss();
return; return;
} }
...@@ -616,7 +623,7 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -616,7 +623,7 @@ void AppListView::EndDrag(const gfx::Point& location) {
case HALF: case HALF:
case FULLSCREEN_SEARCH: case FULLSCREEN_SEARCH:
case FULLSCREEN_ALL_APPS: case FULLSCREEN_ALL_APPS:
SetState(CLOSED); Dismiss();
break; break;
case CLOSED: case CLOSED:
NOTREACHED(); NOTREACHED();
...@@ -676,7 +683,7 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -676,7 +683,7 @@ void AppListView::EndDrag(const gfx::Point& location) {
// If the drag ended near the bezel, close the app list and return early. // If the drag ended near the bezel, close the app list and return early.
if (location_y_in_current_display >= if (location_y_in_current_display >=
(display_height - kAppListBezelMargin)) { (display_height - kAppListBezelMargin)) {
SetState(CLOSED); Dismiss();
return; return;
} }
switch (app_list_state_) { switch (app_list_state_) {
...@@ -688,7 +695,7 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -688,7 +695,7 @@ void AppListView::EndDrag(const gfx::Point& location) {
break; break;
case FULLSCREEN_SEARCH: case FULLSCREEN_SEARCH:
if (std::abs(drag_delta) > app_list_threshold) if (std::abs(drag_delta) > app_list_threshold)
SetState(CLOSED); Dismiss();
else else
SetState(app_list_state_); SetState(app_list_state_);
break; break;
...@@ -706,7 +713,7 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -706,7 +713,7 @@ void AppListView::EndDrag(const gfx::Point& location) {
UMA_HISTOGRAM_ENUMERATION(kAppListPeekingToFullscreenHistogram, UMA_HISTOGRAM_ENUMERATION(kAppListPeekingToFullscreenHistogram,
kSwipe, kMaxPeekingToFullscreen); kSwipe, kMaxPeekingToFullscreen);
} else { } else {
SetState(CLOSED); Dismiss();
} }
} else { } else {
SetState(app_list_state_); SetState(app_list_state_);
...@@ -989,13 +996,7 @@ bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { ...@@ -989,13 +996,7 @@ bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) {
// If the ContentsView does not handle the back action, then this is the // If the ContentsView does not handle the back action, then this is the
// top level, so we close the app list. // top level, so we close the app list.
if (!app_list_main_view_->contents_view()->Back()) { if (!app_list_main_view_->contents_view()->Back()) {
if (is_fullscreen_app_list_enabled_) { Dismiss();
SetState(CLOSED);
} else {
app_list_main_view_->Close();
delegate_->Dismiss();
}
GetWidget()->Deactivate();
} }
// Don't let DialogClientView handle the accelerator. // Don't let DialogClientView handle the accelerator.
...@@ -1153,8 +1154,6 @@ void AppListView::SetState(AppListState new_state) { ...@@ -1153,8 +1154,6 @@ void AppListView::SetState(AppListState new_state) {
case PEEKING: case PEEKING:
case FULLSCREEN_ALL_APPS: case FULLSCREEN_ALL_APPS:
case FULLSCREEN_SEARCH: case FULLSCREEN_SEARCH:
delegate_->Dismiss();
app_list_main_view_->Close();
break; break;
} }
} }
...@@ -1162,7 +1161,9 @@ void AppListView::SetState(AppListState new_state) { ...@@ -1162,7 +1161,9 @@ void AppListView::SetState(AppListState new_state) {
RecordStateTransitionForUma(new_state_override); RecordStateTransitionForUma(new_state_override);
model_->SetStateFullscreen(new_state_override); model_->SetStateFullscreen(new_state_override);
app_list_state_ = new_state_override; app_list_state_ = new_state_override;
if (new_state_override == CLOSED) {
return;
}
// Updates the visibility of app list items according to the change of // Updates the visibility of app list items according to the change of
// |app_list_state_|. // |app_list_state_|.
app_list_main_view_->contents_view() app_list_main_view_->contents_view()
......
...@@ -116,6 +116,9 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -116,6 +116,9 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// timer to show the UI when a maximum allowed wait time has expired. // timer to show the UI when a maximum allowed wait time has expired.
void ShowWhenReady(); void ShowWhenReady();
// Dismisses the UI, cleans up and sets the state to CLOSED.
void Dismiss();
void UpdateBounds(); void UpdateBounds();
// Enables/disables a semi-transparent overlay over the app list (good for // Enables/disables a semi-transparent overlay over the app list (good for
......
...@@ -451,7 +451,7 @@ bool ContentsView::Back() { ...@@ -451,7 +451,7 @@ bool ContentsView::Back() {
apps_container_view_->app_list_folder_view()->CloseFolderPage(); apps_container_view_->app_list_folder_view()->CloseFolderPage();
} else { } else {
is_fullscreen_app_list_enabled_ is_fullscreen_app_list_enabled_
? app_list_view_->SetState(AppListView::CLOSED) ? app_list_view_->Dismiss()
: SetActiveState(AppListModel::STATE_START); : SetActiveState(AppListModel::STATE_START);
} }
break; break;
......
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