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

Commit 66a265c8 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Center paired app icons

In splitscreen overview, the pair of app icons is now always centered at
the top of the view, rather than following the divider's position.

Test: Visually tested on local P6 device

Fixes: 208648221

Change-Id: I460d06047693c9376dab8215085d54aa4164d69f
parent 73d6b4c9
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -482,17 +482,14 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
                (FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
        FrameLayout.LayoutParams secondaryIconParams =
                new FrameLayout.LayoutParams(primaryIconParams);
        int dividerBar = (splitConfig.appsStackedVertically ?
                splitConfig.visualDividerBounds.height() :
                splitConfig.visualDividerBounds.width());

        primaryIconParams.gravity = (isRtl ? START : END) | TOP;
        primaryIconView.setTranslationY(primarySnapshotHeight - primaryIconView.getHeight() / 2f);
        primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END);
        primaryIconView.setTranslationX(0);

        secondaryIconParams.gravity = (isRtl ? START : END) | TOP;
        secondaryIconView.setTranslationY(primarySnapshotHeight + taskIconHeight + dividerBar);
        primaryIconView.setTranslationY(-(taskIconHeight / 2f));
        secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END);
        secondaryIconView.setTranslationX(0);
        secondaryIconView.setTranslationY(taskIconHeight / 2f);

        primaryIconView.setLayoutParams(primaryIconParams);
        secondaryIconView.setLayoutParams(secondaryIconParams);
    }
+7 −18
Original line number Diff line number Diff line
@@ -581,26 +581,15 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
                (FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
        FrameLayout.LayoutParams secondaryIconParams =
                new FrameLayout.LayoutParams(primaryIconParams);
        int dividerBar = (splitConfig.appsStackedVertically ?
                splitConfig.visualDividerBounds.height() :
                splitConfig.visualDividerBounds.width());

        if (deviceProfile.isLandscape) {
            primaryIconParams.gravity = TOP | START;
            primaryIconView.setTranslationX(
                    primarySnapshotWidth - primaryIconView.getMeasuredWidth());
            primaryIconView.setTranslationY(0);
            secondaryIconParams.gravity = TOP | START;
            secondaryIconView.setTranslationX(primarySnapshotWidth + dividerBar);
        } else {
        primaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
            primaryIconView.setTranslationX(-(primaryIconView.getMeasuredWidth()) / 2f);
        // shifts icon half a width left (height is used conveniently here since icons are square)
        primaryIconView.setTranslationX(-(taskIconHeight / 2f));
        primaryIconView.setTranslationY(0);

        secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
            secondaryIconView.setTranslationX(secondaryIconView.getMeasuredWidth() / 2f);
        }
        secondaryIconView.setTranslationX(taskIconHeight / 2f);
        secondaryIconView.setTranslationY(0);

        primaryIconView.setLayoutParams(primaryIconParams);
        secondaryIconView.setLayoutParams(secondaryIconParams);
    }
+2 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.view.Gravity.BOTTOM;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.view.Gravity.END;
import static android.view.Gravity.START;
import static android.view.Gravity.TOP;

import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
@@ -183,8 +182,8 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
        FrameLayout.LayoutParams secondaryIconParams =
                (FrameLayout.LayoutParams) secondaryIconView.getLayoutParams();

        primaryIconParams.gravity = (isRtl ? END : START) | TOP;
        secondaryIconParams.gravity = (isRtl ? END : START) | TOP;
        primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START);
        secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START);
        primaryIconView.setLayoutParams(primaryIconParams);
        secondaryIconView.setLayoutParams(secondaryIconParams);
    }