am bbedfa00: Merge "Tale of status bar on crespo, part 3 Bug #6541079" into jb-dev

* commit 'bbedfa0036f8de393c05b2ad981695ae74e7ab42':
  Tale of status bar on crespo, part 3 Bug #6541079
This commit is contained in:
Romain Guy
2012-05-25 19:23:48 -07:00
committed by Android Git Automerger
3 changed files with 54 additions and 7 deletions

View File

@@ -6,6 +6,7 @@
<View <View
android:id="@+id/top_glow" android:id="@+id/top_glow"
android:alpha="0" android:alpha="0"
android:visibility="invisible"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height" android:layout_height="@dimen/notification_divider_height"
android:layout_gravity="top|center_horizontal" android:layout_gravity="top|center_horizontal"
@@ -41,6 +42,7 @@
<View <View
android:id="@+id/bottom_glow" android:id="@+id/bottom_glow"
android:alpha="0" android:alpha="0"
android:visibility="invisible"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height" android:layout_height="@dimen/notification_divider_height"
android:layout_gravity="bottom|center_horizontal" android:layout_gravity="bottom|center_horizontal"

View File

@@ -17,17 +17,17 @@
package com.android.systemui; package com.android.systemui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet; import android.animation.AnimatorSet;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
import android.graphics.RectF;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import com.android.internal.widget.SizeAdaptiveLayout;
public class ExpandHelper implements Gefingerpoken, OnClickListener { public class ExpandHelper implements Gefingerpoken, OnClickListener {
public interface Callback { public interface Callback {
@@ -130,8 +130,28 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f); mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f);
mScaleAnimation.setDuration(EXPAND_DURATION); 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 = ObjectAnimator.ofFloat(null, "alpha", 0f);
mGlowTopAnimation.addListener(glowVisibilityController);
mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f); mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
mGlowBottomAnimation.addListener(glowVisibilityController);
mGlowAnimationSet = new AnimatorSet(); mGlowAnimationSet = new AnimatorSet();
mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation); mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation);
mGlowAnimationSet.setDuration(GLOW_DURATION); mGlowAnimationSet.setDuration(GLOW_DURATION);
@@ -225,10 +245,19 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
// set it explicitly in reponse to touches. // set it explicitly in reponse to touches.
mCurrViewTopGlow.setAlpha(glow); mCurrViewTopGlow.setAlpha(glow);
mCurrViewBottomGlow.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) { public boolean onInterceptTouchEvent(MotionEvent ev) {
if (DEBUG) Log.d(TAG, "interceptTouch: act=" + (ev.getAction()) + if (DEBUG) Log.d(TAG, "interceptTouch: act=" + (ev.getAction()) +
" stretching=" + mStretching); " stretching=" + mStretching);

View File

@@ -360,6 +360,7 @@ public class PhoneStatusBar extends BaseStatusBar {
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setOnClickListener(mClearButtonListener);
mClearButton.setAlpha(0f); mClearButton.setAlpha(0f);
mClearButton.setVisibility(View.INVISIBLE);
mClearButton.setEnabled(false); mClearButton.setEnabled(false);
mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date); mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date);
mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button); mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button);
@@ -816,16 +817,31 @@ public class PhoneStatusBar extends BaseStatusBar {
if (mClearButton.isShown()) { if (mClearButton.isShown()) {
if (clearable != (mClearButton.getAlpha() == 1.0f)) { if (clearable != (mClearButton.getAlpha() == 1.0f)) {
ObjectAnimator.ofFloat(mClearButton, "alpha", ObjectAnimator clearAnimation = ObjectAnimator.ofFloat(
clearable ? 1.0f : 0.0f) mClearButton, "alpha", clearable ? 1.0f : 0.0f).setDuration(250);
.setDuration(250) clearAnimation.addListener(new AnimatorListenerAdapter() {
.start(); @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 { } else {
mClearButton.setAlpha(clearable ? 1.0f : 0.0f); mClearButton.setAlpha(clearable ? 1.0f : 0.0f);
mClearButton.setVisibility(clearable ? View.VISIBLE : View.INVISIBLE);
} }
mClearButton.setEnabled(clearable); mClearButton.setEnabled(clearable);
final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out); final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out);
final boolean showDot = (any&&!areLightsOn()); final boolean showDot = (any&&!areLightsOn());
if (showDot != (nlo.getAlpha() == 1.0f)) { if (showDot != (nlo.getAlpha() == 1.0f)) {