Implement brightness slider spec.

Bug: 72991368
Test: visual
Change-Id: I5168f0a30d8a325c3c8d84ff26419240db18a634
This commit is contained in:
Amin Shaikh
2018-02-21 15:52:36 -05:00
parent 69ad4a1565
commit 6adcacc5d2
11 changed files with 93 additions and 29 deletions

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white"
android:alpha="?android:attr/disabledAlpha" />
</selector>

View File

@@ -16,4 +16,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/qs_background_dark" />
<corners android:radius="8dp" />
</shape>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle"
android:tint="?android:attr/colorControlActivated">
<size android:height="@dimen/seek_bar_height" />
<solid android:color="@color/white_disabled" />
<corners android:radius="@dimen/seek_bar_corner_radius" />
</shape>
</item>
<item android:id="@android:id/progress"
android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<shape android:shape="rectangle"
android:tint="?android:attr/colorControlActivated">
<size android:height="@dimen/seek_bar_height" />
<solid android:color="@android:color/white" />
<corners android:radius="@dimen/seek_bar_corner_radius" />
</shape>
</scale>
</item>
</layer-list>

View File

@@ -14,14 +14,14 @@ Copyright (C) 2017 The Android Open Source Project
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28.0dp"
android:height="28.0dp"
android:width="24dp"
android:height="24dp"
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="?android:attr/colorPrimary" />
android:fillColor="@android:color/transparent" />
<path
android:pathData="M20,8.69L20,5c0,-0.55 -0.45,-1 -1,-1h-3.69l-2.6,-2.6a0.996,0.996 0,0 0,-1.41 0L8.69,4L5,4c-0.55,0 -1,0.45 -1,1v3.69l-2.6,2.6a0.996,0.996 0,0 0,0 1.41L4,15.3L4,19c0,0.55 0.45,1 1,1h3.69l2.6,2.6c0.39,0.39 1.02,0.39 1.41,0l2.6,-2.6L19,20c0.55,0 1,-0.45 1,-1v-3.69l2.6,-2.6a0.996,0.996 0,0 0,0 -1.41L20,8.69zM12,18.08c-3.36,0 -6.08,-2.73 -6.08,-6.08S8.64,5.92 12,5.92s6.08,2.73 6.08,6.08 -2.72,6.08 -6.08,6.08zM12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4z"
android:fillColor="?android:attr/colorControlNormal" />
android:fillColor="?android:attr/colorControlActivated" />
</vector>

View File

@@ -14,19 +14,19 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/brightness_mirror"
android:layout_width="@dimen/qs_panel_width"
android:layout_height="wrap_content"
android:layout_height="@dimen/brightness_mirror_height"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:visibility="invisible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/brightness_mirror_background"
android:elevation="2dp">
<include layout="@layout/quick_settings_brightness_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_marginLeft="@dimen/notification_side_paddings"
android:layout_marginRight="@dimen/notification_side_paddings"
android:background="@drawable/brightness_mirror_background">
<include layout="@layout/quick_settings_brightness_dialog" />
</FrameLayout>
</FrameLayout>

View File

@@ -15,8 +15,9 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_height="48dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
style="@style/BrightnessDialogContainer">
@@ -34,7 +35,7 @@
<com.android.systemui.settings.ToggleSliderView
android:id="@+id/brightness_slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:contentDescription="@string/accessibility_brightness"

View File

@@ -16,10 +16,7 @@
-->
<!-- android:background="@drawable/status_bar_closed_default_background" -->
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBox
android:id="@+id/toggle"
android:layout_width="48dp"
@@ -44,6 +41,7 @@
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:thumb="@drawable/ic_brightness_thumb"
android:progressDrawable="@drawable/brightness_progress_drawable"
android:splitTrack="false"
/>
<TextView

View File

@@ -22,8 +22,10 @@
<dimen name="docked_divider_handle_width">2dp</dimen>
<dimen name="docked_divider_handle_height">16dp</dimen>
<dimen name="brightness_mirror_height">96dp</dimen>
<dimen name="qs_tile_margin_top">2dp</dimen>
<dimen name="qs_brightness_padding_top">0dp</dimen>
<dimen name="qs_header_tooltip_height">24dp</dimen>
<dimen name="battery_detail_graph_space_top">9dp</dimen>
<dimen name="battery_detail_graph_space_bottom">9dp</dimen>

