diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java index 4a5a6818b18ae..d57124381c1fa 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java @@ -62,6 +62,9 @@ public interface QS extends FragmentBase { View getHeader(); + default void setHasNotifications(boolean hasNotifications) { + } + @ProvidesInterface(version = HeightListener.VERSION) public interface HeightListener { public static final int VERSION = 1; diff --git a/packages/SystemUI/res/layout/qs_footer.xml b/packages/SystemUI/res/layout/qs_footer.xml index c92c811950c7f..577be2fd684bd 100644 --- a/packages/SystemUI/res/layout/qs_footer.xml +++ b/packages/SystemUI/res/layout/qs_footer.xml @@ -27,20 +27,22 @@ android:clipChildren="false" android:clipToPadding="false" android:paddingTop="0dp" - android:paddingEnd="8dp" - android:paddingStart="16dp" android:gravity="center_vertical" android:orientation="horizontal"> + + diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index 2502d414ef435..005e9552a554d 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -41,8 +41,8 @@ android:clipChildren="false" android:clipToPadding="false" android:gravity="center" - android:paddingStart="8dp" - android:paddingEnd="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" android:orientation="horizontal"> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 189c04c1ac4e2..149b5ccd7b1a5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -17,14 +17,11 @@ package com.android.systemui.qs; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Paint; import android.graphics.Point; import android.util.AttributeSet; import android.view.View; import android.widget.FrameLayout; -import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.qs.customize.QSCustomizer; @@ -44,6 +41,7 @@ public class QSContainerImpl extends FrameLayout { private QSFooter mQSFooter; private int mGutterHeight; private View mBackground; + private float mFullElevation; public QSContainerImpl(Context context, AttributeSet attrs) { super(context, attrs); @@ -59,6 +57,7 @@ public class QSContainerImpl extends FrameLayout { mQSFooter = findViewById(R.id.qs_footer); mBackground = findViewById(R.id.qs_background); mGutterHeight = getContext().getResources().getDimensionPixelSize(R.dimen.qs_gutter_height); + mFullElevation = mQSPanel.getElevation(); } @Override @@ -85,7 +84,7 @@ public class QSContainerImpl extends FrameLayout { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - updateBottom(); + updateExpansion(); } /** @@ -96,27 +95,47 @@ public class QSContainerImpl extends FrameLayout { */ public void setHeightOverride(int heightOverride) { mHeightOverride = heightOverride; - updateBottom(); + updateExpansion(); } - public void updateBottom() { + public void updateExpansion() { int height = calculateContainerHeight(); - setBottom(getTop() + height + mGutterHeight); + int gutterHeight = Math.round(mQsExpansion * mGutterHeight); + setBottom(getTop() + height + gutterHeight); mQSDetail.setBottom(getTop() + height); - mBackground.setBottom(mQSDetail.getBottom()); + mBackground.setBottom(getTop() + height); // Pin QS Footer to the bottom of the panel. mQSFooter.setTranslationY(height - mQSFooter.getHeight()); + + float elevation = mQsExpansion * mFullElevation; + mQSDetail.setElevation(elevation); + mBackground.setElevation(elevation); + mQSFooter.setElevation(elevation); + mQSPanel.setElevation(elevation); } protected int calculateContainerHeight() { int heightOverride = mHeightOverride != -1 ? mHeightOverride : getMeasuredHeight(); return mQSCustomizer.isCustomizing() ? mQSCustomizer.getHeight() - : (int) (mQsExpansion * (heightOverride - mHeader.getHeight())) + : Math.round(mQsExpansion * (heightOverride - mHeader.getHeight())) + mHeader.getHeight(); } public void setExpansion(float expansion) { mQsExpansion = expansion; - updateBottom(); + updateExpansion(); + } + + public void setGutterEnabled(boolean gutterEnabled) { + if (gutterEnabled == (mGutterHeight != 0)) { + return; + } + if (gutterEnabled) { + mGutterHeight = getContext().getResources().getDimensionPixelSize( + R.dimen.qs_gutter_height); + } else { + mGutterHeight = 0; + } + updateExpansion(); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooter.java index 063f5dfd1f07e..87b042d61147b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooter.java @@ -235,6 +235,7 @@ public class QSFooter extends FrameLayout implements } TouchAnimator.Builder animatorBuilder = new TouchAnimator.Builder(); + animatorBuilder.setStartDelay(QSAnimator.EXPANDED_TILE_DELAY); if (mShowEditIcon) { animatorBuilder.addFloat(mEdit, "alpha", 0, 1); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 3f090f8cbbf17..61fd6244b7001 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -34,7 +34,6 @@ import android.widget.FrameLayout.LayoutParams; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.R.id; -import com.android.systemui.R.style; import com.android.systemui.plugins.qs.QS; import com.android.systemui.qs.customize.QSCustomizer; import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer; @@ -130,6 +129,11 @@ public class QSFragment extends Fragment implements QS { return mHeader; } + @Override + public void setHasNotifications(boolean hasNotifications) { + mContainer.setGutterEnabled(hasNotifications); + } + public void setPanelView(HeightListener panelView) { mPanelView = panelView; } @@ -307,7 +311,7 @@ public class QSFragment extends Fragment implements QS { public void notifyCustomizeChanged() { // The customize state changed, so our height changed. - mContainer.updateBottom(); + mContainer.updateExpansion(); mQSPanel.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE); mHeader.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE); mFooter.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE); @@ -340,7 +344,7 @@ public class QSFragment extends Fragment implements QS { } public int getQsMinExpansionHeight() { - return mHeader.getHeight() + mGutterHeight; + return mHeader.getHeight(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index af2f7e98bb1bf..6aab8e10543e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2535,6 +2535,9 @@ public class NotificationPanelView extends PanelView implements public void setNoVisibleNotifications(boolean noNotifications) { mNoVisibleNotifications = noNotifications; + if (mQs != null) { + mQs.setHasNotifications(!noNotifications); + } } public void setPulsing(boolean pulsing) {