Merge "Merge "[wm]: Support free snap mode" into rvc-dev am: 85ac2217f8 am: a1930bcc1a" into rvc-d1-dev-plus-aosp am: d9e5f6c7f4

Change-Id: I1202143fe33e39673937b2a8fc28c0a59843c6d4
This commit is contained in:
Automerger Merge Worker
2020-04-03 18:33:48 +00:00
3 changed files with 21 additions and 0 deletions

View File

@@ -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();

View File

@@ -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>

View File

@@ -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" />