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

Commit 85ac2217 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[wm]: Support free snap mode" into rvc-dev

parents 6d99b579 8a9cb1d3
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public class DividerSnapAlgorithm {
    private final ArrayList<SnapTarget> mTargets = new ArrayList<>();
    private final Rect mInsets = new Rect();
    private final int mSnapMode;
    private final boolean mFreeSnapMode;
    private final int mMinimalSizeResizableTask;
    private final int mTaskHeightInMinimizedMode;
    private final float mFixedRatio;
@@ -125,6 +126,8 @@ public class DividerSnapAlgorithm {
        mInsets.set(insets);
        mSnapMode = isMinimizedMode ? SNAP_MODE_MINIMIZED :
                res.getInteger(com.android.internal.R.integer.config_dockedStackDividerSnapMode);
        mFreeSnapMode = res.getBoolean(
                com.android.internal.R.bool.config_dockedStackDividerFreeSnapMode);
        mFixedRatio = res.getFraction(
                com.android.internal.R.fraction.docked_stack_divider_fixed_ratio, 1, 1);
        mMinimalSizeResizableTask = res.getDimensionPixelSize(
@@ -247,7 +250,20 @@ public class DividerSnapAlgorithm {
        }
    }

    private boolean shouldApplyFreeSnapMode(int position) {
        if (!mFreeSnapMode) {
            return false;
        }
        if (!isFirstSplitTargetAvailable() || !isLastSplitTargetAvailable()) {
            return false;
        }
        return mFirstSplitTarget.position < position && position < mLastSplitTarget.position;
    }

    private SnapTarget snap(int position, boolean hardDismiss) {
        if (shouldApplyFreeSnapMode(position)) {
            return new SnapTarget(position, position, SnapTarget.FLAG_NONE);
        }
        int minIndex = -1;
        float minDistance = Float.MAX_VALUE;
        int size = mTargets.size();
+4 −0
Original line number Diff line number Diff line
@@ -3346,6 +3346,10 @@
         This should only be set when the device has gestural navigation enabled by default. -->
    <bool name="config_showGesturalNavigationHints">false</bool>

    <!-- Controls the free snap mode for the docked stack divider. In this mode, the divider can be
         snapped to any position between the first target and the last target. -->
    <bool name="config_dockedStackDividerFreeSnapMode">false</bool>

    <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">16x16</string>
+1 −0
Original line number Diff line number Diff line
@@ -1667,6 +1667,7 @@
  <java-symbol type="bool" name="config_perDisplayFocusEnabled" />
  <java-symbol type="bool" name="config_showNavigationBar" />
  <java-symbol type="bool" name="config_supportAutoRotation" />
  <java-symbol type="bool" name="config_dockedStackDividerFreeSnapMode" />
  <java-symbol type="dimen" name="docked_stack_divider_thickness" />
  <java-symbol type="dimen" name="docked_stack_divider_insets" />
  <java-symbol type="dimen" name="docked_stack_minimize_thickness" />