diff options
author | Adrian Roos <roosa@google.com> | 2015-06-19 15:57:25 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-06-19 16:48:04 -0700 |
commit | c6d3e0e11da6e0515f29928efaaf6969f2de610b (patch) | |
tree | 74e4a5c37e7eb7cfa3f5b079d2b8bf8e8b7cea2a /packages/SystemUI | |
parent | 4f43dc042bf76ec6c3b340b2297dec7c4cdd9098 (diff) | |
download | frameworks_base-c6d3e0e11da6e0515f29928efaaf6969f2de610b.zip frameworks_base-c6d3e0e11da6e0515f29928efaaf6969f2de610b.tar.gz frameworks_base-c6d3e0e11da6e0515f29928efaaf6969f2de610b.tar.bz2 |
Tweak assist disclosure animation
Bug: 21568059
Change-Id: I81666bed4d4ae3eb1998cfdcc652921bafeae7f2
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/res/interpolator/assist_disclosure_trace.xml | 22 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java | 32 |
2 files changed, 43 insertions, 11 deletions
diff --git a/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml new file mode 100644 index 0000000..6b5cd37 --- /dev/null +++ b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:controlX1="0.6" + android:controlY1="0" + android:controlX2="0.7" + android:controlY2="1"/>
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java index 234a699..585f9ba 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java @@ -93,8 +93,9 @@ public class AssistDisclosure { private class AssistDisclosureView extends View implements ValueAnimator.AnimatorUpdateListener { - public static final int TRACING_ANIMATION_DURATION = 300; - public static final int ALPHA_ANIMATION_DURATION = 200; + public static final int TRACING_ANIMATION_DURATION = 600; + public static final int ALPHA_IN_ANIMATION_DURATION = 450; + public static final int ALPHA_OUT_ANIMATION_DURATION = 400; private float mThickness; private float mShadowThickness; @@ -102,11 +103,12 @@ public class AssistDisclosure { private final Paint mShadowPaint = new Paint(); private final ValueAnimator mTracingAnimator; - private final ValueAnimator mAlphaAnimator; + private final ValueAnimator mAlphaOutAnimator; + private final ValueAnimator mAlphaInAnimator; private final AnimatorSet mAnimator; private float mTracingProgress = 0; - private int mAlpha = 255; + private int mAlpha = 0; public AssistDisclosureView(Context context) { super(context); @@ -114,13 +116,19 @@ public class AssistDisclosure { mTracingAnimator = ValueAnimator.ofFloat(0, 1).setDuration(TRACING_ANIMATION_DURATION); mTracingAnimator.addUpdateListener(this); mTracingAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + R.interpolator.assist_disclosure_trace)); + mAlphaInAnimator = ValueAnimator.ofInt(0, 255).setDuration(ALPHA_IN_ANIMATION_DURATION); + mAlphaInAnimator.addUpdateListener(this); + mAlphaInAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_slow_in)); - mAlphaAnimator = ValueAnimator.ofInt(255, 0).setDuration(ALPHA_ANIMATION_DURATION); - mAlphaAnimator.addUpdateListener(this); - mAlphaAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + mAlphaOutAnimator = ValueAnimator.ofInt(255, 0).setDuration( + ALPHA_OUT_ANIMATION_DURATION); + mAlphaOutAnimator.addUpdateListener(this); + mAlphaOutAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_linear_in)); mAnimator = new AnimatorSet(); - mAnimator.play(mTracingAnimator).before(mAlphaAnimator); + mAnimator.play(mAlphaInAnimator).with(mTracingAnimator); + mAnimator.play(mAlphaInAnimator).before(mAlphaOutAnimator); mAnimator.addListener(new AnimatorListenerAdapter() { boolean mCancelled; @@ -167,7 +175,7 @@ public class AssistDisclosure { mAnimator.cancel(); mTracingProgress = 0; - mAlpha = 255; + mAlpha = 0; } private void startAnimation() { @@ -240,8 +248,10 @@ public class AssistDisclosure { @Override public void onAnimationUpdate(ValueAnimator animation) { - if (animation == mAlphaAnimator) { - mAlpha = (int) mAlphaAnimator.getAnimatedValue(); + if (animation == mAlphaOutAnimator) { + mAlpha = (int) mAlphaOutAnimator.getAnimatedValue(); + } else if (animation == mAlphaInAnimator) { + mAlpha = (int) mAlphaInAnimator.getAnimatedValue(); } else if (animation == mTracingAnimator) { mTracingProgress = (float) mTracingAnimator.getAnimatedValue(); } |