diff options
| author | 2016-03-24 10:54:56 -0700 | |
|---|---|---|
| committer | 2016-04-05 11:17:15 -0700 | |
| commit | 567e845d99840a6e556595739a15e16132eb2f1e (patch) | |
| tree | e18dd4c06730dc3a04adecfe62c4ff5351fd3308 | |
| parent | cd404a2fc34a967f0763fb3b6b43f56a5d8014e8 (diff) | |
Fixed a bug where the minHeight of groups was inaccurate
Also cleaned up the methods names a bit and fixed some small
bugs in border cases where the algorithm was using the wrong
sizes.
Bug: 24866646
Change-Id: I6622814f8cec3fe143234e349030a19e3dc11353
8 files changed, 35 insertions, 34 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index aa3f6e5fe4a3..d12ab293ab3e 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -514,7 +514,7 @@ public class ExpandHelper implements Gefingerpoken { if (canBeExpanded) { if (DEBUG) Log.d(TAG, "working on an expandable child"); mNaturalHeight = mScaler.getNaturalHeight(); - mSmallSize = v.getMinExpandHeight(); + mSmallSize = v.getCollapsedHeight(); } else { if (DEBUG) Log.d(TAG, "working on a non-expandable child"); mNaturalHeight = mOldHeight; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java index 7f87c3c687d8..2dabf5d32016 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java @@ -170,22 +170,22 @@ public class DragDownHelper implements Gefingerpoken { : RUBBERBAND_FACTOR_STATIC; float rubberband = heightDelta * rubberbandFactor; if (expandable - && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) { + && (rubberband + child.getCollapsedHeight()) > child.getMaxContentHeight()) { float overshoot = - (rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight(); + (rubberband + child.getCollapsedHeight()) - child.getMaxContentHeight(); overshoot *= (1 - RUBBERBAND_FACTOR_STATIC); rubberband -= overshoot; } - child.setActualHeight((int) (child.getMinExpandHeight() + rubberband)); + child.setActualHeight((int) (child.getCollapsedHeight() + rubberband)); } private void cancelExpansion(final ExpandableView child) { - if (child.getActualHeight() == child.getMinExpandHeight()) { + if (child.getActualHeight() == child.getCollapsedHeight()) { mCallback.setUserLockedChild(child, false); return; } ObjectAnimator anim = ObjectAnimator.ofInt(child, "actualHeight", - child.getActualHeight(), child.getMinExpandHeight()); + child.getActualHeight(), child.getCollapsedHeight()); 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 f9edeb312644..7ca7d12c590a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -470,7 +470,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { if(mExpandedWhenPinned) { return Math.max(getMaxExpandHeight(), mHeadsUpHeight); } else if (atLeastMinHeight) { - return Math.max(getMinHeight(), mHeadsUpHeight); + return Math.max(getCollapsedHeight(), mHeadsUpHeight); } else { return mHeadsUpHeight; } @@ -1040,12 +1040,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } else if (isExpanded()) { return Math.max(getMaxExpandHeight(), mHeadsUpHeight); } else { - return Math.max(getMinHeight(), mHeadsUpHeight); + return Math.max(getCollapsedHeight(), mHeadsUpHeight); } } else if (isExpanded()) { return getMaxExpandHeight(); } else { - return getMinHeight(); + return getCollapsedHeight(); } } @@ -1301,9 +1301,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } @Override - public int getMinExpandHeight() { + public int getCollapsedHeight() { if (mIsSummaryWithChildren && !mShowingPublic) { - return mChildrenContainer.getMinExpandHeight(); + return mChildrenContainer.getCollapsedHeight(); } return getMinHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 91418ad312bf..6dcd61f259f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -153,11 +153,11 @@ public abstract class ExpandableView extends FrameLayout { } /** - * @return The minimum height this child chan be expanded to. Note that this might be different - * than {@link #getMinHeight()} because some elements can't be collapsed by an expand gesture - * to it's absolute minimal height + * @return The collapsed height of this view. Note that this might be different + * than {@link #getMinHeight()} because some elements like groups may have different sizes when + * they are system expanded. */ - public int getMinExpandHeight() { + public int getCollapsedHeight() { return getHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index f4fb0b925b07..5b005237e5d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -604,7 +604,7 @@ public class NotificationContentView extends FrameLayout { } int expandedVisualType = getVisualTypeForHeight(height); int collapsedVisualType = getVisualTypeForHeight( - mContainingNotification.getMinExpandHeight()); + mContainingNotification.getCollapsedHeight()); return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType; 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 dc567fc20113..2f4e799fd69b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -592,7 +592,7 @@ public class NotificationChildrenContainer extends ViewGroup { public float getGroupExpandFraction() { int visibleChildrenExpandedHeight = getVisibleChildrenExpandHeight(); - int minExpandHeight = getMinExpandHeight(); + int minExpandHeight = getCollapsedHeight(); float factor = (mActualHeight - minExpandHeight) / (float) (visibleChildrenExpandedHeight - minExpandHeight); return Math.max(0.0f, Math.min(1.0f, factor)); @@ -618,11 +618,14 @@ public class NotificationChildrenContainer extends ViewGroup { } public int getMinHeight() { - return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED); + return getMinHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED); } - public int getMinExpandHeight() { - int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* forceCollapsed */); + public int getCollapsedHeight() { + return getMinHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */)); + } + + private int getMinHeight(int maxAllowedVisibleChildren) { int minExpandHeight = mNotificationHeaderHeight; int visibleChildren = 0; boolean firstChild = true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 4a8abe68a091..bb1de046c291 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -1947,7 +1947,7 @@ public class NotificationStackScrollLayout extends ViewGroup public int getPeekHeight() { final ExpandableView firstChild = getFirstChildNotGone(); - final int firstChildMinHeight = firstChild != null ? (int) firstChild.getMinHeight() + final int firstChildMinHeight = firstChild != null ? firstChild.getCollapsedHeight() : mCollapsedSize; return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 4c94fe93cbdc..c7333c2721b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -368,7 +368,7 @@ public class StackScrollAlgorithm { childViewState.location = StackViewState.LOCATION_UNKNOWN; paddingAfterChild = getPaddingAfterChild(algorithmState, child); int childHeight = getMaxAllowedChildHeight(child); - int minHeight = child.getMinHeight(); + int collapsedHeight = child.getCollapsedHeight(); childViewState.yTranslation = currentYPosition; if (i == 0) { updateFirstChildHeight(child, childViewState, childHeight, ambientState); @@ -384,7 +384,7 @@ public class StackScrollAlgorithm { // According to the regular scroll view we are fully translated out of the // bottom of the screen so we are fully in the bottom stack updateStateForChildFullyInBottomStack(algorithmState, - bottomStackStart, childViewState, minHeight, ambientState, child); + bottomStackStart, childViewState, collapsedHeight, ambientState, child); } else { // According to the regular scroll view we are currently translating out of / // into the bottom of the screen @@ -475,17 +475,17 @@ public class StackScrollAlgorithm { float newTranslation = Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(), childState.yTranslation); childState.height = (int) Math.max(childState.height - (newTranslation - - childState.yTranslation), row.getMinHeight()); + - childState.yTranslation), row.getCollapsedHeight()); childState.yTranslation = newTranslation; } private void clampHunToMaxTranslation(AmbientState ambientState, ExpandableNotificationRow row, StackViewState childState) { float newTranslation; - float bottomPosition = ambientState.getMaxHeadsUpTranslation() - row.getMinHeight(); + float bottomPosition = ambientState.getMaxHeadsUpTranslation() - row.getCollapsedHeight(); newTranslation = Math.min(childState.yTranslation, bottomPosition); childState.height = (int) Math.max(childState.height - - (childState.yTranslation - newTranslation), row.getMinHeight()); + - (childState.yTranslation - newTranslation), row.getCollapsedHeight()); childState.yTranslation = newTranslation; } @@ -534,10 +534,10 @@ public class StackScrollAlgorithm { float offset = mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom); algorithmState.itemsInBottomStack += algorithmState.partialInBottom; int newHeight = childHeight; - if (childHeight > child.getMinHeight()) { + if (childHeight > child.getCollapsedHeight()) { newHeight = (int) Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState, child) - currentYPosition, childHeight), - child.getMinHeight()); + child.getCollapsedHeight()); childViewState.height = newHeight; } childViewState.yTranslation = transitioningPositionStart + offset - newHeight @@ -547,7 +547,7 @@ public class StackScrollAlgorithm { private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState, float transitioningPositionStart, StackViewState childViewState, - int minHeight, AmbientState ambientState, ExpandableView child) { + int collapsedHeight, AmbientState ambientState, ExpandableView child) { float currentYPosition; algorithmState.itemsInBottomStack += 1.0f; if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) { @@ -568,16 +568,14 @@ public class StackScrollAlgorithm { childViewState.location = StackViewState.LOCATION_BOTTOM_STACK_HIDDEN; currentYPosition = ambientState.getInnerHeight(); } - childViewState.height = minHeight; - childViewState.yTranslation = currentYPosition - minHeight; + childViewState.height = collapsedHeight; + childViewState.yTranslation = currentYPosition - collapsedHeight; } /** * Update the height of the first child i.e clamp it to the bottom stack * - * - * @param child the child to update * @param childViewState the viewstate of the child * @param childHeight the height of the child @@ -591,7 +589,7 @@ public class StackScrollAlgorithm { mBottomStackSlowDownLength + ambientState.getScrollY(); // Collapse and expand the first child while the shade is being expanded childViewState.height = (int) Math.max(Math.min(bottomPeekStart, (float) childHeight), - child.getMinHeight()); + child.getCollapsedHeight()); } /** |