Fix bug where dragging icons in folders causes error

The error was caused by delta being larger than the range, which leads to an UnsupportedOperationException: "Final position of the spring cannot be greater than the max value". With this change, delta will never be greater than range.

Fix: 261674632
Test: 1. Settings > Display > Display size and text >>> Set display size to the biggest
2. Make folder
3. Go to landscape mode
4. Open folder
5. Quickly drag icon in folder
6. Verify that Launcher doesn't stop and drag is successful

Change-Id: I6c81755750acf0de8693b98caad8e7dab3e9f58a
This commit is contained in:
Federico Baron
2022-12-22 22:51:28 +00:00
parent eef0b1640b
commit 7f823d10b4
@@ -568,7 +568,8 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
.setSpring(new SpringForce(0)
.setDampingRatio(DAMPENING_RATIO)
.setStiffness(STIFFNESS));
mDelta = view.getResources().getDisplayMetrics().density * PARALLAX_MAX_IN_DP;
mDelta = Math.min(
range, view.getResources().getDisplayMetrics().density * PARALLAX_MAX_IN_DP);
}
public void animateToPos(float value) {