mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Merge remote-tracking branch 'aosp/android12L-release' into 12.1-dev
This commit is contained in:
@@ -65,7 +65,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
TYPE_OPTIONS_POPUP,
|
||||
TYPE_ICON_SURFACE,
|
||||
TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP,
|
||||
TYPE_WIDGETS_EDUCATION_DIALOG
|
||||
TYPE_WIDGETS_EDUCATION_DIALOG,
|
||||
TYPE_TASKBAR_EDUCATION_DIALOG
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FloatingViewType {}
|
||||
@@ -88,21 +89,24 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
|
||||
public static final int TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP = 1 << 14;
|
||||
public static final int TYPE_WIDGETS_EDUCATION_DIALOG = 1 << 15;
|
||||
public static final int TYPE_TASKBAR_EDUCATION_DIALOG = 1 << 16;
|
||||
|
||||
// Custom compose popups
|
||||
public static final int TYPE_COMPOSE_VIEW = 1 << 16;
|
||||
public static final int TYPE_COMPOSE_VIEW = 1 << 20;
|
||||
|
||||
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
|
||||
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
|
||||
| TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE | TYPE_TASK_MENU
|
||||
| TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU
|
||||
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
|
||||
| TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_COMPOSE_VIEW;
|
||||
| TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_TASKBAR_EDUCATION_DIALOG
|
||||
| TYPE_COMPOSE_VIEW;
|
||||
|
||||
// Type of popups which should be kept open during launcher rebind
|
||||
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
|
||||
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
|
||||
| TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_COMPOSE_VIEW;
|
||||
| TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_COMPOSE_VIEW
|
||||
| TYPE_TASKBAR_EDUCATION_DIALOG;
|
||||
|
||||
// Usually we show the back button when a floating view is open. Instead, hide for these types.
|
||||
public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
|
||||
@@ -196,10 +200,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,
|
||||
@@ -208,7 +226,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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user