OSDN Git Service

Minor tweaks
authorWinson <winsonc@google.com>
Sat, 13 Feb 2016 00:06:04 +0000 (16:06 -0800)
committerWinson <winsonc@google.com>
Sat, 13 Feb 2016 01:07:14 +0000 (17:07 -0800)
- Initializing to focused state when going into Recents
- Dimming the front-most tasks to highlight the focused task
- Fixing wrong call to resize in the LruCache

Change-Id: I41833a9dc59a9bdf4a94b698e4800c1019bceb01

14 files changed:
packages/SystemUI/res/values-sw600dp/dimens.xml
packages/SystemUI/res/values/dimens.xml
packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
packages/SystemUI/src/com/android/systemui/recents/views/AnimationProps.java
packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java

index c0652d8..122413d 100644 (file)
     <dimen name="navigation_key_padding">25dp</dimen>
 
     <dimen name="qs_expand_margin">0dp</dimen>
+
+    <!-- The top padding for the task stack. -->
+    <dimen name="recents_stack_top_padding">40dp</dimen>
+
+    <!-- The side padding for the task stack. -->
+    <dimen name="recents_stack_left_right_padding">64dp</dimen>
 </resources>
index 6702cef..f3b9199 100644 (file)
     <!-- The height of the search bar space. -->
     <dimen name="recents_search_bar_space_height">64dp</dimen>
 
-    <!-- The side padding for the task stack as a percentage of the width. -->
-    <item name="recents_stack_width_padding_percentage" format="float" type="dimen">0.03333</item>
-
     <!-- The overscroll percentage allowed on the stack. -->
     <item name="recents_stack_overscroll_percentage" format="float" type="dimen">0.0875</item>
 
-    <!-- The top offset for the task stack. -->
+    <!-- The top padding for the task stack. -->
     <dimen name="recents_stack_top_padding">16dp</dimen>
 
+    <!-- The side padding for the task stack. -->
+    <dimen name="recents_stack_left_right_padding">16dp</dimen>
+
     <!-- The dimesnsions of the dismiss all recents button. -->
     <dimen name="recents_dismiss_all_button_size">48dp</dimen>
 
     <dimen name="recents_stack_overscroll">24dp</dimen>
 
     <!-- The size of the peek area at the top of the stack. -->
-    <dimen name="recents_layout_focused_peek_size">@dimen/recents_history_button_height</dimen>
+    <dimen name="recents_layout_focused_top_peek_size">@dimen/recents_history_button_height</dimen>
+
+    <!-- The size of the peek area at the bottom of the stack. -->
+    <dimen name="recents_layout_focused_bottom_peek_size">@dimen/recents_history_button_height</dimen>
 
     <!-- The height of the history button. -->
     <dimen name="recents_history_button_height">48dp</dimen>
index 843adc1..3c4adb2 100644 (file)
@@ -186,6 +186,7 @@ public class RecentsHistoryView extends LinearLayout
         mRecyclerView = (RecyclerView) findViewById(R.id.list);
         mRecyclerView.setAdapter(mAdapter);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+        mRecyclerView.getItemAnimator().setRemoveDuration(100);
         ItemTouchHelper touchHelper = new ItemTouchHelper(mItemTouchHandler);
         touchHelper.attachToRecyclerView(mRecyclerView);
     }
index 9d3f3e8..e86b92d 100644 (file)
@@ -18,6 +18,7 @@ package com.android.systemui.recents.misc;
 
 import android.animation.Animator;
 import android.animation.AnimatorSet;
+import android.annotation.FloatRange;
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.graphics.RectF;
@@ -104,6 +105,46 @@ public class Utilities {
         return setOut;
     }
 
