From ce07a81cd1a453a59e39127169c627ec8bf11603 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Wed, 18 Nov 2020 10:58:38 -0500 Subject: [PATCH] Fix QS expanding animation when there's scrolling The bottom of QSContainerImpl has to be set to the bottom of the actual view height. However, the bottom of the views that overlay the background (and should pretend to be scrollable) should be corrected by the interpolated scrolling range. QS will draw behind the nav bar. This is only relevant when QS is long (with media) and we are not using gesture nav. In that case, the bottom padding/margin is enough that any buttons are still above the navbar. Test: force scrolling and test manually Change-Id: Ib0ffd1fe6824808fcf7a0774aa3523366cd869f9 --- .../android/systemui/qs/QSContainerImpl.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index f4571d7d36095..52bd3ce0f9dac 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -17,7 +17,6 @@ package com.android.systemui.qs; import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS; -import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import android.content.Context; import android.content.res.Configuration; @@ -62,7 +61,7 @@ public class QSContainerImpl extends FrameLayout { private float mQsExpansion; private QSCustomizer mQSCustomizer; private View mDragHandle; - private View mQSPanelContainer; + private NonInterceptingScrollView mQSPanelContainer; private View mBackground; @@ -127,18 +126,12 @@ public class QSContainerImpl extends FrameLayout { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // QSPanel will show as many rows as it can (up to TileLayout.MAX_ROWS) such that the // bottom and footer are inside the screen. - Configuration config = getResources().getConfiguration(); - boolean navBelow = config.smallestScreenWidthDp >= 600 - || config.orientation != Configuration.ORIENTATION_LANDSCAPE; MarginLayoutParams layoutParams = (MarginLayoutParams) mQSPanelContainer.getLayoutParams(); // The footer is pinned to the bottom of QSPanel (same bottoms), therefore we don't need to // subtract its height. We do not care if the collapsed notifications fit in the screen. int maxQs = getDisplayHeight() - layoutParams.topMargin - layoutParams.bottomMargin - getPaddingBottom(); - if (navBelow) { - maxQs -= getResources().getDimensionPixelSize(R.dimen.navigation_bar_height); - } int padding = mPaddingLeft + mPaddingRight + layoutParams.leftMargin + layoutParams.rightMargin; @@ -217,12 +210,13 @@ public class QSContainerImpl extends FrameLayout { public void updateExpansion(boolean animate) { int height = calculateContainerHeight(); + int scrollBottom = calculateContainerBottom(); setBottom(getTop() + height); - mQSDetail.setBottom(getTop() + height); + mQSDetail.setBottom(getTop() + scrollBottom); // Pin the drag handle to the bottom of the panel. - mDragHandle.setTranslationY(height - mDragHandle.getHeight()); + mDragHandle.setTranslationY(scrollBottom - mDragHandle.getHeight()); mBackground.setTop(mQSPanelContainer.getTop()); - updateBackgroundBottom(height, animate); + updateBackgroundBottom(scrollBottom, animate); } private void updateBackgroundBottom(int height, boolean animated) { @@ -246,6 +240,15 @@ public class QSContainerImpl extends FrameLayout { + mHeader.getHeight(); } + int calculateContainerBottom() { + int heightOverride = mHeightOverride != -1 ? mHeightOverride : getMeasuredHeight(); + return mQSCustomizer.isCustomizing() ? mQSCustomizer.getHeight() + : Math.round(mQsExpansion + * (heightOverride + mQSPanelContainer.getScrollRange() + - mQSPanelContainer.getScrollY() - mHeader.getHeight())) + + mHeader.getHeight(); + } + public void setExpansion(float expansion) { mQsExpansion = expansion; mDragHandle.setAlpha(1.0f - expansion);