From b65040ac7b5bca6efcf680cd48e19f093e19b46a Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 23 Mar 2018 16:22:06 -0700 Subject: [PATCH] Fix back button not showing in all floating views We only show the back button when adding the floating view to the drag layer if it is already "open". A couple of floating items (folder and options popup) added first then set mIsOpen, causing the back button to not appear. (We have to check that it is open, and not just on the drag layer, because we want to get rid of the back button when changing to some states such as spring-loaded. If we only checked if the view was present, it wouldn't hide if one of the floating views such as folder or shortcuts was animated closed.) Bug: 76169527 Change-Id: I0dff6d2e3424eab72d47dccc42cc703a0fb0141b --- src/com/android/launcher3/folder/Folder.java | 4 ++-- src/com/android/launcher3/views/OptionsPopupView.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 1bdd554b1f..12d7dc77a1 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -481,6 +481,8 @@ public class Folder extends AbstractFloatingView implements DragSource, openFolder.close(true); } + mIsOpen = true; + DragLayer dragLayer = mLauncher.getDragLayer(); // Just verify that the folder hasn't already been added to the DragLayer. // There was a one-off crash where the folder had a parent already. @@ -494,8 +496,6 @@ public class Folder extends AbstractFloatingView implements DragSource, } } - mIsOpen = true; - mContent.completePendingPageChanges(); if (!mDragInProgress) { // Open on the first page. diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java index 21b6773559..dc86aec463 100644 --- a/src/com/android/launcher3/views/OptionsPopupView.java +++ b/src/com/android/launcher3/views/OptionsPopupView.java @@ -288,8 +288,8 @@ public class OptionsPopupView extends AbstractFloatingView lp.y = Utilities.boundToRange((int) (y - height / 2), insets.top + margin, maxHeight - insets.bottom - height - margin); - launcher.getDragLayer().addView(view); view.animateOpen(); + launcher.getDragLayer().addView(view); } public static boolean onWidgetsClicked(Launcher launcher) {