Overshoot when flinging up from an app
- Use OvershootInterpolator based on velocity (consistent with swiping up
from home)
- Scale down recents as well, to be consistent with adjacent pages scaling
up when you launch a task
Bug: 109709720
Change-Id: Ie47309058ccf673a4b86c40c843c415beb2d8dc7
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 4bd9a9b..5355c5e 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -272,6 +272,24 @@
return scale;
}
+ /**
+ * Maps t from one range to another range.
+ * @param t The value to map.
+ * @param fromMin The lower bound of the range that t is being mapped from.
+ * @param fromMax The upper bound of the range that t is being mapped from.
+ * @param toMin The lower bound of the range that t is being mapped to.
+ * @param toMax The upper bound of the range that t is being mapped to.
+ * @return The mapped value of t.
+ */
+ public static float mapToRange(float t, float fromMin, float fromMax, float toMin, float toMax) {
+ if (fromMin == fromMax || toMin == toMax) {
+ Log.e(TAG, "mapToRange: range has 0 length");
+ return toMin;
+ }
+ float progress = Math.abs(t - fromMin) / Math.abs(fromMax - fromMin);
+ return mapRange(progress, toMin, toMax);
+ }
+
public static float mapRange(float value, float min, float max) {
return min + (value * (max - min));
}
@@ -463,6 +481,13 @@
}
/**
+ * @see #boundToRange(int, int, int).
+ */
+ public static long boundToRange(long value, long lowerBound, long upperBound) {
+ return Math.max(lowerBound, Math.min(value, upperBound));
+ }
+
+ /**
* Wraps a message with a TTS span, so that a different message is spoken than
* what is getting displayed.
* @param msg original message