Merge "Limit notification scroll up to status bar" into sc-dev am: 79e39e8e77
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14426423 Change-Id: I4d93c9c1e358564e532d278530eb86c82773a0f0
This commit is contained in:
@@ -75,6 +75,7 @@ public class AmbientState {
|
|||||||
private int mExpandAnimationTopChange;
|
private int mExpandAnimationTopChange;
|
||||||
private ExpandableNotificationRow mExpandingNotification;
|
private ExpandableNotificationRow mExpandingNotification;
|
||||||
private float mHideAmount;
|
private float mHideAmount;
|
||||||
|
private float mNotificationScrimTop;
|
||||||
private boolean mAppearing;
|
private boolean mAppearing;
|
||||||
private float mPulseHeight = MAX_PULSE_HEIGHT;
|
private float mPulseHeight = MAX_PULSE_HEIGHT;
|
||||||
private float mDozeAmount = 0.0f;
|
private float mDozeAmount = 0.0f;
|
||||||
@@ -255,6 +256,20 @@ public class AmbientState {
|
|||||||
return mHideAmount;
|
return mHideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set y position of top of notifications background scrim, relative to top of screen.
|
||||||
|
*/
|
||||||
|
public void setNotificationScrimTop(float notificationScrimTop) {
|
||||||
|
mNotificationScrimTop = notificationScrimTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Y position of top of notifications background scrim, relative to top of screen.
|
||||||
|
*/
|
||||||
|
public float getNotificationScrimTop() {
|
||||||
|
return mNotificationScrimTop;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHideSensitive(boolean hideSensitive) {
|
public void setHideSensitive(boolean hideSensitive) {
|
||||||
mHideSensitive = hideSensitive;
|
mHideSensitive = hideSensitive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1008,9 +1008,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
private void updateClippingToTopRoundedCorner() {
|
private void updateClippingToTopRoundedCorner() {
|
||||||
Float clipStart = (float) mTopPadding
|
Float clipStart = mAmbientState.getNotificationScrimTop();
|
||||||
+ mStackTranslation
|
|
||||||
+ mAmbientState.getExpandAnimationTopChange();
|
|
||||||
Float clipEnd = clipStart + mCornerRadius;
|
Float clipEnd = clipStart + mCornerRadius;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
@@ -1023,7 +1021,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
boolean clip = clipStart > start && clipStart < end
|
boolean clip = clipStart > start && clipStart < end
|
||||||
|| clipEnd >= start && clipEnd <= end;
|
|| clipEnd >= start && clipEnd <= end;
|
||||||
clip &= !(first && mScrollAdapter.isScrolledToTop());
|
clip &= !(first && mScrollAdapter.isScrolledToTop());
|
||||||
child.setDistanceToTopRoundness(ExpandableView.NO_ROUNDNESS);
|
child.setDistanceToTopRoundness(clip ? Math.max(start - clipStart, 0)
|
||||||
|
: ExpandableView.NO_ROUNDNESS);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,9 +156,9 @@ public class StackScrollAlgorithm {
|
|||||||
|
|
||||||
private void updateClipping(StackScrollAlgorithmState algorithmState,
|
private void updateClipping(StackScrollAlgorithmState algorithmState,
|
||||||
AmbientState ambientState) {
|
AmbientState ambientState) {
|
||||||
float drawStart = !ambientState.isOnKeyguard()
|
float drawStart = ambientState.isOnKeyguard() ? 0
|
||||||
? ambientState.getStackY() - ambientState.getScrollY() : 0;
|
: ambientState.getStackY() - ambientState.getScrollY();
|
||||||
float clipStart = 0;
|
float clipStart = ambientState.getNotificationScrimTop();
|
||||||
int childCount = algorithmState.visibleChildren.size();
|
int childCount = algorithmState.visibleChildren.size();
|
||||||
boolean firstHeadsUp = true;
|
boolean firstHeadsUp = true;
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
private LockIconViewController mLockIconViewController;
|
private LockIconViewController mLockIconViewController;
|
||||||
private NotificationsQuickSettingsContainer mNotificationContainerParent;
|
private NotificationsQuickSettingsContainer mNotificationContainerParent;
|
||||||
private boolean mAnimateNextPositionUpdate;
|
private boolean mAnimateNextPositionUpdate;
|
||||||
|
private float mQuickQsOffsetHeight;
|
||||||
private int mTrackingPointer;
|
private int mTrackingPointer;
|
||||||
private VelocityTracker mQsVelocityTracker;
|
private VelocityTracker mQsVelocityTracker;
|
||||||
private boolean mQsTracking;
|
private boolean mQsTracking;
|
||||||
@@ -943,6 +943,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateResources() {
|
public void updateResources() {
|
||||||
|
mQuickQsOffsetHeight = mResources.getDimensionPixelSize(
|
||||||
|
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||||
mSplitShadeNotificationsTopPadding =
|
mSplitShadeNotificationsTopPadding =
|
||||||
mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade);
|
mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade);
|
||||||
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
|
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
|
||||||
@@ -2170,7 +2172,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
// can be wrong during transitions when waiting for the keyguard to unlock
|
// can be wrong during transitions when waiting for the keyguard to unlock
|
||||||
top = mTransitionToFullShadeQSPosition;
|
top = mTransitionToFullShadeQSPosition;
|
||||||
} else {
|
} else {
|
||||||
float notificationTop = getQSEdgePosition();
|
final float notificationTop = getQSEdgePosition();
|
||||||
|
mAmbientState.setNotificationScrimTop(notificationTop);
|
||||||
top = (int) (isOnKeyguard() ? Math.min(qsPanelBottomY, notificationTop)
|
top = (int) (isOnKeyguard() ? Math.min(qsPanelBottomY, notificationTop)
|
||||||
: notificationTop);
|
: notificationTop);
|
||||||
}
|
}
|
||||||
@@ -2252,7 +2255,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
|
|
||||||
private float getQSEdgePosition() {
|
private float getQSEdgePosition() {
|
||||||
// TODO: replace StackY with unified calculation
|
// TODO: replace StackY with unified calculation
|
||||||
return mAmbientState.getStackY() - mAmbientState.getScrollY();
|
return Math.max(mQuickQsOffsetHeight * mAmbientState.getExpansionFraction(),
|
||||||
|
mAmbientState.getStackY() - mAmbientState.getScrollY());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateQsBottomPosition(float qsExpansionFraction) {
|
private int calculateQsBottomPosition(float qsExpansionFraction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user