Merge "Slow down entrance animation on tablets a bit" into nyc-dev

This commit is contained in:
Jorim Jaggi
2016-04-15 21:54:01 +00:00
committed by Android (Google) Code Review
5 changed files with 22 additions and 6 deletions

View File

@@ -36,4 +36,7 @@
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">space;back,home,recent;menu_ime</string>
<!-- Animation duration when using long press on recents to dock -->
<integer name="long_press_dock_anim_duration">290</integer>
</resources>

View File

@@ -98,4 +98,7 @@
<!-- Keyboard shortcuts helper -->
<dimen name="ksh_layout_width">488dp</dimen>
<!-- The offsets the tasks animate from when recents is launched while docking -->
<dimen name="recents_task_stack_animation_launched_while_docking_offset">192dp</dimen>
</resources>

View File

@@ -169,6 +169,9 @@
the smallest position when being launched. -->
<bool name="recents_grow_in_multiwindow">true</bool>
<!-- Animation duration when using long press on recents to dock -->
<integer name="long_press_dock_anim_duration">250</integer>
<!-- Recents: The relative range of visible tasks from the current scroll position
while the stack is focused. -->
<item name="recents_layout_focused_range_min" format="float" type="integer">-3</item>

View File

@@ -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<TaskView> 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<TaskView> 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)

View File

@@ -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;