fix: Disable material expressive folder expansion animations

This commit is contained in:
Pun Butrach committed 2026-01-10 20:51:07 +07:00
1 parent 0ff9636c38
commit 9b90822395
2258 files changed
+165176 -78078

No files matched your search

@@ -34,6 +34,8 @@ import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import android.window.OnBackAnimationCallback;
import androidx.annotation.IntDef;
import com.android.launcher3.anim.PendingAnimation;
@@ -49,7 +51,7 @@ import java.lang.annotation.RetentionPolicy;
*/
@TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public abstract class AbstractFloatingView extends LinearLayout implements TouchController,
OnBackPressedHandler {
OnBackAnimationCallback {
@IntDef(flag = true, value = {
TYPE_COMPOSE_VIEW,
@@ -73,12 +75,13 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
TYPE_TASKBAR_ALL_APPS,
TYPE_ADD_TO_HOME_CONFIRMATION,
TYPE_TASKBAR_OVERLAY_PROXY,
TYPE_TASKBAR_PINNING_POPUP
TYPE_TASKBAR_PINNING_POPUP,
TYPE_PIN_IME_POPUP,
TYPE_ONE_GRID_MIGRATION_EDU,
TYPE_NUDGE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {
}
public @interface FloatingViewType {}
public static final int TYPE_FOLDER = 1 << 0;
public static final int TYPE_ACTION_POPUP = 1 << 1;
public static final int TYPE_WIDGETS_BOTTOM_SHEET = 1 << 2;
@@ -104,9 +107,11 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
public static final int TYPE_TASKBAR_OVERLAY_PROXY = 1 << 20;
public static final int TYPE_TASKBAR_PINNING_POPUP = 1 << 21;
public static final int TYPE_PIN_IME_POPUP = 1 << 22;
public static final int TYPE_ONE_GRID_MIGRATION_EDU = 1 << 23;
public static final int TYPE_NUDGE = 1 << 24;
// Custom compose popups
public static final int TYPE_COMPOSE_VIEW = 1 << 23;
public static final int TYPE_COMPOSE_VIEW = 1 << 25;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
@@ -115,37 +120,35 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
| TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS | TYPE_OPTIONS_POPUP_DIALOG
| TYPE_ADD_TO_HOME_CONFIRMATION | TYPE_TASKBAR_OVERLAY_PROXY
| TYPE_TASKBAR_PINNING_POPUP | TYPE_PIN_IME_POPUP | TYPE_COMPOSE_VIEW;
| TYPE_TASKBAR_PINNING_POPUP | TYPE_PIN_IME_POPUP | TYPE_ONE_GRID_MIGRATION_EDU
| TYPE_NUDGE | 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_TASKBAR_EDUCATION_DIALOG
| TYPE_TASKBAR_ALL_APPS | TYPE_OPTIONS_POPUP_DIALOG | TYPE_TASKBAR_OVERLAY_PROXY
| TYPE_PIN_IME_POPUP | TYPE_COMPOSE_VIEW;
| TYPE_PIN_IME_POPUP | TYPE_ONE_GRID_MIGRATION_EDU | TYPE_NUDGE | TYPE_COMPOSE_VIEW;
/** Type of popups that should get exclusive accessibility focus. */
public static final int TYPE_ACCESSIBLE = TYPE_ALL & ~TYPE_DISCOVERY_BOUNCE & ~TYPE_LISTENER
& ~TYPE_ALL_APPS_EDU & ~TYPE_TASKBAR_ALL_APPS & ~TYPE_PIN_IME_POPUP
& ~TYPE_WIDGET_RESIZE_FRAME;
& ~TYPE_WIDGET_RESIZE_FRAME & ~TYPE_ONE_GRID_MIGRATION_EDU & ~TYPE_ON_BOARD_POPUP
& ~TYPE_TASKBAR_OVERLAY_PROXY;
// These view all have particular operation associated with swipe down
// interaction.
// These view all have particular operation associated with swipe down interaction.
public static final int TYPE_STATUS_BAR_SWIPE_DOWN_DISALLOW = TYPE_WIDGETS_BOTTOM_SHEET |
TYPE_WIDGETS_FULL_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_ON_BOARD_POPUP |
TYPE_DISCOVERY_BOUNCE | TYPE_TASK_MENU | TYPE_DRAG_DROP_POPUP | TYPE_COMPOSE_VIEW;
// Floating views that are exclusive to the taskbar overlay window.
public static final int TYPE_TASKBAR_OVERLAYS = TYPE_TASKBAR_ALL_APPS | TYPE_TASKBAR_EDUCATION_DIALOG;
public static final int TYPE_TASKBAR_OVERLAYS =
TYPE_TASKBAR_ALL_APPS | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_NUDGE;
// Floating views that a TouchController should not try to intercept touches
// from.
// Floating views that a TouchController should not try to intercept touches from.
public static final int TYPE_TOUCH_CONTROLLER_NO_INTERCEPT = TYPE_ALL & ~TYPE_DISCOVERY_BOUNCE
& ~TYPE_LISTENER & ~TYPE_TASKBAR_OVERLAYS;
public static final int TYPE_ALL_EXCEPT_ON_BOARD_POPUP = TYPE_ALL & ~TYPE_ON_BOARD_POPUP
& ~TYPE_PIN_IME_POPUP;
protected boolean mIsOpen;
public AbstractFloatingView(Context context, AttributeSet attrs) {
@@ -157,8 +160,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
}
/**
* We need to handle touch events to prevent them from falling through to the
* workspace below.
* We need to handle touch events to prevent them from falling through to the workspace below.
*/
@SuppressLint("ClickableViewAccessibility")
@Override
@@ -178,15 +180,11 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
protected abstract void handleClose(boolean animate);
/**
* Creates a user-controlled animation to hint that the view will be closed if
* completed.
*
* @param distanceToMove The max distance that elements should move from their
* starting point.
* Creates a user-controlled animation to hint that the view will be closed if completed.
* @param distanceToMove The max distance that elements should move from their starting point.
*/
public void addHintCloseAnim(
float distanceToMove, Interpolator interpolator, PendingAnimation target) {
}
float distanceToMove, Interpolator interpolator, PendingAnimation target) { }
public final boolean isOpen() {
return mIsOpen;
@@ -243,16 +241,14 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
}
/**
* Returns whether there is at least one view of the given type where
* {@link #isOpen()} == true.
* Returns whether there is at least one view of the given type where {@link #isOpen()} == true.
*/
public static boolean hasOpenView(ActivityContext activity, @FloatingViewType int type) {
return getOpenView(activity, type) != null;
}
/**
* Returns a view matching FloatingViewType, and {@link #isOpen()} may be false
* (if animating
* Returns a view matching FloatingViewType, and {@link #isOpen()} may be false (if animating
* closed).
*/
public static <T extends AbstractFloatingView> T getAnyView(
@@ -263,10 +259,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
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,
if (dragLayer == null) return null;
// Iterate in reverse order. AbstractFloatingView is added later to the dragLayer,
// and will be one of the last views.
for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) {
View child = dragLayer.getChildAt(i);
@@ -303,13 +297,13 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
}
public static void closeAllOpenViewsExcept(ActivityContext activity, boolean animate,
@FloatingViewType int type) {
@FloatingViewType int type) {
closeOpenViews(activity, animate, TYPE_ALL & ~type);
activity.finishAutoCancelActionMode();
}
public static void closeAllOpenViewsExcept(ActivityContext activity,
@FloatingViewType int type) {
@FloatingViewType int type) {
closeAllOpenViewsExcept(activity, true, type);
}