Skip to content

Commit

Permalink
Use drag icon proxy for item drop animation in apps grid view
Browse files Browse the repository at this point in the history
Make AppsGridView use AppDragIconProxy widget for the icon drop
animation, and keep drag view hidden until the drag icon proxy animation
ends. This simplifies the animation flow, as the same animation is used
for dropping the drag icon into a folder vs. into the apps grid, but
with different target bounds (previously reorder was performed using
bounds animation, while folder drop was using special
TopIconAnimationView).
Also, this avoids hacks where the drag icon view's title had to be
hidden during the drop animation, and makes AppsGridView drag code less
reliant on hidden drag view's bounds matching the drag icon (avoiding a
hack where drag icon bounds had to be manually adjusted for cardified
state change before running the final bounds animation).

BUG=1234002

Change-Id: I67ceb5f35b60e6d8204e8cf54cd9ba03c1e00519
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3057396
Reviewed-by: James Cook <jamescook@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#906465}
  • Loading branch information
Toni Barzic authored and Chromium LUCI CQ committed Jul 29, 2021
1 parent 6b30e5a commit 87f6c92
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 225 deletions.
10 changes: 4 additions & 6 deletions ash/app_list/views/app_list_folder_view.cc
Expand Up @@ -743,9 +743,11 @@ void AppListFolderView::DispatchDragEventForReparent(

void AppListFolderView::DispatchEndDragEventForReparent(
bool events_forwarded_to_drag_drop_host,
bool cancel_drag) {
bool cancel_drag,
std::unique_ptr<AppDragIconProxy> drag_icon_proxy) {
container_view_->apps_grid_view()->EndDragFromReparentItemInRootLevel(
events_forwarded_to_drag_drop_host, cancel_drag);
events_forwarded_to_drag_drop_host, cancel_drag,
std::move(drag_icon_proxy));
container_view_->ReparentDragEnded();

// The view was not hidden in order to keeping receiving mouse events. Hide it
Expand Down Expand Up @@ -793,10 +795,6 @@ bool AppListFolderView::IsOEMFolder() const {
return folder_item_->folder_type() == AppListFolderItem::FOLDER_TYPE_OEM;
}

void AppListFolderView::SetRootLevelDragViewVisible(bool visible) {
container_view_->apps_grid_view()->SetDragViewVisible(visible);
}

void AppListFolderView::HandleKeyboardReparent(AppListItemView* reparented_view,
ui::KeyboardCode key_code) {
container_view_->ReparentFolderItemTransit(folder_item_);
Expand Down
7 changes: 4 additions & 3 deletions ash/app_list/views/app_list_folder_view.h
Expand Up @@ -135,11 +135,12 @@ class ASH_EXPORT AppListFolderView : public views::View,
void DispatchDragEventForReparent(
AppsGridView::Pointer pointer,
const gfx::Point& drag_point_in_folder_grid) override;
void DispatchEndDragEventForReparent(bool events_forwarded_to_drag_drop_host,
bool cancel_drag) override;
void DispatchEndDragEventForReparent(
bool events_forwarded_to_drag_drop_host,
bool cancel_drag,
std::unique_ptr<AppDragIconProxy> drag_icon_proxy) override;
bool IsViewOutsideOfFolder(AppListItemView* view) override;
bool IsOEMFolder() const override;
void SetRootLevelDragViewVisible(bool visible) override;
void HandleKeyboardReparent(AppListItemView* reparented_view,
ui::KeyboardCode key_code) override;
void UpdateFolderBounds() override;
Expand Down

0 comments on commit 87f6c92

Please sign in to comment.