Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f8f61cb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Slight polish for split screen gesture animation" into sc-v2-dev

parents 8aecc9ac d1a70eeb
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -107,11 +107,9 @@ public class RemoteTargetGluer {
            primaryTaskTarget = targets.findTask(splitIds[0]);
            primaryTaskTarget = targets.findTask(splitIds[0]);
            secondaryTaskTarget = targets.findTask(splitIds[1]);
            secondaryTaskTarget = targets.findTask(splitIds[1]);


            RemoteAnimationTargetCompat dividerTarget = targets.getNonAppTargetOfType(
                    TYPE_DOCK_DIVIDER);
            mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds(
            mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds(
                    primaryTaskTarget.screenSpaceBounds,
                    primaryTaskTarget.screenSpaceBounds,
                    secondaryTaskTarget.screenSpaceBounds, dividerTarget.screenSpaceBounds);
                    secondaryTaskTarget.screenSpaceBounds);
            mRemoteTargetHandles[0].mTransformParams.setTargetSet(
            mRemoteTargetHandles[0].mTransformParams.setTargetSet(
                    createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets));
                    createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets));
            mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget,
            mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget,
+5 −4
Original line number Original line Diff line number Diff line
@@ -388,11 +388,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
    public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
            SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
            SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
        float diff;
        float diff;
        float horizontalDividerDiff = splitInfo.visualDividerBounds.width() / 2f;
        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
            diff = outRect.height() * (1f - splitInfo.leftTaskPercent);
            diff = outRect.height() * (1f - splitInfo.leftTaskPercent) + horizontalDividerDiff;
            outRect.bottom -= diff;
            outRect.bottom -= diff;
        } else {
        } else {
            diff = outRect.height() * splitInfo.leftTaskPercent;
            diff = outRect.height() * splitInfo.leftTaskPercent + horizontalDividerDiff;
            outRect.top += diff;
            outRect.top += diff;
        }
        }
    }
    }
@@ -402,7 +403,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
            SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
            SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
        if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
        if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
            // The preview set is for the bottom/right, inset by top/left task
            // 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 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
        int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
        int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
        int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot;
        int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot;
        int totalThumbnailWidth = taskParent.getWidth();
        int totalThumbnailWidth = taskParent.getWidth();
        int dividerBar = splitBoundsConfig.dividerBounds.width() / 2;
        int dividerBar = splitBoundsConfig.visualDividerBounds.width();
        ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams();
        ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams();
        ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();
        ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();


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


+16 −12
Original line number Original line Diff line number Diff line
@@ -88,25 +88,29 @@ public final class SplitConfigurationOptions {
    public static class StagedSplitBounds {
    public static class StagedSplitBounds {
        public final Rect leftTopBounds;
        public final Rect leftTopBounds;
        public final Rect rightBottomBounds;
        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
        // This class is orientation-agnostic, so we compute both for later use
        public final float topTaskPercent;
        public final float topTaskPercent;
        public final float leftTaskPercent;
        public final float leftTaskPercent;




        public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds, Rect dividerBounds) {
        public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds) {
            this.leftTopBounds = leftTopBounds;
            this.leftTopBounds = leftTopBounds;
            this.rightBottomBounds = rightBottomBounds;
            this.rightBottomBounds = rightBottomBounds;
            this.dividerBounds = dividerBounds;

            float totalHeight = this.leftTopBounds.height()
            if (rightBottomBounds.top > leftTopBounds.top) {
                    + this.rightBottomBounds.height()
                // vertical apps, horizontal divider
                    + this.dividerBounds.height();
                this.visualDividerBounds = new Rect(leftTopBounds.left, leftTopBounds.bottom,
            float totalWidth = this.leftTopBounds.width()
                        leftTopBounds.right, rightBottomBounds.top);
                    + this.rightBottomBounds.width()
            } else {
                    + this.dividerBounds.width();
                // horizontal apps, vertical divider

                this.visualDividerBounds = new Rect(leftTopBounds.right, leftTopBounds.top,
            leftTaskPercent = this.leftTopBounds.width() / totalWidth;
                        rightBottomBounds.left, leftTopBounds.bottom);
            topTaskPercent = this.leftTopBounds.height() / totalHeight;
            }

            leftTaskPercent = this.leftTopBounds.width() / (float) rightBottomBounds.right;
            topTaskPercent = this.leftTopBounds.height() / (float) rightBottomBounds.bottom;
        }
        }
    }
    }