Appear notifications at min height instead of 0 height

Bug: 172289889
Test: manual
Change-Id: I6705c468c37eaab52e8be5eda0e27ea05d4788b7
This commit is contained in:
Lyn Han
2021-05-04 08:15:42 -05:00
parent 8315904e81
commit 317e3b44fd
2 changed files with 10 additions and 5 deletions

View File

@@ -1143,16 +1143,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
*/
private void updateStackPosition() {
// Consider interpolating from an mExpansionStartY for use on lockscreen and AOD
final float stackY = MathUtils.lerp(0, mTopPadding, mAmbientState.getExpansionFraction());
final float fraction = mAmbientState.getExpansionFraction();
final float stackY = MathUtils.lerp(0, mTopPadding, fraction);
mAmbientState.setStackY(stackY);
if (mOnStackYChanged != null) {
mOnStackYChanged.run();
}
final float shadeBottom = getHeight() - getEmptyBottomMargin();
mAmbientState.setStackEndHeight(shadeBottom - mTopPadding);
final float stackEndHeight = getHeight() - getEmptyBottomMargin() - mTopPadding;
mAmbientState.setStackEndHeight(stackEndHeight);
mAmbientState.setStackHeight(
MathUtils.lerp(0, shadeBottom - mTopPadding, mAmbientState.getExpansionFraction()));
MathUtils.lerp(stackEndHeight * StackScrollAlgorithm.START_FRACTION,
stackEndHeight, fraction));
}
void setOnStackYChanged(Runnable onStackYChanged) {

View File

@@ -42,6 +42,8 @@ import java.util.List;
*/
public class StackScrollAlgorithm {
public static final float START_FRACTION = 0.3f;
private static final String LOG_TAG = "StackScrollAlgorithm";
private final ViewGroup mHostView;
@@ -442,7 +444,8 @@ public class StackScrollAlgorithm {
maxViewHeight = algorithmState.viewHeightBeforeShelf;
}
}
viewState.height = (int) MathUtils.lerp(0, maxViewHeight, expansionFraction);
viewState.height = (int) MathUtils.lerp(maxViewHeight * START_FRACTION, maxViewHeight,
expansionFraction);
}
currentYPosition += viewState.height + expansionFraction * mPaddingBetweenElements;