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

Commit 807c423a authored by Jeremy Sim's avatar Jeremy Sim Committed by Android (Google) Code Review
Browse files

Merge "Fix bug with launching non-50-50 splits in landscape on phones" into main

parents 42144a84 2a3f5dee
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -510,16 +510,18 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        }
    }

    /** Updates divide position and split bounds base on the ratio within root bounds. */
    /**
     * Updates divide position and split bounds base on the ratio within root bounds. Falls back
     * to middle position if the provided SnapTarget is not supported.
     */
    public void setDivideRatio(@PersistentSnapPosition int snapPosition) {
        final DividerSnapAlgorithm.SnapTarget snapTarget = mDividerSnapAlgorithm.findSnapTarget(
                snapPosition);

        if (snapTarget == null) {
            throw new IllegalArgumentException("No SnapTarget for position " + snapPosition);
        }

        setDividePosition(snapTarget.position, false /* applyLayoutChange */);
        setDividePosition(snapTarget != null
                ? snapTarget.position
                : mDividerSnapAlgorithm.getMiddleTarget().position,
                false /* applyLayoutChange */);
    }

    /** Resets divider position. */