From e370e15056d45eba83d6ad96d9be46a17eddff29 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Fri, 15 Apr 2016 14:13:33 -0700 Subject: [PATCH] Slow down entrance animation on tablets a bit Also fix an issue where resize was not called. And make the translation a bit larger, because the animation is longer. Bug: 27870534 Change-Id: Ia6128db8108fe57bee96816fc95fd0811d941ffb --- packages/SystemUI/res/values-sw600dp/config.xml | 3 +++ packages/SystemUI/res/values-sw600dp/dimens.xml | 3 +++ packages/SystemUI/res/values/config.xml | 3 +++ .../recents/views/TaskStackAnimationHelper.java | 11 +++++++---- .../android/systemui/stackdivider/DividerView.java | 8 ++++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml index 1f6bbd342b39d..fd147cd174042 100644 --- a/packages/SystemUI/res/values-sw600dp/config.xml +++ b/packages/SystemUI/res/values-sw600dp/config.xml @@ -36,4 +36,7 @@ space;back,home,recent;menu_ime + + 290 + diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index a2010be4f6a1f..6c5a313f5931b 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -98,4 +98,7 @@ 488dp + + + 192dp diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 42798a49b3aff..c54db378bf674 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -169,6 +169,9 @@ the smallest position when being launched. --> true + + 250 + -3 diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java index 76aab59dde714..665d9ad940028 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java @@ -78,7 +78,6 @@ public class TaskStackAnimationHelper { public static final int ENTER_FROM_HOME_ALPHA_DURATION = 100; public static final int ENTER_FROM_HOME_TRANSLATION_DURATION = 333; - public static final int ENTER_WHILE_DOCKING_DURATION = 250; private static final PathInterpolator ENTER_FROM_HOME_TRANSLATION_INTERPOLATOR = new PathInterpolator(0, 0, 0, 1f); @@ -120,6 +119,7 @@ public class TaskStackAnimationHelper { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); Resources res = mStackView.getResources(); + Resources appResources = mStackView.getContext().getApplicationContext().getResources(); TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm(); TaskStackViewScroller stackScroller = mStackView.getScroller(); @@ -136,8 +136,8 @@ public class TaskStackAnimationHelper { R.dimen.recents_task_stack_animation_affiliate_enter_offset); int launchedWhileDockingOffset = res.getDimensionPixelSize( R.dimen.recents_task_stack_animation_launched_while_docking_offset); - boolean isLandscape = mStackView.getContext().getApplicationContext().getResources() - .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; + boolean isLandscape = appResources.getConfiguration().orientation + == Configuration.ORIENTATION_LANDSCAPE; // Prepare each of the task views for their enter animation from front to back List taskViews = mStackView.getTaskViews(); @@ -190,6 +190,7 @@ public class TaskStackAnimationHelper { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); Resources res = mStackView.getResources(); + Resources appRes = mStackView.getContext().getApplicationContext().getResources(); TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm(); TaskStackViewScroller stackScroller = mStackView.getScroller(); @@ -205,6 +206,8 @@ public class TaskStackAnimationHelper { R.integer.recents_task_enter_from_app_duration); int taskViewEnterFromAffiliatedAppDuration = res.getInteger( R.integer.recents_task_enter_from_affiliated_app_duration); + int dockGestureAnimDuration = appRes.getInteger( + R.integer.long_press_dock_anim_duration); // Create enter animations for each of the views from front to back List taskViews = mStackView.getTaskViews(); @@ -267,7 +270,7 @@ public class TaskStackAnimationHelper { } else if (launchState.launchedViaDockGesture) { // Animate the tasks up AnimationProps taskAnimation = new AnimationProps() - .setDuration(AnimationProps.BOUNDS, (int) (ENTER_WHILE_DOCKING_DURATION + + .setDuration(AnimationProps.BOUNDS, (int) (dockGestureAnimDuration + (taskIndexFromBack * 2f * FRAME_OFFSET_MS))) .setInterpolator(AnimationProps.BOUNDS, ENTER_WHILE_DOCKING_INTERPOLATOR) diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 4d1c6ba367371..67c4008b4dc6c 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -121,6 +121,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, private int mDividerWindowWidth; private int mDividerSize; private int mTouchElevation; + private int mLongPressEntraceAnimDuration; private final Rect mDockedRect = new Rect(); private final Rect mDockedTaskRect = new Rect(); @@ -222,6 +223,8 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDividerSize = mDividerWindowWidth - 2 * mDividerInsets; mTouchElevation = getResources().getDimensionPixelSize( R.dimen.docked_stack_divider_lift_elevation); + mLongPressEntraceAnimDuration = getResources().getInteger( + R.integer.long_press_dock_anim_duration); mGrowRecents = getResources().getBoolean(R.bool.recents_grow_in_multiwindow); mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop(); mFlingAnimationUtils = new FlingAnimationUtils(getContext(), 0.3f); @@ -762,7 +765,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, public void resizeStack(int position, int taskPosition, SnapTarget taskSnapTarget) { calculateBoundsForPosition(position, mDockSide, mDockedRect); - if (mDockedRect.equals(mLastResizeRect)) { + if (mDockedRect.equals(mLastResizeRect) && !mEntranceAnimationRunning) { return; } @@ -1027,7 +1030,8 @@ public class DividerView extends FrameLayout implements OnTouchListener, // Delay switching resizing mode because this might cause jank in recents animation // that's long than this animation. stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(), - 250 /* startDelay */, Interpolators.FAST_OUT_SLOW_IN, 200 /* endDelay */); + mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN, + 200 /* endDelay */); } if (mGrowAfterRecentsDrawn) { mGrowAfterRecentsDrawn = false;