summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-10-02 16:11:54 -0700
committerChet Haase <chet@google.com>2013-10-03 15:50:35 -0700
commit167a32326ea3a3b30c147cd02e3b3151e794e016 (patch)
tree0f9e939f901859d9a7401b37b089ea2a666f972f /core/java/com
parentcf5b34b0c43df076cfe8b774c1c919303793fa7c (diff)
downloadframeworks_base-167a32326ea3a3b30c147cd02e3b3151e794e016.zip
frameworks_base-167a32326ea3a3b30c147cd02e3b3151e794e016.tar.gz
frameworks_base-167a32326ea3a3b30c147cd02e3b3151e794e016.tar.bz2
Fix lockscreen wave animation artifacts
On some display sizes, the wave animation was sometimes running more than once, starting over in the center and animating outward... partially. The problem was that the calculations determining the alpha value of the dots was returning bogus values when the display area was large enough, which is why the bug is only on some devices. This fix simplifies the math and ensures that the wave only animates once, from start to finish. Issue #11005936 regression on lockscreen animation for multi-wave widget Change-Id: Id21a2e4d2271f01c82c4bc6e1f37d78e68b9b6e4
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/GlowPadView.java2
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/PointCloud.java11
2 files changed, 6 insertions, 7 deletions
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index aad285a..cd1ccd3 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -76,7 +76,7 @@ public class GlowPadView extends View {
}
// Tuneable parameters for animation
- private static final int WAVE_ANIMATION_DURATION = 1350;
+ private static final int WAVE_ANIMATION_DURATION = 1000;
private static final int RETURN_TO_HOME_DELAY = 1200;
private static final int RETURN_TO_HOME_DURATION = 200;
private static final int HIDE_ANIMATION_DELAY = 200;
diff --git a/core/java/com/android/internal/widget/multiwaveview/PointCloud.java b/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
index bbd1276..f299935 100644
--- a/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
+++ b/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
@@ -45,8 +45,8 @@ public class PointCloud {
public class WaveManager {
private float radius = 50;
- private float width = 200.0f; // TODO: Make configurable
private float alpha = 0.0f;
+
public void setRadius(float r) {
radius = r;
}
@@ -186,13 +186,12 @@ public class PointCloud {
// Compute contribution from Wave
float radius = hypot(point.x, point.y);
- float distanceToWaveRing = (radius - waveManager.radius);
float waveAlpha = 0.0f;
- if (distanceToWaveRing < waveManager.width * 0.5f && distanceToWaveRing < 0.0f) {
- float cosf = FloatMath.cos(PI * 0.25f * distanceToWaveRing / waveManager.width);
- waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 20.0f));
+ if (radius < waveManager.radius * 2) {
+ float distanceToWaveRing = (radius - waveManager.radius);
+ float cosf = FloatMath.cos(PI * 0.5f * distanceToWaveRing / waveManager.radius);
+ waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 6.0f));
}
-
return (int) (max(glowAlpha, waveAlpha) * 255);
}