summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorChristian Robertson <robertsonc@google.com>2013-09-27 18:54:28 -0700
committerChristian Robertson <robertsonc@google.com>2013-10-01 12:37:17 -0700
commit2d1acfc9f7e1502a5dbb8cab54289d6fbb880467 (patch)
treeda2c14d06687d1619fe986737b2fd591ca1ab33f /core/java
parent16e6e203c0c86a1cbc1a7c1cf20cb5447f705a32 (diff)
downloadframeworks_base-2d1acfc9f7e1502a5dbb8cab54289d6fbb880467.zip
frameworks_base-2d1acfc9f7e1502a5dbb8cab54289d6fbb880467.tar.gz
frameworks_base-2d1acfc9f7e1502a5dbb8cab54289d6fbb880467.tar.bz2
New, less blue overscroll assets with tuned constants in EdgeEffect class.
Glow absorb animation was very slow with high velocity flings. Clamped the velocity and adjusted constants for start values and duration of absorb animation. Change-Id: Id2a87814498e05f5f8ceb942dd1d765874461beb
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/EdgeEffect.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index bb4a4cf..30752e0 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -68,6 +68,8 @@ public class EdgeEffect {
// Minimum velocity that will be absorbed
private static final int MIN_VELOCITY = 100;
+ // Maximum velocity, clamps at this value
+ private static final int MAX_VELOCITY = 10000;
private static final float EPSILON = 0.001f;
@@ -115,7 +117,7 @@ public class EdgeEffect {
private static final float PULL_DISTANCE_ALPHA_GLOW_FACTOR = 1.1f;
private static final int VELOCITY_EDGE_FACTOR = 8;
- private static final int VELOCITY_GLOW_FACTOR = 16;
+ private static final int VELOCITY_GLOW_FACTOR = 12;
private int mState = STATE_IDLE;
@@ -283,10 +285,10 @@ public class EdgeEffect {
*/
public void onAbsorb(int velocity) {
mState = STATE_ABSORB;
- velocity = Math.max(MIN_VELOCITY, Math.abs(velocity));
+ velocity = Math.min(Math.max(MIN_VELOCITY, Math.abs(velocity)), MAX_VELOCITY);
mStartTime = AnimationUtils.currentAnimationTimeMillis();
- mDuration = 0.1f + (velocity * 0.03f);
+ mDuration = 0.15f + (velocity * 0.02f);
// The edge should always be at least partially visible, regardless
// of velocity.
@@ -294,7 +296,7 @@ public class EdgeEffect {
mEdgeScaleY = mEdgeScaleYStart = 0.f;
// The glow depends more on the velocity, and therefore starts out
// nearly invisible.
- mGlowAlphaStart = 0.5f;
+ mGlowAlphaStart = 0.3f;
mGlowScaleYStart = 0.f;
// Factor the velocity by 8. Testing on device shows this works best to