diff options
author | Adrian Roos <roosa@google.com> | 2014-08-12 22:25:35 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-08-12 21:04:26 +0000 |
commit | cd542b8a98ea9c648622c9360c251de4be4223e4 (patch) | |
tree | 9266a6714f91fea60a1a42ef7913cf387b28b3a0 /packages/SystemUI | |
parent | 76a1623afc170a13923b68f3256057d8adeb7937 (diff) | |
download | frameworks_base-cd542b8a98ea9c648622c9360c251de4be4223e4.zip frameworks_base-cd542b8a98ea9c648622c9360c251de4be4223e4.tar.gz frameworks_base-cd542b8a98ea9c648622c9360c251de4be4223e4.tar.bz2 |
Update brightness slider thumb and spacing
Also fixes a few errors in the measuring logic.
Bug: 15170399
Change-Id: I7ce7edef0a08dc00ef747988cd64e40a9fbae192
Diffstat (limited to 'packages/SystemUI')
7 files changed, 47 insertions, 9 deletions
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 @@ <activity android:name=".settings.BrightnessDialog" android:label="@string/quick_settings_brightness_dialog_title" - android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" + android:theme="@android:style/Theme.DeviceDefault.Dialog" android:finishOnCloseSystemDialogs="true" android:launchMode="singleInstance" android:excludeFromRecents="true" diff --git a/packages/SystemUI/res/drawable/ic_brightness_thumb.xml b/packages/SystemUI/res/drawable/ic_brightness_thumb.xml new file mode 100644 index 0000000..dc978fe --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_brightness_thumb.xml @@ -0,0 +1,27 @@ +<!-- +Copyright (C) 2014 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="28.0dp" + android:height="28.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="m18.250000,12.000000a6.250000,6.250000 0.000000,1.000000 1.000000,-12.500000 0.000000,6.250000 6.250000,0.000000 1.000000,1.000000 12.500000,0.000000z" + android:fillColor="@color/system_primary_color" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M20.000000,8.700000L20.000000,4.000000L15.300000,4.000000L12.000000,0.700000 8.700000,4.000000L4.000000,4.000000L4.000000,8.700000L0.700000,12.000000 4.000000,15.300000L4.000000,20.000000L8.700000,20.000000L12.000000,23.299999 15.300000,20.000000L20.000000,20.000000L20.000000,15.300000L23.299999,12.000000 20.000000,8.700000zM12.000000,18.000000C8.700000,18.000000 6.000000,15.300000 6.000000,12.000000 6.000000,8.700000 8.700000,6.000000 12.000000,6.000000c3.300000,0.000000 6.000000,2.700000 6.000000,6.000000 0.000000,3.300000 -2.700000,6.000000 -6.000000,6.000000zM12.000000,8.000000c-2.200000,0.000000 -4.000000,1.800000 -4.000000,4.000000 0.000000,2.200000 1.800000,4.000000 4.000000,4.000000 2.200000,0.000000 4.000000,-1.800000 4.000000,-4.000000 0.000000,-2.200000 -1.800000,-4.000000 -4.000000,-4.000000z"/> +</vector> 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 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" + android:paddingLeft="16dp" + android:paddingRight="16dp" style="@style/BrightnessDialogContainer"> <ImageView @@ -24,7 +26,8 @@ android:layout_gravity="center_vertical" android:layout_marginEnd="8dp" android:src="@drawable/ic_qs_brightness_auto_off" - android:contentDescription="@null" /> + android:contentDescription="@null" + android:visibility="gone" /> <com.android.systemui.settings.ToggleSlider android:id="@+id/brightness_slider" diff --git a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml index 1928506..062e6cb 100644 --- a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml +++ b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml @@ -41,6 +41,10 @@ android:layout_alignParentEnd="true" android:paddingStart="20dp" android:paddingEnd="20dp" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:thumb="@drawable/ic_brightness_thumb" + android:splitTrack="false" /> <TextView android:id="@+id/label" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 4a4fa41..3db0a2b 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -175,6 +175,7 @@ <dimen name="qs_panel_padding_bottom">8dp</dimen> <dimen name="qs_detail_item_height">48dp</dimen> <dimen name="qs_detail_item_height_twoline">72dp</dimen> + <dimen name="qs_brightness_padding_top">6dp</dimen> <dimen name="segmented_button_spacing">4dp</dimen> 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 @@ <style name="BaseBrightnessDialogContainer"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> - <item name="android:padding">16dp</item> <item name="android:layout_alignParentBottom">true</item> </style> 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; } |