Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +25 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ public class AmbientState { private float mDozeAmount = 0.0f; private HeadsUpManager mHeadUpManager; private Runnable mOnPulseHeightChangedListener; private ExpandableNotificationRow mTrackedHeadsUpRow; private float mAppearFraction; public AmbientState( Context context, Loading Loading @@ -543,4 +545,27 @@ public class AmbientState { public Runnable getOnPulseHeightChangedListener() { return mOnPulseHeightChangedListener; } public void setTrackedHeadsUpRow(ExpandableNotificationRow row) { mTrackedHeadsUpRow = row; } /** * Returns the currently tracked heads up row, if there is one and it is currently above the * shelf (still appearing). */ public ExpandableNotificationRow getTrackedHeadsUpRow() { if (mTrackedHeadsUpRow == null || !mTrackedHeadsUpRow.isAboveShelf()) { return null; } return mTrackedHeadsUpRow; } public void setAppearFraction(float appearFraction) { mAppearFraction = appearFraction; } public float getAppearFraction() { return mAppearFraction; } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +23 −16 Original line number Diff line number Diff line Loading @@ -1407,14 +1407,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // start translationY = height - appearStartPosition + getExpandTranslationStart(); } stackHeight = (int) (height - translationY); if (isHeadsUpTransition()) { stackHeight = getFirstVisibleSection().getFirstVisibleChild().getPinnedHeadsUpHeight(); translationY = MathUtils.lerp(mHeadsUpInset - mTopPadding, 0, appearFraction); } else { stackHeight = (int) (height - translationY); } } mAmbientState.setAppearFraction(appearFraction); if (stackHeight != mCurrentStackHeight) { mCurrentStackHeight = stackHeight; updateAlgorithmHeightAndPadding(); Loading Loading @@ -1532,17 +1530,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd */ @ShadeViewRefactor(RefactorComponent.COORDINATOR) private float getAppearEndPosition() { int appearPosition; int notGoneChildCount = getNotGoneChildCount(); if (mEmptyShadeView.getVisibility() == GONE && notGoneChildCount != 0) { int appearPosition = 0; int visibleNotifCount = getVisibleNotificationCount(); if (mEmptyShadeView.getVisibility() == GONE && visibleNotifCount > 0) { if (isHeadsUpTransition() || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDozing())) { appearPosition = getTopHeadsUpPinnedHeight(); } else { appearPosition = 0; if (notGoneChildCount >= 1 && mShelf.getVisibility() != GONE) { appearPosition += mShelf.getIntrinsicHeight(); if (mShelf.getVisibility() != GONE && visibleNotifCount > 1) { appearPosition += mShelf.getIntrinsicHeight() + mPaddingBetweenElements; } appearPosition += getTopHeadsUpPinnedHeight() + getPositionInLinearLayout(mAmbientState.getTrackedHeadsUpRow()); } else if (mShelf.getVisibility() != GONE) { appearPosition += mShelf.getIntrinsicHeight(); } } else { appearPosition = mEmptyShadeView.getHeight(); Loading @@ -1552,9 +1551,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) private boolean isHeadsUpTransition() { NotificationSection firstVisibleSection = getFirstVisibleSection(); return mTrackingHeadsUp && firstVisibleSection != null && firstVisibleSection.getFirstVisibleChild().isAboveShelf(); return mAmbientState.getTrackedHeadsUpRow() != null; } /** Loading Loading @@ -2962,8 +2959,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.COORDINATOR) public int getLayoutMinHeight() { if (isHeadsUpTransition()) { ExpandableNotificationRow trackedHeadsUpRow = mAmbientState.getTrackedHeadsUpRow(); if (trackedHeadsUpRow.isAboveShelf()) { int hunDistance = (int) MathUtils.lerp( 0, getPositionInLinearLayout(trackedHeadsUpRow), mAmbientState.getAppearFraction()); return getTopHeadsUpPinnedHeight() + hunDistance; } else { return getTopHeadsUpPinnedHeight(); } } return mShelf.getVisibility() == GONE ? 0 : mShelf.getIntrinsicHeight(); } Loading Loading @@ -5284,6 +5290,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setTrackingHeadsUp(ExpandableNotificationRow row) { mAmbientState.setTrackedHeadsUpRow(row); mTrackingHeadsUp = row != null; mRoundnessManager.setTrackingHeadsUp(row); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +24 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.util.Log; import android.util.MathUtils; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -441,7 +442,7 @@ public class StackScrollAlgorithm { } else if (isEmptyShadeView) { childViewState.yTranslation = ambientState.getInnerHeight() - childHeight + ambientState.getStackTranslation() * 0.25f; } else { } else if (child != ambientState.getTrackedHeadsUpRow()) { clampPositionToShelf(child, childViewState, ambientState); } Loading Loading @@ -539,6 +540,19 @@ public class StackScrollAlgorithm { private void updateHeadsUpStates(StackScrollAlgorithmState algorithmState, AmbientState ambientState) { int childCount = algorithmState.visibleChildren.size(); // Move the tracked heads up into position during the appear animation, by interpolating // between the HUN inset (where it will appear as a HUN) and the end position in the shade ExpandableNotificationRow trackedHeadsUpRow = ambientState.getTrackedHeadsUpRow(); if (trackedHeadsUpRow != null) { ExpandableViewState childState = trackedHeadsUpRow.getViewState(); if (childState != null) { float endPosition = childState.yTranslation - ambientState.getStackTranslation(); childState.yTranslation = MathUtils.lerp( mHeadsUpInset, endPosition, ambientState.getAppearFraction()); } } ExpandableNotificationRow topHeadsUpEntry = null; for (int i = 0; i < childCount; i++) { View child = algorithmState.visibleChildren.get(i); Loading @@ -561,7 +575,7 @@ public class StackScrollAlgorithm { && !row.showingPulsing()) { // Ensure that the heads up is always visible even when scrolled off clampHunToTop(ambientState, row, childState); if (i == 0 && row.isAboveShelf()) { if (isTopEntry && row.isAboveShelf()) { // the first hun can't get off screen. clampHunToMaxTranslation(ambientState, row, childState); childState.hidden = false; Loading Loading @@ -636,9 +650,13 @@ public class StackScrollAlgorithm { return; } ExpandableNotificationRow trackedHeadsUpRow = ambientState.getTrackedHeadsUpRow(); boolean isBeforeTrackedHeadsUp = trackedHeadsUpRow != null && mHostView.indexOfChild(child) < mHostView.indexOfChild(trackedHeadsUpRow); int shelfStart = ambientState.getInnerHeight() - ambientState.getShelf().getIntrinsicHeight(); if (ambientState.isAppearing() && !child.isAboveShelf()) { if (ambientState.isAppearing() && !child.isAboveShelf() && !isBeforeTrackedHeadsUp) { // Don't show none heads-up notifications while in appearing phase. childViewState.yTranslation = Math.max(childViewState.yTranslation, shelfStart); } Loading Loading @@ -695,7 +713,8 @@ public class StackScrollAlgorithm { } childViewState.zTranslation = baseZ + childrenOnTop * zDistanceBetweenElements; } else if (i == 0 && (child.isAboveShelf() || child.showingPulsing())) { } else if (child == ambientState.getTrackedHeadsUpRow() || (i == 0 && (child.isAboveShelf() || child.showingPulsing()))) { // In case this is a new view that has never been measured before, we don't want to // elevate if we are currently expanded more then the notification int shelfHeight = ambientState.getShelf() == null ? 0 : Loading @@ -703,7 +722,7 @@ public class StackScrollAlgorithm { float shelfStart = ambientState.getInnerHeight() - shelfHeight + ambientState.getTopPadding() + ambientState.getStackTranslation(); float notificationEnd = childViewState.yTranslation + child.getPinnedHeadsUpHeight() float notificationEnd = childViewState.yTranslation + child.getIntrinsicHeight() + mPaddingBetweenElements; if (shelfStart > notificationEnd) { childViewState.zTranslation = baseZ; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +25 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ public class AmbientState { private float mDozeAmount = 0.0f; private HeadsUpManager mHeadUpManager; private Runnable mOnPulseHeightChangedListener; private ExpandableNotificationRow mTrackedHeadsUpRow; private float mAppearFraction; public AmbientState( Context context, Loading Loading @@ -543,4 +545,27 @@ public class AmbientState { public Runnable getOnPulseHeightChangedListener() { return mOnPulseHeightChangedListener; } public void setTrackedHeadsUpRow(ExpandableNotificationRow row) { mTrackedHeadsUpRow = row; } /** * Returns the currently tracked heads up row, if there is one and it is currently above the * shelf (still appearing). */ public ExpandableNotificationRow getTrackedHeadsUpRow() { if (mTrackedHeadsUpRow == null || !mTrackedHeadsUpRow.isAboveShelf()) { return null; } return mTrackedHeadsUpRow; } public void setAppearFraction(float appearFraction) { mAppearFraction = appearFraction; } public float getAppearFraction() { return mAppearFraction; } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +23 −16 Original line number Diff line number Diff line Loading @@ -1407,14 +1407,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // start translationY = height - appearStartPosition + getExpandTranslationStart(); } stackHeight = (int) (height - translationY); if (isHeadsUpTransition()) { stackHeight = getFirstVisibleSection().getFirstVisibleChild().getPinnedHeadsUpHeight(); translationY = MathUtils.lerp(mHeadsUpInset - mTopPadding, 0, appearFraction); } else { stackHeight = (int) (height - translationY); } } mAmbientState.setAppearFraction(appearFraction); if (stackHeight != mCurrentStackHeight) { mCurrentStackHeight = stackHeight; updateAlgorithmHeightAndPadding(); Loading Loading @@ -1532,17 +1530,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd */ @ShadeViewRefactor(RefactorComponent.COORDINATOR) private float getAppearEndPosition() { int appearPosition; int notGoneChildCount = getNotGoneChildCount(); if (mEmptyShadeView.getVisibility() == GONE && notGoneChildCount != 0) { int appearPosition = 0; int visibleNotifCount = getVisibleNotificationCount(); if (mEmptyShadeView.getVisibility() == GONE && visibleNotifCount > 0) { if (isHeadsUpTransition() || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDozing())) { appearPosition = getTopHeadsUpPinnedHeight(); } else { appearPosition = 0; if (notGoneChildCount >= 1 && mShelf.getVisibility() != GONE) { appearPosition += mShelf.getIntrinsicHeight(); if (mShelf.getVisibility() != GONE && visibleNotifCount > 1) { appearPosition += mShelf.getIntrinsicHeight() + mPaddingBetweenElements; } appearPosition += getTopHeadsUpPinnedHeight() + getPositionInLinearLayout(mAmbientState.getTrackedHeadsUpRow()); } else if (mShelf.getVisibility() != GONE) { appearPosition += mShelf.getIntrinsicHeight(); } } else { appearPosition = mEmptyShadeView.getHeight(); Loading @@ -1552,9 +1551,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) private boolean isHeadsUpTransition() { NotificationSection firstVisibleSection = getFirstVisibleSection(); return mTrackingHeadsUp && firstVisibleSection != null && firstVisibleSection.getFirstVisibleChild().isAboveShelf(); return mAmbientState.getTrackedHeadsUpRow() != null; } /** Loading Loading @@ -2962,8 +2959,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.COORDINATOR) public int getLayoutMinHeight() { if (isHeadsUpTransition()) { ExpandableNotificationRow trackedHeadsUpRow = mAmbientState.getTrackedHeadsUpRow(); if (trackedHeadsUpRow.isAboveShelf()) { int hunDistance = (int) MathUtils.lerp( 0, getPositionInLinearLayout(trackedHeadsUpRow), mAmbientState.getAppearFraction()); return getTopHeadsUpPinnedHeight() + hunDistance; } else { return getTopHeadsUpPinnedHeight(); } } return mShelf.getVisibility() == GONE ? 0 : mShelf.getIntrinsicHeight(); } Loading Loading @@ -5284,6 +5290,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setTrackingHeadsUp(ExpandableNotificationRow row) { mAmbientState.setTrackedHeadsUpRow(row); mTrackingHeadsUp = row != null; mRoundnessManager.setTrackingHeadsUp(row); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +24 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.util.Log; import android.util.MathUtils; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -441,7 +442,7 @@ public class StackScrollAlgorithm { } else if (isEmptyShadeView) { childViewState.yTranslation = ambientState.getInnerHeight() - childHeight + ambientState.getStackTranslation() * 0.25f; } else { } else if (child != ambientState.getTrackedHeadsUpRow()) { clampPositionToShelf(child, childViewState, ambientState); } Loading Loading @@ -539,6 +540,19 @@ public class StackScrollAlgorithm { private void updateHeadsUpStates(StackScrollAlgorithmState algorithmState, AmbientState ambientState) { int childCount = algorithmState.visibleChildren.size(); // Move the tracked heads up into position during the appear animation, by interpolating // between the HUN inset (where it will appear as a HUN) and the end position in the shade ExpandableNotificationRow trackedHeadsUpRow = ambientState.getTrackedHeadsUpRow(); if (trackedHeadsUpRow != null) { ExpandableViewState childState = trackedHeadsUpRow.getViewState(); if (childState != null) { float endPosition = childState.yTranslation - ambientState.getStackTranslation(); childState.yTranslation = MathUtils.lerp( mHeadsUpInset, endPosition, ambientState.getAppearFraction()); } } ExpandableNotificationRow topHeadsUpEntry = null; for (int i = 0; i < childCount; i++) { View child = algorithmState.visibleChildren.get(i); Loading @@ -561,7 +575,7 @@ public class StackScrollAlgorithm { && !row.showingPulsing()) { // Ensure that the heads up is always visible even when scrolled off clampHunToTop(ambientState, row, childState); if (i == 0 && row.isAboveShelf()) { if (isTopEntry && row.isAboveShelf()) { // the first hun can't get off screen. clampHunToMaxTranslation(ambientState, row, childState); childState.hidden = false; Loading Loading @@ -636,9 +650,13 @@ public class StackScrollAlgorithm { return; } ExpandableNotificationRow trackedHeadsUpRow = ambientState.getTrackedHeadsUpRow(); boolean isBeforeTrackedHeadsUp = trackedHeadsUpRow != null && mHostView.indexOfChild(child) < mHostView.indexOfChild(trackedHeadsUpRow); int shelfStart = ambientState.getInnerHeight() - ambientState.getShelf().getIntrinsicHeight(); if (ambientState.isAppearing() && !child.isAboveShelf()) { if (ambientState.isAppearing() && !child.isAboveShelf() && !isBeforeTrackedHeadsUp) { // Don't show none heads-up notifications while in appearing phase. childViewState.yTranslation = Math.max(childViewState.yTranslation, shelfStart); } Loading Loading @@ -695,7 +713,8 @@ public class StackScrollAlgorithm { } childViewState.zTranslation = baseZ + childrenOnTop * zDistanceBetweenElements; } else if (i == 0 && (child.isAboveShelf() || child.showingPulsing())) { } else if (child == ambientState.getTrackedHeadsUpRow() || (i == 0 && (child.isAboveShelf() || child.showingPulsing()))) { // In case this is a new view that has never been measured before, we don't want to // elevate if we are currently expanded more then the notification int shelfHeight = ambientState.getShelf() == null ? 0 : Loading @@ -703,7 +722,7 @@ public class StackScrollAlgorithm { float shelfStart = ambientState.getInnerHeight() - shelfHeight + ambientState.getTopPadding() + ambientState.getStackTranslation(); float notificationEnd = childViewState.yTranslation + child.getPinnedHeadsUpHeight() float notificationEnd = childViewState.yTranslation + child.getIntrinsicHeight() + mPaddingBetweenElements; if (shelfStart > notificationEnd) { childViewState.zTranslation = baseZ; Loading