Skip to content

Commit bbedfa0

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Tale of status bar on crespo, part 3 Bug #6541079" into jb-dev
2 parents d4cf7e7 + 8900e63 commit bbedfa0

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

packages/SystemUI/res/layout/status_bar_notification_row.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<View
77
android:id="@+id/top_glow"
88
android:alpha="0"
9+
android:visibility="invisible"
910
android:layout_width="match_parent"
1011
android:layout_height="@dimen/notification_divider_height"
1112
android:layout_gravity="top|center_horizontal"
@@ -41,6 +42,7 @@
4142
<View
4243
android:id="@+id/bottom_glow"
4344
android:alpha="0"
45+
android:visibility="invisible"
4446
android:layout_width="match_parent"
4547
android:layout_height="@dimen/notification_divider_height"
4648
android:layout_gravity="bottom|center_horizontal"

packages/SystemUI/src/com/android/systemui/ExpandHelper.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
package com.android.systemui;
1919

20+
import android.animation.Animator;
21+
import android.animation.AnimatorListenerAdapter;
2022
import android.animation.AnimatorSet;
2123
import android.animation.ObjectAnimator;
2224
import android.content.Context;
23-
import android.graphics.RectF;
2425
import android.util.Log;
2526
import android.view.MotionEvent;
2627
import android.view.ScaleGestureDetector;
2728
import android.view.View;
2829
import android.view.ViewGroup;
2930
import android.view.View.OnClickListener;
30-
import com.android.internal.widget.SizeAdaptiveLayout;
3131

3232
public class ExpandHelper implements Gefingerpoken, OnClickListener {
3333
public interface Callback {
@@ -130,8 +130,28 @@ public ExpandHelper(Context context, Callback callback, int small, int large) {
130130
mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f);
131131
mScaleAnimation.setDuration(EXPAND_DURATION);
132132

133+
AnimatorListenerAdapter glowVisibilityController = new AnimatorListenerAdapter() {
134+
@Override
135+
public void onAnimationStart(Animator animation) {
136+
View target = (View) ((ObjectAnimator) animation).getTarget();
137+
if (target.getAlpha() <= 0.0f) {
138+
target.setVisibility(View.VISIBLE);
139+
}
140+
}
141+
142+
@Override
143+
public void onAnimationEnd(Animator animation) {
144+
View target = (View) ((ObjectAnimator) animation).getTarget();
145+
if (target.getAlpha() <= 0.0f) {
146+
target.setVisibility(View.INVISIBLE);
147+
}
148+
}
149+
};
150+
133151
mGlowTopAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
152+
mGlowTopAnimation.addListener(glowVisibilityController);
134153
mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
154+
mGlowBottomAnimation.addListener(glowVisibilityController);
135155
mGlowAnimationSet = new AnimatorSet();
136156
mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation);
137157
mGlowAnimationSet.setDuration(GLOW_DURATION);
@@ -225,10 +245,19 @@ public void setGlow(float glow) {
225245
// set it explicitly in reponse to touches.
226246
mCurrViewTopGlow.setAlpha(glow);
227247
mCurrViewBottomGlow.setAlpha(glow);
248+
handleGlowVisibility();
228249
}
229250
}
230251
}
231252
}
253+
254+
private void handleGlowVisibility() {
255+
mCurrViewTopGlow.setVisibility(mCurrViewTopGlow.getAlpha() <= 0.0f ?
256+
View.INVISIBLE : View.VISIBLE);
257+
mCurrViewBottomGlow.setVisibility(mCurrViewBottomGlow.getAlpha() <= 0.0f ?
258+
View.INVISIBLE : View.VISIBLE);
259+
}
260+
232261
public boolean onInterceptTouchEvent(MotionEvent ev) {
233262
if (DEBUG) Log.d(TAG, "interceptTouch: act=" + (ev.getAction()) +
234263
" stretching=" + mStretching);

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ public boolean onTouch(View v, MotionEvent event) {
360360
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
361361
mClearButton.setOnClickListener(mClearButtonListener);
362362
mClearButton.setAlpha(0f);
363+
mClearButton.setVisibility(View.INVISIBLE);
363364
mClearButton.setEnabled(false);
364365
mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date);
365366
mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button);
@@ -816,16 +817,31 @@ protected void setAreThereNotifications() {
816817

817818
if (mClearButton.isShown()) {
818819
if (clearable != (mClearButton.getAlpha() == 1.0f)) {
819-
ObjectAnimator.ofFloat(mClearButton, "alpha",
820-
clearable ? 1.0f : 0.0f)
821-
.setDuration(250)
822-
.start();
820+
ObjectAnimator clearAnimation = ObjectAnimator.ofFloat(
821+
mClearButton, "alpha", clearable ? 1.0f : 0.0f).setDuration(250);
822+
clearAnimation.addListener(new AnimatorListenerAdapter() {
823+
@Override
824+
public void onAnimationEnd(Animator animation) {
825+
if (mClearButton.getAlpha() <= 0.0f) {
826+
mClearButton.setVisibility(View.INVISIBLE);
827+
}
828+
}
829+
830+
@Override
831+
public void onAnimationStart(Animator animation) {
832+
if (mClearButton.getAlpha() <= 0.0f) {
833+
mClearButton.setVisibility(View.VISIBLE);
834+
}
835+
}
836+
});
837+
clearAnimation.start();
823838
}
824839
} else {
825840
mClearButton.setAlpha(clearable ? 1.0f : 0.0f);
841+
mClearButton.setVisibility(clearable ? View.VISIBLE : View.INVISIBLE);
826842
}
827843
mClearButton.setEnabled(clearable);
828-
844+
829845
final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out);
830846
final boolean showDot = (any&&!areLightsOn());
831847
if (showDot != (nlo.getAlpha() == 1.0f)) {

0 commit comments

Comments
 (0)