Merge "Fix notification launch animation for groups" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2821c69517
@@ -976,10 +976,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
/**
|
/**
|
||||||
* Updates states of all children.
|
* Updates states of all children.
|
||||||
*/
|
*/
|
||||||
public void updateChildrenStates(AmbientState ambientState) {
|
public void updateChildrenStates() {
|
||||||
if (mIsSummaryWithChildren) {
|
if (mIsSummaryWithChildren) {
|
||||||
ExpandableViewState parentState = getViewState();
|
ExpandableViewState parentState = getViewState();
|
||||||
mChildrenContainer.updateState(parentState, ambientState);
|
mChildrenContainer.updateState(parentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -616,9 +616,8 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
* Update the state of all its children based on a linear layout algorithm.
|
* Update the state of all its children based on a linear layout algorithm.
|
||||||
*
|
*
|
||||||
* @param parentState the state of the parent
|
* @param parentState the state of the parent
|
||||||
* @param ambientState the ambient state containing ambient information
|
|
||||||
*/
|
*/
|
||||||
public void updateState(ExpandableViewState parentState, AmbientState ambientState) {
|
public void updateState(ExpandableViewState parentState) {
|
||||||
int childCount = mAttachedChildren.size();
|
int childCount = mAttachedChildren.size();
|
||||||
int yPosition = mNotificationHeaderMargin + mCurrentHeaderTranslation;
|
int yPosition = mNotificationHeaderMargin + mCurrentHeaderTranslation;
|
||||||
boolean firstChild = true;
|
boolean firstChild = true;
|
||||||
@@ -661,9 +660,17 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
childState.height = intrinsicHeight;
|
childState.height = intrinsicHeight;
|
||||||
childState.setYTranslation(yPosition + launchTransitionCompensation);
|
childState.setYTranslation(yPosition + launchTransitionCompensation);
|
||||||
childState.hidden = false;
|
childState.hidden = false;
|
||||||
// When the group is expanded, the children cast the shadows rather than the parent
|
if (child.isExpandAnimationRunning() || mContainingNotification.hasExpandingChild()) {
|
||||||
// so use the parent's elevation here.
|
// Not modifying translationZ during launch animation. The translationZ of the
|
||||||
if (childrenExpandedAndNotAnimating && mEnableShadowOnChildNotifications) {
|
// expanding child is handled inside ExpandableNotificationRow and the translationZ
|
||||||
|
// of the other children inside the group should remain unchanged. In particular,
|
||||||
|
// they should not take over the translationZ of the parent, since the parent has
|
||||||
|
// a positive translationZ set only for the expanding child to be drawn above other
|
||||||
|
// notifications.
|
||||||
|
childState.setZTranslation(child.getTranslationZ());
|
||||||
|
} else if (childrenExpandedAndNotAnimating && mEnableShadowOnChildNotifications) {
|
||||||
|
// When the group is expanded, the children cast the shadows rather than the parent
|
||||||
|
// so use the parent's elevation here.
|
||||||
childState.setZTranslation(parentState.getZTranslation());
|
childState.setZTranslation(parentState.getZTranslation());
|
||||||
} else {
|
} else {
|
||||||
childState.setZTranslation(0);
|
childState.setZTranslation(0);
|
||||||
@@ -716,9 +723,15 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
mHeaderViewState = new ViewState();
|
mHeaderViewState = new ViewState();
|
||||||
}
|
}
|
||||||
mHeaderViewState.initFrom(mNotificationHeader);
|
mHeaderViewState.initFrom(mNotificationHeader);
|
||||||
mHeaderViewState.setZTranslation(childrenExpandedAndNotAnimating
|
|
||||||
? parentState.getZTranslation()
|
if (mContainingNotification.hasExpandingChild()) {
|
||||||
: 0);
|
// Not modifying translationZ during expand animation.
|
||||||
|
mHeaderViewState.setZTranslation(mNotificationHeader.getTranslationZ());
|
||||||
|
} else if (childrenExpandedAndNotAnimating) {
|
||||||
|
mHeaderViewState.setZTranslation(parentState.getZTranslation());
|
||||||
|
} else {
|
||||||
|
mHeaderViewState.setZTranslation(0);
|
||||||
|
}
|
||||||
mHeaderViewState.setYTranslation(mCurrentHeaderTranslation);
|
mHeaderViewState.setYTranslation(mCurrentHeaderTranslation);
|
||||||
mHeaderViewState.setAlpha(mHeaderVisibleAmount);
|
mHeaderViewState.setAlpha(mHeaderVisibleAmount);
|
||||||
// The hiding is done automatically by the alpha, otherwise we'll pick it up again
|
// The hiding is done automatically by the alpha, otherwise we'll pick it up again
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class StackScrollAlgorithm {
|
|||||||
updateSpeedBumpState(algorithmState, speedBumpIndex);
|
updateSpeedBumpState(algorithmState, speedBumpIndex);
|
||||||
updateShelfState(algorithmState, ambientState);
|
updateShelfState(algorithmState, ambientState);
|
||||||
updateAlphaState(algorithmState, ambientState);
|
updateAlphaState(algorithmState, ambientState);
|
||||||
getNotificationChildrenStates(algorithmState, ambientState);
|
getNotificationChildrenStates(algorithmState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAlphaState(StackScrollAlgorithmState algorithmState,
|
private void updateAlphaState(StackScrollAlgorithmState algorithmState,
|
||||||
@@ -231,14 +231,13 @@ public class StackScrollAlgorithm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getNotificationChildrenStates(StackScrollAlgorithmState algorithmState,
|
private void getNotificationChildrenStates(StackScrollAlgorithmState algorithmState) {
|
||||||
AmbientState ambientState) {
|
|
||||||
int childCount = algorithmState.visibleChildren.size();
|
int childCount = algorithmState.visibleChildren.size();
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
ExpandableView v = algorithmState.visibleChildren.get(i);
|
ExpandableView v = algorithmState.visibleChildren.get(i);
|
||||||
if (v instanceof ExpandableNotificationRow) {
|
if (v instanceof ExpandableNotificationRow) {
|
||||||
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
|
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
|
||||||
row.updateChildrenStates(ambientState);
|
row.updateChildrenStates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user