Merge changes I29ce7659,I2d6310a2,Ic4b29409,I6c5c970f into nyc-dev

am: 3952c3a2d4

Change-Id: I6647a1410723a229a7ac6ebf89d4495cb508efd9
This commit is contained in:
Selim Cinek
2016-06-20 19:17:32 +00:00
committed by android-build-merger
6 changed files with 34 additions and 21 deletions

View File

@@ -185,6 +185,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
} }
}; };
private OnClickListener mOnClickListener; private OnClickListener mOnClickListener;
private boolean mHeadsupDisappearRunning;
private View mChildAfterViewWhenDismissed; private View mChildAfterViewWhenDismissed;
private View mGroupParentWhenDismissed; private View mGroupParentWhenDismissed;
private boolean mRefocusOnDismiss; private boolean mRefocusOnDismiss;
@@ -759,15 +760,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mRemoved = true; mRemoved = true;
mPrivateLayout.setRemoved(); mPrivateLayout.setRemoved();
if (mChildrenContainer != null) {
mChildrenContainer.setRemoved();
}
} }
public NotificationChildrenContainer getChildrenContainer() { public NotificationChildrenContainer getChildrenContainer() {
return mChildrenContainer; return mChildrenContainer;
} }
public void setHeadsupDisappearRunning(boolean running) {
mHeadsupDisappearRunning = running;
mPrivateLayout.setHeadsupDisappearRunning(running);
}
public View getChildAfterViewWhenDismissed() { public View getChildAfterViewWhenDismissed() {
return mChildAfterViewWhenDismissed; return mChildAfterViewWhenDismissed;
} }
@@ -1173,8 +1176,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
return getMinHeight(); return getMinHeight();
} else if (mIsSummaryWithChildren && !mOnKeyguard) { } else if (mIsSummaryWithChildren && !mOnKeyguard) {
return mChildrenContainer.getIntrinsicHeight(); return mChildrenContainer.getIntrinsicHeight();
} else if (mIsHeadsUp) { } else if (mIsHeadsUp || mHeadsupDisappearRunning) {
if (isPinned()) { if (isPinned() || mHeadsupDisappearRunning) {
return getPinnedHeadsUpHeight(true /* atLeastMinHeight */); return getPinnedHeadsUpHeight(true /* atLeastMinHeight */);
} else if (isExpanded()) { } else if (isExpanded()) {
return Math.max(getMaxExpandHeight(), mHeadsUpHeight); return Math.max(getMaxExpandHeight(), mHeadsUpHeight);
@@ -1300,6 +1303,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
if (!animated) { if (!animated) {
mPublicLayout.animate().cancel(); mPublicLayout.animate().cancel();
mPrivateLayout.animate().cancel(); mPrivateLayout.animate().cancel();
if (mChildrenContainer != null) {
mChildrenContainer.animate().cancel();
mChildrenContainer.setAlpha(1f);
}
mPublicLayout.setAlpha(1f); mPublicLayout.setAlpha(1f);
mPrivateLayout.setAlpha(1f); mPrivateLayout.setAlpha(1f);
mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE); mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);

View File

@@ -119,6 +119,7 @@ public class NotificationContentView extends FrameLayout {
private int mContentHeightAtAnimationStart = UNDEFINED; private int mContentHeightAtAnimationStart = UNDEFINED;
private boolean mFocusOnVisibilityChange; private boolean mFocusOnVisibilityChange;
private boolean mHeadsupDisappearRunning;
public NotificationContentView(Context context, AttributeSet attrs) { public NotificationContentView(Context context, AttributeSet attrs) {
@@ -446,7 +447,8 @@ public class NotificationContentView extends FrameLayout {
boolean transitioningBetweenHunAndExpanded = boolean transitioningBetweenHunAndExpanded =
isTransitioningFromTo(VISIBLE_TYPE_HEADSUP, VISIBLE_TYPE_EXPANDED) || isTransitioningFromTo(VISIBLE_TYPE_HEADSUP, VISIBLE_TYPE_EXPANDED) ||
isTransitioningFromTo(VISIBLE_TYPE_EXPANDED, VISIBLE_TYPE_HEADSUP); isTransitioningFromTo(VISIBLE_TYPE_EXPANDED, VISIBLE_TYPE_HEADSUP);
boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED) && mIsHeadsUp; boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED)
&& (mIsHeadsUp || mHeadsupDisappearRunning);
if (transitioningBetweenHunAndExpanded || pinned) { if (transitioningBetweenHunAndExpanded || pinned) {
return Math.min(mHeadsUpChild.getHeight(), mExpandedChild.getHeight()); return Math.min(mHeadsUpChild.getHeight(), mExpandedChild.getHeight());
} }
@@ -830,7 +832,7 @@ public class NotificationContentView extends FrameLayout {
return VISIBLE_TYPE_SINGLELINE; return VISIBLE_TYPE_SINGLELINE;
} }
if (mIsHeadsUp && mHeadsUpChild != null) { if ((mIsHeadsUp || mHeadsupDisappearRunning) && mHeadsUpChild != null) {
if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) { if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
return VISIBLE_TYPE_HEADSUP; return VISIBLE_TYPE_HEADSUP;
} else { } else {
@@ -1153,6 +1155,11 @@ public class NotificationContentView extends FrameLayout {
} }
} }
public void setHeadsupDisappearRunning(boolean headsupDisappearRunning) {
mHeadsupDisappearRunning = headsupDisappearRunning;
selectLayout(false /* animate */, true /* force */);
}
public void setFocusOnVisibilityChange() { public void setFocusOnVisibilityChange() {
mFocusOnVisibilityChange = true; mFocusOnVisibilityChange = true;
} }

View File

@@ -213,18 +213,18 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary(); return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary();
} }
public boolean isOnlyChildInSuppressedGroup(StatusBarNotification sbn) {
return isGroupSuppressed(sbn.getGroupKey())
&& isOnlyChild(sbn);
}
private boolean isOnlyChild(StatusBarNotification sbn) { private boolean isOnlyChild(StatusBarNotification sbn) {
return !sbn.getNotification().isGroupSummary() return !sbn.getNotification().isGroupSummary()
&& getTotalNumberOfChildren(sbn) == 1; && getTotalNumberOfChildren(sbn) == 1;
} }
public boolean isOnlyChildInGroup(StatusBarNotification sbn) { public boolean isOnlyChildInGroup(StatusBarNotification sbn) {
return isOnlyChild(sbn) && getLogicalGroupSummary(sbn) != null; if (!isOnlyChild(sbn)) {
return false;
}
ExpandableNotificationRow logicalGroupSummary = getLogicalGroupSummary(sbn);
return logicalGroupSummary != null
&& !logicalGroupSummary.getStatusBarNotification().equals(sbn);
} }
private int getTotalNumberOfChildren(StatusBarNotification sbn) { private int getTotalNumberOfChildren(StatusBarNotification sbn) {

View File

@@ -856,14 +856,6 @@ public class NotificationChildrenContainer extends ViewGroup {
mNotificationParent.getNotificationColor()); mNotificationParent.getNotificationColor());
} }
public void setRemoved() {
int childCount = mChildren.size();
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
child.setRemoved();
}
}
public int getPositionInLinearLayout(View childInGroup) { public int getPositionInLinearLayout(View childInGroup) {
int position = mNotificationHeaderMargin + mNotificatonTopPadding; int position = mNotificationHeaderMargin + mNotificatonTopPadding;

View File

@@ -3689,6 +3689,9 @@ public class NotificationStackScrollLayout extends ViewGroup
if (mAnimationsEnabled) { if (mAnimationsEnabled) {
mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp)); mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp));
mNeedsAnimation = true; mNeedsAnimation = true;
if (!mIsExpanded && !isHeadsUp) {
row.setHeadsupDisappearRunning(true);
}
requestChildrenUpdate(); requestChildrenUpdate();
} }
} }

View File

@@ -733,6 +733,7 @@ public class StackStateAnimator {
animator.setStartDelay(delay); animator.setStartDelay(delay);
} }
animator.addListener(getGlobalAnimationFinishedListener()); animator.addListener(getGlobalAnimationFinishedListener());
final boolean isHeadsUpDisappear = mHeadsUpDisappearChildren.contains(child);
// remove the tag when the animation is finished // remove the tag when the animation is finished
animator.addListener(new AnimatorListenerAdapter() { animator.addListener(new AnimatorListenerAdapter() {
@Override @Override
@@ -741,6 +742,9 @@ public class StackStateAnimator {
child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null); child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null);
child.setTag(TAG_START_TRANSLATION_Y, null); child.setTag(TAG_START_TRANSLATION_Y, null);
child.setTag(TAG_END_TRANSLATION_Y, null); child.setTag(TAG_END_TRANSLATION_Y, null);
if (isHeadsUpDisappear) {
((ExpandableNotificationRow) child).setHeadsupDisappearRunning(false);
}
} }
}); });
startAnimator(animator); startAnimator(animator);