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

Commit e0ccb4e6 authored by Sergey Pinkevich's avatar Sergey Pinkevich
Browse files

Split tasks in RTL mode

For `translationX` in RTL (right to left layout) mode we should take into account `secondarySnapshotWidth`, not the primary one.

The same for `translationY` for foldable phone in folded mode

Known issue: there is still a wrong position for overview app icon, but it is not related to the task thumbnail, and will be fixed in a dedicated task
(Screenshot of the issue: https://screenshot.googleplex.com/9GHNWxQ5H6vJPn5)
Known issue task: b/315787393

Bug: 309452423
Flag: NONE
Test: manual

Tablet: https://drive.google.com/file/d/1WGUVcFq0sFTJYsAwcjE6E1SHMRe7_TaV/view?usp=sharing
Foldable phone: https://drive.google.com/file/d/1GvDgYg8R9OEoMSDKZaZVXSlsxh_qS-wW/view?usp=sharing

Change-Id: Iefe7fec586592e6a72c0f3be5933307213d92c7f
parent b6ebbb01
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -543,15 +543,19 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {

        secondarySnapshotWidth = parentWidth;
        secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar;
        secondarySnapshot.setTranslationY(0);
        primarySnapshot.setTranslationY(secondarySnapshotHeight + spaceAboveSnapshot + dividerBar);

        int translationY = primarySnapshotHeight + spaceAboveSnapshot + dividerBar;
        primarySnapshot.setTranslationY(spaceAboveSnapshot);
        secondarySnapshot.setTranslationY(translationY - spaceAboveSnapshot);

        primarySnapshot.measure(
                View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY),
                View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY));
                View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY)
        );
        secondarySnapshot.measure(
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotWidth, View.MeasureSpec.EXACTLY),
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight,
                        View.MeasureSpec.EXACTLY));
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, View.MeasureSpec.EXACTLY)
        );
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -644,11 +644,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {

            secondarySnapshotHeight = totalThumbnailHeight;
            secondarySnapshotWidth = parentWidth - primarySnapshotWidth - scaledDividerBar;
            int translationX = primarySnapshotWidth + scaledDividerBar;
            if (isRtl) {
                int translationX = secondarySnapshotWidth + scaledDividerBar;
                primarySnapshot.setTranslationX(-translationX);
                secondarySnapshot.setTranslationX(0);
            } else {
                int translationX = primarySnapshotWidth + scaledDividerBar;
                secondarySnapshot.setTranslationX(translationX);
                primarySnapshot.setTranslationX(0);
            }
+5 −3
Original line number Diff line number Diff line
@@ -343,13 +343,15 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
        secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar;
        secondarySnapshot.setTranslationY(0);
        primarySnapshot.setTranslationY(secondarySnapshotHeight + spaceAboveSnapshot + dividerBar);

        primarySnapshot.measure(
                View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY),
                View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY));
                View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY)
        );
        secondarySnapshot.measure(
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotWidth, View.MeasureSpec.EXACTLY),
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight,
                        View.MeasureSpec.EXACTLY));
                View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, View.MeasureSpec.EXACTLY)
        );
    }

    /* ---------- The following are only used by TaskViewTouchHandler. ---------- */