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

Commit 7a78147b authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Use same calculation for portrait as fake landscape for layout of split thumbnails

* Partially revert ag/20330754, not entirely sure why we switched from
using dp.isLanscape to splitInfo.appsStackedVertically, since the two
represent different states (specifically for fake landscape)

Fixes: 280783620
Flag: None
Test: Tested on foldable, small + large screen.
Fake and real landscape on small screen.
Rotated while in overview.
Slight sliver of wallpaper shows on large screen, but that
issue has been there.

Change-Id: I13d834a31417751dd3b757344ec7b4d9a174090e
parent 4d559a6c
Loading
Loading
Loading
Loading
+13 −12
Original line number Original line Diff line number Diff line
@@ -589,17 +589,17 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        float scaledDividerHeight = dividerHeight * scale;
        float scaledDividerHeight = dividerHeight * scale;


        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
        if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
            if (splitInfo.appsStackedVertically) {
            if (dp.isLandscape) {
                outRect.bottom = Math.round(outRect.top + scaledTopTaskHeight);
            } else {
                outRect.right = outRect.left + Math.round(outRect.width() * topLeftTaskPercent);
                outRect.right = outRect.left + Math.round(outRect.width() * topLeftTaskPercent);
            }
            } else {
            } else {
            if (splitInfo.appsStackedVertically) {
                outRect.bottom = Math.round(outRect.top + scaledTopTaskHeight);
                outRect.top += Math.round(scaledTopTaskHeight + scaledDividerHeight);
            }
        } else {
        } else {
            if (dp.isLandscape) {
                outRect.left += Math.round(outRect.width()
                outRect.left += Math.round(outRect.width()
                        * (topLeftTaskPercent + dividerBarPercent));
                        * (topLeftTaskPercent + dividerBarPercent));
            } else {
                outRect.top += Math.round(scaledTopTaskHeight + scaledDividerHeight);
            }
            }
        }
        }
    }
    }
@@ -610,9 +610,9 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
            DeviceProfile dp, boolean isRtl) {
            DeviceProfile dp, boolean isRtl) {
        int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
        int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
        int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
        int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
        int dividerBar = Math.round(splitBoundsConfig.appsStackedVertically
        float dividerScale = splitBoundsConfig.appsStackedVertically
                ? splitBoundsConfig.dividerHeightPercent * dp.availableHeightPx
                ? splitBoundsConfig.dividerHeightPercent
                : splitBoundsConfig.dividerWidthPercent * parentWidth);
                : splitBoundsConfig.dividerWidthPercent;
        int primarySnapshotHeight;
        int primarySnapshotHeight;
        int primarySnapshotWidth;
        int primarySnapshotWidth;
        int secondarySnapshotHeight;
        int secondarySnapshotHeight;
@@ -620,12 +620,13 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        float taskPercent = splitBoundsConfig.appsStackedVertically ?
        float taskPercent = splitBoundsConfig.appsStackedVertically ?
                splitBoundsConfig.topTaskPercent : splitBoundsConfig.leftTaskPercent;
                splitBoundsConfig.topTaskPercent : splitBoundsConfig.leftTaskPercent;
        if (dp.isLandscape) {
        if (dp.isLandscape) {
            int scaledDividerBar = Math.round(parentWidth * dividerScale);
            primarySnapshotHeight = totalThumbnailHeight;
            primarySnapshotHeight = totalThumbnailHeight;
            primarySnapshotWidth = Math.round(parentWidth * taskPercent);
            primarySnapshotWidth = Math.round(parentWidth * taskPercent);


            secondarySnapshotHeight = totalThumbnailHeight;
            secondarySnapshotHeight = totalThumbnailHeight;
            secondarySnapshotWidth = parentWidth - primarySnapshotWidth - dividerBar;
            secondarySnapshotWidth = parentWidth - primarySnapshotWidth - scaledDividerBar;
            int translationX = primarySnapshotWidth + dividerBar;
            int translationX = primarySnapshotWidth + scaledDividerBar;
            if (isRtl) {
            if (isRtl) {
                primarySnapshot.setTranslationX(-translationX);
                primarySnapshot.setTranslationX(-translationX);
                secondarySnapshot.setTranslationX(0);
                secondarySnapshot.setTranslationX(0);
@@ -640,7 +641,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        } else {
        } else {
            float scale = (float) totalThumbnailHeight / dp.availableHeightPx;
            float scale = (float) totalThumbnailHeight / dp.availableHeightPx;
            float topTaskHeight = dp.availableHeightPx * taskPercent;
            float topTaskHeight = dp.availableHeightPx * taskPercent;
            float finalDividerHeight = dividerBar * scale;
            float finalDividerHeight = Math.round(totalThumbnailHeight * dividerScale);
            float scaledTopTaskHeight = topTaskHeight * scale;
            float scaledTopTaskHeight = topTaskHeight * scale;
            primarySnapshotWidth = parentWidth;
            primarySnapshotWidth = parentWidth;
            primarySnapshotHeight = Math.round(scaledTopTaskHeight);
            primarySnapshotHeight = Math.round(scaledTopTaskHeight);