diff --git a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java index 86310fa14f..4e59790771 100644 --- a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java +++ b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java @@ -70,7 +70,8 @@ public interface QuickstepSystemShortcut { RecentsView recentsView = mTarget.getOverviewPanel(); recentsView.initiateSplitSelect( - new SplitSelectSource(view, new BitmapDrawable(bitmap), intent, mPosition)); + new SplitSelectSource(mOriginalView, new BitmapDrawable(bitmap), intent, + mPosition)); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index c07ba2d327..7d95743bc9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar; import static android.view.HapticFeedbackConstants.LONG_PRESS; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW; import static com.android.launcher3.taskbar.Utilities.appendFlag; @@ -34,7 +35,6 @@ import android.view.WindowInsets; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Utilities; -import com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.quickstep.AnimatedFloat; @@ -564,7 +564,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, false); if (applyState) { - applyState(TaskbarAllAppsSlideInView.DEFAULT_CLOSE_DURATION); + applyState(ALL_APPS.getTransitionDuration( + mControllers.taskbarActivityContext, false /* isToState */)); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index bc77c1021c..74b1c6ca1a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -263,12 +263,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar View child = mTaskbarView.getChildAt(i); int positionInHotseat = -1; - if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get() && i == count - 1) { + boolean isRtl = Utilities.isRtl(child.getResources()); + if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get() + && ((isRtl && i == 0) || (!isRtl && i == count - 1))) { // Note that there is no All Apps button in the hotseat, this position is only used // as its convenient for animation purposes. - positionInHotseat = Utilities.isRtl(child.getResources()) + positionInHotseat = isRtl ? -1 - : mActivity.getDeviceProfile().inv.numShownHotseatIcons; + : mActivity.getDeviceProfile().numShownHotseatIcons; setter.setViewAlpha(child, 0, LINEAR); } else if (child.getTag() instanceof ItemInfo) { diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index a37ebac2c3..2d7ce3245a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -15,13 +15,16 @@ */ package com.android.launcher3.taskbar.allapps; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE; +import static com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE; import android.animation.PropertyValuesHolder; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; +import android.view.animation.Interpolator; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; @@ -33,9 +36,6 @@ import java.util.Optional; /** Wrapper for taskbar all apps with slide-in behavior. */ public class TaskbarAllAppsSlideInView extends AbstractSlideInView implements Insettable, DeviceProfile.OnDeviceProfileChangeListener { - static final int DEFAULT_OPEN_DURATION = 500; - public static final int DEFAULT_CLOSE_DURATION = 200; - private TaskbarAllAppsContainerView mAppsView; private OnCloseListener mOnCloseBeginListener; private float mShiftRange; @@ -61,7 +61,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView { AbstractFloatingView.closeOpenContainer( mContext, AbstractFloatingView.TYPE_ACTION_POPUP); diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 86f26c3673..00a98c0647 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -118,7 +118,7 @@ public final class RecentsViewStateController extends if (toState == OVERVIEW_SPLIT_SELECT) { // Animation to "dismiss" selected taskView PendingAnimation splitSelectInitAnimation = mRecentsView.createSplitSelectInitAnimation( - toState.getTransitionDuration(mLauncher)); + toState.getTransitionDuration(mLauncher, true /* isToState */)); // Add properties to shift remaining taskViews to get out of placeholder view splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first, toState.getSplitSelectTranslation(mLauncher), LINEAR); diff --git a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java index df0ac7ce22..fe0bca6646 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java +++ b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java @@ -33,12 +33,12 @@ import com.android.systemui.shared.plugins.PluginInstance; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.plugins.PluginManagerImpl; import com.android.systemui.shared.plugins.PluginPrefs; +import com.android.systemui.shared.system.UncaughtExceptionPreHandlerManager; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.Set; public class PluginManagerWrapper { @@ -48,6 +48,9 @@ public class PluginManagerWrapper { public static final String PLUGIN_CHANGED = PluginManager.PLUGIN_CHANGED; + private static final UncaughtExceptionPreHandlerManager UNCAUGHT_EXCEPTION_PRE_HANDLER_MANAGER = + new UncaughtExceptionPreHandlerManager(); + private final Context mContext; private final PluginManager mPluginManager; private final PluginEnablerImpl mPluginEnabler; @@ -67,7 +70,7 @@ public class PluginManagerWrapper { mPluginManager = new PluginManagerImpl(c, instanceManagerFactory, Utilities.IS_DEBUG_DEVICE, - Optional.ofNullable(Thread.getDefaultUncaughtExceptionHandler()), mPluginEnabler, + UNCAUGHT_EXCEPTION_PRE_HANDLER_MANAGER, mPluginEnabler, new PluginPrefs(c), privilegedPlugins); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index 3c5f216772..c25a815050 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -38,8 +38,8 @@ public class AllAppsState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { - return 150; + public int getTransitionDuration(Context context, boolean isToState) { + return isToState ? 500 : 300; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 6f084a1f97..0c49e5fc69 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -40,7 +40,7 @@ public class OverviewModalTaskState extends OverviewState { } @Override - public int getTransitionDuration(Context launcher) { + public int getTransitionDuration(Context launcher, boolean isToState) { return 300; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 2ec8d9db65..699ce9783c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -58,7 +58,7 @@ public class OverviewState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { // In gesture modes, overview comes in all the way from the side, so give it more time. return DisplayController.getNavigationMode(context).hasGestures ? 380 : 250; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index b1d83e7c31..b5b03a1ec6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -42,6 +42,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SC import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; @@ -50,6 +51,8 @@ import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesT import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD; import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; +import static com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE; +import static com.android.systemui.animation.Interpolators.EMPHASIZED_DECELERATE; import android.animation.ValueAnimator; @@ -179,12 +182,17 @@ public class QuickstepAtomicAnimationFactory extends } config.duration = Math.max(config.duration, mHintToNormalDuration); } else if (fromState == ALL_APPS && toState == NORMAL) { - config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL, - 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, - 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); - config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, + boolean isTablet = mActivity.getDeviceProfile().isTablet; + config.setInterpolator(ANIM_ALL_APPS_FADE, + isTablet ? FINAL_FRAME : Interpolators.clampToProgress(LINEAR, + 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, + 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); + config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); + config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE); + } else if (fromState == NORMAL && toState == ALL_APPS) { + config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE); } } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 7ec12439cb..4da1d41091 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -180,7 +180,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch // Normally we compute the duration based on the velocity and distance to the given // state, but since the hint state tracks the entire screen without a clear endpoint, we // need to manually set the duration to a reasonable value. - animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher)); + animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher, true /* isToState */)); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 27a55c3ff3..1504c12d71 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -21,10 +21,9 @@ import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; +import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; @@ -131,10 +130,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? INSTANT - : Interpolators.clampToProgress(ACCEL, + : Interpolators.clampToProgress(LINEAR, ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD)); - builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL, + builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD)); return builder; @@ -145,10 +144,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? FINAL_FRAME - : Interpolators.clampToProgress(DEACCEL, + : Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); - builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, + builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); return builder; diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 5094d49200..f68bbbce62 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -112,7 +112,7 @@ public class FallbackRecentsStateController implements StateHandler taskViewsFloat = diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsState.java b/quickstep/src/com/android/quickstep/fallback/RecentsState.java index 9705bb6fd5..77db6b79f4 100644 --- a/quickstep/src/com/android/quickstep/fallback/RecentsState.java +++ b/quickstep/src/com/android/quickstep/fallback/RecentsState.java @@ -77,7 +77,7 @@ public class RecentsState implements BaseState { } @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { return 250; } diff --git a/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java index 5cf4f0b97f..3cec1a4f1a 100644 --- a/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java +++ b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java @@ -82,7 +82,7 @@ public class OverviewToHomeAnim { // WorkspaceRevealAnim handles the depth, so don't interfere. config.animFlags |= StateAnimationConfig.SKIP_DEPTH_CONTROLLER; } - config.duration = startState.getTransitionDuration(mLauncher); + config.duration = startState.getTransitionDuration(mLauncher, false /* isToState */); AnimatorSet stateAnim = stateManager.createAtomicAnimation( startState, NORMAL, config); stateAnim.addListener(new AnimationSuccessListener() { diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index 54420de6cb..c980d1eac2 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -196,6 +196,13 @@ public class FloatingTaskView extends FrameLayout { 0, 1, ACCEL); animation.addFloat(mThumbnailView, LauncherAnimUtils.VIEW_ALPHA, 1, 0, DEACCEL_3); + } else if (isStagedTask) { + // Fade in the placeholder view when split is initiated from homescreen / all apps + // icons. + if (mSplitPlaceholderView.getAlpha() == 0) { + animation.addFloat(mSplitPlaceholderView, SplitPlaceholderView.ALPHA_FLOAT, + 0.3f, 1, ACCEL); + } } MultiValueUpdateListener listener = new MultiValueUpdateListener() { diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 71b2cea444..224c1f6c75 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2757,16 +2757,15 @@ public abstract class RecentsView { FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON | FLAG_HAS_SYS_UI_SCRIM) { @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { // Arbitrary duration, when going to NORMAL we use the state we're coming from instead. return 0; } diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java index 1c36db1048..f709acabed 100644 --- a/src/com/android/launcher3/ResourceUtils.java +++ b/src/com/android/launcher3/ResourceUtils.java @@ -31,6 +31,10 @@ public class ResourceUtils { public static final String NAVBAR_HEIGHT = "navigation_bar_height"; public static final String NAVBAR_HEIGHT_LANDSCAPE = "navigation_bar_height_landscape"; + public static final String STATUS_BAR_HEIGHT = "status_bar_height"; + public static final String STATUS_BAR_HEIGHT_LANDSCAPE = "status_bar_height_landscape"; + public static final String STATUS_BAR_HEIGHT_PORTRAIT = "status_bar_height_portrait"; + public static int getNavbarSize(String resName, Resources res) { return getDimenByName(resName, res, DEFAULT_NAVBAR_VALUE); } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 78771ce84a..836d4b8fc8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2118,7 +2118,7 @@ public class Workspace extends PagedView final Runnable onCompleteCallback = onCompleteRunnable; mLauncher.getDragController().animateDragViewToOriginalPosition( /* onComplete= */ callbackList::executeAllAndDestroy, cell, - SPRING_LOADED.getTransitionDuration(mLauncher)); + SPRING_LOADED.getTransitionDuration(mLauncher, true /* isToState */)); mLauncher.getStateManager().goToState(NORMAL, /* delay= */ 0, onCompleteCallback == null ? null diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index bf34df11fc..3600bd26b1 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -255,8 +255,6 @@ public class AllAppsTransitionController anim.setInterpolator(verticalProgressInterpolator); anim.addListener(getProgressAnimatorListener()); builder.add(anim); - // Use ANIM_VERTICAL_PROGRESS's interpolator to determine state transition threshold. - builder.setInterpolator(verticalProgressInterpolator); setAlphas(toState, config, builder); diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java index 5a46ce1b18..4ff5d5e973 100644 --- a/src/com/android/launcher3/anim/Interpolators.java +++ b/src/com/android/launcher3/anim/Interpolators.java @@ -47,13 +47,6 @@ public class Interpolators { public static final Interpolator DEACCEL_2_5 = new DecelerateInterpolator(2.5f); public static final Interpolator DEACCEL_3 = new DecelerateInterpolator(3f); - /** - * The decelerating emphasized interpolator. Used for hero / emphasized movement of content that - * is appearing e.g. when coming from off screen - */ - public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator( - 0.05f, 0.7f, 0.1f, 1f); - public static final Interpolator ACCEL_DEACCEL = new AccelerateDecelerateInterpolator(); public static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f); diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java index 29e7c1854d..f9916d0b3b 100644 --- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java +++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java @@ -87,7 +87,8 @@ class PinShortcutRequestActivityInfo extends ShortcutConfigActivityInfo { // Total duration for the drop animation to complete. long duration = mContext.getResources().getInteger(R.integer.config_dropAnimMaxDuration) + LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY + - LauncherState.SPRING_LOADED.getTransitionDuration(Launcher.getLauncher(mContext)); + LauncherState.SPRING_LOADED.getTransitionDuration(Launcher.getLauncher(mContext), + true /* isToState */); // Delay the actual accept() call until the drop animation is complete. return PinRequestHelper.createWorkspaceItemFromPinItemRequest( mContext, mRequest, duration); diff --git a/src/com/android/launcher3/statemanager/BaseState.java b/src/com/android/launcher3/statemanager/BaseState.java index 122573cfa1..4a68dda331 100644 --- a/src/com/android/launcher3/statemanager/BaseState.java +++ b/src/com/android/launcher3/statemanager/BaseState.java @@ -36,7 +36,7 @@ public interface BaseState { /** * @return How long the animation to this state should take (or from this state to NORMAL). */ - int getTransitionDuration(Context context); + int getTransitionDuration(Context context, boolean isToState); /** * Returns the state to go back to from this state diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 1767939114..2aa9ddeb50 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -253,8 +253,8 @@ public class StateManager> { // Since state mBaseState can be reached from multiple states, just assume that the // transition plays in reverse and use the same duration as previous state. mConfig.duration = state == mBaseState - ? fromState.getTransitionDuration(mActivity) - : state.getTransitionDuration(mActivity); + ? fromState.getTransitionDuration(mActivity, false /* isToState */) + : state.getTransitionDuration(mActivity, true /* isToState */); prepareForAtomicAnimation(fromState, state, mConfig); AnimatorSet animation = createAnimationToNewWorkspaceInternal(state).buildAnim(); if (listener != null) { diff --git a/src/com/android/launcher3/states/HintState.java b/src/com/android/launcher3/states/HintState.java index 8b520165ce..4cfced8561 100644 --- a/src/com/android/launcher3/states/HintState.java +++ b/src/com/android/launcher3/states/HintState.java @@ -43,7 +43,7 @@ public class HintState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { return 80; } diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java index e311bc8740..15cdc20cef 100644 --- a/src/com/android/launcher3/states/SpringLoadedState.java +++ b/src/com/android/launcher3/states/SpringLoadedState.java @@ -39,7 +39,7 @@ public class SpringLoadedState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { return 150; } diff --git a/src/com/android/launcher3/util/window/WindowManagerProxy.java b/src/com/android/launcher3/util/window/WindowManagerProxy.java index 61b7fa106d..92f718ef45 100644 --- a/src/com/android/launcher3/util/window/WindowManagerProxy.java +++ b/src/com/android/launcher3/util/window/WindowManagerProxy.java @@ -22,6 +22,9 @@ import static com.android.launcher3.ResourceUtils.INVALID_RESOURCE_HANDLE; import static com.android.launcher3.ResourceUtils.NAVBAR_HEIGHT; import static com.android.launcher3.ResourceUtils.NAVBAR_HEIGHT_LANDSCAPE; import static com.android.launcher3.ResourceUtils.NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE; +import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT; +import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT_LANDSCAPE; +import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT_PORTRAIT; import static com.android.launcher3.Utilities.dpiFromPx; import static com.android.launcher3.util.MainThreadInitializedObject.forOverride; import static com.android.launcher3.util.RotationUtils.deltaRotation; @@ -152,20 +155,26 @@ public class WindowManagerProxy implements ResourceBasedOverride { boolean isTablet = config.smallestScreenWidthDp > MIN_TABLET_WIDTH; boolean isGesture = isGestureNav(context); + boolean isPortrait = config.screenHeightDp > config.screenWidthDp; int bottomNav = isTablet ? 0 - : (config.screenHeightDp > config.screenWidthDp - ? getDimenByName(NAVBAR_HEIGHT, systemRes) + : (isPortrait + ? getDimenByName(systemRes, NAVBAR_HEIGHT) : (isGesture - ? getDimenByName(NAVBAR_HEIGHT_LANDSCAPE, systemRes) + ? getDimenByName(systemRes, NAVBAR_HEIGHT_LANDSCAPE) : 0)); Insets newNavInsets = Insets.of(navInsets.left, navInsets.top, navInsets.right, bottomNav); insetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets); insetsBuilder.setInsetsIgnoringVisibility(WindowInsets.Type.navigationBars(), newNavInsets); Insets statusBarInsets = oldInsets.getInsets(WindowInsets.Type.statusBars()); - int statusBarHeight = getDimenByName("status_bar_height", systemRes); + + + int statusBarHeight = getDimenByName(systemRes, + (isPortrait) ? STATUS_BAR_HEIGHT_PORTRAIT : STATUS_BAR_HEIGHT_LANDSCAPE, + STATUS_BAR_HEIGHT); + Insets newStatusBarInsets = Insets.of( statusBarInsets.left, Math.max(statusBarInsets.top, statusBarHeight), @@ -221,23 +230,26 @@ public class WindowManagerProxy implements ResourceBasedOverride { boolean isTabletOrGesture = isTablet || (Utilities.ATLEAST_R && isGestureNav(context)); - int statusBarHeight = getDimenByName("status_bar_height", systemRes); + int statusBarHeightPortrait = getDimenByName(systemRes, + STATUS_BAR_HEIGHT_PORTRAIT, STATUS_BAR_HEIGHT); + int statusBarHeightLandscape = getDimenByName(systemRes, + STATUS_BAR_HEIGHT_LANDSCAPE, STATUS_BAR_HEIGHT); int navBarHeightPortrait, navBarHeightLandscape, navbarWidthLandscape; navBarHeightPortrait = isTablet ? (mTaskbarDrawnInProcess ? 0 : systemRes.getDimensionPixelSize(R.dimen.taskbar_size)) - : getDimenByName(NAVBAR_HEIGHT, systemRes); + : getDimenByName(systemRes, NAVBAR_HEIGHT); navBarHeightLandscape = isTablet ? (mTaskbarDrawnInProcess ? 0 : systemRes.getDimensionPixelSize(R.dimen.taskbar_size)) : (isTabletOrGesture - ? getDimenByName(NAVBAR_HEIGHT_LANDSCAPE, systemRes) : 0); + ? getDimenByName(systemRes, NAVBAR_HEIGHT_LANDSCAPE) : 0); navbarWidthLandscape = isTabletOrGesture ? 0 - : getDimenByName(NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE, systemRes); + : getDimenByName(systemRes, NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE); WindowBounds[] result = new WindowBounds[4]; Point tempSize = new Point(); @@ -247,13 +259,15 @@ public class WindowManagerProxy implements ResourceBasedOverride { rotateSize(tempSize, rotationChange); Rect bounds = new Rect(0, 0, tempSize.x, tempSize.y); - int navBarHeight, navbarWidth; + int navBarHeight, navbarWidth, statusBarHeight; if (tempSize.y > tempSize.x) { navBarHeight = navBarHeightPortrait; navbarWidth = 0; + statusBarHeight = statusBarHeightPortrait; } else { navBarHeight = navBarHeightLandscape; navbarWidth = navbarWidthLandscape; + statusBarHeight = statusBarHeightLandscape; } Rect insets = new Rect(safeCutout); @@ -276,10 +290,18 @@ public class WindowManagerProxy implements ResourceBasedOverride { /** * Wrapper around the utility method for easier emulation */ - protected int getDimenByName(String resName, Resources res) { + protected int getDimenByName(Resources res, String resName) { return ResourceUtils.getDimenByName(resName, res, 0); } + /** + * Wrapper around the utility method for easier emulation + */ + protected int getDimenByName(Resources res, String resName, String fallback) { + int dimen = ResourceUtils.getDimenByName(resName, res, -1); + return dimen > -1 ? dimen : getDimenByName(res, fallback); + } + protected boolean isGestureNav(Context context) { return ResourceUtils.getIntegerByName("config_navBarInteractionMode", context.getResources(), INVALID_RESOURCE_HANDLE) == 2; diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java index ed31e8d130..47503b118e 100644 --- a/src/com/android/launcher3/views/AbstractSlideInView.java +++ b/src/com/android/launcher3/views/AbstractSlideInView.java @@ -231,13 +231,17 @@ public abstract class AbstractSlideInView if (mSwipeDetector.isIdleState()) { mOpenCloseAnimator .setDuration(defaultDuration) - .setInterpolator(Interpolators.ACCEL); + .setInterpolator(getIdleInterpolator()); } else { mOpenCloseAnimator.setInterpolator(mScrollInterpolator); } mOpenCloseAnimator.start(); } + protected Interpolator getIdleInterpolator() { + return Interpolators.ACCEL; + } + protected void onCloseComplete() { mIsOpen = false; getPopupContainer().removeView(this); diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java index 8a435c9647..2f8e6806e0 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -39,8 +39,8 @@ public class AllAppsState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { - return 320; + public int getTransitionDuration(Context context, boolean isToState) { + return isToState ? 500 : 300; } @Override diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java index d1543175f4..7a228c42b8 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java @@ -34,7 +34,7 @@ public class OverviewState extends LauncherState { } @Override - public int getTransitionDuration(Context context) { + public int getTransitionDuration(Context context, boolean isToState) { return 250; } diff --git a/tests/src/com/android/launcher3/deviceemulator/TestWindowManagerProxy.java b/tests/src/com/android/launcher3/deviceemulator/TestWindowManagerProxy.java index ca2f81e377..cbea688a9a 100644 --- a/tests/src/com/android/launcher3/deviceemulator/TestWindowManagerProxy.java +++ b/tests/src/com/android/launcher3/deviceemulator/TestWindowManagerProxy.java @@ -43,9 +43,14 @@ public class TestWindowManagerProxy extends WindowManagerProxy { } @Override - protected int getDimenByName(String resName, Resources res) { + protected int getDimenByName(Resources res, String resName) { Integer mock = mDevice.resourceOverrides.get(resName); - return mock != null ? mock : super.getDimenByName(resName, res); + return mock != null ? mock : super.getDimenByName(res, resName); + } + + @Override + protected int getDimenByName(Resources res, String resName, String fallback) { + return getDimenByName(res, resName); } @Override