Merge "Animate scrolling grid into place when there is a gap between last tasks and clear all." into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-09-03 12:23:06 +00:00
committed by Android (Google) Code Review
3 changed files with 244 additions and 46 deletions
@@ -343,6 +343,19 @@ public class TaskView extends FrameLayout implements Reusable {
}
};
public static final FloatProperty<TaskView> GRID_END_TRANSLATION_X =
new FloatProperty<TaskView>("gridEndTranslationX") {
@Override
public void setValue(TaskView taskView, float v) {
taskView.setGridEndTranslationX(v);
}
@Override
public Float get(TaskView taskView) {
return taskView.mGridEndTranslationX;
}
};
public static final FloatProperty<TaskView> SNAPSHOT_SCALE =
new FloatProperty<TaskView>("snapshotScale") {
@Override
@@ -381,6 +394,8 @@ public class TaskView extends FrameLayout implements Reusable {
// The following grid translations scales with mGridProgress.
private float mGridTranslationX;
private float mGridTranslationY;
// The following grid translation is used to animate closing the gap between grid and clear all.
private float mGridEndTranslationX;
// Applied as a complement to gridTranslation, for adjusting the carousel overview and quick
// switch.
private float mNonGridTranslationX;
@@ -950,8 +965,8 @@ public class TaskView extends FrameLayout implements Reusable {
protected void resetViewTransforms() {
// fullscreenTranslation and accumulatedTranslation should not be reset, as
// resetViewTransforms is called during Quickswitch scrolling.
mDismissTranslationX = mTaskOffsetTranslationX = mTaskResistanceTranslationX =
mSplitSelectTranslationX = 0f;
mDismissTranslationX = mTaskOffsetTranslationX =
mTaskResistanceTranslationX = mSplitSelectTranslationX = mGridEndTranslationX = 0f;
mDismissTranslationY = mTaskOffsetTranslationY = mTaskResistanceTranslationY =
mSplitSelectTranslationY = 0f;
setSnapshotScale(1f);
@@ -1162,6 +1177,11 @@ public class TaskView extends FrameLayout implements Reusable {
return mGridTranslationY;
}
private void setGridEndTranslationX(float gridEndTranslationX) {
mGridEndTranslationX = gridEndTranslationX;
applyTranslationX();
}
public float getScrollAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
float scrollAdjustment = 0;
if (gridEnabled) {
@@ -1191,7 +1211,7 @@ public class TaskView extends FrameLayout implements Reusable {
private void applyTranslationX() {
setTranslationX(mDismissTranslationX + mTaskOffsetTranslationX + mTaskResistanceTranslationX
+ mSplitSelectTranslationX + getPersistentTranslationX());
+ mSplitSelectTranslationX + mGridEndTranslationX + getPersistentTranslationX());
}
private void applyTranslationY() {