Fix various animation issues when total width of grid tasks < screen width

Bug fixes:
- Unusual long scroll when only focus task left after split select
- Animation jump when tasks cannot fit screen width after dismiss or split select

To fix the above issue, generified calculations when total grid task width < screen width:
- Removed some special case handling when only focus task left (getSnapToFocusedTaskScrollDiff), and instead replace with generic logic that calculation that extra scroll position (shortTotalCompensation) needed when long row width is smaller than the grid size
- Fixed snapped task grid translation calculation to account for shortTotalCompensation
- Last task scroll calculation should account for shortTotalCompensation too
- Calculate the expected shortTotalCompensation after dismiss, and use that to adjust the close gap between clearAll distance

splitScrollOffset that we applied during split screen does not work well when shortTotalCompensation != 0. splitScrollOffset is not a good solution to handle split placeholder, as it allow tasks to scroll to weird position. I removed splitScrollOffset completely, and only apply split translation when split placeholder covers the tasks:
- Removed splitScrollOffset on TaskView/ClearAll, so scroll position of TaskView will not change while in split to splify things.
- When split placehodler will cover task's natural position (taskSize) in overview grid, apply split translation on all tasks similar to handheld
- Removed isSplitPlaceholderFirstInGrid/isSplitPlaceholderLastInGrid adjustments

Bug: 257952455
Test: Enter overview from home
Test: Enter overview from app, with variations that quick switch and enter
Test: Dismiss task from different position
Test: Split select task from different position
Test: Repeat with/without GRID_ONLY_OVERVIEW flag
Test: Repeat with handheld
Change-Id: I7689b5384845f03491041b6d910835c9ac4fab08
This commit is contained in:
Alex Chau
2023-02-23 12:57:03 +00:00
parent 92c93bdda5
commit 359ac14d13
5 changed files with 159 additions and 215 deletions

View File

@@ -375,7 +375,6 @@ public class TaskView extends FrameLayout implements Reusable {
// Used when in SplitScreenSelectState
private float mSplitSelectTranslationY;
private float mSplitSelectTranslationX;
private float mSplitSelectScrollOffsetPrimary;
@Nullable
private ObjectAnimator mIconAndDimAnimator;
@@ -1297,10 +1296,6 @@ public class TaskView extends FrameLayout implements Reusable {
applyTranslationY();
}
public void setSplitScrollOffsetPrimary(float splitSelectScrollOffsetPrimary) {
mSplitSelectScrollOffsetPrimary = splitSelectScrollOffsetPrimary;
}
private void setDismissTranslationX(float x) {
mDismissTranslationX = x;
applyTranslationX();
@@ -1364,19 +1359,18 @@ public class TaskView extends FrameLayout implements Reusable {
applyTranslationX();
}
public float getScrollAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
public float getScrollAdjustment(boolean gridEnabled) {
float scrollAdjustment = 0;
if (gridEnabled) {
scrollAdjustment += mGridTranslationX;
} else {
scrollAdjustment += getPrimaryNonGridTranslationProperty().get(this);
}
scrollAdjustment += mSplitSelectScrollOffsetPrimary;
return scrollAdjustment;
}
public float getOffsetAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
return getScrollAdjustment(fullscreenEnabled, gridEnabled);
public float getOffsetAdjustment(boolean gridEnabled) {
return getScrollAdjustment(gridEnabled);
}
public float getSizeAdjustment(boolean fullscreenEnabled) {