From 2c58461daf909fae5a2605f0ba63da3f9c897731 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 29 Feb 2016 16:14:25 -0800 Subject: [PATCH] Fixed a bug where group expansion size calculation was wrong On the lockscreen, the minheight was always based on the intrinsic height and not actually the minHeight of the children. Because children were userlocked, they were now reporting their small size instead of the single line size. This meant that the expand motion on the lockscreen wasn't following the finger at all. Bug: 27418617 Change-Id: I81daaf87887de1adc014cb4c6d46f4ef118061e5 --- .../systemui/statusbar/DragDownHelper.java | 12 ++++++---- .../statusbar/ExpandableNotificationRow.java | 4 ++-- .../stack/NotificationChildrenContainer.java | 24 +++++++++++++++++-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java index b3265524965f1..7f87c3c687d81 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java @@ -169,21 +169,23 @@ public class DragDownHelper implements Gefingerpoken { ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC; float rubberband = heightDelta * rubberbandFactor; - if (expandable && (rubberband + child.getMinHeight()) > child.getMaxContentHeight()) { - float overshoot = (rubberband + child.getMinHeight()) - child.getMaxContentHeight(); + if (expandable + && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) { + float overshoot = + (rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight(); overshoot *= (1 - RUBBERBAND_FACTOR_STATIC); rubberband -= overshoot; } - child.setActualHeight((int) (child.getMinHeight() + rubberband)); + child.setActualHeight((int) (child.getMinExpandHeight() + rubberband)); } private void cancelExpansion(final ExpandableView child) { - if (child.getActualHeight() == child.getMinHeight()) { + if (child.getActualHeight() == child.getMinExpandHeight()) { mCallback.setUserLockedChild(child, false); return; } ObjectAnimator anim = ObjectAnimator.ofInt(child, "actualHeight", - child.getActualHeight(), child.getMinHeight()); + child.getActualHeight(), child.getMinExpandHeight()); anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS); anim.addListener(new AnimatorListenerAdapter() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 9799d75a890f1..939cacbbebfc1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -1221,8 +1221,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { @Override public int getMinExpandHeight() { - if (mIsSummaryWithChildren && !mOnKeyguard) { - return mChildrenContainer.getMinExpandHeight(); + if (mIsSummaryWithChildren && !mShowingPublic) { + return mChildrenContainer.getMinExpandHeight(mOnKeyguard); } return getMinHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index 030c8b737e844..123a5c39d61a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -566,8 +566,28 @@ public class NotificationChildrenContainer extends ViewGroup { return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED); } - public int getMinExpandHeight() { - return getIntrinsicHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */)); + public int getMinExpandHeight(boolean onKeyguard) { + int maxAllowedVisibleChildren = onKeyguard ? NUMBER_OF_CHILDREN_WHEN_COLLAPSED + : getMaxAllowedVisibleChildren(true /* forceCollapsed */); + int minExpandHeight = mNotificationHeaderHeight; + int visibleChildren = 0; + boolean firstChild = true; + int childCount = mChildren.size(); + for (int i = 0; i < childCount; i++) { + if (visibleChildren >= maxAllowedVisibleChildren) { + break; + } + if (!firstChild) { + minExpandHeight += mChildPadding; + } else { + firstChild = false; + } + ExpandableNotificationRow child = mChildren.get(i); + minExpandHeight += child.getMinHeight(); + visibleChildren++; + } + minExpandHeight += mCollapsedBottompadding; + return minExpandHeight; } public void setDark(boolean dark, boolean fade, long delay) {