Merge "Fixed a bug where the minHeight of groups was inaccurate" into nyc-dev
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user