diff options
author | Romain Guy <romainguy@google.com> | 2012-05-25 12:08:39 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-05-25 12:08:39 -0700 |
commit | 8900e631940fdffe7b941b56dc0f17e55345441e (patch) | |
tree | 547585decaffc128eea023a1f42e62118fd7f9b7 /packages/SystemUI/src/com/android/systemui/ExpandHelper.java | |
parent | 648342f1f257663fc5b3065b23c80eb015edfbea (diff) | |
download | frameworks_base-8900e631940fdffe7b941b56dc0f17e55345441e.zip frameworks_base-8900e631940fdffe7b941b56dc0f17e55345441e.tar.gz frameworks_base-8900e631940fdffe7b941b56dc0f17e55345441e.tar.bz2 |
Tale of status bar on crespo, part 3
Bug #6541079
The vanished shall not be forgotten.
Change-Id: If01a53d8c203ef82e54d0b440063a8dbebe7b14a
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/ExpandHelper.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/ExpandHelper.java | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index ba3336b..df41d25 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -17,17 +17,17 @@ package com.android.systemui; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; -import android.graphics.RectF; import android.util.Log; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; -import com.android.internal.widget.SizeAdaptiveLayout; public class ExpandHelper implements Gefingerpoken, OnClickListener { public interface Callback { @@ -130,8 +130,28 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f); mScaleAnimation.setDuration(EXPAND_DURATION); + AnimatorListenerAdapter glowVisibilityController = new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + View target = (View) ((ObjectAnimator) animation).getTarget(); + if (target.getAlpha() <= 0.0f) { + target.setVisibility(View.VISIBLE); + } + } + + @Override + public void onAnimationEnd(Animator animation) { + View target = (View) ((ObjectAnimator) animation).getTarget(); + if (target.getAlpha() <= 0.0f) { + target.setVisibility(View.INVISIBLE); + } + } + }; + mGlowTopAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f); + mGlowTopAnimation.addListener(glowVisibilityController); mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f); + mGlowBottomAnimation.addListener(glowVisibilityController); mGlowAnimationSet = new AnimatorSet(); mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation); mGlowAnimationSet.setDuration(GLOW_DURATION); @@ -225,10 +245,19 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { // set it explicitly in reponse to touches. mCurrViewTopGlow.setAlpha(glow); mCurrViewBottomGlow.setAlpha(glow); + handleGlowVisibility(); } } } } + + private void handleGlowVisibility() { + mCurrViewTopGlow.setVisibility(mCurrViewTopGlow.getAlpha() <= 0.0f ? + View.INVISIBLE : View.VISIBLE); + mCurrViewBottomGlow.setVisibility(mCurrViewBottomGlow.getAlpha() <= 0.0f ? + View.INVISIBLE : View.VISIBLE); + } + public boolean onInterceptTouchEvent(MotionEvent ev) { if (DEBUG) Log.d(TAG, "interceptTouch: act=" + (ev.getAction()) + " stretching=" + mStretching); |