diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index f281296ee2..2f2b566e32 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -72,7 +72,6 @@ import android.text.StaticLayout; import android.text.TextPaint; import android.util.AttributeSet; import android.util.FloatProperty; -import android.util.Property; import android.util.SparseBooleanArray; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -1515,7 +1514,9 @@ public abstract class RecentsView extends PagedView } int scrollDiff = newScroll[i] - oldScroll[i] + offset; if (scrollDiff != 0) { - Property translationProperty = mOrientationHandler.getPrimaryViewTranslate(); + FloatProperty translationProperty = child instanceof TaskView + ? ((TaskView) child).getPrimaryFillDismissGapTranslationProperty() + : mOrientationHandler.getPrimaryViewTranslate(); ResourceProvider rp = DynamicResource.provider(mActivity); SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_END) @@ -1927,7 +1928,11 @@ public abstract class RecentsView extends PagedView ? modalLeftOffsetSize : modalRightOffsetSize; float totalTranslation = translation + modalTranslation; - mOrientationHandler.getPrimaryViewTranslate().set(getChildAt(i), + View child = getChildAt(i); + FloatProperty translationProperty = child instanceof TaskView + ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty() + : mOrientationHandler.getPrimaryViewTranslate(); + translationProperty.set(child, totalTranslation * mOrientationHandler.getPrimaryTranslationDirectionFactor()); } updateCurveProperties(); diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index d94e623ad4..b791d29540 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -152,6 +152,58 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } }; + private static final FloatProperty FILL_DISMISS_GAP_TRANSLATION_X = + new FloatProperty("fillDismissGapTranslationX") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setFillDismissGapTranslationX(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mFillDismissGapTranslationX; + } + }; + + private static final FloatProperty FILL_DISMISS_GAP_TRANSLATION_Y = + new FloatProperty("fillDismissGapTranslationY") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setFillDismissGapTranslationY(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mFillDismissGapTranslationY; + } + }; + + private static final FloatProperty TASK_OFFSET_TRANSLATION_X = + new FloatProperty("taskOffsetTranslationX") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setTaskOffsetTranslationX(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mTaskOffsetTranslationX; + } + }; + + private static final FloatProperty TASK_OFFSET_TRANSLATION_Y = + new FloatProperty("taskOffsetTranslationY") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setTaskOffsetTranslationY(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mTaskOffsetTranslationY; + } + }; + private final OnAttachStateChangeListener mTaskMenuStateListener = new OnAttachStateChangeListener() { @Override @@ -179,6 +231,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private final FullscreenDrawParams mCurrentFullscreenParams; private final StatefulActivity mActivity; + // Various causes of changing primary translation, which we aggregate to setTranslationX/Y(). + // TODO: We should do this for secondary translation properties as well. + private float mFillDismissGapTranslationX; + private float mFillDismissGapTranslationY; + private float mTaskOffsetTranslationX; + private float mTaskOffsetTranslationY; + private ObjectAnimator mIconAndDimAnimator; private float mIconScaleAnimStartProgress = 0; private float mFocusTransitionProgress = 1; @@ -601,6 +660,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { protected void resetViewTransforms() { setCurveScale(1); + mFillDismissGapTranslationX = mTaskOffsetTranslationX = 0f; + mFillDismissGapTranslationY = mTaskOffsetTranslationY = 0f; setTranslationX(0f); setTranslationY(0f); setTranslationZ(0); @@ -745,6 +806,44 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { return mCurveScale; } + private void setFillDismissGapTranslationX(float x) { + mFillDismissGapTranslationX = x; + applyTranslationX(); + } + + private void setFillDismissGapTranslationY(float y) { + mFillDismissGapTranslationY = y; + applyTranslationY(); + } + + private void setTaskOffsetTranslationX(float x) { + mTaskOffsetTranslationX = x; + applyTranslationX(); + } + + private void setTaskOffsetTranslationY(float y) { + mTaskOffsetTranslationY = y; + applyTranslationY(); + } + + private void applyTranslationX() { + setTranslationX(mFillDismissGapTranslationX + mTaskOffsetTranslationX); + } + + private void applyTranslationY() { + setTranslationY(mFillDismissGapTranslationY + mTaskOffsetTranslationY); + } + + public FloatProperty getPrimaryFillDismissGapTranslationProperty() { + return getPagedOrientationHandler().getPrimaryValue( + FILL_DISMISS_GAP_TRANSLATION_X, FILL_DISMISS_GAP_TRANSLATION_Y); + } + + public FloatProperty getPrimaryTaskOffsetTranslationProperty() { + return getPagedOrientationHandler().getPrimaryValue( + TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y); + } + @Override public boolean hasOverlappingRendering() { // TODO: Clip-out the icon region from the thumbnail, since they are overlapping.