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
This commit is contained in:
committed by
Winson Chung
parent
f75fa0f8e2
commit
b45444b250
@@ -272,6 +272,24 @@ public final class Utilities {
|
||||
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));
|
||||
}
|
||||
@@ -462,6 +480,13 @@ public final class Utilities {
|
||||
return Math.max(lowerBound, Math.min(value, upperBound));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
|
||||
Reference in New Issue
Block a user