Skip to content

Commit cd542b8

Browse files
committed
Update brightness slider thumb and spacing
Also fixes a few errors in the measuring logic. Bug: 15170399 Change-Id: I7ce7edef0a08dc00ef747988cd64e40a9fbae192
1 parent 76a1623 commit cd542b8

File tree

7 files changed

+47
-9
lines changed

7 files changed

+47
-9
lines changed

packages/SystemUI/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
<activity
328328
android:name=".settings.BrightnessDialog"
329329
android:label="@string/quick_settings_brightness_dialog_title"
330-
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog"
330+
android:theme="@android:style/Theme.DeviceDefault.Dialog"
331331
android:finishOnCloseSystemDialogs="true"
332332
android:launchMode="singleInstance"
333333
android:excludeFromRecents="true"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
Copyright (C) 2014 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:width="28.0dp"
18+
android:height="28.0dp"
19+
android:viewportWidth="24.0"
20+
android:viewportHeight="24.0">
21+
<path
22+
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"
23+
android:fillColor="@color/system_primary_color" />
24+
<path
25+
android:fillColor="#FFFFFFFF"
26+
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"/>
27+
</vector>

packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
-->
1616
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
1717
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
18+
android:paddingLeft="16dp"
19+
android:paddingRight="16dp"
1820
style="@style/BrightnessDialogContainer">
1921

2022
<ImageView
@@ -24,7 +26,8 @@
2426
android:layout_gravity="center_vertical"
2527
android:layout_marginEnd="8dp"
2628
android:src="@drawable/ic_qs_brightness_auto_off"
27-
android:contentDescription="@null" />
29+
android:contentDescription="@null"
30+
android:visibility="gone" />
2831

2932
<com.android.systemui.settings.ToggleSlider
3033
android:id="@+id/brightness_slider"

packages/SystemUI/res/layout/status_bar_toggle_slider.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
android:layout_alignParentEnd="true"
4242
android:paddingStart="20dp"
4343
android:paddingEnd="20dp"
44+
android:paddingTop="16dp"
45+
android:paddingBottom="16dp"
46+
android:thumb="@drawable/ic_brightness_thumb"
47+
android:splitTrack="false"
4448
/>
4549
<TextView
4650
android:id="@+id/label"

packages/SystemUI/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
<dimen name="qs_panel_padding_bottom">8dp</dimen>
176176
<dimen name="qs_detail_item_height">48dp</dimen>
177177
<dimen name="qs_detail_item_height_twoline">72dp</dimen>
178+
<dimen name="qs_brightness_padding_top">6dp</dimen>
178179

179180

180181
<dimen name="segmented_button_spacing">4dp</dimen>

packages/SystemUI/res/values/styles.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@
211211
<style name="BaseBrightnessDialogContainer">
212212
<item name="android:layout_width">match_parent</item>
213213
<item name="android:layout_height">wrap_content</item>
214-
<item name="android:padding">16dp</item>
215214
<item name="android:layout_alignParentBottom">true</item>
216215
</style>
217216

packages/SystemUI/src/com/android/systemui/qs/QSPanel.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class QSPanel extends ViewGroup {
6161
private int mLargeCellHeight;
6262
private int mPanelPaddingBottom;
6363
private int mDualTileUnderlap;
64+
private int mBrightnessPaddingTop;
6465
private boolean mExpanded;
6566
private boolean mListening;
6667

@@ -136,6 +137,7 @@ public void updateResources() {
136137
mLargeCellWidth = (int)(mLargeCellHeight * TILE_ASPECT);
137138
mPanelPaddingBottom = res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom);
138139
mDualTileUnderlap = res.getDimensionPixelSize(R.dimen.qs_dual_tile_padding_vertical);
140+
mBrightnessPaddingTop = res.getDimensionPixelSize(R.dimen.qs_brightness_padding_top);
139141
if (mColumns != columns) {
140142
mColumns = columns;
141143
postInvalidate();
@@ -320,6 +322,7 @@ public void onClick(View v) {
320322
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
321323
final int width = MeasureSpec.getSize(widthMeasureSpec);
322324
mBrightnessView.measure(exactly(width), MeasureSpec.UNSPECIFIED);
325+
final int brightnessHeight = mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop;
323326
mFooter.getView().measure(exactly(width), MeasureSpec.UNSPECIFIED);
324327
int r = -1;
325328
int c = -1;
@@ -348,9 +351,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
348351
final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight;
349352
record.tileView.measure(exactly(cw), exactly(ch));
350353
}
351-
int h = rows == 0 ? mBrightnessView.getHeight() : (getRowTop(rows) + mPanelPaddingBottom);
354+
int h = rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom);
352355
if (mFooter.hasFooter()) {
353-
h += mFooter.getView().getHeight();
356+
h += mFooter.getView().getMeasuredHeight();
354357
}
355358
mDetail.measure(exactly(width), MeasureSpec.UNSPECIFIED);
356359
if (mDetail.getMeasuredHeight() < h) {
@@ -366,8 +369,9 @@ private static int exactly(int size) {
366369
@Override
367370
protected void onLayout(boolean changed, int l, int t, int r, int b) {
368371
final int w = getWidth();
369-
mBrightnessView.layout(0, 0,
370-
mBrightnessView.getMeasuredWidth(), mBrightnessView.getMeasuredHeight());
372+
mBrightnessView.layout(0, mBrightnessPaddingTop,
373+
mBrightnessView.getMeasuredWidth(),
374+
mBrightnessPaddingTop + mBrightnessView.getMeasuredHeight());
371375
for (TileRecord record : mRecords) {
372376
if (record.tileView.getVisibility() == GONE) continue;
373377
final int cols = getColumnCount(record.row);
@@ -389,8 +393,8 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
389393
}
390394

391395
private int getRowTop(int row) {
392-
if (row <= 0) return mBrightnessView.getHeight();
393-
return mBrightnessView.getHeight()
396+
if (row <= 0) return mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop;
397+
return mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop
394398
+ mLargeCellHeight - mDualTileUnderlap + (row - 1) * mCellHeight;
395399
}
396400

0 commit comments

Comments
 (0)