diff options
Diffstat (limited to 'packages')
-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(); } |