+    /**
+     * @return the clamped {@param value} between the provided {@param min} and {@param max}.
+     */
+    public static float clamp(float value, float min, float max) {
+        return Math.max(min, Math.min(max, value));
+    }
+
+    /**
+     * @return the clamped {@param value} between the provided {@param min} and {@param max}.
+     */
+    public static int clamp(int value, int min, int max) {
+        return Math.max(min, Math.min(max, value));
+    }
+
+    /**
+     * @return the clamped {@param value} between 0 and 1.
+     */
+    public static float clamp01(float value) {
+        return Math.max(0f, Math.min(1f, value));
+    }
+
+    /**
+     * Scales the {@param value} to be proportionally between the {@param min} and
+     * {@param max} values.
+     *
+     * @param value must be between 0 and 1
+     */
+    public static float mapRange(@FloatRange(from=0.0,to=1.0) float value, float min, float max) {
+        return min + (value * (max - min));
+    }
+
+    /**
+     * Scales the {@param value} proportionally from {@param min} and {@param max} to 0 and 1.
+     *
+     * @param value must be between {@param min} and {@param max}
+     */
+    public static float unmapRange(float value, float min, float max) {
+        return (value - min) / (max - min);
+    }
+
     /** Scales a rect about its centroid */
     public static void scaleRectAboutCenter(RectF r, float scale) {
         if (scale != 1.0f) {
index 67a6a9f..d433b6c 100644 (file)
@@ -96,6 +96,6 @@ public class TaskKeyLruCache<V> {
 
     /** Trims the cache to a specific size */
     final void trimToSize(int cacheSize) {
-        mCache.resize(cacheSize);
+        mCache.trimToSize(cacheSize);
     }
 }
index 0c305d4..8575c0d 100644 (file)
@@ -22,6 +22,8 @@ import android.view.View;
 import android.view.ViewDebug;
 import android.view.ViewOutlineProvider;
 
+import com.android.systemui.recents.misc.Utilities;
+
 /* An outline provider that has a clip and outline that can be animated. */
 public class AnimateableViewBounds extends ViewOutlineProvider {
 
@@ -55,7 +57,7 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
 
     @Override
     public void getOutline(View view, Outline outline) {
-        outline.setAlpha(MIN_ALPHA + mAlpha * (MAX_ALPHA - MIN_ALPHA));
+        outline.setAlpha(Utilities.mapRange(mAlpha, MIN_ALPHA, MAX_ALPHA));
         if (mCornerRadius > 0) {
             outline.setRoundRect(mClipRect.left, mClipRect.top,
                     mSourceView.getWidth() - mClipRect.right,
index 2338089..48e1370 100644 (file)
@@ -50,6 +50,7 @@ public class AnimationProps {
     public static final int SCALE = 5;
     public static final int BOUNDS = 6;
     public static final int DIM_ALPHA = 7;
+    public static final int FOCUS_STATE = 8;
 
     private SparseLongArray mPropStartDelay;
     private SparseLongArray mPropDuration;
index 2b4c251..d8a3e76 100644 (file)
@@ -156,7 +156,6 @@ public class FreeformWorkspaceLayoutAlgorithm {
             transformOut.rect.set(ffRect);
             transformOut.rect.offset(stackLayout.mFreeformRect.left, stackLayout.mFreeformRect.top);
             transformOut.visible = true;
-            transformOut.relativeTaskProgress = 0f;
             return transformOut;
         }
         return null;
index 623f56a..360a139 100644 (file)
@@ -16,6 +16,8 @@
 
 package com.android.systemui.recents.views;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.content.Context;
 import android.content.res.Resources;
@@ -26,14 +28,12 @@ import android.util.ArraySet;
 import android.util.FloatProperty;
 import android.util.Property;
 import android.view.ViewDebug;
-import android.view.animation.AccelerateInterpolator;
 
 import com.android.systemui.Interpolators;
 import com.android.systemui.R;
 import com.android.systemui.recents.Recents;
 import com.android.systemui.recents.RecentsActivityLaunchState;
 import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.RecentsDebugFlags;
 import com.android.systemui.recents.misc.FreePathInterpolator;
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.misc.Utilities;
@@ -109,8 +109,25 @@ public class TaskStackLayoutAlgorithm {
     private static final float UNFOCUS_MULTIPLIER = 0.8f;
 
     // The distribution of dim to apply to tasks in the stack
-    private static final AccelerateInterpolator DIM_INTERPOLATOR = new AccelerateInterpolator(3f);
     public static final float DIM_MAX_VALUE = 0.35f;
+    private static final Path UNFOCUSED_DIM_PATH = new Path();
+    private static final Path FOCUSED_DIM_PATH = new Path();
+    static {
+        // The unfocused dim interpolator peaks to 1 at 0.5 (the focused task), then slowly drops
+        // back to 0.5 at the front of the stack
+        UNFOCUSED_DIM_PATH.moveTo(0f, 0f);
+        UNFOCUSED_DIM_PATH.cubicTo(0f, 0.1f, 0.4f, 0.8f, 0.5f, 1f);
+        UNFOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0.6f, 1f, 0.5f);
+        // The focused dim interpolator peaks to 1 at 0.5 (the focused task), then drops back to 0
+        // at the front of the stack
+        FOCUSED_DIM_PATH.moveTo(0f, 0f);
+        FOCUSED_DIM_PATH.cubicTo(0.1f, 0f, 0.4f, 1f, 0.5f, 1f);
+        FOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0f, 1f, 0f);
+    }
+    private static final FreePathInterpolator UNFOCUSED_DIM_INTERPOLATOR =
+            new FreePathInterpolator(UNFOCUSED_DIM_PATH);
+    private static final FreePathInterpolator FOCUSED_DIM_INTERPOLATOR =
+            new FreePathInterpolator(FOCUSED_DIM_PATH);
 
     // The various focus states
     public static final float STATE_FOCUSED = 1f;
@@ -244,7 +261,9 @@ public class TaskStackLayoutAlgorithm {
 
     // The offset from the top when scrolled to the top of the stack
     @ViewDebug.ExportedProperty(category="recents")
-    private int mFocusedPeekHeight;
+    private int mFocusedTopPeekHeight;
+    @ViewDebug.ExportedProperty(category="recents")
+    private int mFocusedBottomPeekHeight;
 
     // The offset from the top of the stack to the top of the bounds when the stack is scrolled to
     // the end
@@ -316,7 +335,10 @@ public class TaskStackLayoutAlgorithm {
         mUnfocusedRange = new Range(res.getFloat(R.integer.recents_layout_unfocused_range_min),
                 res.getFloat(R.integer.recents_layout_unfocused_range_max));
         mFocusState = getDefaultFocusState();
-        mFocusedPeekHeight = res.getDimensionPixelSize(R.dimen.recents_layout_focused_peek_size);
+        mFocusedTopPeekHeight =
+                res.getDimensionPixelSize(R.dimen.recents_layout_focused_top_peek_size);
+        mFocusedBottomPeekHeight =
+                res.getDimensionPixelSize(R.dimen.recents_layout_focused_bottom_peek_size);
 
         mMinTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
         mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
@@ -370,19 +392,19 @@ public class TaskStackLayoutAlgorithm {
         // The freeform height is the visible height (not including system insets) - padding above
         // freeform and below stack - gap between the freeform and stack
         mState = state;
-        mStackTopOffset = mFocusedPeekHeight + heightPadding;
+        mStackTopOffset = mFocusedTopPeekHeight + heightPadding;
         mStackBottomOffset = mSystemInsets.bottom + heightPadding;
         state.computeRects(mFreeformRect, mStackRect, taskStackBounds, widthPadding, heightPadding,
                 mStackBottomOffset);
         // The history button will take the full un-padded header space above the stack
         mHistoryButtonRect.set(mStackRect.left, mStackRect.top - heightPadding,
-                mStackRect.right, mStackRect.top + mFocusedPeekHeight);
+                mStackRect.right, mStackRect.top + mFocusedTopPeekHeight);
 
         // Anchor the task rect to the top-center of the non-freeform stack rect
         float aspect = (float) (taskStackBounds.width() - mSystemInsets.left - mSystemInsets.right)
                 / (taskStackBounds.height() - mSystemInsets.bottom);
         int width = mStackRect.width();
-        int minHeight = mStackRect.height() - mFocusedPeekHeight - mStackBottomOffset;
+        int minHeight = mStackRect.height() - mFocusedTopPeekHeight - mStackBottomOffset;
         int height = (int) Math.min(width / aspect, minHeight);
         mTaskRect.set(mStackRect.left, mStackRect.top,
                 mStackRect.left + width, mStackRect.top + height);
@@ -457,8 +479,8 @@ public class TaskStackLayoutAlgorithm {
                         mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(bottomOffsetPct);
                 mMinScrollP = 0;
-                mMaxScrollP = Math.max(mMinScrollP,
-                        (mNumStackTasks - 1) - Math.max(0, mUnfocusedRange.getAbsoluteX(normX)));
+                mMaxScrollP = Math.max(mMinScrollP, (mNumStackTasks - 1) -
+                        Math.max(0, mUnfocusedRange.getAbsoluteX(normX)));
             }
         }
 
@@ -474,16 +496,16 @@ public class TaskStackLayoutAlgorithm {
                 mInitialScrollP = mMinScrollP;
             } else if (getDefaultFocusState() > 0f) {
                 if (launchState.launchedFromHome) {
-                    mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP, launchTaskIndex));
+                    mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
                 } else {
-                    mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP,
-                            launchTaskIndex - 1));
+                    mInitialScrollP = Utilities.clamp(launchTaskIndex - 1, mMinScrollP,
+                            mMaxScrollP);
                 }
             } else {
                 float offsetPct = (float) (mTaskRect.height() / 3) / mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(offsetPct);
-                mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP,
-                        launchTaskIndex - mUnfocusedRange.getAbsoluteX(normX)));
+                mInitialScrollP = Utilities.clamp(launchTaskIndex -
+                        mUnfocusedRange.getAbsoluteX(normX), mMinScrollP, mMaxScrollP);
             }
         }
     }
