Merge "Add schedule setting page for time-based modes." into main
This commit is contained in:
27
res/color/modes_set_schedule_text_color.xml
Normal file
27
res/color/modes_set_schedule_text_color.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
~ Copyright (C) 2024 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">
|
||||
<!-- when checked, background color will be accent color -->
|
||||
<item
|
||||
android:state_checked="true"
|
||||
android:color="?android:attr/textColorPrimaryInverse" />
|
||||
<!-- when unchecked, background color will be transparent -->
|
||||
<item
|
||||
android:state_checked="false"
|
||||
android:color="?android:attr/colorAccent" />
|
||||
</selector>
|
||||
47
res/drawable/modes_schedule_day_toggle.xml
Normal file
47
res/drawable/modes_schedule_day_toggle.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<!--
|
||||
~ Copyright (C) 2024 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:top="2dp"
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp">
|
||||
<selector>
|
||||
<!-- selected state = solid filled in circle -->
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="oval"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<size android:height="34dp"
|
||||
android:width="34dp" />
|
||||
<solid android:color="@android:color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- unselected state = just the outline of a circle -->
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="oval">
|
||||
<size android:height="34dp"
|
||||
android:width="34dp" />
|
||||
<stroke android:width="2dp"
|
||||
android:color="?android:attr/colorAccent" />
|
||||
<solid android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
</item>
|
||||
</layer-list>
|
||||
228
res/layout/modes_set_schedule_layout.xml
Normal file
228
res/layout/modes_set_schedule_layout.xml
Normal file
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2024 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/modes_set_schedule_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
<!-- Start time & end time row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Start time: title (non-clickable preference), time setter -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_start_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- End time: title (non-clickable preference), time setter -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_end_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Schedule duration display row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<!-- left side line divider -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1.5dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:attr/dividerHorizontal" />
|
||||
|
||||
<!-- length of schedule -->
|
||||
<TextView
|
||||
android:id="@+id/schedule_duration"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Small" />
|
||||
|
||||
<!-- right side line divider -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1.5dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:attr/dividerHorizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Buttons for selecting days of the week -->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/days_of_week_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="10dp"
|
||||
android:maxHeight="60dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/day0"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/day1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day3"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/day2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day4"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/day3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day5"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/day4"
|
||||
app:layout_constraintEnd_toStartOf="@+id/day6"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/day6"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/modes_schedule_day_toggle"
|
||||
android:textColor="@color/modes_set_schedule_text_color"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/day5"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -7963,6 +7963,15 @@
|
||||
<!-- Do not disturb: Title on the page where users choose a calendar to determine the schedule for an automatically-triggered DND rule. [CHAR LIMIT=30] -->
|
||||
<string name="zen_mode_set_calendar_category_title">Schedule</string>
|
||||
|
||||
<!-- Do not disturb: Title prompting a user to set a time-based schedule to use for an automatic rule [CHAR LIMIT=30] -->
|
||||
<string name="zen_mode_set_schedule_title">Set a schedule</string>
|
||||
|
||||
<!-- Do not disturb: Link text prompting a user to click through to setting a time-based schedule [CHAR LIMIT=40] -->
|
||||
<string name="zen_mode_set_schedule_link">Schedule</string>
|
||||
|
||||
<!-- Duration in hours and minutes for the length of a Do Not Disturb schedule. For example "1 hr, 22 min" -->
|
||||
<string name="zen_mode_schedule_duration"><xliff:g example="10" id="hours">%1$d</xliff:g> hr, <xliff:g example="20" id="minutes">%2$d</xliff:g> min</string>
|
||||
|
||||
<!-- Do not disturb: Title do not disturb settings representing automatic (scheduled) do not disturb rules. [CHAR LIMIT=30] -->
|
||||
<string name="zen_mode_schedule_category_title">Schedule</string>
|
||||
|
||||
|
||||
38
res/xml/modes_set_schedule.xml
Normal file
38
res/xml/modes_set_schedule.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2024 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="zen_mode_set_schedule"
|
||||
settings:searchable="false"
|
||||
android:title="@string/zen_mode_set_schedule_title">
|
||||
|
||||
<!-- Time picker for schedule -->
|
||||
<com.android.settingslib.widget.LayoutPreference
|
||||
android:key="schedule"
|
||||
android:selectable="false"
|
||||
android:layout="@layout/modes_set_schedule_layout"/>
|
||||
|
||||
<!-- Exit mode with alarm -->
|
||||
<SwitchPreferenceCompat
|
||||
android:key="exit_at_alarm"
|
||||
android:title="@string/zen_mode_schedule_alarm_title"
|
||||
android:summary="@string/zen_mode_schedule_alarm_summary"
|
||||
android:order="99" />
|
||||
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user