Merge "Make workspace and hotseat scale down in widgets picker" into tm-qpr-dev am: fbd9ebd0a0

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

Change-Id: I1da2872a3a9a81fb757b972af3cc637020c1f89d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alex Chau
2022-07-12 11:51:01 +00:00
committed by Automerger Merge Worker
7 changed files with 28 additions and 13 deletions

View File

@@ -66,7 +66,6 @@
<dimen name="quickstep_fling_threshold_speed">0.5dp</dimen>
<!-- Launcher app transition -->
<item name="content_scale" format="float" type="dimen">0.97</item>
<dimen name="closing_window_trans_y">115dp</dimen>
<dimen name="quick_switch_scaling_scroll_threshold">100dp</dimen>

View File

@@ -200,7 +200,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final Handler mHandler;
private final float mContentScale;
private final float mClosingWindowTransY;
private final float mMaxShadowRadius;
@@ -245,7 +244,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mBackAnimationController = new LauncherBackAnimationController(mLauncher, this);
Resources res = mLauncher.getResources();
mContentScale = res.getFloat(R.dimen.content_scale);
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
@@ -483,8 +481,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
: new float[]{0, 1};
float[] scales = isAppOpening
? new float[]{1, mContentScale}
: new float[]{mContentScale, 1};
? new float[]{1, mDeviceProfile.workspaceContentScale}
: new float[]{mDeviceProfile.workspaceContentScale, 1};
// Pause expensive view updates as they can lead to layer thrashing and skipped frames.
mLauncher.pauseExpensiveViewUpdates();

View File

@@ -31,8 +31,6 @@ import com.android.launcher3.util.Themes;
*/
public class AllAppsState extends LauncherState {
private static final float WORKSPACE_SCALE_FACTOR = 0.97f;
private static final int STATE_FLAGS =
FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS | FLAG_HOTSEAT_INACCESSIBLE;
@@ -60,7 +58,8 @@ public class AllAppsState extends LauncherState {
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
return new ScaleAndTranslation(WORKSPACE_SCALE_FACTOR, NO_OFFSET, NO_OFFSET);
return new ScaleAndTranslation(launcher.getDeviceProfile().workspaceContentScale, NO_OFFSET,
NO_OFFSET);
}
@Override
@@ -71,7 +70,7 @@ public class AllAppsState extends LauncherState {
ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW
.getWorkspaceScaleAndTranslation(launcher);
return new ScaleAndTranslation(
WORKSPACE_SCALE_FACTOR,
launcher.getDeviceProfile().workspaceContentScale,
overviewScaleAndTranslation.translationX,
overviewScaleAndTranslation.translationY);
}

View File

@@ -413,4 +413,7 @@
<dimen name="bottom_sheet_handle_height">4dp</dimen>
<dimen name="bottom_sheet_handle_margin">16dp</dimen>
<dimen name="bottom_sheet_handle_corner_radius">2dp</dimen>
<!-- State transition -->
<item name="workspace_content_scale" format="float" type="dimen">0.97</item>
</resources>

View File

@@ -107,6 +107,7 @@ public class DeviceProfile {
public Rect cellLayoutPaddingPx = new Rect();
public final int edgeMarginPx;
public final float workspaceContentScale;
public float workspaceSpringLoadShrunkTop;
public float workspaceSpringLoadShrunkBottom;
public final int workspaceSpringLoadedBottomSpace;
@@ -298,6 +299,7 @@ public class DeviceProfile {
}
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
workspaceContentScale = res.getFloat(R.dimen.workspace_content_scale);
desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res);
desiredWorkspaceHorizontalMarginOriginalPx = desiredWorkspaceHorizontalMarginPx;

View File

@@ -30,7 +30,10 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE;
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR;
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY;
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WIDGET_TRANSITION;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherAnimUtils.WORKSPACE_SCALE_PROPERTY_FACTORY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE;
@@ -96,6 +99,7 @@ import android.os.Trace;
import android.os.UserHandle;
import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.FloatProperty;
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
@@ -302,6 +306,11 @@ public class Launcher extends StatefulActivity<LauncherState>
public static final int DISPLAY_WORKSPACE_TRACE_COOKIE = 0;
public static final int DISPLAY_ALL_APPS_TRACE_COOKIE = 1;
private static final FloatProperty<Workspace<?>> WORKSPACE_WIDGET_SCALE =
WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WIDGET_TRANSITION);
private static final FloatProperty<Hotseat> HOTSEAT_WIDGET_SCALE =
HOTSEAT_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WIDGET_TRANSITION);
private Configuration mOldConfig;
@Thunk
@@ -3239,7 +3248,12 @@ public class Launcher extends StatefulActivity<LauncherState>
* @param progress Transition progress from 0 to 1; where 0 => home and 1 => widgets.
*/
public void onWidgetsTransition(float progress) {
// No-Op
if (mDeviceProfile.isTablet) {
float scale =
Utilities.comp(Utilities.comp(mDeviceProfile.workspaceContentScale) * progress);
WORKSPACE_WIDGET_SCALE.set(getWorkspace(), scale);
HOTSEAT_WIDGET_SCALE.set(getHotseat(), scale);
}
}
private static class NonConfigInstance {

View File

@@ -81,9 +81,9 @@ public class LauncherAnimUtils {
new MultiScalePropertyFactory<Hotseat>("hotseat_scale_property");
public static final int SCALE_INDEX_UNFOLD_ANIMATION = 1;
public static final int SCALE_INDEX_UNLOCK_ANIMATION = 2;
public static final int SCALE_INDEX_WORKSPACE_STATE = 3;
public static final int SCALE_INDEX_REVEAL_ANIM = 4;
public static final int SCALE_INDEX_WORKSPACE_STATE = 2;
public static final int SCALE_INDEX_REVEAL_ANIM = 3;
public static final int SCALE_INDEX_WIDGET_TRANSITION = 4;
/** Increase the duration if we prevented the fling, as we are going against a high velocity. */
public static int blockedFlingDurationFactor(float velocity) {