summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2016-01-07 16:37:39 -0500
committer Alan Viverette <alanv@google.com> 2016-01-07 16:37:39 -0500
commit0671f05fa94a234652c1cf3c6e0c2e123566f76f (patch)
tree545681675943069237f41946695283dc85ec02fa
parent55e20d502f3037920de6598e2350ba9c35216589 (diff)
Revert ripple background fast-enter behavior to M style
No longer fast-enters the background for unbounded ripples. Bug: 25602850 Change-Id: I3250505c1de04a72fb764174abf269e247e21578
-rw-r--r--graphics/java/android/graphics/drawable/RippleBackground.java21
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java3
2 files changed, 18 insertions, 6 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleBackground.java b/graphics/java/android/graphics/drawable/RippleBackground.java
index d313aa5b5f65..6bd2646f9299 100644
--- a/graphics/java/android/graphics/drawable/RippleBackground.java
+++ b/graphics/java/android/graphics/drawable/RippleBackground.java
@@ -33,6 +33,7 @@ import android.view.animation.LinearInterpolator;
* Draws a ripple background.
*/
class RippleBackground extends RippleComponent {
+
private static final TimeInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
private static final int OPACITY_ENTER_DURATION = 600;
@@ -48,8 +49,14 @@ class RippleBackground extends RippleComponent {
// Software rendering properties.
private float mOpacity = 0;
- public RippleBackground(RippleDrawable owner, Rect bounds, boolean forceSoftware) {
+ /** Whether this ripple is bounded. */
+ private boolean mIsBounded;
+
+ public RippleBackground(RippleDrawable owner, Rect bounds, boolean isBounded,
+ boolean forceSoftware) {
super(owner, bounds, forceSoftware);
+
+ mIsBounded = isBounded;
}
public boolean isVisible() {
@@ -105,7 +112,8 @@ class RippleBackground extends RippleComponent {
final AnimatorSet.Builder builder = set.play(exit);
// Linear "fast" enter based on current opacity.
- final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST);
+ final int fastEnterDuration = mIsBounded ?
+ (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
if (fastEnterDuration > 0) {
final ObjectAnimator enter = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 1);
enter.setInterpolator(LINEAR_INTERPOLATOR);
@@ -131,15 +139,18 @@ class RippleBackground extends RippleComponent {
mPropX = CanvasProperty.createFloat(0);
mPropY = CanvasProperty.createFloat(0);
- final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST);
+ final int fastEnterDuration = mIsBounded ?
+ (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
// Linear exit after enter is completed.
final RenderNodeAnimator exit = new RenderNodeAnimator(
mPropPaint, RenderNodeAnimator.PAINT_ALPHA, 0);
exit.setInterpolator(LINEAR_INTERPOLATOR);
exit.setDuration(OPACITY_EXIT_DURATION);
- exit.setStartDelay(fastEnterDuration);
- exit.setStartValue(targetAlpha);
+ if (fastEnterDuration > 0) {
+ exit.setStartDelay(fastEnterDuration);
+ exit.setStartValue(targetAlpha);
+ }
set.add(exit);
// Linear "fast" enter based on current opacity.
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 5213e10332c4..9c691e508535 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -540,7 +540,8 @@ public class RippleDrawable extends LayerDrawable {
*/
private void tryBackgroundEnter(boolean focused) {
if (mBackground == null) {
- mBackground = new RippleBackground(this, mHotspotBounds, mForceSoftware);
+ final boolean isBounded = isBounded();
+ mBackground = new RippleBackground(this, mHotspotBounds, isBounded, mForceSoftware);
}
mBackground.setup(mState.mMaxRadius, mDensity);