@@ -667,20 +689,9 @@ public class TaskStackLayoutAlgorithm {
 
         // Compute the focused and unfocused offset
         mUnfocusedRange.offset(stackScroll);
-        float p = mUnfocusedRange.getNormalizedX(taskProgress);
-        float yp = mUnfocusedCurveInterpolator.getInterpolation(p);
-        float unfocusedP = p;
-        int unFocusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
+        mFocusedRange.offset(stackScroll);
         boolean unfocusedVisible = mUnfocusedRange.isInRange(taskProgress);
-        int focusedY = 0;
-        boolean focusedVisible = true;
-        if (mFocusState > 0f) {
-            mFocusedRange.offset(stackScroll);
-            p = mFocusedRange.getNormalizedX(taskProgress);
-            yp = mFocusedCurveInterpolator.getInterpolation(p);
-            focusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
-            focusedVisible = mFocusedRange.isInRange(taskProgress);
-        }
+        boolean focusedVisible = mFocusedRange.isInRange(taskProgress);
 
         // Skip if the task is not visible
         if (!forceUpdate && !unfocusedVisible && !focusedVisible) {
@@ -688,45 +699,48 @@ public class TaskStackLayoutAlgorithm {
             return;
         }
 
+        float unfocusedRangeX = mUnfocusedRange.getNormalizedX(taskProgress);
+        float focusedRangeX = mFocusedRange.getNormalizedX(taskProgress);
+
         int x = (mStackRect.width() - mTaskRect.width()) / 2;
         int y;
         float z;
-        float relP;
+        float dimAlpha;
         if (!ssp.hasFreeformWorkspaceSupport() && mNumStackTasks == 1 && !ignoreSingleTaskCase) {
             // When there is exactly one task, then decouple the task from the stack and just move
             // in screen space
-            p = (mMinScrollP - stackScroll) / mNumStackTasks;
+            float tmpP = (mMinScrollP - stackScroll) / mNumStackTasks;
             int centerYOffset = (mStackRect.top - mTaskRect.top) +
                     (mStackRect.height() - mTaskRect.height()) / 2;
-            y = centerYOffset + getYForDeltaP(p, 0);
+            y = centerYOffset + getYForDeltaP(tmpP, 0);
             z = mMaxTranslationZ;
-            relP = 1f;
+            dimAlpha = 0f;
 
         } else {
             // Otherwise, update the task to the stack layout
-            y = unFocusedY + (int) (mFocusState * (focusedY - unFocusedY));
-            y += (mStackRect.top - mTaskRect.top);
-            z = Math.max(mMinTranslationZ, Math.min(mMaxTranslationZ,
-                    mMinTranslationZ + (p * (mMaxTranslationZ - mMinTranslationZ))));
-            if (mNumStackTasks == 1) {
-                relP = 1f;
-            } else {
-                relP = Math.min(mMaxScrollP, unfocusedP);
-            }
+            int unfocusedY = (int) ((1f - mUnfocusedCurveInterpolator.getInterpolation(
+                    unfocusedRangeX)) * mStackRect.height());
+            int focusedY = (int) ((1f - mFocusedCurveInterpolator.getInterpolation(
+                    focusedRangeX)) * mStackRect.height());
+            float unfocusedDim = 1f - UNFOCUSED_DIM_INTERPOLATOR.getInterpolation(unfocusedRangeX);
+            float focusedDim = 1f - FOCUSED_DIM_INTERPOLATOR.getInterpolation(focusedRangeX);
+
+            y = (mStackRect.top - mTaskRect.top) +
+                    (int) Utilities.mapRange(mFocusState, unfocusedY, focusedY);
+            z = Utilities.clamp01(unfocusedRangeX) * mMaxTranslationZ;
+            dimAlpha = Utilities.mapRange(mFocusState, unfocusedDim, focusedDim);
         }
 
         // Fill out the transform
         transformOut.scale = 1f;
         transformOut.alpha = 1f;
         transformOut.translationZ = z;
-        transformOut.dimAlpha = DIM_MAX_VALUE * DIM_INTERPOLATOR.getInterpolation(1f -
-                Math.max(0f, Math.min(1f, relP)));
+        transformOut.dimAlpha = DIM_MAX_VALUE * dimAlpha;
         transformOut.rect.set(mTaskRect);
         transformOut.rect.offset(x, y);
         Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
         transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
                 (frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
-        transformOut.relativeTaskProgress = relP;
     }
 
     /**
@@ -770,18 +784,16 @@ public class TaskStackLayoutAlgorithm {
      * Creates a new path for the focused curve.
      */
     private Path constructFocusedCurve() {
-        int taskBarHeight = mContext.getResources().getDimensionPixelSize(
-                R.dimen.recents_task_bar_height);
-
         // Initialize the focused curve. This curve is a piecewise curve composed of several
-        // quadradic beziers that goes from (0,1) through (0.5, peek height offset),
-        // (0.667, next task offset), (0.833, bottom task offset), and (1,0).
-        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
+        // linear pieces that goes from (0,1) through (0.5, peek height offset),
+        // (0.5, bottom task offsets), and (1,0).
+        float topPeekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
+        float bottomPeekHeightPct = (float) Math.max(mFocusedBottomPeekHeight, mStackRect.bottom -
+                mTaskRect.bottom) / mStackRect.height();
         Path p = new Path();
         p.moveTo(0f, 1f);
-        p.lineTo(0.5f, 1f - peekHeightPct);
-        p.lineTo(0.66666667f, (float) (taskBarHeight * 3) / mStackRect.height());
-        p.lineTo(0.83333333f, (float) (taskBarHeight / 2) / mStackRect.height());
+        p.lineTo(0.5f, 1f - topPeekHeightPct);
+        p.lineTo(0.5f + (0.5f / mFocusedRange.relativeMax), bottomPeekHeightPct);
         p.lineTo(1f, 0f);
         return p;
     }
@@ -798,7 +810,7 @@ public class TaskStackLayoutAlgorithm {
         // there is a tangent at (0.5, peek height offset).
         float cpoint1X = 0.4f;
         float cpoint1Y = 1f;
-        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
+        float peekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
         float slope = ((1f - peekHeightPct) - cpoint1Y) / (0.5f - cpoint1X);
         float b = 1f - slope * cpoint1X;
         float cpoint2X = 0.75f;
@@ -819,10 +831,10 @@ public class TaskStackLayoutAlgorithm {
             return;
         }
 
-        float min = mUnfocusedRange.relativeMin +
-                mFocusState * (mFocusedRange.relativeMin - mUnfocusedRange.relativeMin);
-        float max = mUnfocusedRange.relativeMax +
-                mFocusState * (mFocusedRange.relativeMax - mUnfocusedRange.relativeMax);
+        float min = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMin,
+                mFocusedRange.relativeMin);
+        float max = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMax,
+                mFocusedRange.relativeMax);
         getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */,
                 true /* forceUpdate */);
         getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */,
