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

View File

@@ -119,6 +119,7 @@ public class NotificationContentView extends FrameLayout {
private int mContentHeightAtAnimationStart = UNDEFINED;
private boolean mFocusOnVisibilityChange;
private boolean mHeadsupDisappearRunning;
public NotificationContentView(Context context, AttributeSet attrs) {
@@ -446,7 +447,8 @@ public class NotificationContentView extends FrameLayout {
boolean transitioningBetweenHunAndExpanded =
isTransitioningFromTo(VISIBLE_TYPE_HEADSUP, VISIBLE_TYPE_EXPANDED) ||
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) {
return Math.min(mHeadsUpChild.getHeight(), mExpandedChild.getHeight());
}
@@ -830,7 +832,7 @@ public class NotificationContentView extends FrameLayout {
return VISIBLE_TYPE_SINGLELINE;
}
if (mIsHeadsUp && mHeadsUpChild != null) {
if ((mIsHeadsUp || mHeadsupDisappearRunning) && mHeadsUpChild != null) {
if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
return VISIBLE_TYPE_HEADSUP;
} 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() {
mFocusOnVisibilityChange = true;
}

View File

@@ -213,18 +213,18 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary();
}
public boolean isOnlyChildInSuppressedGroup(StatusBarNotification sbn) {
return isGroupSuppressed(sbn.getGroupKey())
&& isOnlyChild(sbn);
}
private boolean isOnlyChild(StatusBarNotification sbn) {
return !sbn.getNotification().isGroupSummary()
&& getTotalNumberOfChildren(sbn) == 1;
}
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) {

View File

@@ -856,14 +856,6 @@ public class NotificationChildrenContainer extends ViewGroup {
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) {
int position = mNotificationHeaderMargin + mNotificatonTopPadding;

View File

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

View File

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