Fix animation play time, animation and alpha.

Change-Id: Ib5f0a7880473930da3db70fcbd8c4e620f267cf8
This commit is contained in:
Jorim Jaggi
2014-05-01 22:40:56 +02:00
parent 864347ae94
commit 98fb09c2b2
6 changed files with 24 additions and 17 deletions

View File

@@ -230,10 +230,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
// 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 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private void updateBackgroundResource() {
if (mDimmed) {
setBackgroundDimmed(mDimmedBgResId);
mBackgroundDimmed.setAlpha(255);
setBackgroundNormal(null);
} else {
setBackgroundDimmed(null);
setBackgroundNormal(mBgResId);
mBackgroundNormal.setAlpha(255);
}
}

View File

@@ -1415,13 +1415,6 @@ public abstract class BaseStatusBar extends SystemUI implements
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);

View File

@@ -127,6 +127,7 @@ public class DragDownHelper implements Gefingerpoken {
mCallback.setUserLockedChild(mStartingChild, false);
}
mOnDragDownListener.onDraggedDown(mStartingChild);
mDraggingDown = false;
} else {
stopDragging();
return false;

View File

@@ -39,6 +39,7 @@ public class NotificationPanelView extends PanelView implements
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 @@ public class NotificationPanelView extends PanelView implements
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

View File

@@ -631,7 +631,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
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 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
setBarState(StatusBarState.SHADE);
if (mLeaveOpenOnKeyguardHide) {
mLeaveOpenOnKeyguardHide = false;
mNotificationPanel.animateNextTopPaddingChange();
} else {
instantCollapseNotificationPanel();
}
@@ -3176,6 +3178,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mLeaveOpenOnKeyguardHide = true;
showBouncer();
} else if (mStatusBarKeyguardViewManager.isSecure()) {
mNotificationPanel.animateNextTopPaddingChange();
setBarState(StatusBarState.SHADE_LOCKED);
updateKeyguardState();
} else {
@@ -3195,10 +3198,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
public boolean isExpandedVisible() {
return mExpandedVisible;
}
public static boolean inBounds(View view, MotionEvent event, boolean orAbove) {
final int[] location = new int[2];
view.getLocationInWindow(location);

View File

@@ -959,8 +959,10 @@ public class NotificationStackScrollLayout extends ViewGroup
}
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;
}