Prevent NotificationShelf from jump cutting notifications when appearing
Even with this change, there are still issues remaining to the overall sensitive reveal animation. I'll address those in subsequent CL's. Bug: 243634602 Flag: SENSITIVE_REVEAL_ANIM Test: Manual, i.e. observing sensitive reveal animation when face unlocking. Also checked that the shelf is still behaving normally for other scenarios Change-Id: I237c6e96753b0333de7ef9a3a6ae4f430788c7c2
This commit is contained in:
@@ -98,6 +98,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
private float mCornerAnimationDistance;
|
||||
private NotificationShelfController mController;
|
||||
private float mActualWidth = -1;
|
||||
private boolean mSensitiveRevealAnimEndabled;
|
||||
|
||||
public NotificationShelf(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -260,7 +261,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
}
|
||||
|
||||
final float stackEnd = ambientState.getStackY() + ambientState.getStackHeight();
|
||||
viewState.setYTranslation(stackEnd - viewState.height);
|
||||
if (mSensitiveRevealAnimEndabled && viewState.hidden) {
|
||||
// if the shelf is hidden, position it at the end of the stack (plus the clip
|
||||
// padding), such that when it appears animated, it will smoothly move in from the
|
||||
// bottom, without jump cutting any notifications
|
||||
viewState.setYTranslation(stackEnd + mPaddingBetweenElements);
|
||||
} else {
|
||||
viewState.setYTranslation(stackEnd - viewState.height);
|
||||
}
|
||||
} else {
|
||||
viewState.hidden = true;
|
||||
viewState.location = ExpandableViewState.LOCATION_GONE;
|
||||
@@ -395,7 +403,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
expandingAnimated, isLastChild, shelfClipStart);
|
||||
|
||||
// TODO(b/172289889) scale mPaddingBetweenElements with expansion amount
|
||||
if ((isLastChild && !child.isInShelf()) || aboveShelf || backgroundForceHidden) {
|
||||
if ((!mSensitiveRevealAnimEndabled && ((isLastChild && !child.isInShelf())
|
||||
|| backgroundForceHidden)) || aboveShelf) {
|
||||
notificationClipEnd = shelfStart + getIntrinsicHeight();
|
||||
} else {
|
||||
notificationClipEnd = shelfStart - mPaddingBetweenElements;
|
||||
@@ -437,15 +446,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
}
|
||||
|
||||
if (child instanceof ActivatableNotificationView) {
|
||||
ActivatableNotificationView anv =
|
||||
(ActivatableNotificationView) child;
|
||||
ActivatableNotificationView anv = (ActivatableNotificationView) child;
|
||||
// Because we show whole notifications on the lockscreen, the bottom notification is
|
||||
// always "just about to enter the shelf" by normal scrolling rules. This is fine
|
||||
// if the shelf is visible, but if the shelf is hidden, it causes incorrect curling.
|
||||
// notificationClipEnd handles the discrepancy between a visible and hidden shelf,
|
||||
// so we use that when on the keyguard (and while animating away) to reduce curling.
|
||||
final float keyguardSafeShelfStart =
|
||||
mAmbientState.isOnKeyguard() ? notificationClipEnd : shelfStart;
|
||||
final float keyguardSafeShelfStart = !mSensitiveRevealAnimEndabled
|
||||
&& mAmbientState.isOnKeyguard() ? notificationClipEnd : shelfStart;
|
||||
updateCornerRoundnessOnScroll(anv, viewStart, keyguardSafeShelfStart);
|
||||
}
|
||||
}
|
||||
@@ -993,6 +1001,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
mIndexOfFirstViewInShelf = mHostLayoutController.indexOfChild(firstViewInShelf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the sensitive reveal animation feature flag is enabled
|
||||
* @param enabled true if enabled
|
||||
*/
|
||||
public void setSensitiveRevealAnimEndabled(boolean enabled) {
|
||||
mSensitiveRevealAnimEndabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method resets the OnScroll roundness of a view to 0f
|
||||
* <p>
|
||||
|
||||
@@ -55,6 +55,7 @@ public class NotificationShelfController {
|
||||
mKeyguardBypassController = keyguardBypassController;
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mView.useRoundnessSourceTypes(featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES));
|
||||
mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
|
||||
mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
|
||||
Reference in New Issue
Block a user