Commit cdf2fc77 authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Forward events to the apps grid view if they are in the same y-region

This allows for scrolling on the very edge to paginate the apps grid first,
before closing the launcher. By limiting the Y-region, you can still close
the launcher with a drag from the top.

Bug: 869642
Change-Id: Ice9759a2e1dd0c3beb6019a00b570bba37e2a7a6
Reviewed-on: https://chromium-review.googlesource.com/1175454Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Cr-Commit-Position: refs/heads/master@{#584271}
parent 37877801
...@@ -316,6 +316,31 @@ const char* AppsContainerView::GetClassName() const { ...@@ -316,6 +316,31 @@ const char* AppsContainerView::GetClassName() const {
return "AppsContainerView"; return "AppsContainerView";
} }
void AppsContainerView::OnGestureEvent(ui::GestureEvent* event) {
// Will forward events to |apps_grid_view_| if they occur in the same y-region
if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN &&
event->location().y() <= apps_grid_view_->bounds().y()) {
return;
}
// If a folder is currently opening or closing, we should ignore the event.
// This is here until the animation for pagination while closing folders is
// fixed: https://crbug.com/875133
if (app_list_folder_view_->IsAnimationRunning()) {
event->SetHandled();
return;
}
// Temporary event for use by |apps_grid_view_|
ui::GestureEvent grid_event(*event);
ConvertEventToTarget(apps_grid_view_, &grid_event);
apps_grid_view_->OnGestureEvent(&grid_event);
// If the temporary event was handled, we don't want to handle it again.
if (grid_event.handled())
event->SetHandled();
}
void AppsContainerView::OnWillBeHidden() { void AppsContainerView::OnWillBeHidden() {
if (show_state_ == SHOW_APPS || show_state_ == SHOW_ITEM_REPARENT) if (show_state_ == SHOW_APPS || show_state_ == SHOW_ITEM_REPARENT)
apps_grid_view_->EndDrag(true); apps_grid_view_->EndDrag(true);
......
...@@ -74,6 +74,7 @@ class APP_LIST_EXPORT AppsContainerView : public HorizontalPage { ...@@ -74,6 +74,7 @@ class APP_LIST_EXPORT AppsContainerView : public HorizontalPage {
void Layout() override; void Layout() override;
bool OnKeyPressed(const ui::KeyEvent& event) override; bool OnKeyPressed(const ui::KeyEvent& event) override;
const char* GetClassName() const override; const char* GetClassName() const override;
void OnGestureEvent(ui::GestureEvent* event) override;
// HorizontalPage overrides: // HorizontalPage overrides:
void OnWillBeHidden() override; void OnWillBeHidden() override;
......
...@@ -19,8 +19,10 @@ bool FolderBackgroundView::OnMousePressed(const ui::MouseEvent& event) { ...@@ -19,8 +19,10 @@ bool FolderBackgroundView::OnMousePressed(const ui::MouseEvent& event) {
} }
void FolderBackgroundView::OnGestureEvent(ui::GestureEvent* event) { void FolderBackgroundView::OnGestureEvent(ui::GestureEvent* event) {
if (event->type() != ui::ET_GESTURE_TAP) // A fix for the current folder close animation should be implemented to allow
return; // for a folder to close while pages are changing. Until this, we should
// always close the folder before movement.
// https://crbug.com/875133
HandleClickOrTap(); HandleClickOrTap();
event->SetHandled(); event->SetHandled();
} }
......
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