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
diff --git a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
index 8a4a632..dc04016 100644
--- a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
+++ b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
@@ -107,11 +107,9 @@
primaryTaskTarget = targets.findTask(splitIds[0]);
secondaryTaskTarget = targets.findTask(splitIds[1]);
- RemoteAnimationTargetCompat dividerTarget = targets.getNonAppTargetOfType(
- TYPE_DOCK_DIVIDER);
mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds(
primaryTaskTarget.screenSpaceBounds,
- secondaryTaskTarget.screenSpaceBounds, dividerTarget.screenSpaceBounds);
+ secondaryTaskTarget.screenSpaceBounds);
mRemoteTargetHandles[0].mTransformParams.setTargetSet(
createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets));
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget,
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 8d330d4..895ca08 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -388,11 +388,12 @@
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
float diff;
+ float horizontalDividerDiff = splitInfo.visualDividerBounds.width() / 2f;
if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
- diff = outRect.height() * (1f - splitInfo.leftTaskPercent);
+ diff = outRect.height() * (1f - splitInfo.leftTaskPercent) + horizontalDividerDiff;
outRect.bottom -= diff;
} else {
- diff = outRect.height() * splitInfo.leftTaskPercent;
+ diff = outRect.height() * splitInfo.leftTaskPercent + horizontalDividerDiff;
outRect.top += diff;
}
}
@@ -402,7 +403,7 @@
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
// The preview set is for the bottom/right, inset by top/left task
- splitOffset.x = splitInfo.leftTopBounds.width() + splitInfo.dividerBounds.width() / 2;
+ splitOffset.x = splitInfo.leftTopBounds.width() + splitInfo.visualDividerBounds.width();
}
}
@@ -413,7 +414,7 @@
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot;
int totalThumbnailWidth = taskParent.getWidth();
- int dividerBar = splitBoundsConfig.dividerBounds.width() / 2;
+ int dividerBar = splitBoundsConfig.visualDividerBounds.width();
ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams();
ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index 8284659..064d808 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -474,21 +474,23 @@
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 @@
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 @@
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();
diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java
index 41693de..5093d85 100644
--- a/src/com/android/launcher3/util/SplitConfigurationOptions.java
+++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java
@@ -88,25 +88,29 @@
public static class StagedSplitBounds {
public final Rect leftTopBounds;
public final Rect rightBottomBounds;
- public final Rect dividerBounds;
+ /** This rect represents the actual gap between the two apps */
+ public final Rect visualDividerBounds;
// This class is orientation-agnostic, so we compute both for later use
public final float topTaskPercent;
public final float leftTaskPercent;
- public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds, Rect dividerBounds) {
+ public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds) {
this.leftTopBounds = leftTopBounds;
this.rightBottomBounds = rightBottomBounds;
- this.dividerBounds = dividerBounds;
- float totalHeight = this.leftTopBounds.height()
- + this.rightBottomBounds.height()
- + this.dividerBounds.height();
- float totalWidth = this.leftTopBounds.width()
- + this.rightBottomBounds.width()
- + this.dividerBounds.width();
- leftTaskPercent = this.leftTopBounds.width() / totalWidth;
- topTaskPercent = this.leftTopBounds.height() / totalHeight;
+ if (rightBottomBounds.top > leftTopBounds.top) {
+ // vertical apps, horizontal divider
+ this.visualDividerBounds = new Rect(leftTopBounds.left, leftTopBounds.bottom,
+ leftTopBounds.right, rightBottomBounds.top);
+ } else {
+ // horizontal apps, vertical divider
+ this.visualDividerBounds = new Rect(leftTopBounds.right, leftTopBounds.top,
+ rightBottomBounds.left, leftTopBounds.bottom);
+ }
+
+ leftTaskPercent = this.leftTopBounds.width() / (float) rightBottomBounds.right;
+ topTaskPercent = this.leftTopBounds.height() / (float) rightBottomBounds.bottom;
}
}