View File

@@ -259,6 +259,8 @@
<dimen name="notification_panel_width">@dimen/match_parent</dimen>
<dimen name="brightness_mirror_height">108dp</dimen>
<!-- The width of the panel that holds the quick settings. -->
<dimen name="qs_panel_width">@dimen/notification_panel_width</dimen>
@@ -290,7 +292,7 @@
<dimen name="qs_tile_height">106dp</dimen>
<dimen name="qs_tile_margin">19dp</dimen>
<dimen name="qs_tile_margin_top">32dp</dimen>
<dimen name="qs_tile_margin_top">18dp</dimen>
<dimen name="qs_quick_tile_size">48dp</dimen>
<dimen name="qs_quick_tile_padding">12dp</dimen>
<dimen name="qs_header_gear_translation">16dp</dimen>
@@ -316,7 +318,6 @@
<dimen name="qs_detail_image_height">56dp</dimen>
<dimen name="qs_detail_image_padding">16dp</dimen>
<dimen name="qs_detail_item_height">48dp</dimen>
<dimen name="qs_brightness_padding_top">6dp</dimen>
<dimen name="qs_detail_header_text_size">20sp</dimen>
<dimen name="qs_detail_button_text_size">14sp</dimen>
<dimen name="qs_detail_item_primary_text_size">16sp</dimen>
@@ -334,9 +335,7 @@
<dimen name="qs_detail_item_icon_width">32dp</dimen>
<dimen name="qs_detail_item_icon_marginStart">0dp</dimen>
<dimen name="qs_detail_item_icon_marginEnd">20dp</dimen>
<dimen name="qs_header_padding_start">16dp</dimen>
<dimen name="qs_header_padding_end">24dp</dimen>
<dimen name="qs_header_tooltip_height">32dp</dimen>
<dimen name="qs_header_tooltip_height">30dp</dimen>
<dimen name="qs_footer_padding_start">16dp</dimen>
<dimen name="qs_footer_padding_end">24dp</dimen>
<dimen name="qs_footer_icon_size">16dp</dimen>
@@ -363,6 +362,9 @@
<!-- Padding between subtitles and the following text in the QSFooter dialog -->
<dimen name="qs_footer_dialog_subtitle_padding">20dp</dimen>
<dimen name="seek_bar_height">3dp</dimen>
<dimen name="seek_bar_corner_radius">3dp</dimen>
<!-- Zen mode panel: condition item button padding -->
<dimen name="zen_mode_condition_detail_button_padding">8dp</dimen>

View File

@@ -254,8 +254,10 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
public void updateResources() {
final Resources res = mContext.getResources();
setPadding(0, res.getDimensionPixelSize(R.dimen.qs_brightness_padding_top),
0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom));
setPadding(0, 0, 0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom));
mTooltipView.getLayoutParams().height =
res.getDimensionPixelSize(R.dimen.qs_header_tooltip_height);
mTooltipView.setLayoutParams(mTooltipView.getLayoutParams());
for (TileRecord r : mRecords) {
r.tile.clearState();
}

View File

@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.policy;
import android.annotation.NonNull;
import android.content.res.Resources;
import android.util.ArraySet;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
@@ -111,10 +112,10 @@ public class BrightnessMirrorController
public void updateResources() {
FrameLayout.LayoutParams lp =
(FrameLayout.LayoutParams) mBrightnessMirror.getLayoutParams();
lp.width = mBrightnessMirror.getResources().getDimensionPixelSize(
R.dimen.qs_panel_width);
lp.gravity = mBrightnessMirror.getResources().getInteger(
R.integer.notification_panel_layout_gravity);
Resources r = mBrightnessMirror.getResources();
lp.width = r.getDimensionPixelSize(R.dimen.qs_panel_width);
lp.height = r.getDimensionPixelSize(R.dimen.brightness_mirror_height);
lp.gravity = r.getInteger(R.integer.notification_panel_layout_gravity);
mBrightnessMirror.setLayoutParams(lp);
}