index 8b5b16c..2195b5e 100644 (file)
@@ -560,7 +560,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                     tv.updateViewPropertiesToTaskTransform(transform, AnimationProps.IMMEDIATE,
                             mRequestUpdateClippingListener);
                 } else {
-                    if (Float.compare(transform.relativeTaskProgress, 0f) <= 0) {
+                    if (transform.rect.top <= mLayoutAlgorithm.mStackRect.top) {
                         tv.updateViewPropertiesToTaskTransform(
                                 mLayoutAlgorithm.getBackOfStackTransform(),
                                 AnimationProps.IMMEDIATE, mRequestUpdateClippingListener);
@@ -838,7 +838,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
             boolean requestViewFocus, int timerIndicatorDuration) {
         // Find the next task to focus
         int newFocusedTaskIndex = mStack.getTaskCount() > 0 ?
-                Math.max(0, Math.min(mStack.getTaskCount() - 1, focusTaskIndex)) : -1;
+                Utilities.clamp(focusTaskIndex, 0, mStack.getTaskCount() - 1) : -1;
         final Task newFocusedTask = (newFocusedTaskIndex != -1) ?
                 mStack.getStackTasks().get(newFocusedTaskIndex) : null;
 
index b54ea1d..b7ff8bc 100644 (file)
@@ -152,8 +152,7 @@ public class TaskStackViewScroller {
 
     /** Returns the bounded stack scroll */
     float getBoundedStackScroll(float scroll) {
-        return Math.max(mLayoutAlgorithm.mMinScrollP,
-                Math.min(mLayoutAlgorithm.mMaxScrollP, scroll));
+        return Utilities.clamp(scroll, mLayoutAlgorithm.mMinScrollP, mLayoutAlgorithm.mMaxScrollP);
     }
 
     /** Returns the amount that the absolute value of how much the scroll is out of bounds. */
index 59991e6..b94a9f7 100644 (file)
@@ -545,8 +545,8 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
             // We only really need to interpolate the bounds, progress and translation
             mTmpTransform.rect.set(Utilities.RECTF_EVALUATOR.evaluate(dismissFraction,
                     fromTransform.rect, toTransform.rect));
-            mTmpTransform.dimAlpha = fromTransform.dimAlpha + (toTransform.dimAlpha - fromTransform.dimAlpha) *
-                    dismissFraction;
+            mTmpTransform.dimAlpha = fromTransform.dimAlpha + (toTransform.dimAlpha -
+                    fromTransform.dimAlpha) * dismissFraction;
             mTmpTransform.translationZ = fromTransform.translationZ +
                     (toTransform.translationZ - fromTransform.translationZ) * dismissFraction;
 
index edac8e8..972b02a 100644 (file)
@@ -500,7 +500,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
     @Override
     public void onStartLaunchTargetEnterAnimation(int duration, boolean screenPinningEnabled,
             ReferenceCountedTrigger postAnimationTrigger) {
-        // Un-dim the view before launching the target
+        // Un-dim the view before/while launching the target
         AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT)
                 .setListener(postAnimationTrigger.decrementOnAnimationEnd());
         postAnimationTrigger.increment();
@@ -514,7 +514,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
     @Override
     public void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
             ReferenceCountedTrigger postAnimationTrigger) {
-        // Un-dim the view before launching the target
+        // Un-dim the view before/while launching the target
         AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
         animateDimAlpha(0, animation);
 
index c930613..d3d2dbe 100644 (file)
@@ -90,10 +90,6 @@ public class TaskViewTransform {
 
     public boolean visible = false;
 
-    // This is the relative task progress of this task, relative to the stack scroll at which this
-    // transform was computed
-    public float relativeTaskProgress = 0f;
-
     // This is a window-space rect used for positioning the task in the stack and freeform workspace
     public RectF rect = new RectF();
 
@@ -106,7 +102,6 @@ public class TaskViewTransform {
         alpha = tv.getAlpha();
         visible = true;
         dimAlpha = tv.getDimAlpha();
-        relativeTaskProgress = 0f;
         rect.set(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
     }
 
@@ -119,7 +114,6 @@ public class TaskViewTransform {
         alpha = other.alpha;
         visible = other.visible;
         dimAlpha = other.dimAlpha;
-        relativeTaskProgress = other.relativeTaskProgress;
         rect.set(other.rect);
     }
 
@@ -131,7 +125,6 @@ public class TaskViewTransform {
         scale = 1f;
         alpha = 1f;
         dimAlpha = 0f;
-        relativeTaskProgress = 0f;
         visible = false;
         rect.setEmpty();
     }