From 4c1e9a2fc8390730b6cebc0e381af43ef85e7eb8 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Tue, 9 May 2017 13:50:47 -0400 Subject: [PATCH] More QS theme fixes for contrast Test: visual Change-Id: I4494e92ebf79bbc20c30a18f5ac13228801a3e54 Fixes: 37443237 --- .../res/layout/qs_customize_panel.xml | 1 + packages/SystemUI/res/layout/qs_detail.xml | 1 + packages/SystemUI/res/layout/qs_footer.xml | 1 + packages/SystemUI/res/layout/qs_panel.xml | 30 +++++++++++-------- .../quick_status_bar_expanded_header.xml | 1 + packages/SystemUI/res/values/dimens.xml | 2 ++ .../android/systemui/qs/QSContainerImpl.java | 10 ++++++- .../com/android/systemui/qs/QSFragment.java | 16 ++++++---- .../systemui/qs/tileimpl/QSTileImpl.java | 5 ++-- 9 files changed, 45 insertions(+), 22 deletions(-) diff --git a/packages/SystemUI/res/layout/qs_customize_panel.xml b/packages/SystemUI/res/layout/qs_customize_panel.xml index 9ab8ac6346d3b..cbc2575bd6f84 100644 --- a/packages/SystemUI/res/layout/qs_customize_panel.xml +++ b/packages/SystemUI/res/layout/qs_customize_panel.xml @@ -21,6 +21,7 @@ android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical" + android:elevation="4dp" android:background="@drawable/qs_customizer_background" android:gravity="center_horizontal"> diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml index 1c087b374a2b8..f41c4944fff83 100644 --- a/packages/SystemUI/res/layout/qs_detail.xml +++ b/packages/SystemUI/res/layout/qs_detail.xml @@ -20,6 +20,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/qs_detail_background" + android:elevation="4dp" android:clickable="true" android:orientation="vertical" android:paddingBottom="8dp" diff --git a/packages/SystemUI/res/layout/qs_footer.xml b/packages/SystemUI/res/layout/qs_footer.xml index 0a848c0769e5c..71f98ba22cebd 100644 --- a/packages/SystemUI/res/layout/qs_footer.xml +++ b/packages/SystemUI/res/layout/qs_footer.xml @@ -21,6 +21,7 @@ android:id="@+id/header" android:layout_width="match_parent" android:layout_height="48dp" + android:elevation="4dp" android:baselineAligned="false" android:clickable="false" android:clipChildren="false" diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index 365831343c567..fb47bbc370e13 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -14,22 +14,28 @@ limitations under the License. --> + + + android:elevation="4dp" /> + android:id="@+id/quick_settings_panel" + android:layout_marginTop="28dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:elevation="4dp" + android:layout_marginBottom="48dp" /> 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 520dab4983ac1..65344b7030353 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -24,6 +24,7 @@ android:layout_height="@dimen/status_bar_header_height" android:layout_gravity="@integer/notification_panel_layout_gravity" android:baselineAligned="false" + android:elevation="4dp" android:clickable="false" android:clipChildren="false" android:clipToPadding="false" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index ffd3096772a42..e9447931c55b5 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -809,4 +809,6 @@ 0dp 0dp + 6dp + diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 06264ba4b9806..189c04c1ac4e2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -17,11 +17,14 @@ 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; @@ -39,6 +42,8 @@ public class QSContainerImpl extends FrameLayout { protected float mQsExpansion; private QSCustomizer mQSCustomizer; private QSFooter mQSFooter; + private int mGutterHeight; + private View mBackground; public QSContainerImpl(Context context, AttributeSet attrs) { super(context, attrs); @@ -52,6 +57,8 @@ public class QSContainerImpl extends FrameLayout { mHeader = findViewById(R.id.header); mQSCustomizer = findViewById(R.id.qs_customize); mQSFooter = findViewById(R.id.qs_footer); + mBackground = findViewById(R.id.qs_background); + mGutterHeight = getContext().getResources().getDimensionPixelSize(R.dimen.qs_gutter_height); } @Override @@ -94,8 +101,9 @@ public class QSContainerImpl extends FrameLayout { public void updateBottom() { int height = calculateContainerHeight(); - setBottom(getTop() + height); + setBottom(getTop() + height + mGutterHeight); mQSDetail.setBottom(getTop() + height); + mBackground.setBottom(mQSDetail.getBottom()); // Pin QS Footer to the bottom of the panel. mQSFooter.setTranslationY(height - mQSFooter.getHeight()); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 406f107f9872e..5cf049abe1354 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -32,6 +32,7 @@ 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.plugins.qs.QS; import com.android.systemui.qs.customize.QSCustomizer; import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer; @@ -61,6 +62,7 @@ public class QSFragment extends Fragment implements QS { private QSContainerImpl mContainer; private int mLayoutDirection; private QSFooter mFooter; + private int mGutterHeight; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @@ -75,7 +77,8 @@ public class QSFragment extends Fragment implements QS { mQSDetail = view.findViewById(R.id.qs_detail); mHeader = view.findViewById(R.id.header); mFooter = view.findViewById(R.id.qs_footer); - mContainer = (QSContainerImpl) view; + mContainer = view.findViewById(id.quick_settings_container); + mGutterHeight = getContext().getResources().getDimensionPixelSize(R.dimen.qs_gutter_height); mQSDetail.setQsPanel(mQSPanel, mHeader); @@ -239,7 +242,8 @@ public class QSFragment extends Fragment implements QS { mContainer.setExpansion(expansion); final float translationScaleY = expansion - 1; if (!mHeaderAnimating) { - getView().setTranslationY(mKeyguardShowing ? (translationScaleY * mHeader.getHeight()) + int height = mHeader.getHeight() + mGutterHeight; + getView().setTranslationY(mKeyguardShowing ? (translationScaleY * height) : headerTranslation); } mHeader.setExpansion(mKeyguardShowing ? 1 : expansion); @@ -321,19 +325,19 @@ public class QSFragment extends Fragment implements QS { LayoutParams layoutParams = (LayoutParams) mQSPanel.getLayoutParams(); int panelHeight = layoutParams.topMargin + layoutParams.bottomMargin + + mQSPanel.getMeasuredHeight(); - return panelHeight + getView().getPaddingBottom(); + return panelHeight + getView().getPaddingBottom() + mGutterHeight; } else { - return getView().getMeasuredHeight(); + return getView().getMeasuredHeight() + mGutterHeight; } } @Override public void setHeightOverride(int desiredHeight) { - mContainer.setHeightOverride(desiredHeight); + mContainer.setHeightOverride(desiredHeight - mGutterHeight); } public int getQsMinExpansionHeight() { - return mHeader.getHeight(); + return mHeader.getHeight() + mGutterHeight; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java index 32af2305062ec..d12b16b77ae59 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -339,11 +339,10 @@ public abstract class QSTileImpl implements QSTile { public static int getColorForState(Context context, int state) { switch (state) { case Tile.STATE_UNAVAILABLE: - return Utils.getDisabled(context, - Utils.getColorAttr(context, android.R.attr.textColorPrimary)); - case Tile.STATE_INACTIVE: return Utils.getDisabled(context, Utils.getColorAttr(context, android.R.attr.colorForeground)); + case Tile.STATE_INACTIVE: + return Utils.getColorAttr(context, android.R.attr.textColorHint); case Tile.STATE_ACTIVE: return Utils.getColorAttr(context, android.R.attr.textColorPrimary); default: