summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-05-03 16:03:46 -0700
committerTony Wickham <twickham@google.com>2016-05-03 17:00:20 -0700
commit8dd24099233c8a2e3e94350a23e4880f3aa89c28 (patch)
tree1647a9bc2779f776d63a44c9779f9769a9adffe9
parent0042e3a5e7ca098da92a202e3d835a0447314ee6 (diff)
downloadLauncher3-8dd24099233c8a2e3e94350a23e4880f3aa89c28.tar.gz
Return 1f in Log(Ac/De)celerateInterpolators on a 1f input.
In battery saver mode, animations skip directly to the final values. For LogDecelerateInterpolator, however, an input of 1f outputs an interpolated 0.99999994. This meant that the FirstFrameAnimatorHelper didn't realize that this was the last frame, and messed things up. Since any interpolator should return 1 on an input of 1, we just short-circuit in that case for the log interpolators. Bug: 25666809 Change-Id: I60527e3758cea383fbcf50acb95460a7bd9ab43c
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/LogAccelerateInterpolator.java4
-rw-r--r--src/com/android/launcher3/LogDecelerateInterpolator.java4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ccf9c00380..07236282f3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3117,10 +3117,6 @@ public class Launcher extends Activity
}
oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
oa.start();
- if (Utilities.isPowerSaverOn(this)) {
- // Animations are disabled in battery saver mode, so just skip to the end state.
- oa.end();
- }
}
private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
diff --git a/src/com/android/launcher3/LogAccelerateInterpolator.java b/src/com/android/launcher3/LogAccelerateInterpolator.java
index c3bbfa5364..519d391304 100644
--- a/src/com/android/launcher3/LogAccelerateInterpolator.java
+++ b/src/com/android/launcher3/LogAccelerateInterpolator.java
@@ -20,6 +20,8 @@ public class LogAccelerateInterpolator implements TimeInterpolator {
@Override
public float getInterpolation(float t) {
- return 1 - computeLog(1 - t, mBase, mDrift) * mLogScale;
+ // Due to rounding issues, the interpolation doesn't quite reach 1 even though it should.
+ // To account for this, we short-circuit to return 1 if the input is 1.
+ return Float.compare(t, 1f) == 0 ? 1f : 1 - computeLog(1 - t, mBase, mDrift) * mLogScale;
}
}
diff --git a/src/com/android/launcher3/LogDecelerateInterpolator.java b/src/com/android/launcher3/LogDecelerateInterpolator.java
index 4c5f6f08c4..7d9528280f 100644
--- a/src/com/android/launcher3/LogDecelerateInterpolator.java
+++ b/src/com/android/launcher3/LogDecelerateInterpolator.java
@@ -21,6 +21,8 @@ public class LogDecelerateInterpolator implements TimeInterpolator {
@Override
public float getInterpolation(float t) {
- return computeLog(t, mBase, mDrift) * mLogScale;
+ // Due to rounding issues, the interpolation doesn't quite reach 1 even though it should.
+ // To account for this, we short-circuit to return 1 if the input is 1.
+ return Float.compare(t, 1f) == 0 ? 1f : computeLog(t, mBase, mDrift) * mLogScale;
}
}