Putting ZenModePanel xml resources to SettingsLib

Move resources for ZenModePanel to SettingsLib for new
EnableZenModeDialog in settings

Test: runtest -x /extra/master/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/volume/ZenModePanelTest.java
Bug: 63077372
Change-Id: Iea9060b063ccfb807b39affcdac29d12420bd93b
This commit is contained in:
Beverly
2018-01-22 09:27:19 -05:00
parent cee2094d75
commit 92c2568b55
13 changed files with 269 additions and 6 deletions

View File

@@ -4480,7 +4480,7 @@
<string name="zen_mode_alarm">Until <xliff:g id="formattedTime" example="10:00 PM">%1$s</xliff:g> (next alarm)</string>
<!-- Zen mode condition: no exit criteria. [CHAR LIMIT=NONE] -->
<string name="zen_mode_forever">Until you turn off Do Not Disturb</string>
<string name="zen_mode_forever">Until you turn off</string>
<!-- Zen mode condition: no exit criteria, includes the name of the feature for emphasis. [CHAR LIMIT=NONE] -->
<string name="zen_mode_forever_dnd">Until you turn off Do Not Disturb</string>

View File

@@ -0,0 +1,31 @@
<!--
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.
-->
<inset
xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="4dp"
android:insetBottom="4dp">
<ripple
android:color="?android:attr/colorControlHighlight" >
<item android:id="@android:id/mask">
<shape>
<corners android:radius="2dp" />
<solid android:color="@android:color/white" />
</shape>
</item>
</ripple>
</inset>

View File

@@ -0,0 +1,24 @@
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24.0dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24.0dp" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18,13H6c-0.55,0 -1,-0.45 -1,-1v0c0,-0.55 0.45,-1 1,-1h12c0.55,0 1,0.45 1,1v0C19,12.55 18.55,13 18,13z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24.0dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24.0dp" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18,13h-5v5c0,0.55 -0.45,1 -1,1h0c-0.55,0 -1,-0.45 -1,-1v-5H6c-0.55,0 -1,-0.45 -1,-1v0c0,-0.55 0.45,-1 1,-1h5V6c0,-0.55 0.45,-1 1,-1h0c0.55,0 1,0.45 1,1v5h5c0.55,0 1,0.45 1,1v0C19,12.55 18.55,13 18,13z"/>
</vector>

View File

@@ -0,0 +1,84 @@
<?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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:layout_marginStart="1dp"
android:layout_marginEnd="0dp"
android:layout_weight="1"
android:gravity="center_vertical" >
<LinearLayout
android:id="@android:id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:gravity="center_vertical"
android:layout_centerVertical="true"
android:orientation="vertical"
android:layout_toEndOf="@android:id/checkbox"
android:layout_toStartOf="@android:id/button1">
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:textAlignment="viewStart"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"/>
<TextView
android:id="@android:id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/zen_mode_condition_detail_item_interline_spacing"
android:ellipsize="end"
android:textAlignment="viewStart"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"/>
</LinearLayout>
<ImageView
android:id="@android:id/button1"
style="@style/BorderlessButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:scaleType="center"
android:layout_toStartOf="@android:id/button2"
android:contentDescription="@string/accessibility_manual_zen_less_time"
android:tint="?android:attr/colorAccent"
android:src="@drawable/ic_minus" />
<ImageView
android:id="@android:id/button2"
style="@style/BorderlessButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:scaleType="center"
android:layout_centerVertical="true"
android:contentDescription="@string/accessibility_manual_zen_more_time"
android:tint="?android:attr/colorAccent"
android:src="@drawable/ic_plus" />
</RelativeLayout>

View File

@@ -0,0 +1,29 @@
<?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.
-->
<RadioButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/checkbox"
android:layout_width="40dp"
android:layout_marginStart="7dp"
android:layout_marginEnd="4dp"
android:layout_height="48dp"
android:layout_alignParentStart="true"
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp">
</RadioButton>

View File

@@ -0,0 +1,46 @@
<?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.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport ="true"
android:orientation="vertical">
<com.android.settingslib.notification.ZenRadioLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/zen_conditions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:layout_marginStart="4dp"
android:paddingBottom="4dp"
android:orientation="horizontal">
<RadioGroup
android:id="@+id/zen_radio_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/zen_radio_buttons_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"/>
</com.android.settingslib.notification.ZenRadioLayout>
</ScrollView>

View File

@@ -74,4 +74,13 @@
fraction of a pixel.-->
<fraction name="battery_subpixel_smoothing_left">0%</fraction>
<fraction name="battery_subpixel_smoothing_right">0%</fraction>
<!-- Zen mode panel: condition item button padding -->
<dimen name="zen_mode_condition_detail_button_padding">8dp</dimen>
<!-- Zen mode panel: spacing between condition items -->
<dimen name="zen_mode_condition_detail_item_spacing">12dp</dimen>
<!-- Zen mode panel: spacing between two-line condition upper and lower lines -->
<dimen name="zen_mode_condition_detail_item_interline_spacing">4dp</dimen>
<!-- Zen mode panel: bottom padding, a bit less than qs_panel_padding -->
<dimen name="zen_mode_condition_detail_bottom_padding">4dp</dimen>
</resources>

View File

@@ -1025,4 +1025,9 @@
<item quantity="other">%1$d devices connected</item>
</plurals>
<!-- Content description of zen mode time condition plus button (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_manual_zen_more_time">More time.</string>
<!-- Content description of zen mode time condition minus button (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_manual_zen_less_time">Less time.</string>
</resources>

View File

@@ -21,4 +21,10 @@
<style name="TextAppearanceMedium">
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
<style name="BorderlessButton">
<item name="android:padding">12dp</item>
<item name="android:background">@drawable/btn_borderless_rect</item>
<item name="android:gravity">center</item>
</style>
</resources>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 The Android Open Source Project
* 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
@@ -12,7 +12,7 @@
* permissions and limitations under the License.
*/
package com.android.systemui.volume;
package com.android.settingslib.notification;
import android.content.Context;
import android.util.AttributeSet;
@@ -22,7 +22,7 @@ import android.widget.LinearLayout;
/**
* Specialized layout for zen mode that allows the radio buttons to reside within
* a RadioGroup, but also makes sure that all the heights off the radio buttons align
* a RadioGroup, but also makes sure that all the heights of the radio buttons align
* with the corresponding content in the second child of this view.
*/
public class ZenRadioLayout extends LinearLayout {

View File

@@ -93,7 +93,7 @@
</RelativeLayout>
<com.android.systemui.volume.ZenRadioLayout
<com.android.settingslib.notification.ZenRadioLayout
android:id="@+id/zen_conditions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -111,7 +111,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"/>
</com.android.systemui.volume.ZenRadioLayout>
</com.android.settingslib.notification.ZenRadioLayout>
<TextView
android:id="@+id/zen_alarm_warning"

View File

@@ -5149,6 +5149,11 @@ message MetricsEvent {
// OS: P
FUELGAUGE_RESTRICTED_APP_DETAILS = 1285;
// OPEN: Settings > Sound & notification > Do Not Disturb > Turn on now
// CATEGORY: SETTINGS
// OS: P
NOTIFICATION_ZEN_MODE_ENABLE_DIALOG = 1286;
// ---- End P Constants, all P constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS