diff --git a/packages/SystemUI/res/layout/recents_task_view.xml b/packages/SystemUI/res/layout/recents_task_view.xml index 85668de3c854e..93c55387812ce 100644 --- a/packages/SystemUI/res/layout/recents_task_view.xml +++ b/packages/SystemUI/res/layout/recents_task_view.xml @@ -67,8 +67,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/recents_task_view_lock_to_app_button_height" android:layout_gravity="center_horizontal|bottom" - android:background="@drawable/recents_lock_to_task_button_bg" - android:visibility="invisible"> + android:background="@drawable/recents_lock_to_task_button_bg"> 0) { - // Make the view visible for the animation - if (visible && getVisibility() != View.VISIBLE) { - setVisibility(View.VISIBLE); - } mFooterAnimator = ObjectAnimator.ofInt(this, "footerHeight", finalHeight); mFooterAnimator.setDuration(duration); mFooterAnimator.setInterpolator(mConfig.fastOutSlowInInterpolator); - mFooterAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - if (!visible) { - setVisibility(View.INVISIBLE); - } - } - }); mFooterAnimator.start(); } else { setFooterHeight(finalHeight); - setVisibility(visible ? View.VISIBLE : View.INVISIBLE); } } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index f135e320b5c3c..b501f7e70e6d1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -83,7 +83,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal int mFocusedTaskIndex = -1; OverScroller mScroller; ObjectAnimator mScrollAnimator; - boolean mEnableStackClipping = true; // Optimizations ReferenceCountedTrigger mHwLayersTrigger; @@ -93,8 +92,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal boolean mStartEnterAnimationRequestedAfterLayout; ViewAnimation.TaskViewEnterContext mStartEnterAnimationContext; int[] mTmpVisibleRange = new int[2]; - Rect mTmpRect = new Rect(); - Rect mTmpRect2 = new Rect(); TaskViewTransform mTmpTransform = new TaskViewTransform(); HashMap mTmpTaskViewMap = new HashMap(); LayoutInflater mInflater; @@ -189,7 +186,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal int stackScroll, int[] visibleRangeOut, boolean boundTranslationsToRect) { - // XXX: We should be intelligent about wheee to look for the visible stack range using the + // XXX: We should be intelligent about where to look for the visible stack range using the // current stack scroll. // XXX: We should log extra cases like the ones below where we don't expect to hit very often // XXX: Print out approximately how many indices we have to go through to find the first visible transform @@ -199,8 +196,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal int frontMostVisibleIndex = -1; int backMostVisibleIndex = -1; - - // We can reuse the task transforms where possible to reduce object allocation if (taskTransformCount < taskCount) { // If there are less transforms than tasks, then add as many transforms as necessary @@ -290,6 +285,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (tv == null) { tv = mViewPool.pickUpViewFromPool(task, task); + if (mStackViewsAnimationDuration > 0) { // For items in the list, put them in start animating them from the // approriate ends of the list where they are expected to appear @@ -319,7 +315,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal /** Updates the clip for each of the task views. */ void clipTaskViews() { // Update the clip on each task child - if (Constants.DebugFlags.App.EnableTaskStackClipping && mEnableStackClipping) { + if (Constants.DebugFlags.App.EnableTaskStackClipping) { int childCount = getChildCount(); for (int i = 0; i < childCount - 1; i++) { TaskView tv = (TaskView) getChildAt(i); @@ -341,12 +337,10 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // stacked and we can make assumptions about the visibility of the this // task relative to the ones in front of it. if (nextTv != null) { - // We calculate the bottom clip independent of the footer (since we animate - // that) - int scaledMaxFooterHeight = (int) (tv.getMaxFooterHeight() * tv.getScaleX()); - tv.getHitRect(mTmpRect); - nextTv.getHitRect(mTmpRect2); - clipBottom = (mTmpRect.bottom - scaledMaxFooterHeight - mTmpRect2.top); + // We can reuse the current task transforms to find the task rects + TaskViewTransform transform = mCurrentTaskTransforms.get(mStack.indexOfTask(tv.getTask())); + TaskViewTransform nextTransform = mCurrentTaskTransforms.get(mStack.indexOfTask(nextTv.getTask())); + clipBottom = transform.rect.bottom - nextTransform.rect.top - 200; } } tv.getViewBounds().setClipBottom(clipBottom); @@ -359,18 +353,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } } - /** Enables/Disables clipping of the tasks in the stack. */ - void setStackClippingEnabled(boolean stackClippingEnabled) { - if (!stackClippingEnabled) { - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - TaskView tv = (TaskView) getChildAt(i); - tv.getViewBounds().setClipBottom(0); - } - } - mEnableStackClipping = stackClippingEnabled; - } - /** The stack insets to apply to the stack contents */ public void setStackInsetRect(Rect r) { mTaskStackBounds.set(r); @@ -634,18 +616,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal setStackScrollToInitialState(); requestSynchronizeStackViewsWithModel(); synchronizeStackViewsWithModel(); - - // Find the first task and mark it as full screen - if (mConfig.launchedFromAppWithScreenshot) { - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - TaskView tv = (TaskView) getChildAt(i); - if (tv.getTask().isLaunchTarget) { - tv.setIsFullScreen(true); - break; - } - } - } } // Measure each of the TaskViews @@ -925,6 +895,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal public void prepareViewToLeavePool(TaskView tv, Task task, boolean isNewView) { // Rebind the task and request that this task's data be filled into the TaskView tv.onTaskBound(task); + + // Mark the launch task as fullscreen + if (Constants.DebugFlags.App.EnableScreenshotAppTransition && mAwaitingFirstLayout) { + if (task.isLaunchTarget) { + tv.setIsFullScreen(true); + } + } + + // Load the task data RecentsTaskLoader.getInstance().loadTaskData(task); // Sanity check, the task view should always be clipping against the stack at this point, diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java index 7f94a0a29dac9..0fd4e86429552 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java @@ -82,7 +82,7 @@ public class TaskStackViewLayoutAlgorithm { // Compute the min and max scroll values int numTasks = Math.max(1, tasks.size()); int taskHeight = mTaskRect.height(); - int stackHeight = mStackRect.height(); + int stackHeight = mStackRectSansPeek.height(); if (numTasks <= 1) { // If there is only one task, then center the task in the stack rect (sans peek) diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java index b83f9cc265466..b1c35f32196ac 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java @@ -263,7 +263,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { int velocity = (int) velocityTracker.getYVelocity(mActivePointerId); if (mIsScrolling && (Math.abs(velocity) > mMinimumVelocity)) { - // XXX: Make this animation a function of the velocity AND distance int overscrollRange = (int) (Math.min(1f, Math.abs((float) velocity / mMaximumVelocity)) * Constants.Values.TaskStackView.TaskStackOverscrollRange); @@ -277,7 +276,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { mSv.invalidate(mSv.mStackAlgorithm.mStackRect); } else if (mSv.isScrollOutOfBounds()) { // Animate the scroll back into bounds - // XXX: Make this animation a function of the velocity OR distance mSv.animateBoundScroll(); } @@ -303,7 +301,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { case MotionEvent.ACTION_CANCEL: { if (mSv.isScrollOutOfBounds()) { // Animate the scroll back into bounds - // XXX: Make this animation a function of the velocity OR distance mSv.animateBoundScroll(); } mActivePointerId = INACTIVE_POINTER_ID; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 259706bd51ecd..1b5ad6ee5828e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -21,7 +21,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; -import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; @@ -60,7 +59,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, boolean mTaskDataLoaded; boolean mIsFocused; boolean mIsFullScreenView; - boolean mIsStub; boolean mClipViewInStack; AnimateableViewBounds mViewBounds; Paint mLayerPaint = new Paint(); @@ -123,7 +121,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mBarView = (TaskBarView) findViewById(R.id.task_view_bar); mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail); mFooterView = (TaskFooterView) findViewById(R.id.lock_to_app); - mFooterView.setCallbacks(this); + if (mConfig.lockToAppEnabled) { + mFooterView.setCallbacks(this); + } else { + mFooterView.setVisibility(View.GONE); + } } @Override @@ -147,6 +149,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)); } setMeasuredDimension(width, height); + invalidateOutline(); } /** Synchronizes this view's properties with the task's transform */ @@ -201,9 +204,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, if (mConfig.launchedFromAppWithScreenshot) { if (isTaskViewLaunchTargetTask) { // Also hide the front most task bar view so we can animate it in - mBarView.prepareEnterRecentsAnimation(); + // mBarView.prepareEnterRecentsAnimation(); } else { - // Don't do anything for the side views + // Don't do anything for the side views when animating in } } else if (mConfig.launchedFromAppWithThumbnail) { @@ -232,17 +235,32 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, if (mConfig.launchedFromAppWithScreenshot) { if (mTask.isLaunchTarget) { - // XXX: We would have to animate the trasnlationY of the task view bar along with the clip and - // reset it at the bottom + int duration = mConfig.taskViewEnterFromHomeDuration * 5; + int windowInsetTop = mConfig.systemInsets.top; // XXX: Should be for the window + float taskScale = ((float) taskRect.width() / getMeasuredWidth()) * transform.scale; + float taskTranslationY = taskRect.top + transform.translationY - windowInsetTop; - // XXX: This should actually be the inset on the current app... - mViewBounds.animateClipTop(taskRect.top, mConfig.taskViewEnterFromHomeDuration * 5); - mViewBounds.animateClipBottom(getMeasuredHeight() - taskRect.bottom, mConfig.taskViewEnterFromHomeDuration * 5); - - animate().scaleX(((float) taskRect.width() / getMeasuredWidth()) * transform.scale) - .scaleY(((float) taskRect.width() / getMeasuredWidth()) * transform.scale) - .translationY(taskRect.top + transform.translationY) - .setDuration(mConfig.taskViewEnterFromHomeDuration * 5) + // Animate the top clip + mViewBounds.animateClipTop(windowInsetTop, duration, + new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + int y = (Integer) animation.getAnimatedValue(); + mBarView.setTranslationY(y); + } + }); + // Animate the bottom or right clip + int size = Math.round((taskRect.width() / taskScale)); + if (mConfig.hasHorizontalLayout()) { + mViewBounds.animateClipRight(getMeasuredWidth() - size, duration); + } else { + mViewBounds.animateClipBottom(getMeasuredHeight() - (windowInsetTop + size), duration); + } + animate() + .scaleX(taskScale) + .scaleY(taskScale) + .translationY(taskTranslationY) + .setDuration(duration) .withEndAction(new Runnable() { @Override public void run() { @@ -424,11 +442,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, return mIsFullScreenView; } - /** Sets the stubbed state of this task view. */ - void setStubState(boolean isStub) { - mIsStub = isStub; - } - /** * Returns whether this view should be clipped, or any views below should clip against this * view. @@ -447,7 +460,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, /** Gets the max footer height. */ public int getMaxFooterHeight() { - return mFooterView.mMaxFooterHeight; + if (mConfig.lockToAppEnabled) { + return mFooterView.mMaxFooterHeight; + } else { + return 0; + } } /** Animates the footer into and out of view. */ @@ -488,17 +505,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, setDim(getDimOverlayFromScale()); } - /**** View drawing ****/ - - @Override - protected boolean drawChild(Canvas canvas, View child, long drawingTime) { - if (mIsStub && (child != mBarView)) { - // Skip the thumbnail view if we are in stub mode - return false; - } - return super.drawChild(canvas, child, drawingTime); - } - /**** View focus state ****/ /**