Slight polish for split screen gesture animation

* Divider bar dimensions manually calculated since
the leash that is provided has bounds larger than
the space that is visually shown between the two split
apps

Bug: 181704764
Test: Swipe up on large and normal screen,
w/ and w/o home rotation enabled

Change-Id: I1fde053151d47c6ce3e11f16f8ae4a153d273871
This commit is contained in:
Vinit Nayak
2021-09-07 16:50:21 -07:00
parent 9d4966d0ca
commit d1a70eeb75
4 changed files with 31 additions and 27 deletions

View File

@@ -474,21 +474,23 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
boolean isLandscape = dp.isLandscape;
float verticalDividerDiff = splitInfo.visualDividerBounds.height() / 2f;
float horizontalDividerDiff = splitInfo.visualDividerBounds.width() / 2f;
float diff;
if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
if (isLandscape) {
diff = outRect.width() * (1f - splitInfo.leftTaskPercent);
diff = outRect.width() * (1f - splitInfo.leftTaskPercent) + horizontalDividerDiff;
outRect.right -= diff;
} else {
diff = outRect.height() * (1f - splitInfo.topTaskPercent);
diff = outRect.height() * (1f - splitInfo.topTaskPercent) + verticalDividerDiff;
outRect.bottom -= diff;
}
} else {
if (isLandscape) {
diff = outRect.width() * splitInfo.leftTaskPercent;
diff = outRect.width() * splitInfo.leftTaskPercent + horizontalDividerDiff;
outRect.left += diff;
} else {
diff = outRect.height() * splitInfo.topTaskPercent;
diff = outRect.height() * splitInfo.topTaskPercent + verticalDividerDiff;
outRect.top += diff;
}
}
@@ -500,10 +502,10 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
if (dp.isLandscape) {
splitOffset.x = splitInfo.leftTopBounds.width() +
splitInfo.dividerBounds.width() / 2;
splitInfo.visualDividerBounds.width();
} else {
splitOffset.y = splitInfo.leftTopBounds.height() +
splitInfo.dividerBounds.height() / 2;
splitInfo.visualDividerBounds.height();
}
}
}
@@ -516,9 +518,8 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot;
int totalThumbnailWidth = taskParent.getWidth();
int dividerBar = (dp.isLandscape ?
splitBoundsConfig.dividerBounds.width() :
splitBoundsConfig.dividerBounds.height())
/ 2;
splitBoundsConfig.visualDividerBounds.width() :
splitBoundsConfig.visualDividerBounds.height());
ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams();
ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();