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

Commit 1d6b7f2a authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix issue with split thumbnails overflowing during rotation

Fixes a set of issues in Overview where you could cause split thumbnails to overflow their contents into each other by rotating the phone in certain ways.

The issue occurred because StagedSplitBounds objects have their height and width assigned differently depending on if they were created while the phone was in portrait or landscape.

Fixed by adding a conditional check in PortraitPagedViewHandler#setSplitTaskSwipeRect and LandscapePagedViewHandler#setSplitTaskSwipeRect.

Fixes: 218784856
Fixes: 218779313

Test: Manual on local devices
Change-Id: I04b4f4344250da34616ab1744af22fa41b9aba9b
parent bc39e4d0
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -415,14 +415,17 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    @Override
    public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
            StagedSplitBounds splitInfo, int desiredStagePosition) {
        float diff;
        float horizontalDividerDiff = splitInfo.visualDividerBounds.width() / 2f;
        float topLeftTaskPercent = splitInfo.appsStackedVertically
                ? splitInfo.topTaskPercent
                : splitInfo.leftTaskPercent;
        float dividerBarPercent = splitInfo.appsStackedVertically
                ? splitInfo.dividerHeightPercent
                : splitInfo.dividerWidthPercent;

        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
            diff = outRect.height() * (1f - splitInfo.leftTaskPercent) + horizontalDividerDiff;
            outRect.bottom -= diff;
            outRect.bottom = outRect.top + (int) (outRect.height() * topLeftTaskPercent);
        } else {
            diff = outRect.height() * splitInfo.leftTaskPercent + horizontalDividerDiff;
            outRect.top += diff;
            outRect.top += (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent));
        }
    }

+11 −6
Original line number Diff line number Diff line
@@ -495,19 +495,24 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
    public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
            StagedSplitBounds splitInfo, int desiredStagePosition) {
        boolean isLandscape = dp.isLandscape;
        float topLeftTaskPercent = splitInfo.appsStackedVertically
                ? splitInfo.topTaskPercent
                : splitInfo.leftTaskPercent;
        float dividerBarPercent = splitInfo.appsStackedVertically
                ? splitInfo.dividerHeightPercent
                : splitInfo.dividerWidthPercent;

        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
            if (isLandscape) {
                outRect.right = outRect.left + (int) (outRect.width() * splitInfo.leftTaskPercent);
                outRect.right = outRect.left + (int) (outRect.width() * topLeftTaskPercent);
            } else {
                outRect.bottom = outRect.top + (int) (outRect.height() * splitInfo.topTaskPercent);
                outRect.bottom = outRect.top + (int) (outRect.height() * topLeftTaskPercent);
            }
        } else {
            if (isLandscape) {
                outRect.left += (int) (outRect.width() *
                        (splitInfo.leftTaskPercent + splitInfo.dividerWidthPercent));
                outRect.left += (int) (outRect.width() * (topLeftTaskPercent + dividerBarPercent));
            } else {
                outRect.top += (int) (outRect.height() *
                        (splitInfo.topTaskPercent + splitInfo.dividerHeightPercent));
                outRect.top += (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent));
            }
        }
    }