diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 06a174e..33a07d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -78,13 +78,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private NotificationContentView mPublicLayout; private NotificationContentView mPrivateLayout; private int mMaxExpandHeight; + private int mHeadsUpHeight; private View mVetoButton; private boolean mClearable; private ExpansionLogger mLogger; private String mLoggingKey; private boolean mWasReset; - private NotificationGuts mGuts; + private NotificationGuts mGuts; private StatusBarNotification mStatusBarNotification; private boolean mIsHeadsUp; private View mExpandButton; @@ -108,6 +109,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { !mChildrenExpanded); } }; + private boolean mInShade; + + public NotificationContentView getPrivateLayout() { + return mPrivateLayout; + } + + public NotificationContentView getPublicLayout() { + return mPublicLayout; + } public void setIconAnimationRunning(boolean running) { setIconAnimationRunning(running, mPublicLayout); @@ -118,8 +128,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { if (layout != null) { View contractedChild = layout.getContractedChild(); View expandedChild = layout.getExpandedChild(); + View headsUpChild = layout.getHeadsUpChild(); setIconAnimationRunningForChild(running, contractedChild); setIconAnimationRunningForChild(running, expandedChild); + setIconAnimationRunningForChild(running, headsUpChild); } } @@ -164,8 +176,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mStatusBarNotification; } + public boolean isHeadsUp() { + return mIsHeadsUp; + } + public void setHeadsUp(boolean isHeadsUp) { + int intrinsicBefore = getIntrinsicHeight(); mIsHeadsUp = isHeadsUp; + mPrivateLayout.setHeadsUp(isHeadsUp); + if (intrinsicBefore != getIntrinsicHeight()) { + notifyHeightChanged(false /* needsAnimation */); + } } public void setGroupManager(NotificationGroupManager groupManager) { @@ -263,6 +284,18 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return realActualHeight; } + public void setInShade(boolean inShade) { + mInShade = inShade; + } + + public boolean isInShade() { + return mInShade; + } + + public int getHeadsUpHeight() { + return mHeadsUpHeight; + } + public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } @@ -299,6 +332,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { resetActualHeight(); } mMaxExpandHeight = 0; + mHeadsUpHeight = 0; mWasReset = true; onHeightReset(); requestLayout(); @@ -536,7 +570,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } boolean inExpansionState = isExpanded(); int maxContentHeight; - if ((!inExpansionState && !mChildrenExpanded) || mShowingPublicForIntrinsicHeight) { + if (mIsHeadsUp) { + if (inExpansionState) { + maxContentHeight = Math.max(mMaxExpandHeight, mHeadsUpHeight); + } else { + maxContentHeight = Math.max(mRowMinHeight, mHeadsUpHeight); + } + } else if ((!inExpansionState && !mChildrenExpanded) || mShowingPublicForIntrinsicHeight) { maxContentHeight = mRowMinHeight; } else if (mChildrenExpanded) { maxContentHeight = mChildrenContainer.getIntrinsicHeight(); @@ -583,7 +623,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); boolean updateExpandHeight = mMaxExpandHeight == 0 && !mWasReset; - updateMaxExpandHeight(); + updateMaxHeights(); if (updateExpandHeight) { applyExpansionToLayout(); } @@ -599,9 +639,18 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return super.isChildInvisible(child) || isInvisibleChildContainer; } - private void updateMaxExpandHeight() { + private void updateMaxHeights() { int intrinsicBefore = getIntrinsicHeight(); - mMaxExpandHeight = mPrivateLayout.getMaxHeight(); + View expandedChild = mPrivateLayout.getExpandedChild(); + if (expandedChild == null) { + expandedChild = mPrivateLayout.getContractedChild(); + } + mMaxExpandHeight = expandedChild.getHeight(); + View headsUpChild = mPrivateLayout.getHeadsUpChild(); + if (headsUpChild == null) { + headsUpChild = mPrivateLayout.getContractedChild(); + } + mHeadsUpHeight = headsUpChild.getHeight(); if (intrinsicBefore != getIntrinsicHeight()) { notifyHeightChanged(false /* needsAnimation */); } |