Merge "Don't set Taskbar window to non-fullscreen while folder animates closed" into sc-v2-dev am: 3d0fca7e0d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15832181

Change-Id: I92d822ab9e163d162275f55f7ed534ca001a2ad6
This commit is contained in:
Tony Wickham
2021-09-15 18:06:18 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 3 deletions
@@ -156,7 +156,7 @@ public class TaskbarDragLayerController {
* Called when a child is removed from TaskbarDragLayer.
*/
public void onDragLayerViewRemoved() {
if (AbstractFloatingView.getOpenView(mActivity, TYPE_ALL) == null) {
if (AbstractFloatingView.getAnyView(mActivity, TYPE_ALL) == null) {
mActivity.setTaskbarWindowFullscreen(false);
}
}
@@ -195,10 +195,24 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
}
/**
* Returns a view matching FloatingViewType
* Returns a view matching FloatingViewType and {@link #isOpen()} == true.
*/
public static <T extends AbstractFloatingView> T getOpenView(
ActivityContext activity, @FloatingViewType int type) {
return getView(activity, type, true /* mustBeOpen */);
}
/**
* Returns a view matching FloatingViewType, and {@link #isOpen()} may be false (if animating
* closed).
*/
public static <T extends AbstractFloatingView> T getAnyView(
ActivityContext activity, @FloatingViewType int type) {
return getView(activity, type, false /* mustBeOpen */);
}
private static <T extends AbstractFloatingView> T getView(
ActivityContext activity, @FloatingViewType int type, boolean mustBeOpen) {
BaseDragLayer dragLayer = activity.getDragLayer();
if (dragLayer == null) return null;
// Iterate in reverse order. AbstractFloatingView is added later to the dragLayer,
@@ -207,7 +221,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
View child = dragLayer.getChildAt(i);
if (child instanceof AbstractFloatingView) {
AbstractFloatingView view = (AbstractFloatingView) child;
if (view.isOfType(type) && view.isOpen()) {
if (view.isOfType(type) && (!mustBeOpen || view.isOpen())) {
return (T) view;
}
}