Fix animation play time, animation and alpha.
Change-Id: Ib5f0a7880473930da3db70fcbd8c4e620f267cf8
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index f5f2eb79..1c88ea7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -230,10 +230,13 @@
// Check whether there is already a background animation running.
if (mBackgroundAnimator != null) {
startAlpha = (Integer) mBackgroundAnimator.getAnimatedValue();
- duration = (int) (NotificationActivator.ANIMATION_LENGTH_MS
- - mBackgroundAnimator.getCurrentPlayTime());
+ duration = (int) mBackgroundAnimator.getCurrentPlayTime();
mBackgroundAnimator.removeAllListeners();
mBackgroundAnimator.cancel();
+ if (duration <= 0) {
+ updateBackgroundResource();
+ return;
+ }
}
mBackgroundNormal.setAlpha(startAlpha);
mBackgroundAnimator =
@@ -257,10 +260,12 @@
private void updateBackgroundResource() {
if (mDimmed) {
setBackgroundDimmed(mDimmedBgResId);
+ mBackgroundDimmed.setAlpha(255);
setBackgroundNormal(null);
} else {
setBackgroundDimmed(null);
setBackgroundNormal(mBgResId);
+ mBackgroundNormal.setAlpha(255);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index c040918..236e0e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1415,13 +1415,6 @@
return mBouncerShowing;
}
- /**
- * See {@link PowerManager#isInteractive()} for the meaning of this method.
- */
- public boolean isScreenTurnedOn() {
- return mPowerManager.isInteractive();
- }
-
public void destroy() {
if (mSearchPanelView != null) {
mWindowManager.removeViewImmediate(mSearchPanelView);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
index 699c83f..e471754 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
@@ -127,6 +127,7 @@
mCallback.setUserLockedChild(mStartingChild, false);
}
mOnDragDownListener.onDraggedDown(mStartingChild);
+ mDraggingDown = false;
} else {
stopDragging();
return false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index b04977a..627b80f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -39,6 +39,7 @@
private NotificationStackScrollLayout mNotificationStackScroller;
private boolean mTrackingSettings;
private int mNotificationTopPadding;
+ private boolean mAnimateNextTopPaddingChange;
public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -80,7 +81,13 @@
mNotificationStackScroller.setTopPadding(mStatusBar.getBarState() == StatusBarState.KEYGUARD
? mKeyguardStatusView.getBottom() + keyguardBottomMargin
: mHeader.getBottom() + mNotificationTopPadding,
- mStatusBar.isScreenTurnedOn() && mStatusBar.isExpandedVisible());
+ mAnimateNextTopPaddingChange);
+ mAnimateNextTopPaddingChange = false;
+ }
+
+ public void animateNextTopPaddingChange() {
+ mAnimateNextTopPaddingChange = true;
+ requestLayout();
}
@Override
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 64906ea..0db6914 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -631,7 +631,8 @@
R.layout.status_bar_notification_keyguard_overflow, mStackScroller, false);
mKeyguardIconOverflowContainer.setOnActivatedListener(this);
mKeyguardCarrierLabel = mStatusBarWindow.findViewById(R.id.keyguard_carrier_text);
- mKeyguardIconOverflowContainer.setOnClickListener(mOverflowClickListener);
+ // TODO: Comment in when transition is ready.
+ //mKeyguardIconOverflowContainer.setOnClickListener(mOverflowClickListener);
mStackScroller.addView(mKeyguardIconOverflowContainer);
mExpandedContents = mStackScroller;
@@ -2990,6 +2991,7 @@
setBarState(StatusBarState.SHADE);
if (mLeaveOpenOnKeyguardHide) {
mLeaveOpenOnKeyguardHide = false;
+ mNotificationPanel.animateNextTopPaddingChange();
} else {
instantCollapseNotificationPanel();
}
@@ -3176,6 +3178,7 @@
mLeaveOpenOnKeyguardHide = true;
showBouncer();
} else if (mStatusBarKeyguardViewManager.isSecure()) {
+ mNotificationPanel.animateNextTopPaddingChange();
setBarState(StatusBarState.SHADE_LOCKED);
updateKeyguardState();
} else {
@@ -3195,10 +3198,6 @@
}
}
- public boolean isExpandedVisible() {
- return mExpandedVisible;
- }
-
public static boolean inBounds(View view, MotionEvent event, boolean orAbove) {
final int[] location = new int[2];
view.getLocationInWindow(location);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index b96e33d..3ea9cca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -959,8 +959,10 @@
}
private void generateTopPaddingEvent() {
- mAnimationEvents.add(
- new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_TOP_PADDING_CHANGED));
+ if (mTopPaddingNeedsAnimation) {
+ mAnimationEvents.add(
+ new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_TOP_PADDING_CHANGED));
+ }
mTopPaddingNeedsAnimation = false;
}