Commit 1236d45e authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

app_list: Hide drag item title during a drop to a folder

When dragged app item view is dropped into a folder at the end of the
drag, hide its title, and keep it hidden. Generally, the title will be
hidden at the end of the drag while the item is animating to the new
target bounds, but the item view is removed from the views model before
the bounds animations run, so AnimateToIdealBounds() will not update
the dragged view title.

BUG=1053935

Change-Id: Ief279b9f11f7c6bf7d562e4e4d9a690e89acf229
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2068279
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744031}
parent 99e53a1f
...@@ -1931,15 +1931,27 @@ void AppsGridView::EndDragFromReparentItemInRootLevel( ...@@ -1931,15 +1931,27 @@ void AppsGridView::EndDragFromReparentItemInRootLevel(
} }
SetAsFolderDroppingTarget(drop_target_, false); SetAsFolderDroppingTarget(drop_target_, false);
AppListItemView* released_drag_view = nullptr;
if (!cancel_reparent) { if (!cancel_reparent) {
// By setting |drag_view_| to nullptr here, we prevent ClearDragState() from // By setting |drag_view_| to nullptr here, we prevent ClearDragState() from
// cleaning up the newly created AppListItemView, effectively claiming // cleaning up the newly created AppListItemView, effectively claiming
// ownership of the newly created drag view. // ownership of the newly created drag view.
drag_view_->OnDragEnded(); drag_view_->OnDragEnded();
// Hide the title if the item is being dropped into another folder, so it
// doesn't flash during transition. Otherwise, the item is being dropped
// into the root apps grid - pass the released view to
// AnimateToIdealBounds(), which will ensure the title remains hidden
// during the item view bounds animation to the target apps grid location.
if (folder_item_view) {
drag_view_->title()->SetVisible(false);
} else {
released_drag_view = drag_view_;
}
drag_view_ = nullptr; drag_view_ = nullptr;
} }
ClearDragState(); ClearDragState();
AnimateToIdealBounds(nullptr /* released_drag_view */); AnimateToIdealBounds(released_drag_view);
if (!folder_delegate_) if (!folder_delegate_)
view_structure_.SaveToMetadata(); view_structure_.SaveToMetadata();
...@@ -2356,6 +2368,7 @@ void AppsGridView::FadeOutItemViewAndDelete(AppListItemView* item_view) { ...@@ -2356,6 +2368,7 @@ void AppsGridView::FadeOutItemViewAndDelete(AppListItemView* item_view) {
view_model_.Remove(model_index); view_model_.Remove(model_index);
if (!folder_delegate_) if (!folder_delegate_)
view_structure_.Remove(item_view); view_structure_.Remove(item_view);
item_view->title()->SetVisible(false);
bounds_animator_->AnimateViewTo(item_view, item_view->bounds()); bounds_animator_->AnimateViewTo(item_view, item_view->bounds());
bounds_animator_->SetAnimationDelegate( bounds_animator_->SetAnimationDelegate(
item_view, std::unique_ptr<gfx::AnimationDelegate>( item_view, std::unique_ptr<gfx::AnimationDelegate>(
......
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