Loading quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java +40 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch; Loading @@ -27,9 +30,15 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherState.ScaleAndTranslation; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.SpringAnimationBuilder; Loading @@ -38,9 +47,6 @@ import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import androidx.annotation.NonNull; import androidx.annotation.Nullable; /** * A {@link QuickstepAppTransitionManagerImpl} that also implements recents transitions from * {@link RecentsView}. Loading Loading @@ -144,8 +150,37 @@ public final class LauncherAppTransitionManagerImpl extends QuickstepAppTransiti @Override public Animator createStateElementAnimation(int index, float... values) { switch (index) { case INDEX_SHELF_ANIM: return mLauncher.getAllAppsController().createSpringAnimation(values); case INDEX_SHELF_ANIM: { AllAppsTransitionController aatc = mLauncher.getAllAppsController(); Animator springAnim = aatc.createSpringAnimation(values); if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) { // Translate hotseat with the shelf until reaching overview. float overviewProgress = OVERVIEW.getVerticalProgress(mLauncher); ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mLauncher); float shiftRange = aatc.getShiftRange(); if (values.length == 1) { values = new float[] {aatc.getProgress(), values[0]}; } ValueAnimator hotseatAnim = ValueAnimator.ofFloat(values); hotseatAnim.addUpdateListener(anim -> { float progress = (Float) anim.getAnimatedValue(); if (progress >= overviewProgress || mLauncher.isInState(BACKGROUND_APP)) { float hotseatShift = (progress - overviewProgress) * shiftRange; mLauncher.getHotseat().setTranslationY(hotseatShift + sat.translationY); } }); hotseatAnim.setInterpolator(LINEAR); hotseatAnim.setDuration(springAnim.getDuration()); AnimatorSet anim = new AnimatorSet(); anim.play(hotseatAnim); anim.play(springAnim); return anim; } return springAnim; } case INDEX_RECENTS_FADE_ANIM: return ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(), RecentsView.CONTENT_ALPHA, values); Loading quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class BackgroundAppState extends OverviewState { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // Translate hotseat offscreen if we show it in overview. ScaleAndTranslation scaleAndTranslation = super.getHotseatScaleAndTranslation(launcher); scaleAndTranslation.translationY = LayoutUtils.getShelfTrackingDistance(launcher, scaleAndTranslation.translationY += LayoutUtils.getShelfTrackingDistance(launcher, launcher.getDeviceProfile()); return scaleAndTranslation; } Loading quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +15 −12 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE; import android.content.Context; import android.graphics.Rect; import android.view.View; Loading @@ -47,6 +46,7 @@ import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; Loading Loading @@ -91,8 +91,19 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // If the hotseat icons are visible in overview, keep them in their normal position. return super.getWorkspaceScaleAndTranslation(launcher); DeviceProfile dp = launcher.getDeviceProfile(); if (dp.allAppsIconSizePx >= dp.iconSizePx) { return new ScaleAndTranslation(1, 0, 0); } else { float scale = ((float) dp.allAppsIconSizePx) / dp.iconSizePx; // Distance between the screen center (which is the pivotY for hotseat) and the // bottom of the hotseat (which we want to preserve) float distanceFromBottom = dp.heightPx / 2 - dp.hotseatBarBottomPaddingPx; // On scaling, the bottom edge is moved closer to the pivotY. We move the // hotseat back down so that the bottom edge's position is preserved. float translationY = distanceFromBottom * (1 - scale); return new ScaleAndTranslation(scale, 0, translationY); } } return getWorkspaceScaleAndTranslation(launcher); } Loading Loading @@ -160,15 +171,7 @@ public class OverviewState extends LauncherState { } public static float getDefaultSwipeHeight(Launcher launcher) { return getDefaultSwipeHeight(launcher, launcher.getDeviceProfile()); } public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) { float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; if (SysUINavigationMode.getMode(context) == SysUINavigationMode.Mode.NO_BUTTON) { swipeHeight -= dp.getInsets().bottom; } return swipeHeight; return LayoutUtils.getDefaultSwipeHeight(launcher, launcher.getDeviceProfile()); } @Override Loading quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +1 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import android.os.Bundle; import com.android.launcher3.testing.TestInformationHandler; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.OverviewState; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; Loading @@ -25,7 +24,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { switch (method) { case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { final float swipeHeight = OverviewState.getDefaultSwipeHeight(mContext, mDeviceProfile); LayoutUtils.getDefaultSwipeHeight(mContext, mDeviceProfile); response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); return response; } Loading quickstep/src/com/android/quickstep/util/LayoutUtils.java +17 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import androidx.annotation.IntDef; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.SysUINavigationMode; import java.lang.annotation.Retention; Loading @@ -39,12 +39,27 @@ public class LayoutUtils { @IntDef({MULTI_WINDOW_STRATEGY_HALF_SCREEN, MULTI_WINDOW_STRATEGY_DEVICE_PROFILE}) private @interface MultiWindowStrategy {} /** * The height for the swipe up motion */ public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) { float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; if (SysUINavigationMode.getMode(context) == SysUINavigationMode.Mode.NO_BUTTON) { swipeHeight -= dp.getInsets().bottom; } return swipeHeight; } public static void calculateLauncherTaskSize(Context context, DeviceProfile dp, Rect outRect) { float extraSpace; if (dp.isVerticalBarLayout()) { extraSpace = 0; } else { extraSpace = dp.hotseatBarSizePx + dp.verticalDragHandleSizePx; Resources res = context.getResources(); extraSpace = getDefaultSwipeHeight(context, dp) + dp.verticalDragHandleSizePx + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size) + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); } calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_HALF_SCREEN, outRect); } Loading Loading
quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java +40 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch; Loading @@ -27,9 +30,15 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherState.ScaleAndTranslation; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.SpringAnimationBuilder; Loading @@ -38,9 +47,6 @@ import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import androidx.annotation.NonNull; import androidx.annotation.Nullable; /** * A {@link QuickstepAppTransitionManagerImpl} that also implements recents transitions from * {@link RecentsView}. Loading Loading @@ -144,8 +150,37 @@ public final class LauncherAppTransitionManagerImpl extends QuickstepAppTransiti @Override public Animator createStateElementAnimation(int index, float... values) { switch (index) { case INDEX_SHELF_ANIM: return mLauncher.getAllAppsController().createSpringAnimation(values); case INDEX_SHELF_ANIM: { AllAppsTransitionController aatc = mLauncher.getAllAppsController(); Animator springAnim = aatc.createSpringAnimation(values); if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) { // Translate hotseat with the shelf until reaching overview. float overviewProgress = OVERVIEW.getVerticalProgress(mLauncher); ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mLauncher); float shiftRange = aatc.getShiftRange(); if (values.length == 1) { values = new float[] {aatc.getProgress(), values[0]}; } ValueAnimator hotseatAnim = ValueAnimator.ofFloat(values); hotseatAnim.addUpdateListener(anim -> { float progress = (Float) anim.getAnimatedValue(); if (progress >= overviewProgress || mLauncher.isInState(BACKGROUND_APP)) { float hotseatShift = (progress - overviewProgress) * shiftRange; mLauncher.getHotseat().setTranslationY(hotseatShift + sat.translationY); } }); hotseatAnim.setInterpolator(LINEAR); hotseatAnim.setDuration(springAnim.getDuration()); AnimatorSet anim = new AnimatorSet(); anim.play(hotseatAnim); anim.play(springAnim); return anim; } return springAnim; } case INDEX_RECENTS_FADE_ANIM: return ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(), RecentsView.CONTENT_ALPHA, values); Loading
quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class BackgroundAppState extends OverviewState { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // Translate hotseat offscreen if we show it in overview. ScaleAndTranslation scaleAndTranslation = super.getHotseatScaleAndTranslation(launcher); scaleAndTranslation.translationY = LayoutUtils.getShelfTrackingDistance(launcher, scaleAndTranslation.translationY += LayoutUtils.getShelfTrackingDistance(launcher, launcher.getDeviceProfile()); return scaleAndTranslation; } Loading
quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +15 −12 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE; import android.content.Context; import android.graphics.Rect; import android.view.View; Loading @@ -47,6 +46,7 @@ import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; Loading Loading @@ -91,8 +91,19 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // If the hotseat icons are visible in overview, keep them in their normal position. return super.getWorkspaceScaleAndTranslation(launcher); DeviceProfile dp = launcher.getDeviceProfile(); if (dp.allAppsIconSizePx >= dp.iconSizePx) { return new ScaleAndTranslation(1, 0, 0); } else { float scale = ((float) dp.allAppsIconSizePx) / dp.iconSizePx; // Distance between the screen center (which is the pivotY for hotseat) and the // bottom of the hotseat (which we want to preserve) float distanceFromBottom = dp.heightPx / 2 - dp.hotseatBarBottomPaddingPx; // On scaling, the bottom edge is moved closer to the pivotY. We move the // hotseat back down so that the bottom edge's position is preserved. float translationY = distanceFromBottom * (1 - scale); return new ScaleAndTranslation(scale, 0, translationY); } } return getWorkspaceScaleAndTranslation(launcher); } Loading Loading @@ -160,15 +171,7 @@ public class OverviewState extends LauncherState { } public static float getDefaultSwipeHeight(Launcher launcher) { return getDefaultSwipeHeight(launcher, launcher.getDeviceProfile()); } public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) { float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; if (SysUINavigationMode.getMode(context) == SysUINavigationMode.Mode.NO_BUTTON) { swipeHeight -= dp.getInsets().bottom; } return swipeHeight; return LayoutUtils.getDefaultSwipeHeight(launcher, launcher.getDeviceProfile()); } @Override Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +1 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import android.os.Bundle; import com.android.launcher3.testing.TestInformationHandler; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.OverviewState; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; Loading @@ -25,7 +24,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { switch (method) { case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { final float swipeHeight = OverviewState.getDefaultSwipeHeight(mContext, mDeviceProfile); LayoutUtils.getDefaultSwipeHeight(mContext, mDeviceProfile); response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); return response; } Loading
quickstep/src/com/android/quickstep/util/LayoutUtils.java +17 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import androidx.annotation.IntDef; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.SysUINavigationMode; import java.lang.annotation.Retention; Loading @@ -39,12 +39,27 @@ public class LayoutUtils { @IntDef({MULTI_WINDOW_STRATEGY_HALF_SCREEN, MULTI_WINDOW_STRATEGY_DEVICE_PROFILE}) private @interface MultiWindowStrategy {} /** * The height for the swipe up motion */ public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) { float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; if (SysUINavigationMode.getMode(context) == SysUINavigationMode.Mode.NO_BUTTON) { swipeHeight -= dp.getInsets().bottom; } return swipeHeight; } public static void calculateLauncherTaskSize(Context context, DeviceProfile dp, Rect outRect) { float extraSpace; if (dp.isVerticalBarLayout()) { extraSpace = 0; } else { extraSpace = dp.hotseatBarSizePx + dp.verticalDragHandleSizePx; Resources res = context.getResources(); extraSpace = getDefaultSwipeHeight(context, dp) + dp.verticalDragHandleSizePx + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size) + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); } calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_HALF_SCREEN, outRect); } Loading