Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java +32 −2 Original line number Diff line number Diff line Loading @@ -212,9 +212,9 @@ public class DividerSnapAlgorithm { return snap(position, hardToDismiss); } if (velocity < 0) { return mFirstSplitTarget; return Flags.enableFlexibleTwoAppSplit() ? snapToPrev(position) : mFirstSplitTarget; } else { return mLastSplitTarget; return Flags.enableFlexibleTwoAppSplit() ? snapToNext(position) : mLastSplitTarget; } } Loading Loading @@ -331,6 +331,36 @@ public class DividerSnapAlgorithm { return mTargets.get(minIndex); } /** * From the given position, returns the closest SnapTarget on the left/top side. If there is * no such target, return the left/top-most target. */ private SnapTarget snapToPrev(int position) { // Iterate backwards until we reach the first target "smaller" than the given position. for (int i = mTargets.size() - 1; i >= 0; i--) { SnapTarget currentTarget = mTargets.get(i); if (currentTarget.getPosition() < position) { return currentTarget; } } return mDismissStartTarget; } /** * From the given position, returns the closest SnapTarget on the right/bottom side. If there is * no such target, return the right/bottom-most target. */ private SnapTarget snapToNext(int position) { // Iterate until we reach the first target "larger" than the given position. for (int i = 0; i < mTargets.size(); i++) { SnapTarget currentTarget = mTargets.get(i); if (currentTarget.getPosition() > position) { return currentTarget; } } return mDismissEndTarget; } private void calculateTargets() { mTargets.clear(); int dividerMax = mIsLeftRightSplit Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java +32 −2 Original line number Diff line number Diff line Loading @@ -212,9 +212,9 @@ public class DividerSnapAlgorithm { return snap(position, hardToDismiss); } if (velocity < 0) { return mFirstSplitTarget; return Flags.enableFlexibleTwoAppSplit() ? snapToPrev(position) : mFirstSplitTarget; } else { return mLastSplitTarget; return Flags.enableFlexibleTwoAppSplit() ? snapToNext(position) : mLastSplitTarget; } } Loading Loading @@ -331,6 +331,36 @@ public class DividerSnapAlgorithm { return mTargets.get(minIndex); } /** * From the given position, returns the closest SnapTarget on the left/top side. If there is * no such target, return the left/top-most target. */ private SnapTarget snapToPrev(int position) { // Iterate backwards until we reach the first target "smaller" than the given position. for (int i = mTargets.size() - 1; i >= 0; i--) { SnapTarget currentTarget = mTargets.get(i); if (currentTarget.getPosition() < position) { return currentTarget; } } return mDismissStartTarget; } /** * From the given position, returns the closest SnapTarget on the right/bottom side. If there is * no such target, return the right/bottom-most target. */ private SnapTarget snapToNext(int position) { // Iterate until we reach the first target "larger" than the given position. for (int i = 0; i < mTargets.size(); i++) { SnapTarget currentTarget = mTargets.get(i); if (currentTarget.getPosition() > position) { return currentTarget; } } return mDismissEndTarget; } private void calculateTargets() { mTargets.clear(); int dividerMax = mIsLeftRightSplit Loading