diff options
author | Romain Guy <romainguy@google.com> | 2012-05-25 19:21:49 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-25 19:21:49 -0700 |
commit | bbedfa0036f8de393c05b2ad981695ae74e7ab42 (patch) | |
tree | ffc23d814cf23d99bcd938f4bac17f925eb8441d /packages | |
parent | d4cf7e7b06e6870d447dbed2683b8849cfe5336b (diff) | |
parent | 8900e631940fdffe7b941b56dc0f17e55345441e (diff) | |
download | frameworks_base-bbedfa0036f8de393c05b2ad981695ae74e7ab42.zip frameworks_base-bbedfa0036f8de393c05b2ad981695ae74e7ab42.tar.gz frameworks_base-bbedfa0036f8de393c05b2ad981695ae74e7ab42.tar.bz2 |
Merge "Tale of status bar on crespo, part 3 Bug #6541079" into jb-dev
Diffstat (limited to 'packages')
3 files changed, 54 insertions, 7 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml index 7491939..dd70166 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_row.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml @@ -6,6 +6,7 @@ <View android:id="@+id/top_glow" android:alpha="0" + android:visibility="invisible" android:layout_width="match_parent" android:layout_height="@dimen/notification_divider_height" android:layout_gravity="top|center_horizontal" @@ -41,6 +42,7 @@ <View android:id="@+id/bottom_glow" android:alpha="0" + android:visibility="invisible" android:layout_width="match_parent" android:layout_height="@dimen/notification_divider_height" android:layout_gravity="bottom|center_horizontal" 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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 4bc8f19..b9dd32f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -360,6 +360,7 @@ public class PhoneStatusBar extends BaseStatusBar { mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); + mClearButton.setVisibility(View.INVISIBLE); mClearButton.setEnabled(false); mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date); mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button); @@ -816,16 +817,31 @@ public class PhoneStatusBar extends BaseStatusBar { if (mClearButton.isShown()) { if (clearable != (mClearButton.getAlpha() == 1.0f)) { - ObjectAnimator.ofFloat(mClearButton, "alpha", - clearable ? 1.0f : 0.0f) - .setDuration(250) - .start(); + ObjectAnimator clearAnimation = ObjectAnimator.ofFloat( + mClearButton, "alpha", clearable ? 1.0f : 0.0f).setDuration(250); + clearAnimation.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mClearButton.getAlpha() <= 0.0f) { + mClearButton.setVisibility(View.INVISIBLE); + } + } + + @Override + public void onAnimationStart(Animator animation) { + if (mClearButton.getAlpha() <= 0.0f) { + mClearButton.setVisibility(View.VISIBLE); + } + } + }); + clearAnimation.start(); } } else { mClearButton.setAlpha(clearable ? 1.0f : 0.0f); + mClearButton.setVisibility(clearable ? View.VISIBLE : View.INVISIBLE); } mClearButton.setEnabled(clearable); - + final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out); final boolean showDot = (any&&!areLightsOn()); if (showDot != (nlo.getAlpha() == 1.0f)) { |