From 1028a726efbff75df60e2dde9d7d13d933cf7b52 Mon Sep 17 00:00:00 2001 From: Federico Baron Date: Thu, 13 Oct 2022 14:09:38 -0700 Subject: [PATCH] Get rid of spring loaded mode for home gardening design For the new home gardening mode, we plan on not having a spring loaded mode where the overlay shrinks, so when we have the flag for home gardening on, we won't be having the workspace have the green overlay and the icons shrink Bug: 251259222 Test: Hold on an icon in workspace to enter edit workspace mode, notice how we no longer shrink the workspace Change-Id: Ibf1c38eecc117a838eca20a860d47c355955b513 --- src/com/android/launcher3/CellLayout.java | 11 ++++++++--- src/com/android/launcher3/Workspace.java | 1 - .../android/launcher3/states/SpringLoadedState.java | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index c1df403b54..cdd8f5a1c8 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -19,6 +19,7 @@ package com.android.launcher3; import static android.animation.ValueAnimator.areAnimatorsEnabled; import static com.android.launcher3.anim.Interpolators.DEACCEL_1_5; +import static com.android.launcher3.config.FeatureFlags.SHOW_HOME_GARDENING; import static com.android.launcher3.dragndrop.DraggableView.DRAGGABLE_ICON; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; @@ -552,7 +553,9 @@ public class CellLayout extends ViewGroup { public void setSpringLoadedProgress(float progress) { if (Float.compare(progress, mSpringLoadedProgress) != 0) { mSpringLoadedProgress = progress; - updateBgAlpha(); + if (!SHOW_HOME_GARDENING.get()) { + updateBgAlpha(); + } setGridAlpha(progress); } } @@ -577,7 +580,9 @@ public class CellLayout extends ViewGroup { public void setScrollProgress(float progress) { if (Float.compare(Math.abs(progress), mScrollProgress) != 0) { mScrollProgress = Math.abs(progress); - updateBgAlpha(); + if (!SHOW_HOME_GARDENING.get()) { + updateBgAlpha(); + } } } @@ -616,7 +621,7 @@ public class CellLayout extends ViewGroup { } } - if (mVisualizeDropLocation) { + if (mVisualizeDropLocation && !SHOW_HOME_GARDENING.get()) { for (int i = 0; i < mDragOutlines.length; i++) { final float alpha = mDragOutlineAlphas[i]; if (alpha <= 0) continue; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 6aff83e300..5d388dcbed 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -107,7 +107,6 @@ import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.WallpaperOffsetInterpolator; -import com.android.launcher3.views.ActivityContext; import com.android.launcher3.widget.LauncherAppWidgetHost; import com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener; import com.android.launcher3.widget.LauncherAppWidgetHostView; diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java index 3286afb67c..f5d511c7d3 100644 --- a/src/com/android/launcher3/states/SpringLoadedState.java +++ b/src/com/android/launcher3/states/SpringLoadedState.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.states; +import static com.android.launcher3.config.FeatureFlags.SHOW_HOME_GARDENING; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import android.content.Context; @@ -44,6 +45,11 @@ public class SpringLoadedState extends LauncherState { @Override public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { + + if (SHOW_HOME_GARDENING.get()) { + return super.getWorkspaceScaleAndTranslation(launcher); + } + DeviceProfile grid = launcher.getDeviceProfile(); Workspace ws = launcher.getWorkspace(); if (ws.getChildCount() == 0) { @@ -62,6 +68,9 @@ public class SpringLoadedState extends LauncherState { @Override protected float getDepthUnchecked(Context context) { + if (SHOW_HOME_GARDENING.get()) { + return 0; + } return 0.5f; } @@ -72,6 +81,10 @@ public class SpringLoadedState extends LauncherState { @Override public float getWorkspaceBackgroundAlpha(Launcher launcher) { + if (SHOW_HOME_GARDENING.get()) { + return 0; + } + return 0.2f; } }