Merge "Allow all ActivatableNotificationRows to clip properly when interacting with the shelf." into qt-dev
am: b7a1ea9a3a
Change-Id: I7986e1033a2d0d208e0b647dd290927b7a7c7f41
This commit is contained in:
@@ -294,17 +294,17 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
int backgroundTop = 0;
|
int backgroundTop = 0;
|
||||||
int clipTopAmount = 0;
|
int clipTopAmount = 0;
|
||||||
float firstElementRoundness = 0.0f;
|
float firstElementRoundness = 0.0f;
|
||||||
ExpandableNotificationRow previousRow = null;
|
ActivatableNotificationView previousRow = null;
|
||||||
|
|
||||||
for (int i = 0; i < mHostLayout.getChildCount(); i++) {
|
for (int i = 0; i < mHostLayout.getChildCount(); i++) {
|
||||||
ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);
|
ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);
|
||||||
|
|
||||||
if (!(child instanceof ExpandableNotificationRow)
|
if (!(child instanceof ActivatableNotificationView)
|
||||||
|| child.getVisibility() == GONE) {
|
|| child.getVisibility() == GONE || child == this) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
ActivatableNotificationView row = (ActivatableNotificationView) child;
|
||||||
float notificationClipEnd;
|
float notificationClipEnd;
|
||||||
boolean aboveShelf = ViewState.getFinalTranslationZ(row) > baseZHeight
|
boolean aboveShelf = ViewState.getFinalTranslationZ(row) > baseZHeight
|
||||||
|| row.isPinned();
|
|| row.isPinned();
|
||||||
@@ -324,7 +324,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
}
|
}
|
||||||
int clipTop = updateNotificationClipHeight(row, notificationClipEnd, notGoneIndex);
|
int clipTop = updateNotificationClipHeight(row, notificationClipEnd, notGoneIndex);
|
||||||
clipTopAmount = Math.max(clipTop, clipTopAmount);
|
clipTopAmount = Math.max(clipTop, clipTopAmount);
|
||||||
float inShelfAmount = updateIconAppearance(row, expandAmount, scrolling, scrollingFast,
|
|
||||||
|
// If the current row is an ExpandableNotificationRow, update its color, roundedness,
|
||||||
|
// and icon state.
|
||||||
|
if (row instanceof ExpandableNotificationRow) {
|
||||||
|
ExpandableNotificationRow expandableRow = (ExpandableNotificationRow) row;
|
||||||
|
|
||||||
|
float inShelfAmount = updateIconAppearance(expandableRow, expandAmount, scrolling,
|
||||||
|
scrollingFast,
|
||||||
expandingAnimated, isLastChild);
|
expandingAnimated, isLastChild);
|
||||||
numViewsInShelf += inShelfAmount;
|
numViewsInShelf += inShelfAmount;
|
||||||
int ownColorUntinted = row.getBackgroundColorWithoutTint();
|
int ownColorUntinted = row.getBackgroundColorWithoutTint();
|
||||||
@@ -347,20 +354,25 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
row.setOverrideTintColor(NO_COLOR, 0 /* overrideAmount */);
|
row.setOverrideTintColor(NO_COLOR, 0 /* overrideAmount */);
|
||||||
}
|
}
|
||||||
if (notGoneIndex != 0 || !aboveShelf) {
|
if (notGoneIndex != 0 || !aboveShelf) {
|
||||||
row.setAboveShelf(false);
|
expandableRow.setAboveShelf(false);
|
||||||
}
|
}
|
||||||
if (notGoneIndex == 0) {
|
if (notGoneIndex == 0) {
|
||||||
StatusBarIconView icon = row.getEntry().expandedIcon;
|
StatusBarIconView icon = expandableRow.getEntry().expandedIcon;
|
||||||
NotificationIconContainer.IconState iconState = getIconState(icon);
|
NotificationIconContainer.IconState iconState = getIconState(icon);
|
||||||
// The icon state might be null in rare cases where the notification is actually
|
// The icon state might be null in rare cases where the notification is actually
|
||||||
// added to the layout, but not to the shelf. An example are replied messages, since
|
// added to the layout, but not to the shelf. An example are replied messages,
|
||||||
// they don't show up on AOD
|
// since they don't show up on AOD
|
||||||
if (iconState != null && iconState.clampedAppearAmount == 1.0f) {
|
if (iconState != null && iconState.clampedAppearAmount == 1.0f) {
|
||||||
// only if the first icon is fully in the shelf we want to clip to it!
|
// only if the first icon is fully in the shelf we want to clip to it!
|
||||||
backgroundTop = (int) (row.getTranslationY() - getTranslationY());
|
backgroundTop = (int) (row.getTranslationY() - getTranslationY());
|
||||||
firstElementRoundness = row.getCurrentTopRoundness();
|
firstElementRoundness = row.getCurrentTopRoundness();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousColor = ownColorUntinted;
|
||||||
|
notGoneIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
if (row.isFirstInSection() && previousRow != null && previousRow.isLastInSection()) {
|
if (row.isFirstInSection() && previousRow != null && previousRow.isLastInSection()) {
|
||||||
// If the top of the shelf is between the view before a gap and the view after a gap
|
// If the top of the shelf is between the view before a gap and the view after a gap
|
||||||
// then we need to adjust the shelf's top roundness.
|
// then we need to adjust the shelf's top roundness.
|
||||||
@@ -379,8 +391,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
backgroundTop = (int) distanceToGapBottom;
|
backgroundTop = (int) distanceToGapBottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notGoneIndex++;
|
|
||||||
previousColor = ownColorUntinted;
|
|
||||||
previousRow = row;
|
previousRow = row;
|
||||||
}
|
}
|
||||||
clipTransientViews();
|
clipTransientViews();
|
||||||
@@ -497,7 +507,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
* Update the clipping of this view.
|
* Update the clipping of this view.
|
||||||
* @return the amount that our own top should be clipped
|
* @return the amount that our own top should be clipped
|
||||||
*/
|
*/
|
||||||
private int updateNotificationClipHeight(ExpandableNotificationRow row,
|
private int updateNotificationClipHeight(ActivatableNotificationView row,
|
||||||
float notificationClipEnd, int childIndex) {
|
float notificationClipEnd, int childIndex) {
|
||||||
float viewEnd = row.getTranslationY() + row.getActualHeight();
|
float viewEnd = row.getTranslationY() + row.getActualHeight();
|
||||||
boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway())
|
boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway())
|
||||||
|
|||||||
Reference in New Issue
Block a user