From cd542b8a98ea9c648622c9360c251de4be4223e4 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Tue, 12 Aug 2014 22:25:35 +0200 Subject: Update brightness slider thumb and spacing Also fixes a few errors in the measuring logic. Bug: 15170399 Change-Id: I7ce7edef0a08dc00ef747988cd64e40a9fbae192 --- packages/SystemUI/AndroidManifest.xml | 2 +- .../SystemUI/res/drawable/ic_brightness_thumb.xml | 27 ++++++++++++++++++++++ .../layout/quick_settings_brightness_dialog.xml | 5 +++- .../res/layout/status_bar_toggle_slider.xml | 4 ++++ packages/SystemUI/res/values/dimens.xml | 1 + packages/SystemUI/res/values/styles.xml | 1 - .../src/com/android/systemui/qs/QSPanel.java | 16 ++++++++----- 7 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 packages/SystemUI/res/drawable/ic_brightness_thumb.xml (limited to 'packages/SystemUI') diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index e48aef1..b8836a0 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -327,7 +327,7 @@ + + + + diff --git a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml index 7ded708..f776a87 100644 --- a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml +++ b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml @@ -15,6 +15,8 @@ --> + android:contentDescription="@null" + android:visibility="gone" /> 8dp 48dp 72dp + 6dp 4dp diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index baaa379..0d3a487 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -211,7 +211,6 @@ diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 6d88214..c3144c1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -61,6 +61,7 @@ public class QSPanel extends ViewGroup { private int mLargeCellHeight; private int mPanelPaddingBottom; private int mDualTileUnderlap; + private int mBrightnessPaddingTop; private boolean mExpanded; private boolean mListening; @@ -136,6 +137,7 @@ public class QSPanel extends ViewGroup { mLargeCellWidth = (int)(mLargeCellHeight * TILE_ASPECT); mPanelPaddingBottom = res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom); mDualTileUnderlap = res.getDimensionPixelSize(R.dimen.qs_dual_tile_padding_vertical); + mBrightnessPaddingTop = res.getDimensionPixelSize(R.dimen.qs_brightness_padding_top); if (mColumns != columns) { mColumns = columns; postInvalidate(); @@ -320,6 +322,7 @@ public class QSPanel extends ViewGroup { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); mBrightnessView.measure(exactly(width), MeasureSpec.UNSPECIFIED); + final int brightnessHeight = mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop; mFooter.getView().measure(exactly(width), MeasureSpec.UNSPECIFIED); int r = -1; int c = -1; @@ -348,9 +351,9 @@ public class QSPanel extends ViewGroup { final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight; record.tileView.measure(exactly(cw), exactly(ch)); } - int h = rows == 0 ? mBrightnessView.getHeight() : (getRowTop(rows) + mPanelPaddingBottom); + int h = rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom); if (mFooter.hasFooter()) { - h += mFooter.getView().getHeight(); + h += mFooter.getView().getMeasuredHeight(); } mDetail.measure(exactly(width), MeasureSpec.UNSPECIFIED); if (mDetail.getMeasuredHeight() < h) { @@ -366,8 +369,9 @@ public class QSPanel extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final int w = getWidth(); - mBrightnessView.layout(0, 0, - mBrightnessView.getMeasuredWidth(), mBrightnessView.getMeasuredHeight()); + mBrightnessView.layout(0, mBrightnessPaddingTop, + mBrightnessView.getMeasuredWidth(), + mBrightnessPaddingTop + mBrightnessView.getMeasuredHeight()); for (TileRecord record : mRecords) { if (record.tileView.getVisibility() == GONE) continue; final int cols = getColumnCount(record.row); @@ -389,8 +393,8 @@ public class QSPanel extends ViewGroup { } private int getRowTop(int row) { - if (row <= 0) return mBrightnessView.getHeight(); - return mBrightnessView.getHeight() + if (row <= 0) return mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop; + return mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop + mLargeCellHeight - mDualTileUnderlap + (row - 1) * mCellHeight; } -- cgit v1.1