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

Commit f8e71cd4 authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Maintain order in GlobalActions when rotating to/from seascape.

Previous code keeps the order wrt the hardware -- eg, power off is
always nearest the camera -- but this winds up being unintuitive.
Instead maintain reading order: power is always first, farthest
left/top.

Bug: 73910843, 73910843
Test: Manual in all 3 rotations.
Change-Id: I2bcbdaf58953f746864c941339888608074c5400
parent 113f9f85
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -175,9 +175,6 @@ public class HardwareUiLayout extends FrameLayout implements Tunable {
                mRotatedBackground = true;
                mBackground.setRotatedBackground(true);
                LinearLayout linearLayout = (LinearLayout) mChild;
                if (to == ROTATION_SEASCAPE) {
                    swapOrder(linearLayout);
                }
                if (mSwapOrientation) {
                    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
                }
@@ -188,9 +185,6 @@ public class HardwareUiLayout extends FrameLayout implements Tunable {
                mRotatedBackground = false;
                mBackground.setRotatedBackground(false);
                LinearLayout linearLayout = (LinearLayout) mChild;
                if (from == ROTATION_SEASCAPE) {
                    swapOrder(linearLayout);
                }
                if (mSwapOrientation) {
                    linearLayout.setOrientation(LinearLayout.VERTICAL);
                }
@@ -199,15 +193,6 @@ public class HardwareUiLayout extends FrameLayout implements Tunable {
        }
    }

    private void swapOrder(LinearLayout linearLayout) {
        ArrayList<View> children = new ArrayList<>();
        for (int i = 0; i < linearLayout.getChildCount(); i++) {
            children.add(0, linearLayout.getChildAt(0));
            linearLayout.removeViewAt(0);
        }
        children.forEach(v -> linearLayout.addView(v));
    }

    private void rotateRight() {
        rotateRight(this);
        rotateRight(mChild);