diff options
179 files changed, 2428 insertions, 2290 deletions
diff --git a/Android.bp b/Android.bp index 2e669fe1e..a8271b54a 100644 --- a/Android.bp +++ b/Android.bp @@ -43,6 +43,7 @@ android_app { "androidx.appcompat_appcompat", "androidx.gridlayout_gridlayout", "androidx.recyclerview_recyclerview", + "androidx-constraintlayout_constraintlayout" ], required: [ "com.android.deskclock_whitelist" diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 1463515a3..1d45a9aec 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -22,7 +22,7 @@ <original-package android:name="com.android.alarmclock" /> <original-package android:name="com.android.deskclock" /> - <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="29" /> + <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="30" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> @@ -78,8 +78,7 @@ <activity android:name=".ringtone.RingtonePickerActivity" android:excludeFromRecents="true" - android:taskAffinity="" - android:theme="@style/Theme.DeskClock.RingtonePicker" /> + android:taskAffinity="" /> <activity android:name=".worldclock.CitySelectionActivity" diff --git a/res/animator-v22/caret_collapse_base_animation.xml b/res/animator-v22/caret_collapse_base_animation.xml deleted file mode 100644 index 45d0684c1..000000000 --- a/res/animator-v22/caret_collapse_base_animation.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@android:interpolator/fast_out_slow_in" - android:pathData="M 12.0,15.0 c 0.0,-1.0 0.0,-5.33333 0.0,-6.0" - android:propertyXName="translateX" - android:propertyYName="translateY" /> diff --git a/res/animator-v22/caret_collapse_l_animation.xml b/res/animator-v22/caret_collapse_l_animation.xml deleted file mode 100644 index a352f3cbd..000000000 --- a/res/animator-v22/caret_collapse_l_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@anim/caret_toclose_animation_interpolator_0" - android:propertyName="rotation" - android:valueFrom="45.0" - android:valueTo="-45.0" - android:valueType="floatType" /> diff --git a/res/animator-v22/caret_collapse_r_animation.xml b/res/animator-v22/caret_collapse_r_animation.xml deleted file mode 100644 index e6292e260..000000000 --- a/res/animator-v22/caret_collapse_r_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@anim/caret_toclose_animation_interpolator_0" - android:propertyName="rotation" - android:valueFrom="-45.0" - android:valueTo="45.0" - android:valueType="floatType" /> diff --git a/res/animator-v22/caret_expand_base_animation.xml b/res/animator-v22/caret_expand_base_animation.xml deleted file mode 100644 index 78753fece..000000000 --- a/res/animator-v22/caret_expand_base_animation.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@android:interpolator/fast_out_slow_in" - android:pathData="M 12.0,9.0 c 0.0,0.66667 0.0,5.0 0.0,6.0" - android:propertyXName="translateX" - android:propertyYName="translateY" /> diff --git a/res/animator-v22/caret_expand_l_animation.xml b/res/animator-v22/caret_expand_l_animation.xml deleted file mode 100644 index c6eb69445..000000000 --- a/res/animator-v22/caret_expand_l_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@anim/caret_toopen_animation_interpolator_0" - android:propertyName="rotation" - android:valueFrom="-45.0" - android:valueTo="45.0" - android:valueType="floatType" /> diff --git a/res/animator-v22/caret_expand_r_animation.xml b/res/animator-v22/caret_expand_r_animation.xml deleted file mode 100644 index d5273fd3b..000000000 --- a/res/animator-v22/caret_expand_r_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="300" - android:interpolator="@anim/caret_toopen_animation_interpolator_0" - android:propertyName="rotation" - android:valueFrom="45.0" - android:valueTo="-45.0" - android:valueType="floatType" />
\ No newline at end of file diff --git a/res/animator-v24/ic_pause_play_path_0_animation.xml b/res/animator-v24/ic_pause_play_path_0_animation.xml deleted file mode 100644 index 6218db246..000000000 --- a/res/animator-v24/ic_pause_play_path_0_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_pause_play_animation_interpolator_0" - android:propertyName="rotation" - android:valueFrom="0.0" - android:valueTo="90.0" - android:valueType="floatType" /> diff --git a/res/animator-v24/ic_pause_play_path_1_animation.xml b/res/animator-v24/ic_pause_play_path_1_animation.xml deleted file mode 100644 index 793a98783..000000000 --- a/res/animator-v24/ic_pause_play_path_1_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_pause_play_animation_interpolator_1" - android:propertyName="pathData" - android:valueFrom="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:valueTo="M 0.0,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 -14.0625,22.0625 -14.0625,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 0.0,-22.0625 0.0,-22.0625 Z" - android:valueType="pathType" /> diff --git a/res/animator-v24/ic_pause_play_path_2_animation.xml b/res/animator-v24/ic_pause_play_path_2_animation.xml deleted file mode 100644 index a6d777c1d..000000000 --- a/res/animator-v24/ic_pause_play_path_2_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_pause_play_animation_interpolator_1" - android:propertyName="pathData" - android:valueFrom="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:valueTo="M -15.9375,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 0.0,22.0625 0.0,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 -14.0625,-22.0625 -14.0625,-22.0625 Z" - android:valueType="pathType" /> diff --git a/res/animator-v24/ic_play_pause_path_0_animation.xml b/res/animator-v24/ic_play_pause_path_0_animation.xml deleted file mode 100644 index e7b52513b..000000000 --- a/res/animator-v24/ic_play_pause_path_0_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_play_pause_animation_interpolator_1" - android:propertyName="rotation" - android:valueFrom="90.0" - android:valueTo="180.0" - android:valueType="floatType" /> diff --git a/res/animator-v24/ic_play_pause_path_1_animation.xml b/res/animator-v24/ic_play_pause_path_1_animation.xml deleted file mode 100644 index 69dab8d4b..000000000 --- a/res/animator-v24/ic_play_pause_path_1_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_play_pause_animation_interpolator_0" - android:propertyName="pathData" - android:valueFrom="M 0.0,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 -14.0625,22.0625 -14.0625,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 0.0,-22.0625 0.0,-22.0625 Z" - android:valueTo="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:valueType="pathType" /> diff --git a/res/animator-v24/ic_play_pause_path_2_animation.xml b/res/animator-v24/ic_play_pause_path_2_animation.xml deleted file mode 100644 index 9ba8b1b70..000000000 --- a/res/animator-v24/ic_play_pause_path_2_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="250" - android:interpolator="@anim/ic_play_pause_animation_interpolator_0" - android:propertyName="pathData" - android:valueFrom="M -15.9375,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 0.0,22.0625 0.0,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 -14.0625,-22.0625 -14.0625,-22.0625 Z" - android:valueTo="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:valueType="pathType" /> diff --git a/res/animator-v24/ic_stop_play_ic_stop_play_path_0_animation.xml b/res/animator-v24/ic_stop_play_ic_stop_play_path_0_animation.xml deleted file mode 100644 index 48d617457..000000000 --- a/res/animator-v24/ic_stop_play_ic_stop_play_path_0_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="366" - android:interpolator="@android:interpolator/fast_out_slow_in" - android:propertyName="rotation" - android:valueFrom="0.0" - android:valueTo="90.0" - android:valueType="floatType" /> diff --git a/res/animator-v24/ic_stop_play_path_1_animation.xml b/res/animator-v24/ic_stop_play_path_1_animation.xml deleted file mode 100644 index 0b938ffeb..000000000 --- a/res/animator-v24/ic_stop_play_path_1_animation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<objectAnimator - xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="366" - android:interpolator="@anim/ic_stop_play_animation_interpolator_0" - android:propertyName="pathData" - android:valueFrom="M -6.0,-6.0 c 0.0,0.0 12.0,0.0 12.0,0.0 c 0.0,0.0 0.0,12.0 0.0,12.0 c 0.0,0.0 -12.0,0.0 -12.0,0.0 c 0.0,0.0 0.0,-12.0 0.0,-12.0 Z" - android:valueTo="M 0.0,-7.001953125 c 0.0,0.0 7.001953125,11.0009765625 7.001953125,11.0009765625 c 0.0,0.0 0.0,0.0009765625 0.0,0.0009765625 c 0.0,0.0 -14.001953125,0.0 -14.001953125,0.0 c 0.0,0.0 7.0,-11.001953125 7.0,-11.001953125 Z" - android:valueType="pathType" /> diff --git a/res/color/backspace_tint_color.xml b/res/color/switch_thumb_color.xml index f01ba2511..e43b1d8ab 100644 --- a/res/color/backspace_tint_color.xml +++ b/res/color/switch_thumb_color.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 The Android Open Source Project +<!-- Copyright (C) 2021 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. @@ -15,6 +15,12 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="true" android:color="@color/white" /> - <item android:color="@color/white_63p" /> -</selector>
\ No newline at end of file + <!-- Disabled status of thumb --> + <item android:state_enabled="false" + android:color="@color/thumb_disabled_color" /> + <!-- Toggle off status of thumb --> + <item android:state_checked="false" + android:color="@color/thumb_off_color" /> + <!-- Enabled or toggle on status of thumb --> + <item android:color="@color/state_on_color" /> +</selector> diff --git a/res/color/switch_track_color.xml b/res/color/switch_track_color.xml new file mode 100644 index 000000000..9a645d908 --- /dev/null +++ b/res/color/switch_track_color.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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"> + <!-- Disabled status of thumb --> + <item android:state_enabled="false" + android:color="@color/track_off_color" + android:alpha="?android:attr/disabledAlpha" /> + <!-- Toggle off status of thumb --> + <item android:state_checked="false" + android:color="@color/track_off_color" /> + <!-- Enabled or toggle on status of thumb --> + <item android:color="@color/track_on_color" /> +</selector> diff --git a/res/drawable-hdpi/alarm_background_expanded.9.png b/res/drawable-hdpi/alarm_background_expanded.9.png Binary files differdeleted file mode 100644 index f32e39d7b..000000000 --- a/res/drawable-hdpi/alarm_background_expanded.9.png +++ /dev/null diff --git a/res/drawable-hdpi/bg_day_selected.png b/res/drawable-hdpi/bg_day_selected.png Binary files differdeleted file mode 100644 index 5f0579c59..000000000 --- a/res/drawable-hdpi/bg_day_selected.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_alarm_off_white_24dp.png b/res/drawable-hdpi/ic_alarm_off_white_24dp.png Binary files differdeleted file mode 100644 index 2d7ff0aed..000000000 --- a/res/drawable-hdpi/ic_alarm_off_white_24dp.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_lap_white_24dp.png b/res/drawable-hdpi/ic_lap_white_24dp.png Binary files differdeleted file mode 100644 index e2b6a4dc7..000000000 --- a/res/drawable-hdpi/ic_lap_white_24dp.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_reset_white_24dp.png b/res/drawable-hdpi/ic_reset_white_24dp.png Binary files differdeleted file mode 100644 index 18b4075f3..000000000 --- a/res/drawable-hdpi/ic_reset_white_24dp.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_snooze_white_24dp.png b/res/drawable-hdpi/ic_snooze_white_24dp.png Binary files differdeleted file mode 100644 index e1c06b626..000000000 --- a/res/drawable-hdpi/ic_snooze_white_24dp.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_stop_white_24dp.png b/res/drawable-hdpi/ic_stop_white_24dp.png Binary files differdeleted file mode 100644 index dfff26cee..000000000 --- a/res/drawable-hdpi/ic_stop_white_24dp.png +++ /dev/null diff --git a/res/drawable-ldrtl/ic_label.xml b/res/drawable-ldrtl/ic_label.xml deleted file mode 100644 index a62018ea5..000000000 --- a/res/drawable-ldrtl/ic_label.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <group - android:pivotX="12" - android:scaleX="-1"> - <path - android:fillColor="@android:color/white" - android:pathData="M16,17H5V7H16L19.55,12M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z" /> - </group> -</vector> diff --git a/res/drawable-mdpi/alarm_background_expanded.9.png b/res/drawable-mdpi/alarm_background_expanded.9.png Binary files differdeleted file mode 100644 index 645471fd6..000000000 --- a/res/drawable-mdpi/alarm_background_expanded.9.png +++ /dev/null diff --git a/res/drawable-mdpi/bg_day_selected.png b/res/drawable-mdpi/bg_day_selected.png Binary files differdeleted file mode 100644 index f031f18ef..000000000 --- a/res/drawable-mdpi/bg_day_selected.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_alarm_off_white_24dp.png b/res/drawable-mdpi/ic_alarm_off_white_24dp.png Binary files differdeleted file mode 100644 index fa37e9ded..000000000 --- a/res/drawable-mdpi/ic_alarm_off_white_24dp.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_lap_white_24dp.png b/res/drawable-mdpi/ic_lap_white_24dp.png Binary files differdeleted file mode 100644 index 6a347e7ef..000000000 --- a/res/drawable-mdpi/ic_lap_white_24dp.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_reset_white_24dp.png b/res/drawable-mdpi/ic_reset_white_24dp.png Binary files differdeleted file mode 100644 index 982662265..000000000 --- a/res/drawable-mdpi/ic_reset_white_24dp.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_snooze_white_24dp.png b/res/drawable-mdpi/ic_snooze_white_24dp.png Binary files differdeleted file mode 100644 index 249722874..000000000 --- a/res/drawable-mdpi/ic_snooze_white_24dp.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_stop_white_24dp.png b/res/drawable-mdpi/ic_stop_white_24dp.png Binary files differdeleted file mode 100644 index b84d2f6c1..000000000 --- a/res/drawable-mdpi/ic_stop_white_24dp.png +++ /dev/null diff --git a/res/drawable-v21/bg_day_button_animatable.xml b/res/drawable-v21/bg_day_button_animatable.xml deleted file mode 100644 index 5f34ac8fc..000000000 --- a/res/drawable-v21/bg_day_button_animatable.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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:name="day_button_circle_vector" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24" - android:viewportWidth="24"> - <group - android:name="day_button_circle_animate" - android:alpha="1.0" - android:pivotX="0.0" - android:pivotY="0.0" - android:translateX="12" - android:translateY="12"> - <path - android:name="path" - android:fillColor="#FFFFFFFF" - android:pathData="M 0.0,8.0 c -4.41999816895,0.0 -8.0,-3.58200073242 -8.0,-8.0 c 0.0,-4.41799926758 3.58000183105,-8.0 8.0,-8.0 c 4.41999816895,0.0 8.0,3.58200073242 8.0,8.0 c 0.0,4.41799926758 -3.58000183105,8.0 -8.0,8.0 Z"/> - </group> -</vector>
\ No newline at end of file diff --git a/res/drawable-v21/bg_day_button_checked_to_unchecked_anim.xml b/res/drawable-v21/bg_day_button_checked_to_unchecked_anim.xml deleted file mode 100644 index 8ffcb462b..000000000 --- a/res/drawable-v21/bg_day_button_checked_to_unchecked_anim.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. - --> -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/bg_day_button_animatable"> - <target - android:name="day_button_circle_animate" - android:animation="@animator/day_button_unchecked_animation" /> - <target - android:name="day_button_circle_vector" - android:animation="@animator/day_button_unchecked_alpha_animation" /> -</animated-vector>
\ No newline at end of file diff --git a/res/drawable-v21/bg_day_button_transparent.xml b/res/drawable-v21/bg_day_button_transparent.xml deleted file mode 100644 index 42001c4f0..000000000 --- a/res/drawable-v21/bg_day_button_transparent.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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:name="day_button_circle_vector" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <group - android:name="day_button_circle_transparent" - android:alpha="0.0" - android:translateX="12" - android:translateY="12"> - <path - android:name="path" - android:fillColor="#00FFFFFF" - android:pathData="M 0.0,8.0 c -4.41999816895,0.0 -8.0,-3.58200073242 -8.0,-8.0 c 0.0,-4.41799926758 3.58000183105,-8.0 8.0,-8.0 c 4.41999816895,0.0 8.0,3.58200073242 8.0,8.0 c 0.0,4.41799926758 -3.58000183105,8.0 -8.0,8.0 Z"/> - </group> -</vector>
\ No newline at end of file diff --git a/res/drawable-v21/bg_day_button_unchecked_to_checked_anim.xml b/res/drawable-v21/bg_day_button_unchecked_to_checked_anim.xml deleted file mode 100644 index 0bca97e86..000000000 --- a/res/drawable-v21/bg_day_button_unchecked_to_checked_anim.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. - --> -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/bg_day_button_animatable"> - <target - android:name="day_button_circle_animate" - android:animation="@animator/day_button_checked_animation" /> - <target - android:name="day_button_circle_vector" - android:animation="@animator/day_button_checked_alpha_animation" /> -</animated-vector>
\ No newline at end of file diff --git a/res/drawable-v21/bg_day_button_white.xml b/res/drawable-v21/bg_day_button_white.xml deleted file mode 100644 index 1ebfd57e2..000000000 --- a/res/drawable-v21/bg_day_button_white.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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:name="day_button_circle_vector" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24" - android:viewportWidth="24"> - <group - android:name="day_button_circle_white" - android:alpha="1.0" - android:translateX="12" - android:translateY="12"> - <path - android:name="path" - android:fillColor="#FFFFFFFF" - android:pathData="M 0.0,8.0 c -4.41999816895,0.0 -8.0,-3.58200073242 -8.0,-8.0 c 0.0,-4.41799926758 3.58000183105,-8.0 8.0,-8.0 c 4.41999816895,0.0 8.0,3.58200073242 8.0,8.0 c 0.0,4.41799926758 -3.58000183105,8.0 -8.0,8.0 Z"/> - </group> -</vector>
\ No newline at end of file diff --git a/res/drawable-v21/ic_alarm_off_24dp.xml b/res/drawable-v21/ic_alarm_off_24dp.xml deleted file mode 100644 index 24e0b5f54..000000000 --- a/res/drawable-v21/ic_alarm_off_24dp.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_alarm_off_white_24dp" - android:tint="@color/clock_gray" /> diff --git a/res/drawable-v21/ic_reset_24dp.xml b/res/drawable-v21/ic_reset_24dp.xml deleted file mode 100644 index b88c04fa4..000000000 --- a/res/drawable-v21/ic_reset_24dp.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_reset_white_24dp" - android:tint="@color/black_54p" /> diff --git a/res/drawable-v21/ic_snooze_24dp.xml b/res/drawable-v21/ic_snooze_24dp.xml deleted file mode 100644 index 1968c6d7d..000000000 --- a/res/drawable-v21/ic_snooze_24dp.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_snooze_white_24dp" - android:tint="@color/black_54p" />
\ No newline at end of file diff --git a/res/drawable-v21/ic_sw_lap_24dp.xml b/res/drawable-v21/ic_sw_lap_24dp.xml deleted file mode 100644 index 25b0e5095..000000000 --- a/res/drawable-v21/ic_sw_lap_24dp.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_lap_white_24dp" - android:tint="@color/black_54p" /> diff --git a/res/drawable-v21/toggle_circle.xml b/res/drawable-v21/toggle_circle.xml deleted file mode 100644 index ed6a72e59..000000000 --- a/res/drawable-v21/toggle_circle.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2015 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 - --> -<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/checked" - android:drawable="@drawable/bg_day_button_white" - android:state_checked="true" /> - <item - android:id="@+id/unchecked" - android:drawable="@drawable/bg_day_button_transparent" /> - <transition - android:drawable="@drawable/bg_day_button_unchecked_to_checked_anim" - android:fromId="@+id/unchecked" - android:toId="@+id/checked" /> - <transition - android:drawable="@drawable/bg_day_button_checked_to_unchecked_anim" - android:fromId="@+id/checked" - android:toId="@+id/unchecked" /> -</animated-selector>
\ No newline at end of file diff --git a/res/drawable-v22/ic_caret_down_animation.xml b/res/drawable-v22/ic_caret_down_animation.xml deleted file mode 100644 index 9944de56c..000000000 --- a/res/drawable-v22/ic_caret_down_animation.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/ic_caret_down_static"> - <target - android:name="caret01" - android:animation="@animator/caret_expand_base_animation" /> - <target - android:name="caret_l" - android:animation="@animator/caret_expand_l_animation" /> - <target - android:name="caret_r" - android:animation="@animator/caret_expand_r_animation" /> -</animated-vector> diff --git a/res/drawable-v22/ic_caret_up_animation.xml b/res/drawable-v22/ic_caret_up_animation.xml deleted file mode 100644 index f00f5662d..000000000 --- a/res/drawable-v22/ic_caret_up_animation.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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. ---> -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/ic_caret_up_static"> - <target - android:name="caret02" - android:animation="@animator/caret_collapse_base_animation" /> - <target - android:name="caret02_l" - android:animation="@animator/caret_collapse_l_animation" /> - <target - android:name="caret02_r" - android:animation="@animator/caret_collapse_r_animation" /> -</animated-vector> diff --git a/res/drawable-v24/ic_pause_play_animation.xml b/res/drawable-v24/ic_pause_play_animation.xml deleted file mode 100644 index 1c6b93830..000000000 --- a/res/drawable-v24/ic_pause_play_animation.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/ic_play_pause"> - <target - android:name="path_0" - android:animation="@animator/ic_pause_play_path_0_animation" /> - <target - android:name="path_1" - android:animation="@animator/ic_pause_play_path_1_animation" /> - <target - android:name="path_2" - android:animation="@animator/ic_pause_play_path_2_animation" /> -</animated-vector>
\ No newline at end of file diff --git a/res/drawable-v24/ic_play_pause_animation.xml b/res/drawable-v24/ic_play_pause_animation.xml deleted file mode 100644 index 42eebe000..000000000 --- a/res/drawable-v24/ic_play_pause_animation.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/ic_pause_play"> - <target - android:name="path_0" - android:animation="@animator/ic_play_pause_path_0_animation" /> - <target - android:name="path_1" - android:animation="@animator/ic_play_pause_path_1_animation" /> - <target - android:name="path_2" - android:animation="@animator/ic_play_pause_path_2_animation" /> -</animated-vector>
\ No newline at end of file diff --git a/res/drawable-v24/ic_stop_play_animation.xml b/res/drawable-v24/ic_stop_play_animation.xml deleted file mode 100644 index 96b2842b4..000000000 --- a/res/drawable-v24/ic_stop_play_animation.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 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. ---> - -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/ic_stop_play"> - <target - android:name="path_0" - android:animation="@animator/ic_stop_play_ic_stop_play_path_0_animation" /> - <target - android:name="path_1" - android:animation="@animator/ic_stop_play_path_1_animation" /> -</animated-vector> diff --git a/res/drawable-xhdpi/alarm_background_expanded.9.png b/res/drawable-xhdpi/alarm_background_expanded.9.png Binary files differdeleted file mode 100644 index 9b6551e6c..000000000 --- a/res/drawable-xhdpi/alarm_background_expanded.9.png +++ /dev/null diff --git a/res/drawable-xhdpi/bg_day_selected.png b/res/drawable-xhdpi/bg_day_selected.png Binary files differdeleted file mode 100644 index 9df40ee4b..000000000 --- a/res/drawable-xhdpi/bg_day_selected.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_alarm_off_white_24dp.png b/res/drawable-xhdpi/ic_alarm_off_white_24dp.png Binary files differdeleted file mode 100644 index c229b487d..000000000 --- a/res/drawable-xhdpi/ic_alarm_off_white_24dp.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_lap_white_24dp.png b/res/drawable-xhdpi/ic_lap_white_24dp.png Binary files differdeleted file mode 100644 index f0e6de506..000000000 --- a/res/drawable-xhdpi/ic_lap_white_24dp.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_reset_white_24dp.png b/res/drawable-xhdpi/ic_reset_white_24dp.png Binary files differdeleted file mode 100644 index 75683fa55..000000000 --- a/res/drawable-xhdpi/ic_reset_white_24dp.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_snooze_white_24dp.png b/res/drawable-xhdpi/ic_snooze_white_24dp.png Binary files differdeleted file mode 100644 index deb35130e..000000000 --- a/res/drawable-xhdpi/ic_snooze_white_24dp.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_stop_white_24dp.png b/res/drawable-xhdpi/ic_stop_white_24dp.png Binary files differdeleted file mode 100644 index 3ad2c9c4e..000000000 --- a/res/drawable-xhdpi/ic_stop_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxhdpi/alarm_background_expanded.9.png b/res/drawable-xxhdpi/alarm_background_expanded.9.png Binary files differdeleted file mode 100644 index dae60b43c..000000000 --- a/res/drawable-xxhdpi/alarm_background_expanded.9.png +++ /dev/null diff --git a/res/drawable-xxhdpi/bg_day_selected.png b/res/drawable-xxhdpi/bg_day_selected.png Binary files differdeleted file mode 100644 index 2653570d9..000000000 --- a/res/drawable-xxhdpi/bg_day_selected.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_alarm_off_white_24dp.png b/res/drawable-xxhdpi/ic_alarm_off_white_24dp.png Binary files differdeleted file mode 100644 index 2b3f401bc..000000000 --- a/res/drawable-xxhdpi/ic_alarm_off_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_lap_white_24dp.png b/res/drawable-xxhdpi/ic_lap_white_24dp.png Binary files differdeleted file mode 100644 index 048c76f6f..000000000 --- a/res/drawable-xxhdpi/ic_lap_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_reset_white_24dp.png b/res/drawable-xxhdpi/ic_reset_white_24dp.png Binary files differdeleted file mode 100644 index b20fcda6a..000000000 --- a/res/drawable-xxhdpi/ic_reset_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_snooze_white_24dp.png b/res/drawable-xxhdpi/ic_snooze_white_24dp.png Binary files differdeleted file mode 100644 index eed45c36a..000000000 --- a/res/drawable-xxhdpi/ic_snooze_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_stop_white_24dp.png b/res/drawable-xxhdpi/ic_stop_white_24dp.png Binary files differdeleted file mode 100644 index 801d34111..000000000 --- a/res/drawable-xxhdpi/ic_stop_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/alarm_background_expanded.9.png b/res/drawable-xxxhdpi/alarm_background_expanded.9.png Binary files differdeleted file mode 100644 index ec1ce5035..000000000 --- a/res/drawable-xxxhdpi/alarm_background_expanded.9.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/bg_day_selected.png b/res/drawable-xxxhdpi/bg_day_selected.png Binary files differdeleted file mode 100644 index e8b7cfe5f..000000000 --- a/res/drawable-xxxhdpi/bg_day_selected.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/ic_alarm_off_white_24dp.png b/res/drawable-xxxhdpi/ic_alarm_off_white_24dp.png Binary files differdeleted file mode 100644 index e824dda41..000000000 --- a/res/drawable-xxxhdpi/ic_alarm_off_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/ic_lap_white_24dp.png b/res/drawable-xxxhdpi/ic_lap_white_24dp.png Binary files differdeleted file mode 100644 index 8b6e32379..000000000 --- a/res/drawable-xxxhdpi/ic_lap_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/ic_reset_white_24dp.png b/res/drawable-xxxhdpi/ic_reset_white_24dp.png Binary files differdeleted file mode 100644 index b3ff489b4..000000000 --- a/res/drawable-xxxhdpi/ic_reset_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/ic_snooze_white_24dp.png b/res/drawable-xxxhdpi/ic_snooze_white_24dp.png Binary files differdeleted file mode 100644 index a7b4ff199..000000000 --- a/res/drawable-xxxhdpi/ic_snooze_white_24dp.png +++ /dev/null diff --git a/res/drawable-xxxhdpi/ic_stop_white_24dp.png b/res/drawable-xxxhdpi/ic_stop_white_24dp.png Binary files differdeleted file mode 100644 index 523933667..000000000 --- a/res/drawable-xxxhdpi/ic_stop_white_24dp.png +++ /dev/null diff --git a/res/drawable/alarm_background.xml b/res/drawable/alarm_background.xml new file mode 100644 index 000000000..7b0bdf28e --- /dev/null +++ b/res/drawable/alarm_background.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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. + --> + +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + + <solid android:color="@color/default_background_lighter" /> + <corners android:radius="28dp" /> +</shape> diff --git a/res/drawable/bg_day_selected.xml b/res/drawable/bg_day_selected.xml new file mode 100644 index 000000000..f4661c42d --- /dev/null +++ b/res/drawable/bg_day_selected.xml @@ -0,0 +1,12 @@ +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:top="8dp" + android:left="8dp" + android:right="8dp" + android:bottom="8dp"> + <shape android:shape="oval" > + <size android:height="20dp" android:width="20dp" /> + <solid android:color="@color/accent_color" /> + </shape> + </item> +</layer-list> diff --git a/res/drawable/bg_day_unselected.xml b/res/drawable/bg_day_unselected.xml new file mode 100644 index 000000000..71f51f252 --- /dev/null +++ b/res/drawable/bg_day_unselected.xml @@ -0,0 +1,12 @@ +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:top="8dp" + android:left="8dp" + android:right="8dp" + android:bottom="8dp"> + <shape android:shape="oval" > + <size android:height="20dp" android:width="20dp" /> + <stroke android:width="1dp" android:color="@color/system_neutral2_300" /> + </shape> + </item> +</layer-list> diff --git a/res/drawable/digit_background.xml b/res/drawable/digit_background.xml new file mode 100644 index 000000000..95d91de47 --- /dev/null +++ b/res/drawable/digit_background.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="oval"> + + <solid android:color="@color/default_background_lighter" /> +</shape> diff --git a/res/drawable/ic_alarm_off_24dp.xml b/res/drawable/ic_alarm_off_24dp.xml index 663b16c4e..c9cf4edad 100644 --- a/res/drawable/ic_alarm_off_24dp.xml +++ b/res/drawable/ic_alarm_off_24dp.xml @@ -1,3 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_alarm_off_white_24dp" /> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFF" + android:pathData="M8,3.28L6.6,1.86L5.74,2.57L7.16,4M16.47,18.39C15.26,19.39 13.7,20 12,20A7,7 0 0,1 5,13C5,11.3 5.61,9.74 6.61,8.53M2.92,2.29L1.65,3.57L3,4.9L1.87,5.83L3.29,7.25L4.4,6.31L5.2,7.11C3.83,8.69 3,10.75 3,13A9,9 0 0,0 12,22C14.25,22 16.31,21.17 17.89,19.8L20.09,22L21.36,20.73L3.89,3.27L2.92,2.29M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72M12,6A7,7 0 0,1 19,13C19,13.84 18.84,14.65 18.57,15.4L20.09,16.92C20.67,15.73 21,14.41 21,13A9,9 0 0,0 12,4C10.59,4 9.27,4.33 8.08,4.91L9.6,6.43C10.35,6.16 11.16,6 12,6Z" /> +</vector> diff --git a/res/drawable/ic_backspace.xml b/res/drawable/ic_backspace.xml deleted file mode 100644 index 1adc2d3c5..000000000 --- a/res/drawable/ic_backspace.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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="@dimen/backspace_icon_size" - android:height="@dimen/backspace_icon_size" - android:tint="?attr/colorControlNormal" - android:tintMode="src_in" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <path - android:fillColor="@android:color/white" - android:pathData="M9,15.59L12.59,12L9,8.41L10.41,7L14,10.59L17.59,7L19,8.41L15.41,12L19,15.59L17.59,17L14,13.41L10.41,17L9,15.59zM21,6H8l-4.5,6L8,18h13V6M21,4c1.1,0 2,0.9 2,2v12c0,1.1 -0.9,2 -2,2H8c-0.63,0 -1.22,-0.3 -1.6,-0.8L1,12l5.4,-7.2C6.78,4.3 7.37,4 8,4H21L21,4z" /> -</vector> diff --git a/res/drawable/ic_caret_down.xml b/res/drawable/ic_caret_down.xml new file mode 100644 index 000000000..e802999d0 --- /dev/null +++ b/res/drawable/ic_caret_down.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2016 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="8dp" + android:left="8dp" + android:right="8dp" + android:bottom="8dp"> + <shape android:shape="oval" > + <size android:height="20dp" android:width="20dp" /> + <solid android:color="@color/system_neutral2_500" /> + </shape> + </item> + <item> + <vector + android:name="caret_toclose" + android:width="24dp" + android:height="24dp" + android:viewportHeight="32.0" + android:viewportWidth="32.0"> + <group + android:name="caret01" + android:rotation="90" + android:translateX="16" + android:translateY="19"> + <group + android:name="caret_l" + android:rotation="45"> + <group + android:name="caret_l_pivot" + android:translateY="4"> + <group + android:name="caret_l_rect_position" + android:translateY="-1"> + <path + android:name="caret_l_rect" + android:fillColor="#FFFFFFFF" + android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> + </group> + </group> + </group> + <group + android:name="caret_r" + android:rotation="-45"> + <group + android:name="caret_r_pivot" + android:translateY="-4"> + <group + android:name="caret_r_rect_position" + android:translateY="1"> + <path + android:name="caret_r_rect" + android:fillColor="#FFFFFFFF" + android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> + </group> + </group> + </group> + </group> + </vector> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/ic_caret_down_static.xml b/res/drawable/ic_caret_down_static.xml deleted file mode 100644 index c61c85c5d..000000000 --- a/res/drawable/ic_caret_down_static.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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:name="caret_toclose" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <group - android:name="caret01" - android:rotation="90" - android:translateX="12" - android:translateY="15"> - <group - android:name="caret_l" - android:rotation="45"> - <group - android:name="caret_l_pivot" - android:translateY="4"> - <group - android:name="caret_l_rect_position" - android:translateY="-1"> - <path - android:name="caret_l_rect" - android:fillColor="#FFFFFFFF" - android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> - </group> - </group> - </group> - <group - android:name="caret_r" - android:rotation="-45"> - <group - android:name="caret_r_pivot" - android:translateY="-4"> - <group - android:name="caret_r_rect_position" - android:translateY="1"> - <path - android:name="caret_r_rect" - android:fillColor="#FFFFFFFF" - android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> - </group> - </group> - </group> - </group> -</vector> diff --git a/res/drawable/ic_caret_up.xml b/res/drawable/ic_caret_up.xml new file mode 100644 index 000000000..d0ad7eed7 --- /dev/null +++ b/res/drawable/ic_caret_up.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2016 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="8dp" + android:left="8dp" + android:right="8dp" + android:bottom="8dp"> + <shape android:shape="oval" > + <size android:height="20dp" android:width="20dp" /> + <solid android:color="@color/system_neutral2_500" /> + </shape> + </item> + <item> + <vector + android:name="caret_up" + android:width="24dp" + android:height="24dp" + android:viewportHeight="32.0" + android:viewportWidth="32.0"> + <group + android:name="caret02" + android:rotation="90" + android:translateX="16" + android:translateY="13"> + <group + android:name="caret02_l" + android:rotation="-45"> + <group + android:name="caret02_l_pivot" + android:translateY="4"> + <group + android:name="caret02_l_rect_position" + android:translateY="-1"> + <path + android:name="caret02_l_rect" + android:fillColor="#FFFFFFFF" + android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> + </group> + </group> + </group> + <group + android:name="caret02_r" + android:rotation="45"> + <group + android:name="caret02_r_pivot" + android:translateY="-4"> + <group + android:name="caret02_r_rect_position" + android:translateY="1"> + <path + android:name="caret02_r_rect" + android:fillColor="#FFFFFFFF" + android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> + </group> + </group> + </group> + </group> + </vector> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/ic_caret_up_static.xml b/res/drawable/ic_caret_up_static.xml deleted file mode 100644 index 8eaa80e23..000000000 --- a/res/drawable/ic_caret_up_static.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2016 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:name="caret_up" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <group - android:name="caret02" - android:rotation="90" - android:translateX="12" - android:translateY="9"> - <group - android:name="caret02_l" - android:rotation="-45"> - <group - android:name="caret02_l_pivot" - android:translateY="4"> - <group - android:name="caret02_l_rect_position" - android:translateY="-1"> - <path - android:name="caret02_l_rect" - android:fillColor="#FFFFFFFF" - android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> - </group> - </group> - </group> - <group - android:name="caret02_r" - android:rotation="45"> - <group - android:name="caret02_r_pivot" - android:translateY="-4"> - <group - android:name="caret02_r_rect_position" - android:translateY="1"> - <path - android:name="caret02_r_rect" - android:fillColor="#FFFFFFFF" - android:pathData="M -1.0,-4.0 l 2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -2.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-8.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"/> - </group> - </group> - </group> - </group> -</vector> diff --git a/res/drawable/ic_delete.xml b/res/drawable/ic_delete.xml new file mode 100644 index 000000000..4d42af512 --- /dev/null +++ b/res/drawable/ic_delete.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /> +</vector> diff --git a/res/drawable/ic_pause_24dp.xml b/res/drawable/ic_pause_24dp.xml deleted file mode 100644 index 15bbcddab..000000000 --- a/res/drawable/ic_pause_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <path - android:fillColor="@android:color/black" - android:pathData="M19,19h-6L13,5h6v14zM15,17h2L17,7h-2v10zM11,19L5,19L5,5h6v14zM7,17h2L9,7L7,7v10z" /> -</vector> diff --git a/res/drawable/ic_pause_play.xml b/res/drawable/ic_pause_play.xml index 52a1f39e6..de9161710 100644 --- a/res/drawable/ic_pause_play.xml +++ b/res/drawable/ic_pause_play.xml @@ -32,9 +32,9 @@ android:name="shape_1"> <path android:name="path_1" - android:fillColor="#FFFFFFFF" + android:fillColor="#FF000000" android:pathData="M 0.0,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 -14.0625,22.0625 -14.0625,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 0.0,-22.0625 0.0,-22.0625 Z" - android:strokeColor="#FFFFFFFF" + android:strokeColor="#FF000000" android:strokeWidth="0" /> </group> </group> @@ -48,9 +48,9 @@ android:name="shape_2"> <path android:name="path_2" - android:fillColor="#FFFFFFFF" + android:fillColor="#FF000000" android:pathData="M -15.9375,-14.0625 c 0.0,0.0 0.0,0.0 0.0,0.0 c 0.0,0.0 0.0,22.0625 0.0,22.0625 c 0.0,0.0 14.0625,0.0 14.0625,0.0 c 0.0,0.0 -14.0625,-22.0625 -14.0625,-22.0625 Z" - android:strokeColor="#FFFFFFFF" + android:strokeColor="#FF000000" android:strokeWidth="0" /> </group> </group> diff --git a/res/drawable/ic_play_pause.xml b/res/drawable/ic_play_pause.xml index 437ca9275..a22c8ce6f 100644 --- a/res/drawable/ic_play_pause.xml +++ b/res/drawable/ic_play_pause.xml @@ -31,9 +31,9 @@ android:name="shape_1"> <path android:name="path_1" - android:fillColor="#FFFFFFFF" + android:fillColor="#FF000000" android:pathData="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:strokeColor="#FFFFFFFF" + android:strokeColor="#FF000000" android:strokeWidth="0" /> </group> </group> @@ -47,9 +47,9 @@ android:name="shape_2"> <path android:name="path_2" - android:fillColor="#FFFFFFFF" + android:fillColor="#FF000000" android:pathData="M -3.9375,-14.0625 c 0.0,0.0 -8.0625,0.0 -8.0625,0.0 c 0.0,0.0 0.0,28.125 0.0,28.125 c 0.0,0.0 8.0625,0.0 8.0625,0.0 c 0.0,0.0 0.0,-28.125 0.0,-28.125 Z" - android:strokeColor="#FFFFFFFF" + android:strokeColor="#FF000000" android:strokeWidth="0" /> </group> </group> diff --git a/res/drawable/ic_reset_24dp.xml b/res/drawable/ic_reset_24dp.xml deleted file mode 100644 index 3a301cd3e..000000000 --- a/res/drawable/ic_reset_24dp.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_reset_white_24dp" /> diff --git a/res/drawable/ic_share.xml b/res/drawable/ic_share.xml new file mode 100644 index 000000000..1bcf37988 --- /dev/null +++ b/res/drawable/ic_share.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" /> +</vector> diff --git a/res/drawable/ic_snooze_24dp.xml b/res/drawable/ic_snooze_24dp.xml deleted file mode 100644 index 17d95fe0b..000000000 --- a/res/drawable/ic_snooze_24dp.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_snooze_white_24dp" />
\ No newline at end of file diff --git a/res/drawable/ic_start_24dp.xml b/res/drawable/ic_start_24dp.xml deleted file mode 100644 index 96e0449b2..000000000 --- a/res/drawable/ic_start_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <path - android:fillColor="@android:color/black" - android:pathData="M8.5,8.64L13.77,12L8.5,15.36V8.64M6.5,5V19L17.5,12" /> -</vector> diff --git a/res/drawable/ic_stop_24dp.xml b/res/drawable/ic_stop_24dp.xml deleted file mode 100644 index 4d9c9d41e..000000000 --- a/res/drawable/ic_stop_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportHeight="24.0" - android:viewportWidth="24.0"> - <path - android:fillColor="@android:color/black" - android:pathData="M16,8v8H8V8h8m2-2H6v12h12V6z" /> -</vector> diff --git a/res/drawable/ic_stop_play.xml b/res/drawable/ic_stop_play.xml index 662edf464..9f9253856 100644 --- a/res/drawable/ic_stop_play.xml +++ b/res/drawable/ic_stop_play.xml @@ -35,7 +35,7 @@ android:translateY="12"> <path android:name="path_1" - android:fillColor="#FFFFFFFF" + android:fillColor="#FF000000" android:pathData="M -6.0,-6.0 c 0.0,0.0 12.0,0.0 12.0,0.0 c 0.0,0.0 0.0,12.0 0.0,12.0 c 0.0,0.0 -12.0,0.0 -12.0,0.0 c 0.0,0.0 0.0,-12.0 0.0,-12.0 Z" /> </group> </group> diff --git a/res/drawable/ic_stopwatch_black.xml b/res/drawable/ic_stopwatch_black.xml new file mode 100644 index 000000000..e0438c9ea --- /dev/null +++ b/res/drawable/ic_stopwatch_black.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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:height="24dp" + android:width="24dp" + android:viewportHeight="24" + android:viewportWidth="24" > + <group + android:name="timer" + android:translateX="12" + android:translateY="12" > + <group + android:name="timer_pivot" + android:translateX="-12" + android:translateY="-12" > + <group + android:name="timer_body" > + <path + android:name="timer_interior_path" + android:pathData="M 19.0269927979,7.40730285645 c 0.0,0.0 1.42401123047,-1.42399597168 1.42401123047,-1.42399597168 c -0.428009033203,-0.513000488281 -0.902008056641,-0.98600769043 -1.41500854492,-1.41400146484 c 0.0,0.0 -1.4229888916,1.42399597168 -1.4229888916,1.42399597168 c -1.54000854492,-1.23199462891 -3.49101257324,-1.97300720215 -5.61801147461,-1.97300720215 c -4.97399902344,0.0 -8.99499511719,4.0299987793 -8.99499511719,9.0 c 0,4.9700012207 4.02099609375,9.0 8.99499511719,9.0 c 4.97399902344,0.0 9.00500488281,-4.0299987793 9.00500488281,-9.0 c 0,-2.125 -0.740997314453,-4.07398986816 -1.97300720215,-5.61299133301 Z M 12,20.0202941895 c -3.86700439453,0.0 -7,-3.13398742676 -7,-7.0 c 0,-3.86599731445 3.13299560547,-7.0 7,-7.0 c 3.86700439453,0.0 7,3.13400268555 7,7.0 c 0,3.86601257324 -3.13299560547,7.0 -7,7.0 Z" + android:fillColor="#FF000000" + android:fillAlpha="1" /> + </group> + </group> + </group> + <group + android:name="hand" + android:translateX="11.96875" + android:translateY="13.17188" > + <group + android:name="hand_pivot" + android:translateX="-12" + android:translateY="-13.17188" > + <path + android:name="hand_path" + android:pathData="M 11,14.0200042725 c 0,0.0 2,0.0 2,0.0 c 0,0.0 0,-6.0 0,-6.0 c 0,0.0 -2,0.0 -2,0.0 c 0,0.0 0,6.0 0,6.0 Z" + android:fillColor="#FF000000" + android:fillAlpha="1" /> + </group> + </group> + <group + android:name="button" + android:translateX="12" + android:translateY="12" > + <group + android:name="button_pivot" + android:translateX="-12" + android:translateY="-12" > + <path + android:name="button_path" + android:pathData="M 15,1.02000427246 c 0,0.0 -6,0.0 -6,0.0 c 0,0.0 0,2.0 0,2.0 c 0,0.0 6,0.0 6,0.0 c 0,0.0 0,-2.0 0,-2.0 Z" + android:fillColor="#FF000000" + android:fillAlpha="1" /> + </group> + </group> +</vector> diff --git a/res/drawable/ic_sw_lap_24dp.xml b/res/drawable/ic_sw_lap_24dp.xml deleted file mode 100644 index 84ada73c6..000000000 --- a/res/drawable/ic_sw_lap_24dp.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/ic_lap_white_24dp" /> diff --git a/res/drawable/ic_vibrate.xml b/res/drawable/ic_vibrate.xml new file mode 100644 index 000000000..da69e4dfe --- /dev/null +++ b/res/drawable/ic_vibrate.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFF" + android:pathData="M16,19H8V5H16M16.5,3H7.5A1.5,1.5 0 0,0 6,4.5V19.5A1.5,1.5 0 0,0 7.5,21H16.5A1.5,1.5 0 0,0 18,19.5V4.5A1.5,1.5 0 0,0 16.5,3M19,17H21V7H19M22,9V15H24V9M3,17H5V7H3M0,15H2V9H0V15Z" /> +</vector> diff --git a/res/drawable/popup_background.xml b/res/drawable/popup_background.xml new file mode 100644 index 000000000..66ef3597c --- /dev/null +++ b/res/drawable/popup_background.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + + <corners android:radius="28dp" /> + <solid android:color="@color/system_neutral2_700" /> +</shape> diff --git a/res/drawable/popup_background_selected.xml b/res/drawable/popup_background_selected.xml new file mode 100644 index 000000000..3d26ef9b1 --- /dev/null +++ b/res/drawable/popup_background_selected.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <corners + android:topLeftRadius="28dp" + android:topRightRadius="28dp"/> + <solid android:color="@color/accent_color" /> +</shape> diff --git a/res/drawable/selector_checkbox_checked.xml b/res/drawable/selector_checkbox_checked.xml new file mode 100644 index 000000000..b0aefb570 --- /dev/null +++ b/res/drawable/selector_checkbox_checked.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24.0dip" + android:height="24.0dip" + android:tint="?colorAccent" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#ff000000" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-4,-4 1.4,-1.4 2.6,2.6 6.6,-6.6L18,9l-8,8z" /> +</vector> diff --git a/res/drawable/selector_checkbox_material.xml b/res/drawable/selector_checkbox_material.xml new file mode 100644 index 000000000..4aaf36c1a --- /dev/null +++ b/res/drawable/selector_checkbox_material.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector + xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="false" android:drawable="@drawable/selector_checkbox_unchecked" /> + <item android:state_checked="true" android:drawable="@drawable/selector_checkbox_checked" /> +</selector> diff --git a/res/drawable/selector_checkbox_unchecked.xml b/res/drawable/selector_checkbox_unchecked.xml new file mode 100644 index 000000000..a411f2201 --- /dev/null +++ b/res/drawable/selector_checkbox_unchecked.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector android:tint="?colorControlNormal" android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0" + xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z" /> +</vector> diff --git a/res/anim-v22/caret_toopen_animation_interpolator_0.xml b/res/drawable/switch_thumb.xml index bce86f73b..4ff649cd9 100644 --- a/res/anim-v22/caret_toopen_animation_interpolator_0.xml +++ b/res/drawable/switch_thumb.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2016 The Android Open Source Project + Copyright (C) 2021 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. @@ -14,6 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. --> -<pathInterpolator - xmlns:android="http://schemas.android.com/apk/res/android" - android:pathData="M 0.0,0.0 c 0.0001,0.0 0.0,1.0 1.0,1.0" /> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:top="4dp" + android:left="4dp" + android:right="4dp" + android:bottom="4dp"> + <shape android:shape="oval" > + <size android:height="20dp" android:width="20dp" /> + <solid android:color="@color/switch_thumb_color" /> + </shape> + </item> +</layer-list> diff --git a/res/anim-v22/caret_toclose_animation_interpolator_0.xml b/res/drawable/switch_track.xml index bce86f73b..f54a350a6 100644 --- a/res/anim-v22/caret_toclose_animation_interpolator_0.xml +++ b/res/drawable/switch_track.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2016 The Android Open Source Project + Copyright (C) 2021 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. @@ -14,6 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. --> -<pathInterpolator +<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:pathData="M 0.0,0.0 c 0.0001,0.0 0.0,1.0 1.0,1.0" /> + android:shape="rectangle" + android:width="52dp" + android:height="28dp"> + + <solid android:color="@color/switch_track_color" /> + <corners android:radius="35dp" /> +</shape> diff --git a/res/drawable/toggle_circle.xml b/res/drawable/toggle_circle.xml index 574ae8cc7..966be0c46 100644 --- a/res/drawable/toggle_circle.xml +++ b/res/drawable/toggle_circle.xml @@ -16,10 +16,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_checked="true"> - <bitmap - android:src="@drawable/bg_day_selected" - android:gravity="center" /> - </item> - <item android:drawable="@android:color/transparent" /> + <item android:drawable="@drawable/bg_day_selected" android:state_checked="true" /> + <item android:drawable="@drawable/bg_day_unselected" /> </selector> diff --git a/res/layout-land/desk_clock.xml b/res/layout-land/desk_clock.xml new file mode 100644 index 000000000..03f6ba72f --- /dev/null +++ b/res/layout-land/desk_clock.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2016 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" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + app:statusBarBackground="@null" + android:fitsSystemWindows="true"> + + <com.google.android.material.appbar.AppBarLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@null" + app:elevation="0dp"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:contentInsetStart="0dp" + tools:ignore="RtlSymmetry" + android:gravity="center"> + + <TextView + android:id="@+id/title_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="start" + style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" + android:paddingStart="24dp" + tools:text="Alarm"/> + + </androidx.appcompat.widget.Toolbar> + </com.google.android.material.appbar.AppBarLayout> + + <androidx.coordinatorlayout.widget.CoordinatorLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <FrameLayout + android:id="@+id/fragment_container" + android:layout_width="0dp" + android:layout_height="match_parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/fab_container" /> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/fab_container" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:baselineAligned="false" + android:orientation="vertical" + app:layout_behavior="com.android.deskclock.widget.toast.SnackbarSlidingBehavior" + app:layout_constraintEnd_toEndOf="parent"> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/left_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/fab" + app:layout_constraintVertical_bias="0.35" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="@dimen/fab_margin" + android:contentDescription="@null" + app:borderWidth="0dp" + app:fabCustomSize="@dimen/fab_height" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/right_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toTopOf="@+id/fab" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.65" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + </androidx.constraintlayout.widget.ConstraintLayout> + + </androidx.coordinatorlayout.widget.CoordinatorLayout> + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/bottom_view" + android:layout_width="match_parent" + android:layout_height="72dp" + android:background="@color/secondary_color" + app:menu="@menu/bottom_navigation_menu" + app:itemIconTint="@color/tab_tint_color" + app:itemTextColor="@color/tab_tint_color" + app:itemTextAppearanceActive="@style/navText" + app:itemTextAppearanceInactive="@style/navText" + app:labelVisibilityMode="labeled" /> + +</LinearLayout> diff --git a/res/layout-land/desk_clock_old.xml b/res/layout-land/desk_clock_old.xml new file mode 100644 index 000000000..6f98ce555 --- /dev/null +++ b/res/layout-land/desk_clock_old.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2016 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" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + app:statusBarBackground="@null" + android:fitsSystemWindows="true"> + + <com.google.android.material.appbar.AppBarLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@null" + app:elevation="0dp"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:contentInsetStart="0dp" + tools:ignore="RtlSymmetry" + android:gravity="center"> + + <TextView + android:id="@+id/title_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="start" + style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" + android:paddingStart="24dp" + tools:text="Alarm"/> + + </androidx.appcompat.widget.Toolbar> + </com.google.android.material.appbar.AppBarLayout> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <FrameLayout + android:id="@+id/fragment_container" + android:layout_width="0dp" + android:layout_height="match_parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/fab_container" /> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/fab_container" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:baselineAligned="false" + android:orientation="vertical" + app:layout_behavior="com.android.deskclock.widget.toast.SnackbarSlidingBehavior" + app:layout_constraintEnd_toEndOf="parent"> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/left_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/fab" + app:layout_constraintVertical_bias="0.35" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="@dimen/fab_margin" + android:contentDescription="@null" + app:borderWidth="0dp" + app:fabCustomSize="@dimen/fab_height" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/right_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toTopOf="@+id/fab" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.65" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/bottom_view" + android:layout_width="match_parent" + android:layout_height="72dp" + android:background="@color/secondary_color" + app:menu="@menu/bottom_navigation_menu" + app:itemIconTint="@color/tab_tint_color" + app:itemTextColor="@color/tab_tint_color" + app:itemTextAppearanceActive="@style/navText" + app:itemTextAppearanceInactive="@style/navText" + app:labelVisibilityMode="labeled" /> + +</LinearLayout> diff --git a/res/layout-land/main_clock_frame.xml b/res/layout-land/main_clock_frame.xml index b72f62333..6abfdddd6 100644 --- a/res/layout-land/main_clock_frame.xml +++ b/res/layout-land/main_clock_frame.xml @@ -15,6 +15,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" @@ -42,18 +43,14 @@ android:layout_height="wrap_content" android:ellipsize="none" android:singleLine="true" - android:textSize="@dimen/main_clock_digital_font_size" /> + android:textSize="@dimen/main_clock_digital_font_size" + tools:text="01:23" /> </FrameLayout> - <include layout="@layout/date_and_next_alarm_time" /> - - <View - android:id="@+id/hairline" - android:layout_width="match_parent" - android:layout_height="@dimen/hairline_height" - android:layout_marginTop="24dp" - android:background="@color/hairline" - android:visibility="gone" /> + <include layout="@layout/date_and_next_alarm_time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal"/> </LinearLayout> diff --git a/res/layout-land/stopwatch_fragment.xml b/res/layout-land/stopwatch_fragment.xml index 25018967f..7cc0c5d74 100644 --- a/res/layout-land/stopwatch_fragment.xml +++ b/res/layout-land/stopwatch_fragment.xml @@ -19,7 +19,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" - android:orientation="horizontal"> + android:orientation="horizontal" + android:layout_gravity="center_vertical"> <!-- Left gutter. --> <Space @@ -31,8 +32,7 @@ <com.android.deskclock.stopwatch.StopwatchLandscapeLayout android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="@integer/guttered_content_width_percent" - android:paddingBottom="@dimen/fab_height"> + android:layout_weight="@integer/guttered_content_width_percent"> <FrameLayout android:id="@+id/stopwatch_time_wrapper" @@ -48,15 +48,14 @@ android:id="@+id/laps_list" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:clipToPadding="false" - android:paddingBottom="@dimen/fab_height" /> + android:clipToPadding="false" /> </com.android.deskclock.stopwatch.StopwatchLandscapeLayout> - - <!-- Right gutter. --> +<!-- + <!– Right gutter. –> <Space android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> + android:layout_weight="@integer/gutter_width_percent" />--> </LinearLayout> diff --git a/res/layout-land/timer_setup_view.xml b/res/layout-land/timer_setup_view.xml index 151a37621..2bbb3dce1 100644 --- a/res/layout-land/timer_setup_view.xml +++ b/res/layout-land/timer_setup_view.xml @@ -31,15 +31,15 @@ android:paddingBottom="@dimen/fab_height"> <include layout="@layout/timer_setup_time" /> + </LinearLayout> - <include layout="@layout/timer_setup_divider" /> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="2" + android:paddingBottom="8dp"> + <include layout="@layout/timer_setup_digits"/> </LinearLayout> - <include - layout="@layout/timer_setup_digits" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="2" /> - </LinearLayout> diff --git a/res/layout-land/world_clock_item.xml b/res/layout-land/world_clock_item.xml index e5e9398ea..77a162039 100644 --- a/res/layout-land/world_clock_item.xml +++ b/res/layout-land/world_clock_item.xml @@ -14,47 +14,47 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + style="@style/MaterialCardViewStyle" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:background="@drawable/alarm_background" + android:paddingTop="22.0dip" + android:paddingBottom="22.0dip" + android:paddingStart="16.0dip" + android:paddingEnd="16.0dip"> <LinearLayout - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="29" android:orientation="vertical"> - <TextClock + <com.android.deskclock.widget.AutoSizingTextClock android:id="@+id/digital_clock" style="@style/world_clock_time" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_horizontal" + android:gravity="start" android:ellipsize="end" android:singleLine="true" - android:includeFontPadding="false" /> + android:includeFontPadding="false" + tools:text="01:23"/> <com.android.deskclock.AnalogClock android:id="@+id/analog_clock" android:layout_width="@dimen/world_clock_analog_size" android:layout_height="@dimen/world_clock_analog_size" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="@dimen/bottom_text_spacing_analog_small" /> + android:layout_gravity="start" + android:layout_marginBottom="@dimen/bottom_text_spacing_analog_small" + tools:visibility="gone"/> <include layout="@layout/world_clock_city_container" android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_gravity="center_horizontal" - android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_gravity="left" /> </LinearLayout> - <!-- Right gutter. --> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> - </LinearLayout> diff --git a/res/layout-w320dp-h320dp-land/stopwatch_fragment.xml b/res/layout-w320dp-h320dp-land/stopwatch_fragment.xml index 869282426..5dda82f9d 100644 --- a/res/layout-w320dp-h320dp-land/stopwatch_fragment.xml +++ b/res/layout-w320dp-h320dp-land/stopwatch_fragment.xml @@ -37,8 +37,7 @@ android:id="@+id/stopwatch_time_wrapper" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingBottom="@dimen/fab_height"> + android:layout_gravity="center"> <include layout="@layout/stopwatch_time" /> @@ -54,8 +53,7 @@ android:id="@+id/laps_list" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:clipToPadding="false" - android:paddingBottom="@dimen/fab_height" /> + android:clipToPadding="false" /> </com.android.deskclock.stopwatch.StopwatchLandscapeLayout> diff --git a/res/layout-w320dp-h320dp/timer_item.xml b/res/layout-w320dp-h320dp/timer_item.xml index fac8f2b0d..081716eb1 100644 --- a/res/layout-w320dp-h320dp/timer_item.xml +++ b/res/layout-w320dp-h320dp/timer_item.xml @@ -18,75 +18,80 @@ <com.android.deskclock.timer.TimerItem xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <androidx.percentlayout.widget.PercentFrameLayout - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"> - - <com.android.deskclock.TimerCircleFrameLayout - android:layout_gravity="center" - app:layout_aspectRatio="100%" - app:layout_heightPercent="@fraction/timer_circle_height_percent" - app:layout_widthPercent="@fraction/timer_circle_width_percent"> - - <com.android.deskclock.CircleButtonsLayout + android:layout_height="match_parent"> + + <include layout="@layout/centered_guidelines" /> + + <TextView + android:id="@+id/timer_label" + style="?attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="start" + android:paddingStart="24dp" + android:paddingEnd="24dp" + android:hint="@string/label" + android:maxLines="1" + android:minWidth="@dimen/touch_target_min_size" + android:minHeight="@dimen/touch_target_min_size" + android:textAppearance="@style/TimerLabelTextAppearance" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/label" /> + + <FrameLayout + android:layout_width="0.0dip" + android:layout_height="0.0dip" + app:layout_constraintBottom_toTopOf="@id/fab_spacing" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toStartOf="@id/timer_circle_end_guide" + app:layout_constraintHeight_max="@dimen/max_timer_circle_size" + app:layout_constraintStart_toEndOf="@id/timer_circle_start_guide" + app:layout_constraintTop_toTopOf="parent"> + + <com.android.deskclock.CircleButtonsLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.android.deskclock.timer.TimerCircleView + android:id="@+id/timer_time" android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.android.deskclock.timer.TimerCircleView - android:id="@+id/timer_time" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <com.android.deskclock.widget.AutoSizingTextView - android:id="@+id/timer_time_text" - style="@style/display_time" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:includeFontPadding="false" - android:paddingEnd="20dp" - android:paddingStart="20dp" - android:textSize="70sp" /> + android:layout_height="match_parent" /> - <Button - android:id="@+id/timer_label" - style="?attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top|center_horizontal" - android:clickable="false" - android:ellipsize="end" - android:gravity="center" - android:hint="@string/label" - android:maxLines="1" - android:minHeight="@dimen/touch_target_min_size" - android:minWidth="@dimen/touch_target_min_size" - android:textAppearance="@style/SecondaryLabelTextAppearance" /> - - <Button - android:id="@+id/reset_add" - style="?attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="bottom|center_horizontal" - android:contentDescription="@string/timer_plus_one" - android:gravity="center" - android:scaleType="centerInside" /> - - </com.android.deskclock.CircleButtonsLayout> - - </com.android.deskclock.TimerCircleFrameLayout> - - </androidx.percentlayout.widget.PercentFrameLayout> + <com.android.deskclock.widget.AutoSizingTextView + android:id="@+id/timer_time_text" + style="@style/display_time" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:gravity="center" + android:includeFontPadding="false" + android:paddingStart="20dp" + android:paddingEnd="20dp" + android:textSize="70sp" /> + + <Button + android:id="@+id/reset_add" + style="?attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|center_horizontal" + android:contentDescription="@string/timer_plus_one" + android:gravity="center" + android:scaleType="centerInside" /> + + </com.android.deskclock.CircleButtonsLayout> + + </FrameLayout> <Space + android:id="@+id/fab_spacing" android:layout_width="match_parent" - android:layout_height="@dimen/fab_height" /> + android:layout_height="@dimen/fab_container_height" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> -</com.android.deskclock.timer.TimerItem>
\ No newline at end of file +</com.android.deskclock.timer.TimerItem> diff --git a/res/layout/alarm_activity.xml b/res/layout/alarm_activity.xml index 61bff3455..2a634cae7 100644 --- a/res/layout/alarm_activity.xml +++ b/res/layout/alarm_activity.xml @@ -18,6 +18,7 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" @@ -43,7 +44,8 @@ app:layout_row="0" app:layout_column="0" app:layout_columnSpan="3" - app:layout_gravity="fill_horizontal" /> + app:layout_gravity="fill_horizontal" + tools:text="08:30" /> <TextView android:id="@+id/title" @@ -133,7 +135,8 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" - android:visibility="gone"> + android:visibility="gone" + tools:visibility="visible"> <TextView android:id="@+id/alert_title" diff --git a/res/layout/alarm_time_collapsed.xml b/res/layout/alarm_time_collapsed.xml index fa8f1125f..3f0b64264 100644 --- a/res/layout/alarm_time_collapsed.xml +++ b/res/layout/alarm_time_collapsed.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,116 +14,115 @@ limitations under the License. --> -<androidx.gridlayout.widget.GridLayout +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + style="@style/MaterialCardViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:paddingEnd="16dp" - android:paddingStart="16dp" - app:columnCount="5" - app:columnOrderPreserved="false" - app:rowCount="4"> + android:background="@drawable/alarm_background" + android:importantForAccessibility="no"> + + <include layout="@layout/centered_guidelines" /> + + <TextView + android:id="@+id/label" + android:layout_width="0.0dip" + android:layout_height="@dimen/touch_target_min_size" + android:background="?selectableItemBackground" + android:drawablePadding="@dimen/alarm_horizontal_padding" + android:ellipsize="end" + android:focusable="true" + android:gravity="start|center" + android:hint="@string/add_label" + android:paddingStart="4.0dip" + android:paddingEnd="4.0dip" + android:singleLine="true" + android:textAlignment="viewStart" + android:textAppearance="@style/body" + app:layout_constraintEnd_toStartOf="@id/arrow" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toTopOf="parent" /> <include layout="@layout/alarm_time_summary" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" - app:layout_column="0" - app:layout_gravity="center_vertical" - app:layout_row="0" /> + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/label" /> + + <ImageButton + android:id="@+id/arrow" + android:layout_width="wrap_content" + android:layout_height="@dimen/touch_target_min_size" + android:background="?selectableItemBackgroundBorderless" + android:contentDescription="@string/collapse_alarm" + android:focusable="true" + android:padding="@dimen/checkbox_start_padding" + android:scaleType="center" + app:layout_constraintEnd_toEndOf="@id/end_guide_extreme_thin" + app:layout_constraintTop_toTopOf="parent" + app:srcCompat="@drawable/ic_caret_down" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/onoff" + style="@style/DeskClock.Switch" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" - android:minHeight="@dimen/touch_target_min_size" + android:layout_marginEnd="6.0dip" + android:focusable="true" android:minWidth="@dimen/touch_target_min_size" - android:theme="@style/ThemeOverlay.Control.Accent" - app:layout_column="3" - app:layout_columnSpan="2" - app:layout_gravity="center_vertical" - app:layout_row="0" /> + android:minHeight="@dimen/touch_target_min_size" + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintTop_toBottomOf="@id/digital_clock" /> <com.android.deskclock.widget.EllipsizeLayout - android:layout_width="0dp" + android:id="@+id/ellipse_layout" + android:layout_width="0.0dip" android:layout_height="@dimen/touch_target_min_size" + android:background="@android:color/transparent" + android:focusable="false" android:gravity="center_vertical" - app:layout_column="0" - app:layout_columnSpan="3" - app:layout_gravity="fill_horizontal" - app:layout_row="1"> - - <TextView - android:id="@+id/label" - style="@style/body" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:maxLines="1" - android:paddingEnd="@dimen/icon_margin" - android:paddingStart="@dimen/icon_margin" - android:textColor="@color/clock_gray" /> + app:layout_constraintBottom_toTopOf="@id/repeat_days" + app:layout_constraintEnd_toStartOf="@id/onoff" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/digital_clock"> <TextView android:id="@+id/days_of_week" - style="@style/body" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="none" - android:focusable="true" + android:focusable="false" android:maxLines="1" - android:paddingEnd="@dimen/icon_margin" - android:paddingStart="@dimen/icon_margin" /> - - <TextView - android:id="@+id/upcoming_instance_label" - style="@style/body" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="none" - android:focusable="true" - android:paddingEnd="@dimen/icon_margin" - android:paddingStart="@dimen/icon_margin" - android:singleLine="true" /> - + android:paddingHorizontal="@dimen/icon_margin" + android:paddingLeft="@dimen/icon_margin" + android:paddingRight="@dimen/icon_margin" + android:textAppearance="@style/body" + android:visibility="visible" + tools:text="Mo.,Tue.,Wed." /> </com.android.deskclock.widget.EllipsizeLayout> - <include - layout="@layout/preemptive_dismiss" - android:layout_width="wrap_content" - android:layout_height="@dimen/touch_target_min_size" - app:layout_column="0" - app:layout_columnSpan="2" - app:layout_row="2" /> - - <ImageButton - android:id="@+id/arrow" + <Button + android:id="@+id/preemptive_dismiss_button" + style="?borderlessButtonStyle" android:layout_width="wrap_content" - android:layout_height="@dimen/touch_target_min_size" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/expand_alarm" - android:padding="@dimen/checkbox_start_padding" - android:scaleType="center" - app:layout_column="4" - app:layout_gravity="bottom" - app:layout_row="1" - app:layout_rowSpan="2" - app:srcCompat="@drawable/ic_caret_down" /> - - <View - android:id="@+id/hairline" - android:layout_width="0dp" - android:layout_height="@dimen/hairline_height" - android:layout_marginEnd="@dimen/icon_margin" - android:layout_marginStart="@dimen/icon_margin" - android:background="@color/hairline" - app:layout_column="0" - app:layout_columnSpan="5" - app:layout_gravity="fill_horizontal" - app:layout_row="3" /> - -</androidx.gridlayout.widget.GridLayout> + android:layout_height="wrap_content" + android:drawablePadding="@dimen/alarm_horizontal_padding" + android:focusable="true" + android:gravity="center_vertical" + android:minHeight="@dimen/touch_target_min_size" + android:paddingStart="@dimen/icon_margin" + android:paddingEnd="0dp" + android:textAllCaps="false" + android:textAppearance="@style/body" + android:textColor="@color/accent_color" + android:visibility="gone" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/ellipse_layout" + tools:text="Dismiss" + tools:visibility="visible" /> +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/res/layout/alarm_time_expanded.xml b/res/layout/alarm_time_expanded.xml index 4958683bd..f115d9e7d 100644 --- a/res/layout/alarm_time_expanded.xml +++ b/res/layout/alarm_time_expanded.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,170 +14,192 @@ limitations under the License. --> -<androidx.gridlayout.widget.GridLayout +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + style="@style/MaterialCardViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingEnd="16dp" - android:paddingStart="16dp" - app:columnCount="8" - app:columnOrderPreserved="false" - app:rowCount="8"> + android:background="@drawable/alarm_background" + android:importantForAccessibility="no"> + + <include layout="@layout/centered_guidelines" /> + + <TextView + android:id="@+id/edit_label" + android:layout_width="0.0dip" + android:layout_height="@dimen/touch_target_min_size" + android:background="?selectableItemBackground" + android:drawablePadding="@dimen/alarm_horizontal_padding" + android:ellipsize="end" + android:focusable="true" + android:gravity="start|center" + android:hint="@string/add_label" + android:paddingStart="4.0dip" + android:paddingEnd="4.0dip" + android:singleLine="true" + android:textAlignment="viewStart" + android:textAppearance="@style/body" + app:drawableStartCompat="@drawable/ic_label" + app:drawableTint="?colorControlNormal" + app:layout_constraintEnd_toStartOf="@id/arrow" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toTopOf="parent" /> <include layout="@layout/alarm_time_summary" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" - app:layout_column="0" - app:layout_columnSpan="4" - app:layout_gravity="center_vertical" - app:layout_row="0" /> + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/edit_label" /> + + <ImageButton + android:id="@+id/arrow" + android:layout_width="wrap_content" + android:layout_height="@dimen/touch_target_min_size" + android:background="?selectableItemBackgroundBorderless" + android:contentDescription="@string/collapse_alarm" + android:focusable="true" + android:padding="@dimen/checkbox_start_padding" + android:scaleType="center" + app:layout_constraintEnd_toEndOf="@id/end_guide_extreme_thin" + app:layout_constraintTop_toTopOf="parent" + app:srcCompat="@drawable/ic_caret_up" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/onoff" + style="@style/DeskClock.Switch" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" - android:minHeight="@dimen/touch_target_min_size" + android:layout_marginEnd="6.0dip" + android:focusable="true" android:minWidth="@dimen/touch_target_min_size" - android:theme="@style/ThemeOverlay.Control.Accent" - app:layout_column="6" - app:layout_columnSpan="2" - app:layout_gravity="center_vertical" - app:layout_row="0" /> + android:minHeight="@dimen/touch_target_min_size" + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintTop_toBottomOf="@id/digital_clock" /> - <CheckBox - android:id="@+id/repeat_onoff" - style="@style/body" - android:layout_width="wrap_content" + <com.android.deskclock.widget.EllipsizeLayout + android:id="@+id/ellipse_layout" + android:layout_width="0.0dip" android:layout_height="@dimen/touch_target_min_size" - android:paddingEnd="@dimen/checkbox_start_padding" - android:paddingStart="@dimen/checkbox_start_padding" - android:text="@string/alarm_repeat" - app:layout_column="0" - app:layout_columnSpan="2" - app:layout_row="1" /> - - <!-- Day buttons are put here programmatically --> - <LinearLayout + android:background="@android:color/transparent" + android:focusable="false" + android:gravity="center_vertical" + app:layout_constraintBottom_toTopOf="@id/repeat_days" + app:layout_constraintEnd_toStartOf="@id/onoff" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/digital_clock"> + + <TextView + android:id="@+id/days_of_week" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="none" + android:focusable="false" + android:maxLines="1" + android:paddingHorizontal="@dimen/icon_margin" + android:paddingLeft="@dimen/icon_margin" + android:paddingRight="@dimen/icon_margin" + android:textAppearance="@style/body" + android:visibility="visible" + tools:text="Mo.,Tue.,Wed." /> + </com.android.deskclock.widget.EllipsizeLayout> + + <include android:id="@+id/repeat_days" - android:layout_width="0dp" + layout="@layout/days_of_week" + android:layout_width="0.0dip" android:layout_height="@dimen/touch_target_min_size" - android:orientation="horizontal" - android:visibility="gone" - app:layout_column="0" - app:layout_columnSpan="8" - app:layout_gravity="fill_horizontal" - app:layout_row="2" /> + android:layout_marginHorizontal="4.0dip" + android:layout_marginLeft="4.0dip" + android:layout_marginRight="4.0dip" + android:focusable="false" + android:visibility="visible" + app:layout_constraintEnd_toStartOf="@id/end_guide_very_thin" + app:layout_constraintStart_toEndOf="@id/start_guide_very_thin" + app:layout_constraintTop_toBottomOf="@id/ellipse_layout" /> <TextView android:id="@+id/choose_ringtone" - style="@style/body" - android:layout_width="0dp" + android:layout_width="0.0dip" android:layout_height="@dimen/touch_target_min_size" - android:background="?attr/selectableItemBackground" - android:clickable="true" + android:background="?selectableItemBackground" android:drawablePadding="@dimen/alarm_horizontal_padding" android:ellipsize="marquee" - android:gravity="start|center_vertical" + android:focusable="true" + android:gravity="start|center" android:marqueeRepeatLimit="marquee_forever" - android:paddingEnd="@dimen/icon_margin" android:paddingStart="@dimen/icon_margin" + android:paddingEnd="@dimen/icon_margin" android:scrollHorizontally="true" android:singleLine="true" android:textAlignment="viewStart" - app:layout_column="0" - app:layout_columnSpan="5" - app:layout_gravity="fill_horizontal" - app:layout_row="3" /> + android:textAppearance="@style/body" + app:drawableStartCompat="@drawable/ic_ringtone" + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/repeat_days" + tools:text="Standard (Hassium)" /> <CheckBox android:id="@+id/vibrate_onoff" - style="@style/body" - android:layout_width="wrap_content" + android:layout_width="0.0dip" android:layout_height="@dimen/touch_target_min_size" - android:paddingEnd="@dimen/checkbox_start_padding" - android:paddingStart="@dimen/checkbox_start_padding" + android:background="?selectableItemBackground" + android:button="@null" + android:drawablePadding="@dimen/alarm_horizontal_padding" + android:focusable="true" + android:paddingStart="4.0dip" + android:paddingEnd="4.0dip" android:text="@string/alarm_vibrate" - app:layout_column="5" - app:layout_columnSpan="3" - app:layout_gravity="center_vertical" - app:layout_row="3" /> + android:textAppearance="@style/body" + android:drawableStart="@drawable/ic_vibrate" + android:drawableEnd="@drawable/selector_checkbox_material" + app:layout_constraintEnd_toStartOf="@id/end_guide_thin" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/choose_ringtone" /> - <TextView - android:id="@+id/edit_label" - style="@style/body" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:drawablePadding="@dimen/alarm_horizontal_padding" - android:ellipsize="end" - android:gravity="start|center_vertical" - android:hint="@string/label" - android:paddingBottom="12dp" - android:paddingEnd="4dp" - android:paddingStart="4dp" - android:paddingTop="12dp" - android:singleLine="true" - android:textAlignment="viewStart" - app:layout_column="0" - app:layout_columnSpan="8" - app:layout_gravity="fill_horizontal" - app:layout_row="4" /> - <include - layout="@layout/preemptive_dismiss" + <Button + android:id="@+id/preemptive_dismiss_button" + style="?borderlessButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_column="0" - app:layout_columnSpan="3" - app:layout_row="5" /> - - <View - android:id="@+id/hairline" - android:layout_width="0dp" - android:layout_height="@dimen/hairline_height" - android:layout_marginRight="@dimen/hairline_side_padding" - android:layout_marginLeft="@dimen/hairline_side_padding" - android:background="@color/hairline" - app:layout_column="0" - app:layout_columnSpan="8" - app:layout_gravity="fill_horizontal" - app:layout_row="6" /> + android:drawablePadding="@dimen/alarm_horizontal_padding" + android:focusable="true" + android:gravity="center_vertical" + android:minHeight="@dimen/touch_target_min_size" + android:paddingStart="@dimen/icon_margin" + android:paddingEnd="0dp" + android:textAllCaps="false" + android:textAppearance="@style/body" + android:textColor="@color/accent_color" + android:visibility="gone" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/vibrate_onoff" + tools:text="Dismiss" + tools:visibility="visible" /> <Button android:id="@+id/delete" - style="?attr/borderlessButtonStyle" + style="?borderlessButtonStyle" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/alarm_clock_vertical_margin" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" + android:layout_height="@dimen/touch_target_min_size" + android:layout_marginBottom="@dimen/alarm_clock_expanded_vertical_margin" + android:background="?selectableItemBackground" + android:drawableStart="@drawable/ic_delete_small" android:drawablePadding="@dimen/alarm_horizontal_padding" - android:gravity="start|center_vertical" - android:paddingEnd="@dimen/checkbox_start_padding" + android:focusable="true" + android:gravity="start|center" android:paddingStart="@dimen/icon_margin" + android:paddingEnd="@dimen/checkbox_start_padding" android:text="@string/delete" android:textAllCaps="false" android:textAppearance="@style/body" - app:layout_column="0" - app:layout_gravity="center_vertical" - app:layout_row="7" /> - - <ImageButton - android:id="@+id/arrow" - android:layout_width="wrap_content" - android:layout_height="@dimen/touch_target_min_size" - android:layout_marginBottom="@dimen/alarm_clock_vertical_margin" - android:layout_marginTop="@dimen/alarm_clock_vertical_margin" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/collapse_alarm" - android:padding="@dimen/checkbox_start_padding" - android:scaleType="center" - app:layout_column="7" - app:layout_gravity="center_vertical" - app:layout_row="7" - app:srcCompat="@drawable/ic_caret_up" /> - -</androidx.gridlayout.widget.GridLayout> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/start_guide_thin" + app:layout_constraintTop_toBottomOf="@id/preemptive_dismiss_button" /> +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/res/layout/alarm_time_summary.xml b/res/layout/alarm_time_summary.xml index 25c76b3d7..b2c04b1e7 100644 --- a/res/layout/alarm_time_summary.xml +++ b/res/layout/alarm_time_summary.xml @@ -16,8 +16,10 @@ <com.android.deskclock.widget.TextTime xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/digital_clock" style="@style/display_time" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground"/> + android:background="?attr/selectableItemBackground" + tools:text="08:30" /> diff --git a/res/layout/centered_guidelines.xml b/res/layout/centered_guidelines.xml new file mode 100644 index 000000000..e537fb911 --- /dev/null +++ b/res/layout/centered_guidelines.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/start_guide" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_begin="@dimen/gutter_horizontal_padding" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/start_guide_thin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_begin="@dimen/gutter_horizontal_padding_thin" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/start_guide_very_thin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_begin="@dimen/gutter_horizontal_padding_very_thin" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/end_guide" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_end="@dimen/gutter_horizontal_padding" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/end_guide_thin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_end="@dimen/gutter_horizontal_padding_thin" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/end_guide_very_thin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_end="@dimen/gutter_horizontal_padding_very_thin" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/end_guide_extreme_thin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_end="@dimen/gutter_horizontal_padding_extreme_thin" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/timer_circle_start_guide" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.1" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/timer_circle_end_guide" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.9" /> +</merge>
\ No newline at end of file diff --git a/res/layout/cities_activity.xml b/res/layout/cities_activity.xml index d80865d83..722e087ce 100644 --- a/res/layout/cities_activity.xml +++ b/res/layout/cities_activity.xml @@ -29,7 +29,6 @@ android:layout_height="match_parent" android:clipToPadding="false" android:divider="@null" - android:scrollbarStyle="insideInset" - android:theme="@style/ThemeOverlay.Control.Accent" /> + android:scrollbarStyle="insideInset" /> </FrameLayout> diff --git a/res/layout/collapsing_toolbar_base_layout.xml b/res/layout/collapsing_toolbar_base_layout.xml new file mode 100644 index 000000000..b07c5f074 --- /dev/null +++ b/res/layout/collapsing_toolbar_base_layout.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2021 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. + --> +<androidx.coordinatorlayout.widget.CoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/content_parent" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/app_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fitsSystemWindows="true" + android:outlineAmbientShadowColor="@android:color/transparent" + android:outlineSpotShadowColor="@android:color/transparent" + android:background="?colorPrimary" + android:theme="@style/Theme.CollapsingToolbar.Settings"> + + <com.google.android.material.appbar.CollapsingToolbarLayout + android:id="@+id/collapsing_toolbar" + android:layout_width="match_parent" + android:layout_height="@dimen/settingslib_toolbar_layout_height" + android:clipToPadding="false" + app:forceApplySystemWindowInsetTop="true" + app:extraMultilineHeightEnabled="true" + app:contentScrim="@android:color/system_neutral1_700" + app:maxLines="3" + app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" + app:scrimAnimationDuration="50" + app:scrimVisibleHeightTrigger="@dimen/settingslib_scrim_visible_height_trigger" + app:statusBarScrim="@null" + app:titleCollapseMode="fade" + app:collapsedTitleTextAppearance="@style/CollapsingToolbarTitle.Collapsed" + app:expandedTitleTextAppearance="@style/CollapsingToolbarTitle.Expanded" + app:expandedTitleMarginStart="@dimen/expanded_title_margin_start" + app:expandedTitleMarginEnd="@dimen/expanded_title_margin_end" + app:toolbarId="@id/action_bar"> + + <Toolbar + android:id="@+id/action_bar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:theme="?android:attr/actionBarTheme" + android:transitionName="shared_element_view" + app:layout_collapseMode="pin"/> + + </com.google.android.material.appbar.CollapsingToolbarLayout> + </com.google.android.material.appbar.AppBarLayout> + + <FrameLayout + android:id="@+id/content_frame" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_behavior="@string/appbar_scrolling_view_behavior"/> +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/res/layout/date_and_next_alarm_time.xml b/res/layout/date_and_next_alarm_time.xml index ad25502a8..23df1cd3b 100644 --- a/res/layout/date_and_next_alarm_time.xml +++ b/res/layout/date_and_next_alarm_time.xml @@ -14,11 +14,11 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" + xmlns:tools="http://schemas.android.com/tools" + android:layout_gravity="center_vertical" android:gravity="center"> <TextView @@ -26,7 +26,8 @@ style="@style/body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAllCaps="true" /> + android:textAllCaps="true" + tools:text="Sa., 01.01."/> <TextView android:id="@+id/nextAlarmIcon" @@ -46,6 +47,7 @@ style="@style/body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAllCaps="true" /> + android:textAllCaps="true" + tools:text="Mo., 07:00"/> </LinearLayout>
\ No newline at end of file diff --git a/res/layout/days_of_week.xml b/res/layout/days_of_week.xml new file mode 100644 index 000000000..1d4cc386a --- /dev/null +++ b/res/layout/days_of_week.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout android:focusable="false" android:layout_width="match_parent" android:layout_height="wrap_content" + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/one_seventh" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.143" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/two_sevenths" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.286" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/three_sevenths" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.429" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/four_sevenths" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.571" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/five_sevenths" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.714" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/six_sevenths" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.857" /> + <CheckBox android:id="@+id/day_button_0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_1" app:layout_constraintStart_toEndOf="@id/one_seventh" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_2" app:layout_constraintStart_toEndOf="@id/two_sevenths" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_3" app:layout_constraintStart_toEndOf="@id/three_sevenths" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_4" app:layout_constraintStart_toEndOf="@id/four_sevenths" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_5" app:layout_constraintStart_toEndOf="@id/five_sevenths" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> + <CheckBox android:id="@+id/day_button_6" app:layout_constraintStart_toEndOf="@id/six_sevenths" app:layout_constraintTop_toTopOf="parent" style="@style/DayButtonStyle" /> +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/res/layout/desk_clock.xml b/res/layout/desk_clock.xml index e39d1bbbd..7cad679b3 100644 --- a/res/layout/desk_clock.xml +++ b/res/layout/desk_clock.xml @@ -43,8 +43,9 @@ android:id="@+id/title_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" - style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" /> + android:layout_gravity="start" + android:layout_marginStart="24dp" + style="@style/TextAppearance.Title" /> </androidx.appcompat.widget.Toolbar> </com.google.android.material.appbar.AppBarLayout> @@ -60,29 +61,29 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/fab_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:baselineAligned="false" android:orientation="horizontal" - app:layout_behavior="com.android.deskclock.widget.toast.SnackbarSlidingBehavior"> - - <FrameLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_gravity="start|center_vertical" - android:layout_weight="1"> - - <Button - android:id="@+id/left_button" - style="?attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:scaleType="centerInside" /> + app:layout_dodgeInsetEdges="bottom" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - </FrameLayout> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/left_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/fab" + app:layout_constraintHorizontal_bias="0.6" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + android:backgroundTint="@color/accent_color2" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab" @@ -90,40 +91,39 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="@dimen/fab_margin" - app:borderWidth="0dp" - app:elevation="@dimen/fab_elevation" /> - - <FrameLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_gravity="end|center_vertical" - android:layout_weight="1"> - - <Button - android:id="@+id/right_button" - style="?attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:scaleType="centerInside" /> - - </FrameLayout> - - </LinearLayout> + android:contentDescription="@null" + app:fabCustomSize="@dimen/fab_height" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"/> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/right_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@null" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.4" + app:layout_constraintStart_toEndOf="@id/fab" + app:layout_constraintTop_toTopOf="parent" + android:backgroundTint="@color/accent_color2"/> + </androidx.constraintlayout.widget.ConstraintLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout> <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottom_view" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/content" + android:layout_height="80dp" android:background="@color/secondary_color" + android:paddingTop="12dp" + android:paddingBottom="16dp" app:menu="@menu/bottom_navigation_menu" app:itemIconTint="@color/tab_tint_color" app:itemTextColor="@color/tab_tint_color" app:itemTextAppearanceActive="@style/navText" app:itemTextAppearanceInactive="@style/navText" app:labelVisibilityMode="labeled" /> - </LinearLayout> diff --git a/res/layout/expired_timers_activity.xml b/res/layout/expired_timers_activity.xml index 6129bb20f..3d4493976 100644 --- a/res/layout/expired_timers_activity.xml +++ b/res/layout/expired_timers_activity.xml @@ -44,8 +44,8 @@ android:layout_gravity="center_horizontal|bottom" android:layout_margin="@dimen/fab_margin" android:contentDescription="@string/timer_stop" - android:src="@drawable/ic_stop_white_24dp" + android:src="@drawable/ic_stop_play" app:borderWidth="0dp" app:elevation="@dimen/fab_elevation" /> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/res/layout/main_clock_frame.xml b/res/layout/main_clock_frame.xml index ab960728f..159956f19 100644 --- a/res/layout/main_clock_frame.xml +++ b/res/layout/main_clock_frame.xml @@ -14,67 +14,45 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_horizontal"> - - <!-- Left gutter. --> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> - - <LinearLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="@integer/guttered_content_width_percent" - android:gravity="center_horizontal" - android:orientation="vertical"> - - <FrameLayout + xmlns:tools="http://schemas.android.com/tools" + android:gravity="center_horizontal" + android:paddingBottom="14dp" + android:layout_marginStart="24dp" + android:layout_marginEnd="24dp" + android:orientation="vertical"> + + <FrameLayout + android:layout_width="wrap_content" + android:layout_height="0dp" + android:layout_weight="1" + android:layout_gravity="start"> + + <com.android.deskclock.AnalogClock + android:id="@+id/analog_clock" android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_weight="1"> - - <com.android.deskclock.AnalogClock - android:id="@+id/analog_clock" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/analog_clock_margin" - android:layout_marginLeft="@dimen/analog_clock_margin" - android:layout_marginRight="@dimen/analog_clock_margin" - android:layout_marginStart="@dimen/analog_clock_margin" - android:layout_marginTop="@dimen/circle_margin_top" /> - - <com.android.deskclock.widget.AutoSizingTextClock - android:id="@+id/digital_clock" - style="@style/display_time" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="none" - android:includeFontPadding="false" - android:paddingTop="@dimen/main_clock_digital_padding" - android:singleLine="true" - android:textSize="@dimen/main_clock_digital_font_size" /> - - </FrameLayout> - - <include layout="@layout/date_and_next_alarm_time" /> - - <View - android:id="@+id/hairline" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/analog_clock_margin" + android:layout_marginLeft="@dimen/analog_clock_margin" + android:layout_marginRight="@dimen/analog_clock_margin" + android:layout_marginStart="@dimen/analog_clock_margin" + android:layout_marginTop="@dimen/circle_margin_top" /> + + <com.android.deskclock.widget.AutoSizingTextClock + android:id="@+id/digital_clock" + style="@style/display_time" android:layout_width="match_parent" - android:layout_height="@dimen/hairline_height" - android:layout_marginTop="24dp" - android:background="@color/hairline" /> - </LinearLayout> + android:layout_height="wrap_content" + android:ellipsize="none" + android:includeFontPadding="false" + android:paddingTop="@dimen/main_clock_digital_padding" + android:singleLine="true" + android:textSize="@dimen/main_clock_digital_font_size" + tools:text="01:23" /> - <!-- Right gutter. --> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> + </FrameLayout> + <include layout="@layout/date_and_next_alarm_time" /> </LinearLayout>
\ No newline at end of file diff --git a/res/layout/preemptive_dismiss.xml b/res/layout/preemptive_dismiss.xml index d095facde..42386171e 100644 --- a/res/layout/preemptive_dismiss.xml +++ b/res/layout/preemptive_dismiss.xml @@ -15,15 +15,19 @@ --> <Button xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/preemptive_dismiss_button" style="?attr/borderlessButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/touch_target_min_size" android:drawablePadding="@dimen/alarm_horizontal_padding" - android:drawableStart="@drawable/ic_alarm_off_white_24dp" + android:drawableStart="@drawable/ic_alarm_off_24dp" android:gravity="center_vertical" android:paddingStart="@dimen/icon_margin" + android:paddingEnd="@null" android:textAllCaps="false" android:textAppearance="@style/body" - android:visibility="gone"/> + android:visibility="gone" + tools:visibility="visible" + tools:text="Dismiss"/> diff --git a/res/layout/ringtone_item_sound.xml b/res/layout/ringtone_item_sound.xml index 12bd7653f..cf25d0b3f 100644 --- a/res/layout/ringtone_item_sound.xml +++ b/res/layout/ringtone_item_sound.xml @@ -55,7 +55,8 @@ android:layout_width="40dp" android:layout_height="40dp" android:importantForAccessibility="no" - android:scaleType="center" /> + android:scaleType="center" + tools:src="@drawable/ic_ringtone"/> <TextView android:id="@+id/ringtone_name" @@ -64,21 +65,23 @@ android:paddingEnd="16dp" android:paddingStart="16dp" android:textColor="@color/white" - android:textSize="@dimen/alarm_text_font_size" /> + android:textSize="@dimen/alarm_text_font_size" + tools:text="Standard"/> </LinearLayout> <ImageView android:id="@+id/sound_image_selected" + android:src="@drawable/selector_checkbox_checked" android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:importantForAccessibility="no" android:scaleType="center" - android:tint="?attr/colorAccent" android:visibility="gone" - app:srcCompat="@drawable/ic_checkmark" /> + app:tint="@color/accent_color" + tools:visibility="visible"/> </RelativeLayout> diff --git a/res/layout/ringtone_picker.xml b/res/layout/ringtone_picker.xml index d2127fea9..39baf29dc 100644 --- a/res/layout/ringtone_picker.xml +++ b/res/layout/ringtone_picker.xml @@ -20,8 +20,6 @@ android:layout_height="match_parent" android:fitsSystemWindows="true"> - <include layout="@layout/drop_shadow" /> - <androidx.recyclerview.widget.RecyclerView android:id="@+id/ringtone_content" android:layout_width="match_parent" diff --git a/res/layout/settings.xml b/res/layout/settings.xml deleted file mode 100644 index f1d871952..000000000 --- a/res/layout/settings.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 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. ---> - -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <include layout="@layout/drop_shadow" /> - - <FrameLayout - android:id="@+id/main" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - -</FrameLayout>
\ No newline at end of file diff --git a/res/layout/stopwatch_fragment.xml b/res/layout/stopwatch_fragment.xml index 12a390347..5c72bc727 100644 --- a/res/layout/stopwatch_fragment.xml +++ b/res/layout/stopwatch_fragment.xml @@ -32,6 +32,8 @@ android:id="@+id/stopwatch_time_wrapper" android:layout_gravity="center" app:layout_aspectRatio="100%" + android:layout_height="0dp" + android:layout_width="0dp" app:layout_heightPercent="@fraction/timer_circle_height_percent" app:layout_widthPercent="@fraction/timer_circle_width_percent"> diff --git a/res/layout/stopwatch_time.xml b/res/layout/stopwatch_time.xml index c1895b488..d71498b77 100644 --- a/res/layout/stopwatch_time.xml +++ b/res/layout/stopwatch_time.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 The Android Open Source Project +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2016 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. @@ -14,8 +13,8 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" @@ -34,7 +33,8 @@ android:includeFontPadding="false" android:paddingEnd="3dp" android:paddingStart="30dp" - android:textSize="70sp" /> + android:textSize="72sp" + tools:text="1"/> <TextView android:id="@+id/stopwatch_hundredths_text" @@ -46,6 +46,7 @@ android:includeFontPadding="false" android:paddingEnd="30dp" android:paddingStart="3dp" - android:textSize="30sp" /> + android:textSize="42sp" + tools:text="23"/> </LinearLayout> diff --git a/res/layout/timer_item.xml b/res/layout/timer_item.xml index 607b78245..4b6baaadc 100644 --- a/res/layout/timer_item.xml +++ b/res/layout/timer_item.xml @@ -17,115 +17,76 @@ <!-- This TimerItem discards the circle because space is limited. --> <com.android.deskclock.timer.TimerItem xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="match_parent"> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"> + <LinearLayout + android:layout_width="0.0dip" + android:layout_height="0.0dip" + app:layout_constraintBottom_toTopOf="@id/guideline" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="@dimen/fab_height" - android:orientation="horizontal"> - - <Space - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" /> - - <FrameLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="3"> - - <Button - android:id="@+id/timer_label" - style="?attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:clickable="false" - android:ellipsize="end" - android:gravity="center" - android:hint="@string/label" - android:maxLines="1" - android:minHeight="@dimen/touch_target_min_size" - android:minWidth="@dimen/touch_target_min_size" - android:textAppearance="@style/SecondaryLabelTextAppearance" /> - - </FrameLayout> - - <Space - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" /> - - </LinearLayout> + <TextView + android:id="@id/timer_label" + style="@style/SecondaryLabelTextAppearance" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> <LinearLayout android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" + android:layout_height="0.0dip" + android:layout_weight="1.0" android:orientation="horizontal"> <FrameLayout - android:layout_width="0dp" + android:layout_width="0.0dip" android:layout_height="match_parent" - android:layout_weight="1"> + android:layout_weight="1.0"> <Button - android:id="@+id/reset_add" - style="?attr/borderlessButtonStyle" + android:id="@id/reset_add" + style="?borderlessButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/timer_plus_one" android:gravity="center" - android:scaleType="centerInside" /> - + android:scaleType="centerInside" + android:textColor="?colorPrimary" /> </FrameLayout> <FrameLayout - android:layout_width="0dp" + android:layout_width="0.0dip" android:layout_height="match_parent" - android:layout_weight="3"> + android:layout_weight="3.0"> <com.android.deskclock.widget.AutoSizingTextView - android:id="@+id/timer_time_text" - style="@style/display_time" + android:id="@id/timer_time_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:includeFontPadding="false" - android:paddingEnd="20dp" - android:paddingStart="20dp" - android:textSize="70sp" /> - + android:paddingStart="20.0dip" + android:paddingEnd="20.0dip" + android:textSize="72.0sp" /> </FrameLayout> - - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" /> - - </LinearLayout> - </LinearLayout> - - </FrameLayout> - - <Space - android:layout_width="match_parent" - android:layout_height="@dimen/fab_height" /> - -</com.android.deskclock.timer.TimerItem>
\ No newline at end of file + </LinearLayout> + + <androidx.constraintlayout.widget.Guideline + android:id="@id/guideline" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_end="@dimen/tab_content_bottom_padding" /> +</com.android.deskclock.timer.TimerItem> diff --git a/res/layout/timer_setup_container.xml b/res/layout/timer_setup_container.xml index 1cf0fbb4a..0f0f9c797 100644 --- a/res/layout/timer_setup_container.xml +++ b/res/layout/timer_setup_container.xml @@ -15,8 +15,7 @@ --> <!-- Flanks the timer setup view (which has multiple layouts) with gutters. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> diff --git a/res/layout/timer_setup_digits.xml b/res/layout/timer_setup_digits.xml index 99fd9d2d7..b0aae45da 100644 --- a/res/layout/timer_setup_digits.xml +++ b/res/layout/timer_setup_digits.xml @@ -15,113 +15,184 @@ limitations under the License. --> -<androidx.gridlayout.widget.GridLayout +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layoutDirection="ltr" - app:rowCount="4" - app:columnCount="3"> + android:orientation="vertical"> - <Button - android:id="@+id/timer_setup_digit_1" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" android:layout_height="0dp" - app:layout_row="0" - app:layout_rowWeight="1" - app:layout_column="0" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_2" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="0" - app:layout_rowWeight="1" - app:layout_column="1" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_3" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="0" - app:layout_rowWeight="1" - app:layout_column="2" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_4" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="1" - app:layout_rowWeight="1" - app:layout_column="0" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_5" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="1" - app:layout_rowWeight="1" - app:layout_column="1" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_6" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="1" - app:layout_rowWeight="1" - app:layout_column="2" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_7" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="2" - app:layout_rowWeight="1" - app:layout_column="0" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_8" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="2" - app:layout_rowWeight="1" - app:layout_column="1" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_9" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="2" - app:layout_rowWeight="1" - app:layout_column="2" - app:layout_columnWeight="1" /> - - <Button - android:id="@+id/timer_setup_digit_0" - style="@style/Widget.Button.TimerSetupDigit" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_row="3" - app:layout_rowWeight="1" - app:layout_column="1" - app:layout_columnWeight="1" /> + android:layout_weight="1"> + + <androidx.constraintlayout.widget.Guideline android:orientation="horizontal" android:id="@+id/row_0_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.25" /> + <androidx.constraintlayout.widget.Guideline android:orientation="horizontal" android:id="@+id/row_1_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.5" /> + <androidx.constraintlayout.widget.Guideline android:orientation="horizontal" android:id="@+id/row_2_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.75" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/column_0_right" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.3333" /> + <androidx.constraintlayout.widget.Guideline android:orientation="vertical" android:id="@+id/column_1_right" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintGuide_percent="0.6666" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_1" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="1" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/column_0_right" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toTopOf="@id/row_0_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_2" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="2" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_0_right" + app:layout_constraintEnd_toStartOf="@id/column_1_right" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toTopOf="@id/row_0_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_3" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="3" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_1_right" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="@id/row_0_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_4" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="4" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/column_0_right" + app:layout_constraintTop_toTopOf="@id/row_0_bottom" + app:layout_constraintBottom_toTopOf="@id/row_1_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_5" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="5" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_0_right" + app:layout_constraintEnd_toStartOf="@id/column_1_right" + app:layout_constraintTop_toBottomOf="@id/row_0_bottom" + app:layout_constraintBottom_toTopOf="@id/row_1_bottom"/> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_6" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="6" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_1_right" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/row_0_bottom" + app:layout_constraintBottom_toTopOf="@id/row_1_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_7" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="7" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/column_0_right" + app:layout_constraintTop_toBottomOf="@id/row_1_bottom" + app:layout_constraintBottom_toTopOf="@id/row_2_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_8" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + tools:text="8" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_0_right" + app:layout_constraintEnd_toStartOf="@id/column_1_right" + app:layout_constraintTop_toBottomOf="@id/row_1_bottom" + app:layout_constraintBottom_toTopOf="@id/row_2_bottom" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_9" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_1_right" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/row_1_bottom" + app:layout_constraintBottom_toTopOf="@+id/row_2_bottom" + tools:text="9" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_00" + style="@style/Widget.Button.TimerSetupDigit" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + android:visibility="invisible" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/column_0_right" + app:layout_constraintTop_toBottomOf="@id/row_2_bottom" + app:layout_constraintBottom_toBottomOf="parent"/> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_digit_0" + style="@style/Widget.Button.TimerSetupDigit" + tools:text="0" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_0_right" + app:layout_constraintEnd_toStartOf="@id/column_1_right" + app:layout_constraintTop_toBottomOf="@+id/row_2_bottom" + app:layout_constraintBottom_toBottomOf="parent" /> + + <com.android.deskclock.widget.MotionButton + android:id="@+id/timer_setup_delete" + style="@style/Widget.Button.TimerSetupDigit" + android:text="⌫" + android:scaleType="centerInside" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="4dp" + android:backgroundTint="@color/accent_color2" + android:textColor="@color/secondary_color" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintStart_toEndOf="@id/column_1_right" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/row_2_bottom" + app:layout_constraintBottom_toBottomOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> -</androidx.gridlayout.widget.GridLayout> +</LinearLayout> diff --git a/res/layout/timer_setup_time.xml b/res/layout/timer_setup_time.xml index 572063fc6..2f8f0ea92 100644 --- a/res/layout/timer_setup_time.xml +++ b/res/layout/timer_setup_time.xml @@ -17,7 +17,6 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -38,15 +37,7 @@ android:singleLine="true" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/timer_setup_digit_font_size" - tools:targetApi="21" /> - - <ImageButton - android:id="@+id/timer_setup_delete" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:contentDescription="@string/timer_delete" - android:padding="12dp" - android:scaleType="center" - app:srcCompat="@drawable/ic_backspace" /> + tools:targetApi="21" + tools:text="12h34m56s"/> </LinearLayout> diff --git a/res/layout/timer_setup_view.xml b/res/layout/timer_setup_view.xml index 526862fb9..0a2d1baea 100644 --- a/res/layout/timer_setup_view.xml +++ b/res/layout/timer_setup_view.xml @@ -21,16 +21,9 @@ android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" - android:paddingBottom="@dimen/fab_height"> + android:paddingBottom="@dimen/fab_container_height"> <include layout="@layout/timer_setup_time" /> - <include layout="@layout/timer_setup_divider" /> - - <include - layout="@layout/timer_setup_digits" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" /> - + <include layout="@layout/timer_setup_digits"/> </LinearLayout> diff --git a/res/layout/widget_switch_compat.xml b/res/layout/widget_switch_compat.xml new file mode 100644 index 000000000..221d04c25 --- /dev/null +++ b/res/layout/widget_switch_compat.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 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. + --> + +<!-- Layout used by SwitchPreference for the switch widget style. This is inflated + inside android.R.layout.preference. --> +<androidx.appcompat.widget.SwitchCompat + xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/DeskClock.Switch" + android:id="@+id/switchWidget" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="false" + android:clickable="false" + android:background="@null"/> diff --git a/res/layout/world_clock_city_container.xml b/res/layout/world_clock_city_container.xml index 5fa97983f..daa3ef6bf 100644 --- a/res/layout/world_clock_city_container.xml +++ b/res/layout/world_clock_city_container.xml @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/city_container" android:layout_width="0dp" android:layout_height="wrap_content" @@ -26,7 +26,8 @@ android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" - android:textAppearance="@style/body"/> + android:textAppearance="@style/body" + tools:text="Fictive city"/> <TextView android:id="@+id/hours_ahead" @@ -36,7 +37,8 @@ android:ellipsize="end" android:maxLines="2" android:scrollHorizontally="true" - android:textAppearance="@style/SecondaryLabelTextAppearance"/> + android:textAppearance="@style/SecondaryLabelTextAppearance" + tools:text="1 hour ahead"/> </LinearLayout> diff --git a/res/layout/world_clock_item.xml b/res/layout/world_clock_item.xml index 080c0bf0c..d7dca6bef 100644 --- a/res/layout/world_clock_item.xml +++ b/res/layout/world_clock_item.xml @@ -16,20 +16,20 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + style="@style/MaterialCardViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal"> - - <!-- Left gutter. --> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> + android:orientation="horizontal" + android:background="@drawable/alarm_background" + android:paddingTop="24.0dip" + android:paddingBottom="24.0dip" + android:paddingStart="16.0dip" + android:paddingEnd="16.0dip"> <LinearLayout - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="@integer/guttered_content_width_percent" android:gravity="center_vertical"> <include @@ -38,14 +38,15 @@ android:layout_height="wrap_content" android:layout_weight="1" /> - <TextClock + <com.android.deskclock.widget.AutoSizingTextClock android:id="@+id/digital_clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="24dp" android:layout_gravity="end" android:singleLine="true" - android:textAppearance="@style/world_clock_time"/> + android:textAppearance="@style/world_clock_time" + tools:text="01:23"/> <com.android.deskclock.AnalogClock android:id="@+id/analog_clock" @@ -53,14 +54,8 @@ android:layout_height="@dimen/world_clock_analog_size" android:paddingStart="24dp" android:layout_gravity="end" - android:layout_marginBottom="@dimen/bottom_text_spacing_analog_small" /> + android:layout_marginBottom="@dimen/bottom_text_spacing_analog_small" + android:visibility="gone"/> </LinearLayout> - - <!-- Right gutter. --> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/gutter_width_percent" /> - -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index ea3ec5e5b..6378cecc6 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -26,4 +26,6 @@ <dimen name="circle_margin_top">0dp</dimen> <dimen name="bottom_text_spacing_analog">5dp</dimen> + + <dimen name="timer_setup_digit_font_size">56sp</dimen> </resources> diff --git a/res/values-land/fractions.xml b/res/values-land/fractions.xml index 4642e0ed4..9e515bc3f 100644 --- a/res/values-land/fractions.xml +++ b/res/values-land/fractions.xml @@ -19,5 +19,5 @@ <fraction name="timer_circle_width_percent">-100%</fraction> <!-- In landscape, timer circles are 90% of the container height; width matches height. --> - <fraction name="timer_circle_height_percent">90%</fraction> + <fraction name="timer_circle_height_percent">100%</fraction> </resources>
\ No newline at end of file diff --git a/res/values-land/lineage_dimens.xml b/res/values-land/lineage_dimens.xml new file mode 100644 index 000000000..e9fb54bf0 --- /dev/null +++ b/res/values-land/lineage_dimens.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="fab_container_height">0dp</dimen> + <dimen name="tab_content_bottom_padding">8dp</dimen> +</resources>
\ No newline at end of file diff --git a/res/values-v22/drawable.xml b/res/values-v22/drawable.xml index 22234f3e1..8d3ecffa1 100644 --- a/res/values-v22/drawable.xml +++ b/res/values-v22/drawable.xml @@ -22,8 +22,4 @@ <item name="ic_tab_timer" type="drawable">@drawable/ic_tab_timer_animated</item> <item name="ic_tab_stopwatch" type="drawable">@drawable/ic_tab_stopwatch_animated</item> <item name="ic_ringtone_active" type="drawable">@drawable/ic_ringtone_active_animated</item> - - <item name="ic_caret_up" type="drawable">@drawable/ic_caret_up_animation</item> - <item name="ic_caret_down" type="drawable">@drawable/ic_caret_down_animation</item> - -</resources>
\ No newline at end of file +</resources> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 2baa4997a..9a619bced 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -29,4 +29,22 @@ <attr name="radius" format="dimension" /> </declare-styleable> + <attr name="onStateTransition"> + <enum name="actionDown" value="1" /> + <enum name="actionDownUp" value="3" /> + <enum name="actionUp" value="2" /> + <enum name="sharedValueSet" value="4" /> + <enum name="sharedValueUnset" value="5" /> + </attr> + + <attr name="viewTransitionMode"> + <enum name="allStates" value="1" /> + <enum name="currentState" value="0" /> + <enum name="noState" value="2" /> + </attr> + + <declare-styleable name="MotionButton"> + <attr format="dimension" name="round"/> + <attr format="float" name="roundPercent"/> + </declare-styleable> </resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index a4f007272..caf28fb28 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -38,4 +38,5 @@ <string name="stopwatch_channel">Stopwatch</string> <string name="timer_channel">Timer</string> + <string name="add_label">Add label</string> </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 519b470ba..91ca13873 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -33,11 +33,41 @@ <color name="clock_gray">#B3FFFFFF</color> - <color name="default_background">#1A237E</color> + <color name="default_background">@android:color/system_neutral1_900</color> <!-- shadowColor for widget text --> <color name="widget_shadow_color">#000000</color> - <color name="accent_color">#FFEB40</color> - <color name="secondary_color">#2F378A</color> + <color name="accent_color">@android:color/system_accent3_200</color> + <color name="accent_color2">@android:color/system_accent2_200</color> + <color name="secondary_color">@android:color/system_neutral1_800</color> + <color name="default_background_lighter">@android:color/system_neutral2_800</color> + + <!-- Material next state on color--> + <color name="state_on_color">@color/accent_100</color> + + <!-- Material next thumb disable color--> + <color name="thumb_disabled_color">@color/black</color> + + <!-- Material next thumb off color--> + <color name="thumb_off_color">@color/default_background</color> + + <!-- Material next track on color--> + <color name="track_on_color">@color/accent_color</color> + + <!-- Material next track off color--> + <color name="track_off_color">@color/system_neutral2_500</color> + + <color name="system_neutral2_100">@android:color/system_neutral2_100</color> + <color name="system_neutral2_300">@android:color/system_neutral2_300</color> + <color name="system_neutral2_500">@android:color/system_neutral2_500</color> + <color name="system_neutral2_700">@android:color/system_neutral2_700</color> + + <color name="system_neutral1_50">@android:color/system_neutral1_50</color> + + <color name="accent_100">@android:color/system_accent3_100</color> + <color name="accent_200">@android:color/system_accent3_200</color> + <color name="accent_600">@android:color/system_accent3_600</color> + <color name="accent_900">@android:color/system_accent3_900</color> + </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 6a384e94b..856ef8241 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -34,8 +34,7 @@ <dimen name="alarm_text_font_size">16sp</dimen> <dimen name="circletimer_dot_size">12dp</dimen> - <dimen name="circletimer_circle_size">4dp</dimen> - <dimen name="circletimer_marker_size">16dp</dimen> + <dimen name="circletimer_circle_size">12dp</dimen> <dimen name="max_timer_circle_size">360dp</dimen> <dimen name="alarm_lockscreen_alarm_horizontal_padding">16dp</dimen> @@ -52,7 +51,7 @@ <dimen name="day_button_font_size">16sp</dimen> <dimen name="alarm_info_font_size">36sp</dimen> <dimen name="no_alarm_font_size">16sp</dimen> - <dimen name="timer_setup_digit_font_size">42sp</dimen> + <dimen name="timer_setup_digit_font_size">72sp</dimen> <dimen name="timer_setup_top_size">120dip</dimen> <dimen name="alarm_picker_dialog_horizontal_margin">30dp</dimen> @@ -129,4 +128,16 @@ <!-- KitKat floating action button container height; see -v21 folder for newer platforms. --> <dimen name="fab_height">96dp</dimen> + + <dimen name="fab_container_height">120dp</dimen> + <dimen name="tab_content_bottom_padding">@dimen/fab_container_height</dimen> + + <dimen name="gutter_horizontal_padding">24.0dip</dimen> + <dimen name="gutter_horizontal_padding_extreme_thin">4.0dip</dimen> + <dimen name="gutter_horizontal_padding_thin">16.0dip</dimen> + <dimen name="gutter_horizontal_padding_very_thin">8.0dip</dimen> + + <dimen name="alarm_clock_expanded_vertical_margin">8dp</dimen> + + <dimen name="settings_padding">4dp</dimen> </resources> diff --git a/res/values-night/colors.xml b/res/values/dimens_settingslib.xml index be5642398..8f3a3f85a 100644 --- a/res/values-night/colors.xml +++ b/res/values/dimens_settingslib.xml @@ -1,22 +1,23 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2016 The Android Open Source Project + Copyright (C) 2021 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 + 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. - --> - +--> <resources> - <color name="default_background">#121212</color> - <color name="accent_color">#FEF177</color> - <color name="secondary_color">#212121</color> + <!-- Collapsing toolbar layout dimensions --> + <dimen name="settingslib_toolbar_layout_height">179dp</dimen> + <dimen name="settingslib_scrim_visible_height_trigger">137dp</dimen> + <dimen name="expanded_title_margin_start">24dp</dimen> + <dimen name="expanded_title_margin_end">24dp</dimen> </resources> diff --git a/res/values/drawable.xml b/res/values/drawable.xml index f010c4ba6..cace85bd0 100644 --- a/res/values/drawable.xml +++ b/res/values/drawable.xml @@ -22,8 +22,4 @@ <item name="ic_tab_timer" type="drawable">@drawable/ic_tab_timer_static</item> <item name="ic_tab_stopwatch" type="drawable">@drawable/ic_tab_stopwatch_static</item> <item name="ic_ringtone_active" type="drawable">@drawable/ic_ringtone_active_static</item> - - <item name="ic_caret_up" type="drawable">@drawable/ic_caret_up_static</item> - <item name="ic_caret_down" type="drawable">@drawable/ic_caret_down_static</item> - -</resources>
\ No newline at end of file +</resources> diff --git a/res/values/fractions.xml b/res/values/fractions.xml index 62c866d99..d81b6afa5 100644 --- a/res/values/fractions.xml +++ b/res/values/fractions.xml @@ -19,5 +19,5 @@ <fraction name="timer_circle_height_percent">-100%</fraction> <!-- In portrait, timer circles are 60% of the container width; height matches width. --> - <fraction name="timer_circle_width_percent">60%</fraction> -</resources>
\ No newline at end of file + <fraction name="timer_circle_width_percent">80%</fraction> +</resources> diff --git a/res/values/integers.xml b/res/values/integers.xml index 6c0ecd41e..9f9e4eb53 100644 --- a/res/values/integers.xml +++ b/res/values/integers.xml @@ -16,5 +16,5 @@ <resources> <integer name="gutter_width_percent">4</integer> - <integer name="guttered_content_width_percent">92</integer> + <integer name="guttered_content_width_percent">96</integer> </resources>
\ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml index fbe62ae3a..6103f4458 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -44,7 +44,7 @@ <style name="display_time"> <item name="android:textSize">56sp</item> <item name="android:textColor">@color/white</item> - <item name="android:fontFamily">sans-serif-light</item> + <item name="android:fontFamily">sans-serif</item> <item name="android:fontFeatureSettings" tools:targetApi="21">tnum</item> </style> @@ -76,14 +76,6 @@ <item name="android:shadowDy">@dimen/widget_shadow_dy</item> </style> - <style name="alarm_label"> - <item name="android:textSize">@dimen/alarm_label_size</item> - </style> - - <style name="alarm_label_bold" parent="alarm_label"> - <item name="android:textStyle">bold</item> - </style> - <style name="PrimaryLabelTextParentAppearance"> <item name="android:textColor">@color/white</item> <item name="android:textSize">@dimen/label_text_size</item> @@ -115,23 +107,84 @@ </style> <style name="Widget.Button.TimerSetupDigit" parent="Widget.AppCompat.Button.Borderless"> - <item name="android:background">?attr/selectableItemBackgroundBorderless</item> - <item name="android:fontFamily">sans-serif-light</item> + <item name="android:foreground">?attr/selectableItemBackgroundBorderless</item> + <item name="android:background">@drawable/digit_background</item> + <item name="android:fontFamily">sans-serif</item> <item name="android:gravity">center</item> <item name="android:includeFontPadding">false</item> <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">36sp</item> + <item name="android:layout_margin">2.0dip</item> + <item name="layout_constraintDimensionRatio">1:1</item> + <item name="roundPercent">1.0</item> + <item name="autoSizeMaxTextSize">36sp</item> + <item name="autoSizeTextType">uniform</item> </style> <style name="Widget.ImageButton" parent="Widget.AppCompat.ImageButton"> <item name="android:background">?attr/selectableItemBackgroundBorderless</item> </style> - <style name="Widget.TimePicker" parent="android:Widget.Material.TimePicker" - tools:targetApi="21"> - <item name="android:headerBackground">@android:color/transparent</item> - <item name="android:numbersBackgroundColor">@android:color/transparent</item> + <style name="Widget.TimePicker" parent="android:Widget.Material.TimePicker"> + <item name="android:background">@color/default_background</item> + <item name="android:headerBackground">@color/system_neutral2_700</item> + <item name="android:numbersBackgroundColor">@color/system_neutral2_700</item> <item name="android:numbersSelectorColor">?attr/colorAccent</item> </style> + <style name="AlertDialogTheme" parent="@style/ThemeOverlay.AppCompat.Dialog.Alert"> + <item name="android:background">@drawable/popup_background</item> + <item name="dialogCornerRadius">28dp</item> + </style> + + <style name="DeskClock.Settings.DropDownSpinnerStyle" parent="@android:style/Widget.Material.Spinner"> + <item name="android:popupBackground">@drawable/popup_background</item> + </style> + + <style name="DeskClock.Switch" parent="@android:style/Widget.Material.CompoundButton.Switch"> + <item name="android:switchMinWidth">52dp</item> + <item name="android:minHeight">@dimen/touch_target_min_size</item> + <item name="android:track">@drawable/switch_track</item> + <item name="track">@drawable/switch_track</item> + <item name="android:thumb">@drawable/switch_thumb</item> + <item name="thumbTint">@color/default_background</item> + </style> + + <style name="DeskClock.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material"> + <item name="iconSpaceReserved">false</item> + <item name="android:widgetLayout">@layout/widget_switch_compat</item> + </style> + + <style name="TimerLabelTextAppearance" parent="SecondaryLabelTextAppearance"> + <item name="android:textSize">32sp</item> + </style> + + <style name="MaterialCardViewStyle"> + <item name="android:layout_marginTop">8.0dip</item> + <item name="android:layout_marginStart">16.0dip</item> + <item name="android:layout_marginEnd">16.0dip</item> + <item name="elevation">0.0dip</item> + </style> + + <style name="DayButtonStyle"> + <item name="android:textSize">@dimen/day_button_font_size</item> + <item name="android:gravity">center</item> + <item name="android:background">@drawable/toggle_circle</item> + <item name="android:layout_width">@dimen/touch_target_min_size</item> + <item name="android:layout_height">@dimen/touch_target_min_size</item> + <item name="android:button">@null</item> + </style> + + <style name="SnackBarStyle" parent="@style/Widget.MaterialComponents.Snackbar"> + <item name="android:background">@drawable/popup_background</item> + <item name="android:layout_margin">@null</item> + <item name="android:layout_marginLeft">8.0dip</item> + <item name="android:layout_marginTop">8.0dip</item> + <item name="android:layout_marginRight">8.0dip</item> + <item name="android:layout_marginBottom">8dp</item> + </style> + + <style name="TextAppearance.Title" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"> + <item name="android:textSize">22.0sp</item> + </style> </resources> diff --git a/res/values/styles_settingslib.xml b/res/values/styles_settingslib.xml new file mode 100644 index 000000000..9c54c840c --- /dev/null +++ b/res/values/styles_settingslib.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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. +--> +<resources> + <style name="CollapsingToolbarTitle.Collapsed" parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title"> + <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> + <item name="android:textSize">20dp</item> + <item name="android:textColor">@android:color/system_neutral1_50</item> + </style> + + <style name="CollapsingToolbarTitle.Expanded" parent="CollapsingToolbarTitle.Collapsed"> + <item name="android:textSize">36dp</item> + <item name="android:textColor">@android:color/system_neutral1_50</item> + </style> +</resources> diff --git a/res/values/themes.xml b/res/values/themes.xml index 63216f441..0272f6864 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -22,37 +22,39 @@ ?attr/colorBackgroundFloating </item> <item name="android:navigationBarColor" tools:targetApi="21">?attr/colorPrimaryDark</item> - <item name="android:popupTheme" tools:targetApi="21">?attr/popupTheme</item> + <item name="popupTheme">@style/ThemeOverlay.Popup</item> + <item name="android:timePickerStyle" tools:targetApi="21">@style/Widget.TimePicker</item> <item name="android:windowBackground">@color/default_background</item> <item name="android:windowContentOverlay">@null</item> - <!-- Attributes from androidx.appcompat.appcompat --> <item name="colorAccent">@color/accent_color</item> - <item name="colorBackgroundFloating">#303030</item> + <item name="android:colorSecondary">@color/secondary_color</item> + <item name="android:colorForeground">@android:color/system_neutral1_50</item> + <item name="colorSurface">@android:color/system_neutral1_500</item> + <item name="colorBackgroundFloating">@android:color/system_neutral1_500</item> <item name="colorControlActivated">@android:color/white</item> <item name="colorControlNormal">?android:attr/textColorPrimary</item> - <item name="colorPrimaryDark">#66000000</item> + <item name="colorPrimaryDark">#00000000</item> <item name="imageButtonStyle">@style/Widget.ImageButton</item> - <item name="popupTheme">@style/ThemeOverlay.Popup</item> + + <item name="android:switchStyle">@style/DeskClock.Switch</item> + <item name="alertDialogTheme">@style/AlertDialogTheme</item> + <item name="snackbarStyle">@style/SnackBarStyle</item> + <item name="actionBarSize">64dp</item> </style> <style name="Theme.DeskClock.Settings"> - <!-- Attributes from androidx.appcompat.appcompat --> - <item name="actionBarStyle">@style/Widget.ActionBar</item> + <item name="colorPrimary">@color/default_background</item> + <item name="elevationOverlayColor">?attr/colorPrimary</item> <item name="colorControlActivated">?attr/colorAccent</item> - <item name="windowActionBar">true</item> - <item name="windowNoTitle">false</item> - - <!-- Attributes from androidx.preference.--> - <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> + <item name="android:switchStyle">@style/DeskClock.Switch</item> + <item name="preferenceTheme">@style/Theme.DeskClock.Settings.PreferenceTheme</item> + <item name="android:dropDownSpinnerStyle">@style/DeskClock.Settings.DropDownSpinnerStyle</item> </style> - <style name="Theme.DeskClock.RingtonePicker"> - <!-- Attributes from androidx.appcompat.appcompat --> - <item name="actionBarStyle">@style/Widget.ActionBar</item> - <item name="windowActionBar">true</item> - <item name="windowNoTitle">false</item> + <style name="Theme.DeskClock.Settings.PreferenceTheme" parent="@style/PreferenceThemeOverlay"> + <item name="switchPreferenceCompatStyle">@style/DeskClock.SwitchPreferenceCompat</item> </style> <style name="Theme.DeskClock.CitySelection"> @@ -67,8 +69,8 @@ <item name="colorControlActivated">?attr/colorAccent</item> </style> - <style name="ThemeOverlay.Popup" parent="ThemeOverlay.AppCompat"> - <item name="android:colorBackground">?attr/colorBackgroundFloating</item> + <style name="ThemeOverlay.Popup" parent="Widget.AppCompat.PopupMenu"> + <item name="android:background">@drawable/popup_background</item> + <item name="android:colorBackground">@color/transparent</item> </style> - </resources> diff --git a/res/layout/timer_setup_divider.xml b/res/values/themes_settingslib.xml index a15d3e998..6867dfb5b 100644 --- a/res/layout/timer_setup_divider.xml +++ b/res/values/themes_settingslib.xml @@ -1,26 +1,24 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2016 The Android Open Source Project + Copyright (C) 2021 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 + 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. - --> - -<ImageView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/timer_setup_divider" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:importantForAccessibility="no" - android:theme="@style/ThemeOverlay.Control.Accent" - android:background="?android:attr/dividerHorizontal" /> +--> +<resources> + <style name="Theme.CollapsingToolbar.Settings" parent="@style/Theme.MaterialComponents.DayNight.DarkActionBar"> + <item name="elevationOverlayEnabled">true</item> + <item name="elevationOverlayColor">?colorPrimary</item> + <item name="colorPrimary">@color/default_background</item> + <item name="colorAccent">@color/accent_color</item> + </style> +</resources> diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 6e65a3e25..ee7669033 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -14,48 +14,60 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:title="@string/settings"> + <PreferenceCategory - android:title="@string/clock_settings"> + android:title="@string/clock_settings" + app:iconSpaceReserved="false"> + <com.android.deskclock.settings.SimpleMenuPreference android:defaultValue="@string/default_clock_style" android:dialogTitle="@string/clock_style" android:entries="@array/clock_style_entries" android:entryValues="@array/clock_style_values" android:key="clock_style" - android:title="@string/clock_style" /> + android:title="@string/clock_style" + app:iconSpaceReserved="false" /> <SwitchPreferenceCompat android:key="display_clock_seconds" - android:title="@string/display_clock_seconds_pref" /> + android:title="@string/display_clock_seconds_pref" + app:iconSpaceReserved="false" /> <SwitchPreferenceCompat android:defaultValue="true" android:key="automatic_home_clock" android:summary="@string/automatic_home_clock_summary" - android:title="@string/automatic_home_clock" /> + android:title="@string/automatic_home_clock" + app:iconSpaceReserved="false" /> <ListPreference android:dialogTitle="@string/home_time_zone_title" android:entries="@array/timezone_labels" android:entryValues="@array/timezone_values" android:key="home_time_zone" - android:title="@string/home_time_zone" /> + android:title="@string/home_time_zone" + app:iconSpaceReserved="false" /> <Preference android:key="date_time" - android:title="@string/open_date_settings" /> + android:title="@string/open_date_settings" + app:iconSpaceReserved="false" /> </PreferenceCategory> <PreferenceCategory - android:title="@string/alarm_settings"> + android:title="@string/alarm_settings" + app:iconSpaceReserved="false"> + <ListPreference android:defaultValue="10" android:dialogTitle="@string/auto_silence_title" android:entries="@array/auto_silence_entries" android:entryValues="@array/auto_silence_values" android:key="auto_silence" - android:title="@string/auto_silence_title" /> + android:title="@string/auto_silence_title" + app:iconSpaceReserved="false" /> <ListPreference android:defaultValue="10" @@ -63,7 +75,8 @@ android:entries="@array/snooze_duration_entries" android:entryValues="@array/snooze_duration_values" android:key="snooze_duration" - android:title="@string/snooze_duration_title" /> + android:title="@string/snooze_duration_title" + app:iconSpaceReserved="false" /> <com.android.deskclock.settings.AlarmVolumePreference android:key="volume_setting" @@ -77,7 +90,8 @@ android:entries="@array/crescendo_entries" android:entryValues="@array/crescendo_values" android:key="alarm_crescendo_duration" - android:title="@string/crescendo_duration_title" /> + android:title="@string/crescendo_duration_title" + app:iconSpaceReserved="false" /> <com.android.deskclock.settings.SimpleMenuPreference android:defaultValue="0" @@ -85,7 +99,8 @@ android:entries="@array/volume_button_setting_entries" android:entryValues="@array/volume_button_setting_values" android:key="volume_button_setting" - android:title="@string/volume_button_setting_title" /> + android:title="@string/volume_button_setting_title" + app:iconSpaceReserved="false" /> <com.android.deskclock.settings.SimpleMenuPreference android:defaultValue="0" @@ -93,7 +108,8 @@ android:entries="@array/action_setting_entries" android:entryValues="@array/volume_button_setting_values" android:key="flip_action" - android:title="@string/flip_action_title" /> + android:title="@string/flip_action_title" + app:iconSpaceReserved="false" /> <com.android.deskclock.settings.SimpleMenuPreference android:defaultValue="0" @@ -101,21 +117,26 @@ android:entries="@array/action_setting_entries" android:entryValues="@array/volume_button_setting_values" android:key="shake_action" - android:title="@string/shake_action_title" /> + android:title="@string/shake_action_title" + app:iconSpaceReserved="false" /> <com.android.deskclock.settings.SimpleMenuPreference android:dialogTitle="@string/week_start_title" android:entries="@array/week_start_entries" android:entryValues="@array/week_start_values" android:key="week_start" - android:title="@string/week_start_title" /> + android:title="@string/week_start_title" + app:iconSpaceReserved="false" /> </PreferenceCategory> <PreferenceCategory - android:title="@string/timer_settings"> + android:title="@string/timer_settings" + app:iconSpaceReserved="false"> + <Preference android:key="timer_ringtone" - android:title="@string/timer_sound" /> + android:title="@string/timer_sound" + app:iconSpaceReserved="false" /> <ListPreference android:defaultValue="0" @@ -123,13 +144,14 @@ android:entries="@array/crescendo_entries" android:entryValues="@array/crescendo_values" android:key="timer_crescendo_duration" - android:title="@string/crescendo_duration_title" /> - + android:title="@string/crescendo_duration_title" + app:iconSpaceReserved="false" /> <SwitchPreferenceCompat android:defaultValue="false" android:key="timer_vibrate" - android:title="@string/timer_vibrate_title" /> + android:title="@string/timer_vibrate_title" + app:iconSpaceReserved="false" /> </PreferenceCategory> </PreferenceScreen> diff --git a/src/com/android/deskclock/AlarmClockFragment.java b/src/com/android/deskclock/AlarmClockFragment.java index bf4852855..5fe9ba805 100644 --- a/src/com/android/deskclock/AlarmClockFragment.java +++ b/src/com/android/deskclock/AlarmClockFragment.java @@ -25,7 +25,6 @@ import android.os.SystemClock; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -119,12 +118,13 @@ public final class AlarmClockFragment extends DeskClockFragment implements mRecyclerView = (RecyclerView) v.findViewById(R.id.alarms_recycler_view); mLayoutManager = new LinearLayoutManager(context) { @Override - protected int getExtraLayoutSpace(RecyclerView.State state) { - final int extraSpace = super.getExtraLayoutSpace(state); - if (state.willRunPredictiveAnimations()) { - return Math.max(getHeight(), extraSpace); - } - return extraSpace; + protected void calculateExtraLayoutSpace(@NonNull RecyclerView.State state, + @NonNull int[] extraLayoutSpace) { + // We need enough space so after expand/collapse, other items are still + // shown properly. The multiplier was chosen after tests + extraLayoutSpace[0] = 2 * getHeight(); + extraLayoutSpace[1] = extraLayoutSpace[0]; + } }; mRecyclerView.setLayoutManager(mLayoutManager); @@ -398,7 +398,7 @@ public final class AlarmClockFragment extends DeskClockFragment implements } @Override - public void onUpdateFabButtons(@NonNull Button left, @NonNull Button right) { + public void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right) { left.setVisibility(View.INVISIBLE); right.setVisibility(View.INVISIBLE); } diff --git a/src/com/android/deskclock/AnimatorUtils.java b/src/com/android/deskclock/AnimatorUtils.java index 9b3cc6fb2..f78bd1e98 100644 --- a/src/com/android/deskclock/AnimatorUtils.java +++ b/src/com/android/deskclock/AnimatorUtils.java @@ -26,13 +26,14 @@ import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import android.util.Property; import android.view.View; import android.view.animation.Interpolator; import android.widget.ImageView; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.interpolator.view.animation.FastOutSlowInInterpolator; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/src/com/android/deskclock/CircleButtonsLayout.java b/src/com/android/deskclock/CircleButtonsLayout.java index c77a823e6..72672e641 100644 --- a/src/com/android/deskclock/CircleButtonsLayout.java +++ b/src/com/android/deskclock/CircleButtonsLayout.java @@ -31,9 +31,7 @@ public class CircleButtonsLayout extends FrameLayout { final Resources res = getContext().getResources(); final float strokeSize = res.getDimension(R.dimen.circletimer_circle_size); - final float dotStrokeSize = res.getDimension(R.dimen.circletimer_dot_size); - final float markerStrokeSize = res.getDimension(R.dimen.circletimer_marker_size); - mDiamOffset = Utils.calculateRadiusOffset(strokeSize, dotStrokeSize, markerStrokeSize) * 2; + mDiamOffset = strokeSize * 2; } @Override diff --git a/src/com/android/deskclock/ClockFragment.java b/src/com/android/deskclock/ClockFragment.java index 0ab1f4e9d..e9654f895 100644 --- a/src/com/android/deskclock/ClockFragment.java +++ b/src/com/android/deskclock/ClockFragment.java @@ -28,20 +28,20 @@ import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import android.text.format.DateUtils; import android.view.GestureDetector; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.ImageView; import android.widget.TextClock; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.android.deskclock.data.City; import com.android.deskclock.data.CityListener; import com.android.deskclock.data.DataModel; @@ -210,7 +210,7 @@ public final class ClockFragment extends DeskClockFragment { } @Override - public void onUpdateFabButtons(@NonNull Button left, @NonNull Button right) { + public void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right) { left.setVisibility(INVISIBLE); right.setVisibility(INVISIBLE); } @@ -401,7 +401,7 @@ public final class ClockFragment extends DeskClockFragment { break; case MAIN_CLOCK: ((MainClockViewHolder) holder).bind(mContext, mDateFormat, - mDateFormatForAccessibility, getItemCount() > 1); + mDateFormatForAccessibility); break; default: throw new IllegalArgumentException("Unexpected view type: " + viewType); @@ -524,27 +524,23 @@ public final class ClockFragment extends DeskClockFragment { private static final class MainClockViewHolder extends RecyclerView.ViewHolder { - private final View mHairline; private final TextClock mDigitalClock; private final AnalogClock mAnalogClock; private MainClockViewHolder(View itemView) { super(itemView); - mHairline = itemView.findViewById(R.id.hairline); mDigitalClock = (TextClock) itemView.findViewById(R.id.digital_clock); mAnalogClock = (AnalogClock) itemView.findViewById(R.id.analog_clock); Utils.setClockIconTypeface(itemView); } private void bind(Context context, String dateFormat, - String dateFormatForAccessibility, boolean showHairline) { + String dateFormatForAccessibility) { Utils.refreshAlarm(context, itemView); Utils.updateDate(dateFormat, dateFormatForAccessibility, itemView); Utils.setClockStyle(mDigitalClock, mAnalogClock); - mHairline.setVisibility(showHairline ? VISIBLE : GONE); - Utils.setClockSecondsEnabled(mDigitalClock, mAnalogClock); } } diff --git a/src/com/android/deskclock/DeskClock.java b/src/com/android/deskclock/DeskClock.java index c2026fef4..8cc7d4b45 100644 --- a/src/com/android/deskclock/DeskClock.java +++ b/src/com/android/deskclock/DeskClock.java @@ -22,23 +22,21 @@ import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.content.Intent; import android.content.pm.PackageManager; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; + import androidx.annotation.NonNull; import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; -import androidx.viewpager.widget.ViewPager.OnPageChangeListener; import com.android.deskclock.actionbarmenu.MenuItemControllerFactory; import com.android.deskclock.actionbarmenu.NightModeMenuItemController; @@ -48,7 +46,6 @@ import com.android.deskclock.data.DataModel; import com.android.deskclock.data.DataModel.SilentSetting; import com.android.deskclock.data.OnSilentSettingsListener; import com.android.deskclock.events.Events; -import com.android.deskclock.LogUtils; import com.android.deskclock.provider.Alarm; import com.android.deskclock.uidata.TabListener; import com.android.deskclock.uidata.UiDataModel; @@ -57,9 +54,6 @@ import com.android.deskclock.widget.toast.SnackbarManager; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.snackbar.Snackbar; -import static androidx.viewpager.widget.ViewPager.SCROLL_STATE_DRAGGING; -import static androidx.viewpager.widget.ViewPager.SCROLL_STATE_IDLE; -import static androidx.viewpager.widget.ViewPager.SCROLL_STATE_SETTLING; import static android.text.format.DateUtils.SECOND_IN_MILLIS; import static com.android.deskclock.AnimatorUtils.getScaleAnimator; @@ -108,10 +102,10 @@ public class DeskClock extends BaseActivity private ImageView mFab; /** The button left of the {@link #mFab} shared across all tabs in the user interface. */ - private Button mLeftButton; + private ImageView mLeftButton; /** The button right of the {@link #mFab} shared across all tabs in the user interface. */ - private Button mRightButton; + private ImageView mRightButton; /** The ViewPager that pages through the fragments representing the content of the tabs. */ private ViewPager mFragmentTabPager; @@ -170,8 +164,8 @@ public class DeskClock extends BaseActivity // Configure the buttons shared by the tabs. mFab = (ImageView) findViewById(R.id.fab); - mLeftButton = (Button) findViewById(R.id.left_button); - mRightButton = (Button) findViewById(R.id.right_button); + mLeftButton = (ImageView) findViewById(R.id.left_button); + mRightButton = (ImageView) findViewById(R.id.right_button); mFab.setOnClickListener(new OnClickListener() { @Override diff --git a/src/com/android/deskclock/DeskClockFragment.java b/src/com/android/deskclock/DeskClockFragment.java index c08a15a8e..5db0c27c4 100644 --- a/src/com/android/deskclock/DeskClockFragment.java +++ b/src/com/android/deskclock/DeskClockFragment.java @@ -17,8 +17,8 @@ package com.android.deskclock; import android.view.KeyEvent; -import android.widget.Button; import android.widget.ImageView; + import androidx.annotation.ColorInt; import androidx.annotation.Keep; import androidx.annotation.NonNull; @@ -55,12 +55,12 @@ public abstract class DeskClockFragment extends Fragment implements FabContainer } @Override - public void onLeftButtonClick(@NonNull Button left) { + public void onLeftButtonClick(@NonNull ImageView left) { // Do nothing here, only in derived classes } @Override - public void onRightButtonClick(@NonNull Button right) { + public void onRightButtonClick(@NonNull ImageView right) { // Do nothing here, only in derived classes } diff --git a/src/com/android/deskclock/FabController.java b/src/com/android/deskclock/FabController.java index 11c5d5375..8a121bf87 100644 --- a/src/com/android/deskclock/FabController.java +++ b/src/com/android/deskclock/FabController.java @@ -2,7 +2,6 @@ package com.android.deskclock; import androidx.annotation.NonNull; import android.view.View; -import android.widget.Button; import android.widget.ImageView; /** @@ -35,7 +34,7 @@ public interface FabController { * @param left button to the left of the fab to configure based on current state * @param right button to the right of the fab to configure based on current state */ - void onUpdateFabButtons(@NonNull Button left, @NonNull Button right); + void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right); /** * Handles a click on the fab. @@ -49,14 +48,14 @@ public interface FabController { * * @param left the button to the left of the fab component */ - void onLeftButtonClick(@NonNull Button left); + void onLeftButtonClick(@NonNull ImageView left); /** * Handles a click on the button to the right of the fab component. * * @param right the button to the right of the fab component */ - void onRightButtonClick(@NonNull Button right); + void onRightButtonClick(@NonNull ImageView right); /** * diff --git a/src/com/android/deskclock/alarms/AlarmNotifications.java b/src/com/android/deskclock/alarms/AlarmNotifications.java index 208ee4fe6..2920485a5 100644 --- a/src/com/android/deskclock/alarms/AlarmNotifications.java +++ b/src/com/android/deskclock/alarms/AlarmNotifications.java @@ -384,8 +384,8 @@ public final class AlarmNotifications { PendingIntent snoozePendingIntent = PendingIntent.getService(service, ALARM_FIRING_NOTIFICATION_ID, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); - notification.addAction(R.drawable.ic_snooze_24dp, - resources.getString(R.string.alarm_alert_snooze_text), snoozePendingIntent); + notification.addAction(0, resources.getString(R.string.alarm_alert_snooze_text), + snoozePendingIntent); // Setup Dismiss Action Intent dismissIntent = AlarmStateManager.createStateChangeIntent(service, diff --git a/src/com/android/deskclock/alarms/AlarmTimeClickHandler.java b/src/com/android/deskclock/alarms/AlarmTimeClickHandler.java index acc7ec03a..5daf41cae 100644 --- a/src/com/android/deskclock/alarms/AlarmTimeClickHandler.java +++ b/src/com/android/deskclock/alarms/AlarmTimeClickHandler.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Vibrator; + import androidx.fragment.app.Fragment; import com.android.deskclock.AlarmClockFragment; @@ -28,7 +29,6 @@ import com.android.deskclock.LogUtils; import com.android.deskclock.R; import com.android.deskclock.alarms.dataadapter.AlarmItemHolder; import com.android.deskclock.data.DataModel; -import com.android.deskclock.data.Weekdays; import com.android.deskclock.events.Events; import com.android.deskclock.provider.Alarm; import com.android.deskclock.provider.AlarmInstance; @@ -102,36 +102,6 @@ public final class AlarmTimeClickHandler { } } - public void setAlarmRepeatEnabled(Alarm alarm, boolean isEnabled) { - final Calendar now = Calendar.getInstance(); - final Calendar oldNextAlarmTime = alarm.getNextAlarmTime(now); - final String alarmId = String.valueOf(alarm.id); - if (isEnabled) { - // Set all previously set days - // or - // Set all days if no previous. - final int bitSet = mPreviousDaysOfWeekMap.getInt(alarmId); - alarm.daysOfWeek = Weekdays.fromBits(bitSet); - if (!alarm.daysOfWeek.isRepeating()) { - alarm.daysOfWeek = Weekdays.ALL; - } - } else { - // Remember the set days in case the user wants it back. - final int bitSet = alarm.daysOfWeek.getBits(); - mPreviousDaysOfWeekMap.putInt(alarmId, bitSet); - - // Remove all repeat days - alarm.daysOfWeek = Weekdays.NONE; - } - - // if the change altered the next scheduled alarm time, tell the user - final Calendar newNextAlarmTime = alarm.getNextAlarmTime(now); - final boolean popupToast = !oldNextAlarmTime.equals(newNextAlarmTime); - - Events.sendAlarmEvent(R.string.action_toggle_repeat_days, R.string.label_deskclock); - mAlarmUpdateHandler.asyncUpdateAlarm(alarm, popupToast, false); - } - public void setDayOfWeekEnabled(Alarm alarm, boolean checked, int index) { final Calendar now = Calendar.getInstance(); final Calendar oldNextAlarmTime = alarm.getNextAlarmTime(now); diff --git a/src/com/android/deskclock/alarms/dataadapter/AlarmItemViewHolder.java b/src/com/android/deskclock/alarms/dataadapter/AlarmItemViewHolder.java index a39ad61ea..bb7e6b07b 100644 --- a/src/com/android/deskclock/alarms/dataadapter/AlarmItemViewHolder.java +++ b/src/com/android/deskclock/alarms/dataadapter/AlarmItemViewHolder.java @@ -16,20 +16,28 @@ package com.android.deskclock.alarms.dataadapter; +import android.animation.Animator; import android.content.Context; +import android.graphics.Typeface; import android.view.View; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; import com.android.deskclock.AlarmUtils; +import com.android.deskclock.AnimatorUtils; import com.android.deskclock.ItemAdapter; import com.android.deskclock.ItemAnimator; import com.android.deskclock.R; +import com.android.deskclock.data.DataModel; +import com.android.deskclock.data.Weekdays; import com.android.deskclock.provider.Alarm; import com.android.deskclock.provider.AlarmInstance; +import com.android.deskclock.widget.EllipsizeLayout; import com.android.deskclock.widget.TextTime; +import java.util.Calendar; + /** * Abstract ViewHolder for alarm time items. */ @@ -47,12 +55,14 @@ public abstract class AlarmItemViewHolder extends ItemAdapter.ItemViewHolder<Ala public static final float ANIM_LONG_DELAY_INCREMENT_MULTIPLIER = 1f - ANIM_STANDARD_DELAY_MULTIPLIER - ANIM_SHORT_DURATION_MULTIPLIER; - public static final String ANIMATE_REPEAT_DAYS = "ANIMATE_REPEAT_DAYS"; - public final TextTime clock; public final CompoundButton onOff; public final ImageView arrow; public final TextView preemptiveDismissButton; + public final TextView daysOfWeek; + public final EllipsizeLayout ellipsizeLayout; + + public float annotationsAlpha = CLOCK_ENABLED_ALPHA; public AlarmItemViewHolder(View itemView) { super(itemView); @@ -60,8 +70,9 @@ public abstract class AlarmItemViewHolder extends ItemAdapter.ItemViewHolder<Ala clock = (TextTime) itemView.findViewById(R.id.digital_clock); onOff = (CompoundButton) itemView.findViewById(R.id.onoff); arrow = (ImageView) itemView.findViewById(R.id.arrow); - preemptiveDismissButton = - (TextView) itemView.findViewById(R.id.preemptive_dismiss_button); + daysOfWeek = (TextView) itemView.findViewById(R.id.days_of_week); + preemptiveDismissButton = itemView.findViewById(R.id.preemptive_dismiss_button); + ellipsizeLayout = (EllipsizeLayout) itemView.findViewById(R.id.ellipse_layout); preemptiveDismissButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -98,6 +109,8 @@ public abstract class AlarmItemViewHolder extends ItemAdapter.ItemViewHolder<Ala protected void bindClock(Alarm alarm) { clock.setTime(alarm.hour, alarm.minutes); clock.setAlpha(alarm.enabled ? CLOCK_ENABLED_ALPHA : CLOCK_DISABLED_ALPHA); + Typeface oldTypeface = alarm.enabled ? clock.getTypeface() : null; + clock.setTypeface(oldTypeface, alarm.enabled ? Typeface.BOLD : Typeface.NORMAL); } protected boolean bindPreemptiveDismissButton(Context context, Alarm alarm, @@ -117,4 +130,28 @@ public abstract class AlarmItemViewHolder extends ItemAdapter.ItemViewHolder<Ala } return canBind; } -}
\ No newline at end of file + + protected void bindRepeatText(Context context, Alarm alarm) { + if (alarm.daysOfWeek.isRepeating()) { + final Weekdays.Order weekdayOrder = DataModel.getDataModel().getWeekdayOrder(); + final String daysOfWeekText = alarm.daysOfWeek.toString(context, weekdayOrder); + daysOfWeek.setText(daysOfWeekText); + + final String string = alarm.daysOfWeek.toAccessibilityString(context, weekdayOrder); + daysOfWeek.setContentDescription(string); + } else { + final String labelText = Alarm.isTomorrow(alarm, Calendar.getInstance()) ? + context.getString(R.string.alarm_tomorrow) : + context.getString(R.string.alarm_today); + daysOfWeek.setText(labelText); + } + } + + protected Animator getBoundsAnimator(View from, View to, long duration) { + final Animator animator = AnimatorUtils + .getBoundsAnimator(from, from, to) + .setDuration(duration); + animator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); + return animator; + } +} diff --git a/src/com/android/deskclock/alarms/dataadapter/CollapsedAlarmViewHolder.java b/src/com/android/deskclock/alarms/dataadapter/CollapsedAlarmViewHolder.java index 4c0407646..7f2205ae8 100644 --- a/src/com/android/deskclock/alarms/dataadapter/CollapsedAlarmViewHolder.java +++ b/src/com/android/deskclock/alarms/dataadapter/CollapsedAlarmViewHolder.java @@ -21,23 +21,20 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; -import android.graphics.Rect; -import androidx.recyclerview.widget.RecyclerView.ViewHolder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.recyclerview.widget.RecyclerView.ViewHolder; + import com.android.deskclock.AnimatorUtils; import com.android.deskclock.ItemAdapter; import com.android.deskclock.R; -import com.android.deskclock.data.DataModel; -import com.android.deskclock.data.Weekdays; import com.android.deskclock.events.Events; import com.android.deskclock.provider.Alarm; import com.android.deskclock.provider.AlarmInstance; -import java.util.Calendar; import java.util.List; /** @@ -48,19 +45,11 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { public static final int VIEW_TYPE = R.layout.alarm_time_collapsed; private final TextView alarmLabel; - public final TextView daysOfWeek; - private final TextView upcomingInstanceLabel; - private final View hairLine; - - private float annotationsAlpha = CLOCK_ENABLED_ALPHA; private CollapsedAlarmViewHolder(View itemView) { super(itemView); alarmLabel = (TextView) itemView.findViewById(R.id.label); - daysOfWeek = (TextView) itemView.findViewById(R.id.days_of_week); - upcomingInstanceLabel = (TextView) itemView.findViewById(R.id.upcoming_instance_label); - hairLine = itemView.findViewById(R.id.hairline); // Expand handler itemView.setOnClickListener(new View.OnClickListener() { @@ -105,9 +94,9 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { final Context context = itemView.getContext(); bindRepeatText(context, alarm); bindReadOnlyLabel(context, alarm); - bindUpcomingInstance(context, alarm); bindPreemptiveDismissButton(context, alarm, alarmInstance); - bindAnnotations(context, alarm); + bindAnnotations(alarm); + bindAnnotations(alarm); } private void bindReadOnlyLabel(Context context, Alarm alarm) { @@ -121,48 +110,21 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { } } - private void bindRepeatText(Context context, Alarm alarm) { - if (alarm.daysOfWeek.isRepeating()) { - final Weekdays.Order weekdayOrder = DataModel.getDataModel().getWeekdayOrder(); - final String daysOfWeekText = alarm.daysOfWeek.toString(context, weekdayOrder); - daysOfWeek.setText(daysOfWeekText); - - final String string = alarm.daysOfWeek.toAccessibilityString(context, weekdayOrder); - daysOfWeek.setContentDescription(string); - - daysOfWeek.setVisibility(View.VISIBLE); - } else { - daysOfWeek.setVisibility(View.GONE); - } - } - - private void bindUpcomingInstance(Context context, Alarm alarm) { - if (alarm.daysOfWeek.isRepeating()) { - upcomingInstanceLabel.setVisibility(View.GONE); - } else { - upcomingInstanceLabel.setVisibility(View.VISIBLE); - final String labelText = Alarm.isTomorrow(alarm, Calendar.getInstance()) ? - context.getString(R.string.alarm_tomorrow) : - context.getString(R.string.alarm_today); - upcomingInstanceLabel.setText(labelText); - } - } - - private void bindAnnotations(Context context, Alarm alarm) { + private void bindAnnotations(Alarm alarm) { annotationsAlpha = alarm.enabled ? CLOCK_ENABLED_ALPHA : CLOCK_DISABLED_ALPHA; setChangingViewsAlpha(annotationsAlpha); } @Override public Animator onAnimateChange(List<Object> payloads, int fromLeft, int fromTop, int fromRight, - int fromBottom, long duration) { + int fromBottom, long duration) { /* There are no possible partial animations for collapsed view holders. */ return null; } @Override public Animator onAnimateChange(final ViewHolder oldHolder, ViewHolder newHolder, - long duration) { + long duration) { if (!(oldHolder instanceof AlarmItemViewHolder) || !(newHolder instanceof AlarmItemViewHolder)) { return null; @@ -177,9 +139,6 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { changeAnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { - clock.setVisibility(View.VISIBLE); - onOff.setVisibility(View.VISIBLE); - arrow.setVisibility(View.VISIBLE); arrow.setTranslationY(0f); setChangingViewsAlpha(annotationsAlpha); arrow.jumpDrawablesToCurrentState(); @@ -189,27 +148,31 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { } private Animator createExpandingAnimator(AlarmItemViewHolder newHolder, long duration) { - clock.setVisibility(View.INVISIBLE); - onOff.setVisibility(View.INVISIBLE); - arrow.setVisibility(View.INVISIBLE); - final AnimatorSet alphaAnimatorSet = new AnimatorSet(); alphaAnimatorSet.playTogether( ObjectAnimator.ofFloat(alarmLabel, View.ALPHA, 0f), - ObjectAnimator.ofFloat(daysOfWeek, View.ALPHA, 0f), - ObjectAnimator.ofFloat(upcomingInstanceLabel, View.ALPHA, 0f), - ObjectAnimator.ofFloat(preemptiveDismissButton, View.ALPHA, 0f), - ObjectAnimator.ofFloat(hairLine, View.ALPHA, 0f)); + ObjectAnimator.ofFloat(preemptiveDismissButton, View.ALPHA, 0f)); alphaAnimatorSet.setDuration((long) (duration * ANIM_SHORT_DURATION_MULTIPLIER)); - final View oldView = itemView; - final View newView = newHolder.itemView; - final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView) - .setDuration(duration); - boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); + final Animator boundsAnimator = getBoundsAnimator(itemView, newHolder.itemView, duration); + final Animator switchAnimator = getBoundsAnimator(onOff, newHolder.onOff, duration); + final Animator clockAnimator = getBoundsAnimator(clock, newHolder.clock, duration); + final Animator ellipseAnimator = getBoundsAnimator(ellipsizeLayout, + newHolder.ellipsizeLayout, duration); final AnimatorSet animatorSet = new AnimatorSet(); - animatorSet.playTogether(alphaAnimatorSet, boundsAnimator); + animatorSet.playTogether(alphaAnimatorSet, boundsAnimator, switchAnimator, clockAnimator, + ellipseAnimator); + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + clock.setVisibility(View.INVISIBLE); + onOff.setVisibility(View.INVISIBLE); + arrow.setVisibility(View.INVISIBLE); + ellipsizeLayout.setVisibility(View.INVISIBLE); + } + }); return animatorSet; } @@ -218,9 +181,7 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { alphaAnimatorSet.playTogether( ObjectAnimator.ofFloat(alarmLabel, View.ALPHA, annotationsAlpha), ObjectAnimator.ofFloat(daysOfWeek, View.ALPHA, annotationsAlpha), - ObjectAnimator.ofFloat(upcomingInstanceLabel, View.ALPHA, annotationsAlpha), - ObjectAnimator.ofFloat(preemptiveDismissButton, View.ALPHA, annotationsAlpha), - ObjectAnimator.ofFloat(hairLine, View.ALPHA, annotationsAlpha)); + ObjectAnimator.ofFloat(preemptiveDismissButton, View.ALPHA, annotationsAlpha)); final long standardDelay = (long) (duration * ANIM_STANDARD_DELAY_MULTIPLIER); alphaAnimatorSet.setDuration(standardDelay); alphaAnimatorSet.setStartDelay(duration - standardDelay); @@ -231,17 +192,6 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { .setDuration(duration); boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); - final View oldArrow = oldHolder.arrow; - final Rect oldArrowRect = new Rect(0, 0, oldArrow.getWidth(), oldArrow.getHeight()); - final Rect newArrowRect = new Rect(0, 0, arrow.getWidth(), arrow.getHeight()); - ((ViewGroup) newView).offsetDescendantRectToMyCoords(arrow, newArrowRect); - ((ViewGroup) oldView).offsetDescendantRectToMyCoords(oldArrow, oldArrowRect); - final float arrowTranslationY = oldArrowRect.bottom - newArrowRect.bottom; - arrow.setTranslationY(arrowTranslationY); - arrow.setVisibility(View.VISIBLE); - clock.setVisibility(View.VISIBLE); - onOff.setVisibility(View.VISIBLE); - final Animator arrowAnimation = ObjectAnimator.ofFloat(arrow, View.TRANSLATION_Y, 0f) .setDuration(duration); arrowAnimation.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); @@ -260,8 +210,6 @@ public final class CollapsedAlarmViewHolder extends AlarmItemViewHolder { private void setChangingViewsAlpha(float alpha) { alarmLabel.setAlpha(alpha); daysOfWeek.setAlpha(alpha); - upcomingInstanceLabel.setAlpha(alpha); - hairLine.setAlpha(alpha); preemptiveDismissButton.setAlpha(alpha); } diff --git a/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java b/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java index 59a26e086..65454ecc6 100644 --- a/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java +++ b/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java @@ -23,20 +23,20 @@ import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; import android.graphics.Color; -import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Vibrator; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView.ViewHolder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; -import android.widget.LinearLayout; import android.widget.TextView; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView.ViewHolder; + import com.android.deskclock.AnimatorUtils; import com.android.deskclock.ItemAdapter; import com.android.deskclock.R; @@ -51,23 +51,18 @@ import com.android.deskclock.uidata.UiDataModel; import java.util.List; -import static android.content.Context.VIBRATOR_SERVICE; -import static android.view.View.TRANSLATION_Y; - /** * A ViewHolder containing views for an alarm item in expanded state. */ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { public static final int VIEW_TYPE = R.layout.alarm_time_expanded; - public final CheckBox repeat; private final TextView editLabel; - public final LinearLayout repeatDays; - private final CompoundButton[] dayButtons = new CompoundButton[7]; - public final CheckBox vibrate; - public final TextView ringtone; - public final TextView delete; - private final View hairLine; + private final ConstraintLayout repeatDays; + private final CompoundButton[] dayButtons; + private final CheckBox vibrate; + private final TextView ringtone; + private final TextView delete; private final boolean mHasVibrator; @@ -77,40 +72,36 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { mHasVibrator = hasVibrator; delete = (TextView) itemView.findViewById(R.id.delete); - repeat = (CheckBox) itemView.findViewById(R.id.repeat_onoff); vibrate = (CheckBox) itemView.findViewById(R.id.vibrate_onoff); ringtone = (TextView) itemView.findViewById(R.id.choose_ringtone); editLabel = (TextView) itemView.findViewById(R.id.edit_label); - repeatDays = (LinearLayout) itemView.findViewById(R.id.repeat_days); - hairLine = itemView.findViewById(R.id.hairline); + repeatDays = (ConstraintLayout) itemView.findViewById(R.id.repeat_days); final Context context = itemView.getContext(); itemView.setBackground(new LayerDrawable(new Drawable[] { - ContextCompat.getDrawable(context, R.drawable.alarm_background_expanded), + ContextCompat.getDrawable(context, R.drawable.alarm_background), ThemeUtils.resolveDrawable(context, R.attr.selectableItemBackground) })); // Build button for each day. final LayoutInflater inflater = LayoutInflater.from(context); final List<Integer> weekdays = DataModel.getDataModel().getWeekdayOrder().getCalendarDays(); - for (int i = 0; i < 7; i++) { - final View dayButtonFrame = inflater.inflate(R.layout.day_button, repeatDays, - false /* attachToRoot */); - final CompoundButton dayButton = - (CompoundButton) dayButtonFrame.findViewById(R.id.day_button_box); + dayButtons = new CompoundButton[] { + itemView.findViewById(R.id.day_button_0), + itemView.findViewById(R.id.day_button_1), + itemView.findViewById(R.id.day_button_2), + itemView.findViewById(R.id.day_button_3), + itemView.findViewById(R.id.day_button_4), + itemView.findViewById(R.id.day_button_5), + itemView.findViewById(R.id.day_button_6), + }; + for (int i = 0; i < dayButtons.length; i++) { + final CompoundButton dayButton = dayButtons[i]; final int weekday = weekdays.get(i); dayButton.setText(UiDataModel.getUiDataModel().getShortWeekday(weekday)); dayButton.setContentDescription(UiDataModel.getUiDataModel().getLongWeekday(weekday)); - repeatDays.addView(dayButtonFrame); - dayButtons[i] = dayButton; } - // Cannot set in xml since we need compat functionality for API < 21 - final Drawable labelIcon = Utils.getVectorDrawable(context, R.drawable.ic_label); - editLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(labelIcon, null, null, null); - final Drawable deleteIcon = Utils.getVectorDrawable(context, R.drawable.ic_delete_small); - delete.setCompoundDrawablesRelativeWithIntrinsicBounds(deleteIcon, null, null, null); - // Collapse handler itemView.setOnClickListener(new View.OnClickListener() { @Override @@ -163,15 +154,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { v.announceForAccessibility(context.getString(R.string.alarm_deleted)); } }); - // Repeat checkbox handler - repeat.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - final boolean checked = ((CheckBox) view).isChecked(); - getAlarmTimeClickHandler().setAlarmRepeatEnabled(getItemHolder().item, checked); - getItemHolder().notifyItemChanged(ANIMATE_REPEAT_DAYS); - } - }); // Day buttons handler for (int i = 0; i < dayButtons.length; i++) { final int buttonIndex = i; @@ -200,6 +182,8 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { bindVibrator(alarm); bindRingtone(context, alarm); bindPreemptiveDismissButton(context, alarm, alarmInstance); + bindRepeatText(context, alarm); + bindAnnotations(alarm); } private void bindRingtone(Context context, Alarm alarm) { @@ -228,13 +212,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { dayButton.setTextColor(Color.WHITE); } } - if (alarm.daysOfWeek.isRepeating()) { - repeat.setChecked(true); - repeatDays.setVisibility(View.VISIBLE); - } else { - repeat.setChecked(false); - repeatDays.setVisibility(View.GONE); - } } private void bindEditLabel(Context context, Alarm alarm) { @@ -253,65 +230,25 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { } } + private void bindAnnotations(Alarm alarm) { + annotationsAlpha = alarm.enabled ? CLOCK_ENABLED_ALPHA : CLOCK_DISABLED_ALPHA; + setChangingViewsAlpha(annotationsAlpha); + } + private AlarmTimeClickHandler getAlarmTimeClickHandler() { return getItemHolder().getAlarmTimeClickHandler(); } @Override public Animator onAnimateChange(List<Object> payloads, int fromLeft, int fromTop, int fromRight, - int fromBottom, long duration) { - if (payloads == null || payloads.isEmpty() || !payloads.contains(ANIMATE_REPEAT_DAYS)) { - return null; - } - - final boolean isExpansion = repeatDays.getVisibility() == View.VISIBLE; - final int height = repeatDays.getHeight(); - setTranslationY(isExpansion ? -height : 0f, isExpansion ? -height : height); - repeatDays.setVisibility(View.VISIBLE); - repeatDays.setAlpha(isExpansion ? 0f : 1f); - - final AnimatorSet animatorSet = new AnimatorSet(); - animatorSet.playTogether(AnimatorUtils.getBoundsAnimator(itemView, - fromLeft, fromTop, fromRight, fromBottom, - itemView.getLeft(), itemView.getTop(), itemView.getRight(), itemView.getBottom()), - ObjectAnimator.ofFloat(repeatDays, View.ALPHA, isExpansion ? 1f : 0f), - ObjectAnimator.ofFloat(repeatDays, TRANSLATION_Y, isExpansion ? 0f : -height), - ObjectAnimator.ofFloat(ringtone, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(vibrate, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(editLabel, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(preemptiveDismissButton, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(hairLine, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(delete, TRANSLATION_Y, 0f), - ObjectAnimator.ofFloat(arrow, TRANSLATION_Y, 0f)); - animatorSet.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animator) { - setTranslationY(0f, 0f); - repeatDays.setAlpha(1f); - repeatDays.setVisibility(isExpansion ? View.VISIBLE : View.GONE); - itemView.requestLayout(); - } - }); - animatorSet.setDuration(duration); - animatorSet.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); - - return animatorSet; - } - - private void setTranslationY(float repeatDaysTranslationY, float translationY) { - repeatDays.setTranslationY(repeatDaysTranslationY); - ringtone.setTranslationY(translationY); - vibrate.setTranslationY(translationY); - editLabel.setTranslationY(translationY); - preemptiveDismissButton.setTranslationY(translationY); - hairLine.setTranslationY(translationY); - delete.setTranslationY(translationY); - arrow.setTranslationY(translationY); + int fromBottom, long duration) { + /* There are no possible partial animations for expanded view holders. */ + return null; } @Override public Animator onAnimateChange(final ViewHolder oldHolder, ViewHolder newHolder, - long duration) { + long duration) { if (!(oldHolder instanceof AlarmItemViewHolder) || !(newHolder instanceof AlarmItemViewHolder)) { return null; @@ -319,7 +256,7 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { final boolean isExpanding = this == newHolder; AnimatorUtils.setBackgroundAlpha(itemView, isExpanding ? 0 : 255); - setChangingViewsAlpha(isExpanding ? 0f : 1f); + setChangingViewsAlpha(isExpanding ? 0f : annotationsAlpha); final Animator changeAnimatorSet = isExpanding ? createExpandingAnimator((AlarmItemViewHolder) oldHolder, duration) @@ -328,39 +265,33 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { @Override public void onAnimationEnd(Animator animator) { AnimatorUtils.setBackgroundAlpha(itemView, 255); - clock.setVisibility(View.VISIBLE); - onOff.setVisibility(View.VISIBLE); - arrow.setVisibility(View.VISIBLE); arrow.setTranslationY(0f); - setChangingViewsAlpha(1f); + setChangingViewsAlpha(annotationsAlpha); arrow.jumpDrawablesToCurrentState(); + arrow.setVisibility(isExpanding ? View.VISIBLE : View.INVISIBLE); + clock.setVisibility(isExpanding ? View.VISIBLE : View.INVISIBLE); + onOff.setVisibility(isExpanding ? View.VISIBLE : View.INVISIBLE); + ellipsizeLayout.setVisibility(isExpanding ? View.VISIBLE : View.INVISIBLE); } }); return changeAnimatorSet; } private Animator createCollapsingAnimator(AlarmItemViewHolder newHolder, long duration) { - arrow.setVisibility(View.INVISIBLE); - clock.setVisibility(View.INVISIBLE); - onOff.setVisibility(View.INVISIBLE); - final boolean daysVisible = repeatDays.getVisibility() == View.VISIBLE; final int numberOfItems = countNumberOfItems(); - final View oldView = itemView; - final View newView = newHolder.itemView; - - final Animator backgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(oldView, + final Animator backgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(itemView, PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 255, 0)); backgroundAnimator.setDuration(duration); - final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView); - boundsAnimator.setDuration(duration); - boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); + final Animator boundsAnimator = getBoundsAnimator(itemView, newHolder.itemView, duration); + final Animator switchAnimator = getBoundsAnimator(onOff, newHolder.onOff, duration); + final Animator clockAnimator = getBoundsAnimator(clock, newHolder.clock, duration); + final Animator ellipseAnimator = getBoundsAnimator(ellipsizeLayout, + newHolder.ellipsizeLayout, duration); final long shortDuration = (long) (duration * ANIM_SHORT_DURATION_MULTIPLIER); - final Animator repeatAnimation = ObjectAnimator.ofFloat(repeat, View.ALPHA, 0f) - .setDuration(shortDuration); final Animator editLabelAnimation = ObjectAnimator.ofFloat(editLabel, View.ALPHA, 0f) .setDuration(shortDuration); final Animator repeatDaysAnimation = ObjectAnimator.ofFloat(repeatDays, View.ALPHA, 0f) @@ -373,8 +304,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { View.ALPHA, 0f).setDuration(shortDuration); final Animator deleteAnimation = ObjectAnimator.ofFloat(delete, View.ALPHA, 0f) .setDuration(shortDuration); - final Animator hairLineAnimation = ObjectAnimator.ofFloat(hairLine, View.ALPHA, 0f) - .setDuration(shortDuration); // Set the staggered delays; use the first portion (duration * (1 - 1/4 - 1/6)) of the time, // so that the final animation, with a duration of 1/4 the total duration, finishes exactly @@ -387,7 +316,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { startDelay += delayIncrement; dismissAnimation.setStartDelay(startDelay); } - hairLineAnimation.setStartDelay(startDelay); startDelay += delayIncrement; editLabelAnimation.setStartDelay(startDelay); startDelay += delayIncrement; @@ -398,12 +326,21 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { repeatDaysAnimation.setStartDelay(startDelay); startDelay += delayIncrement; } - repeatAnimation.setStartDelay(startDelay); final AnimatorSet animatorSet = new AnimatorSet(); - animatorSet.playTogether(backgroundAnimator, boundsAnimator, repeatAnimation, + animatorSet.playTogether(backgroundAnimator, boundsAnimator, repeatDaysAnimation, vibrateAnimation, ringtoneAnimation, editLabelAnimation, - deleteAnimation, hairLineAnimation, dismissAnimation); + deleteAnimation, dismissAnimation, switchAnimator, clockAnimator, ellipseAnimator); + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + newHolder.clock.setVisibility(View.VISIBLE); + newHolder.onOff.setVisibility(View.VISIBLE); + newHolder.arrow.setVisibility(View.VISIBLE); + newHolder.ellipsizeLayout.setVisibility(View.VISIBLE); + } + }); return animatorSet; } @@ -418,21 +355,7 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 0, 255)); backgroundAnimator.setDuration(duration); - final View oldArrow = oldHolder.arrow; - final Rect oldArrowRect = new Rect(0, 0, oldArrow.getWidth(), oldArrow.getHeight()); - final Rect newArrowRect = new Rect(0, 0, arrow.getWidth(), arrow.getHeight()); - ((ViewGroup) newView).offsetDescendantRectToMyCoords(arrow, newArrowRect); - ((ViewGroup) oldView).offsetDescendantRectToMyCoords(oldArrow, oldArrowRect); - final float arrowTranslationY = oldArrowRect.bottom - newArrowRect.bottom; - - arrow.setTranslationY(arrowTranslationY); - arrow.setVisibility(View.VISIBLE); - clock.setVisibility(View.VISIBLE); - onOff.setVisibility(View.VISIBLE); - final long longDuration = (long) (duration * ANIM_LONG_DURATION_MULTIPLIER); - final Animator repeatAnimation = ObjectAnimator.ofFloat(repeat, View.ALPHA, 1f) - .setDuration(longDuration); final Animator repeatDaysAnimation = ObjectAnimator.ofFloat(repeatDays, View.ALPHA, 1f) .setDuration(longDuration); final Animator ringtoneAnimation = ObjectAnimator.ofFloat(ringtone, View.ALPHA, 1f) @@ -443,8 +366,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { .setDuration(longDuration); final Animator editLabelAnimation = ObjectAnimator.ofFloat(editLabel, View.ALPHA, 1f) .setDuration(longDuration); - final Animator hairLineAnimation = ObjectAnimator.ofFloat(hairLine, View.ALPHA, 1f) - .setDuration(longDuration); final Animator deleteAnimation = ObjectAnimator.ofFloat(delete, View.ALPHA, 1f) .setDuration(longDuration); final Animator arrowAnimation = ObjectAnimator.ofFloat(arrow, View.TRANSLATION_Y, 0f) @@ -457,8 +378,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { final int numberOfItems = countNumberOfItems(); final long delayIncrement = (long) (duration * ANIM_SHORT_DELAY_INCREMENT_MULTIPLIER) / (numberOfItems - 1); - repeatAnimation.setStartDelay(startDelay); - startDelay += delayIncrement; final boolean daysVisible = repeatDays.getVisibility() == View.VISIBLE; if (daysVisible) { repeatDaysAnimation.setStartDelay(startDelay); @@ -469,7 +388,6 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { startDelay += delayIncrement; editLabelAnimation.setStartDelay(startDelay); startDelay += delayIncrement; - hairLineAnimation.setStartDelay(startDelay); if (preemptiveDismissButton.getVisibility() == View.VISIBLE) { dismissAnimation.setStartDelay(startDelay); startDelay += delayIncrement; @@ -477,9 +395,9 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { deleteAnimation.setStartDelay(startDelay); final AnimatorSet animatorSet = new AnimatorSet(); - animatorSet.playTogether(backgroundAnimator, repeatAnimation, boundsAnimator, + animatorSet.playTogether(backgroundAnimator, boundsAnimator, repeatDaysAnimation, vibrateAnimation, ringtoneAnimation, editLabelAnimation, - deleteAnimation, hairLineAnimation, dismissAnimation, arrowAnimation); + deleteAnimation, dismissAnimation, arrowAnimation); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { @@ -502,14 +420,10 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { } private void setChangingViewsAlpha(float alpha) { - repeat.setAlpha(alpha); editLabel.setAlpha(alpha); repeatDays.setAlpha(alpha); - vibrate.setAlpha(alpha); - ringtone.setAlpha(alpha); - hairLine.setAlpha(alpha); - delete.setAlpha(alpha); preemptiveDismissButton.setAlpha(alpha); + daysOfWeek.setAlpha(alpha); } public static class Factory implements ItemAdapter.ItemViewHolder.Factory { @@ -519,7 +433,7 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { public Factory(Context context) { mLayoutInflater = LayoutInflater.from(context); - mHasVibrator = ((Vibrator) context.getSystemService(VIBRATOR_SERVICE)).hasVibrator(); + mHasVibrator = (context.getSystemService(Vibrator.class)).hasVibrator(); } @Override diff --git a/src/com/android/deskclock/data/StopwatchNotificationBuilder.java b/src/com/android/deskclock/data/StopwatchNotificationBuilder.java index 850299a08..d426b5c0b 100644 --- a/src/com/android/deskclock/data/StopwatchNotificationBuilder.java +++ b/src/com/android/deskclock/data/StopwatchNotificationBuilder.java @@ -19,18 +19,16 @@ package com.android.deskclock.data; import static com.android.deskclock.NotificationUtils.STOPWATCH_NOTIFICATION_CHANNEL_ID; import android.app.Notification; -import android.app.NotificationChannel; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.SystemClock; -import androidx.annotation.DrawableRes; + import androidx.annotation.StringRes; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat.Action; import androidx.core.app.NotificationCompat.Builder; -import androidx.core.app.NotificationManagerCompat; import androidx.core.content.ContextCompat; import android.widget.RemoteViews; @@ -80,10 +78,9 @@ class StopwatchNotificationBuilder { .setAction(StopwatchService.ACTION_PAUSE_STOPWATCH) .putExtra(Events.EXTRA_EVENT_LABEL, eventLabel); - @DrawableRes final int icon1 = R.drawable.ic_pause_24dp; final CharSequence title1 = res.getText(R.string.sw_pause_button); final PendingIntent intent1 = Utils.pendingServiceIntent(context, pause); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); // Right button: Add Lap if (DataModel.getDataModel().canAddMoreLaps()) { @@ -91,10 +88,9 @@ class StopwatchNotificationBuilder { .setAction(StopwatchService.ACTION_LAP_STOPWATCH) .putExtra(Events.EXTRA_EVENT_LABEL, eventLabel); - @DrawableRes final int icon2 = R.drawable.ic_sw_lap_24dp; final CharSequence title2 = res.getText(R.string.sw_lap_button); final PendingIntent intent2 = Utils.pendingServiceIntent(context, lap); - actions.add(new Action.Builder(icon2, title2, intent2).build()); + actions.add(new Action.Builder(null, title2, intent2).build()); } // Show the current lap number if any laps have been recorded. @@ -113,20 +109,18 @@ class StopwatchNotificationBuilder { .setAction(StopwatchService.ACTION_START_STOPWATCH) .putExtra(Events.EXTRA_EVENT_LABEL, eventLabel); - @DrawableRes final int icon1 = R.drawable.ic_start_24dp; final CharSequence title1 = res.getText(R.string.sw_start_button); final PendingIntent intent1 = Utils.pendingServiceIntent(context, start); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); // Right button: Reset (dismisses notification and resets stopwatch) final Intent reset = new Intent(context, StopwatchService.class) .setAction(StopwatchService.ACTION_RESET_STOPWATCH) .putExtra(Events.EXTRA_EVENT_LABEL, eventLabel); - @DrawableRes final int icon2 = R.drawable.ic_reset_24dp; final CharSequence title2 = res.getText(R.string.sw_reset_button); final PendingIntent intent2 = Utils.pendingServiceIntent(context, reset); - actions.add(new Action.Builder(icon2, title2, intent2).build()); + actions.add(new Action.Builder(null, title2, intent2).build()); // Indicate the stopwatch is paused. content.setTextViewText(R.id.state, res.getString(R.string.swn_paused)); diff --git a/src/com/android/deskclock/data/TimerNotificationBuilder.java b/src/com/android/deskclock/data/TimerNotificationBuilder.java index 1958d531a..6bc9c12fa 100644 --- a/src/com/android/deskclock/data/TimerNotificationBuilder.java +++ b/src/com/android/deskclock/data/TimerNotificationBuilder.java @@ -16,26 +16,29 @@ package com.android.deskclock.data; +import static androidx.core.app.NotificationCompat.Action; +import static androidx.core.app.NotificationCompat.Builder; +import static android.text.format.DateUtils.MINUTE_IN_MILLIS; +import static android.text.format.DateUtils.SECOND_IN_MILLIS; + import static com.android.deskclock.NotificationUtils.FIRING_NOTIFICATION_CHANNEL_ID; import static com.android.deskclock.NotificationUtils.TIMER_MODEL_NOTIFICATION_CHANNEL_ID; import android.annotation.TargetApi; import android.app.AlarmManager; import android.app.Notification; -import android.app.NotificationChannel; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.Build; import android.os.SystemClock; -import androidx.annotation.DrawableRes; -import androidx.core.app.NotificationCompat; -import androidx.core.app.NotificationManagerCompat; -import androidx.core.content.ContextCompat; import android.text.TextUtils; import android.widget.RemoteViews; +import androidx.core.app.NotificationCompat; +import androidx.core.content.ContextCompat; + import com.android.deskclock.AlarmUtils; import com.android.deskclock.NotificationUtils; import com.android.deskclock.R; @@ -47,11 +50,6 @@ import com.android.deskclock.timer.TimerService; import java.util.ArrayList; import java.util.List; -import static androidx.core.app.NotificationCompat.Action; -import static androidx.core.app.NotificationCompat.Builder; -import static android.text.format.DateUtils.MINUTE_IN_MILLIS; -import static android.text.format.DateUtils.SECOND_IN_MILLIS; - /** * Builds notifications to reflect the latest state of the timers. */ @@ -88,20 +86,18 @@ class TimerNotificationBuilder { .setAction(TimerService.ACTION_PAUSE_TIMER) .putExtra(TimerService.EXTRA_TIMER_ID, timer.getId()); - @DrawableRes final int icon1 = R.drawable.ic_pause_24dp; final CharSequence title1 = res.getText(R.string.timer_pause); final PendingIntent intent1 = Utils.pendingServiceIntent(context, pause); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); // Right Button: +1 Minute final Intent addMinute = new Intent(context, TimerService.class) .setAction(TimerService.ACTION_ADD_MINUTE_TIMER) .putExtra(TimerService.EXTRA_TIMER_ID, timer.getId()); - @DrawableRes final int icon2 = R.drawable.ic_add_24dp; final CharSequence title2 = res.getText(R.string.timer_plus_1_min); final PendingIntent intent2 = Utils.pendingServiceIntent(context, addMinute); - actions.add(new Action.Builder(icon2, title2, intent2).build()); + actions.add(new Action.Builder(null, title2, intent2).build()); } else { // Single timer is paused. @@ -112,20 +108,18 @@ class TimerNotificationBuilder { .setAction(TimerService.ACTION_START_TIMER) .putExtra(TimerService.EXTRA_TIMER_ID, timer.getId()); - @DrawableRes final int icon1 = R.drawable.ic_start_24dp; final CharSequence title1 = res.getText(R.string.sw_resume_button); final PendingIntent intent1 = Utils.pendingServiceIntent(context, start); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); // Right Button: Reset final Intent reset = new Intent(context, TimerService.class) .setAction(TimerService.ACTION_RESET_TIMER) .putExtra(TimerService.EXTRA_TIMER_ID, timer.getId()); - @DrawableRes final int icon2 = R.drawable.ic_reset_24dp; final CharSequence title2 = res.getText(R.string.sw_reset_button); final PendingIntent intent2 = Utils.pendingServiceIntent(context, reset); - actions.add(new Action.Builder(icon2, title2, intent2).build()); + actions.add(new Action.Builder(null, title2, intent2).build()); } } else { if (running) { @@ -138,10 +132,9 @@ class TimerNotificationBuilder { final Intent reset = TimerService.createResetUnexpiredTimersIntent(context); - @DrawableRes final int icon1 = R.drawable.ic_reset_24dp; final CharSequence title1 = res.getText(R.string.timer_reset_all); final PendingIntent intent1 = Utils.pendingServiceIntent(context, reset); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); } // Intent to load the app and show the timer when the notification is tapped. @@ -225,7 +218,6 @@ class TimerNotificationBuilder { final Timer timer = expired.get(0); // First action intent is to reset all timers. - @DrawableRes final int icon1 = R.drawable.ic_stop_24dp; final Intent reset = TimerService.createResetExpiredTimersIntent(context); final PendingIntent intent1 = Utils.pendingServiceIntent(context, reset); @@ -243,20 +235,19 @@ class TimerNotificationBuilder { // Left button: Reset single timer final CharSequence title1 = context.getString(R.string.timer_stop); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); // Right button: Add minute final Intent addTime = TimerService.createAddMinuteTimerIntent(context, timer.getId()); final PendingIntent intent2 = Utils.pendingServiceIntent(context, addTime); - @DrawableRes final int icon2 = R.drawable.ic_add_24dp; final CharSequence title2 = context.getString(R.string.timer_plus_1_min); - actions.add(new Action.Builder(icon2, title2, intent2).build()); + actions.add(new Action.Builder(null, title2, intent2).build()); } else { stateText = context.getString(R.string.timer_multi_times_up, count); // Left button: Reset all timers final CharSequence title1 = context.getString(R.string.timer_stop_all); - actions.add(new Action.Builder(icon1, title1, intent1).build()); + actions.add(new Action.Builder(null, title1, intent1).build()); } final long base = getChronometerBase(timer); @@ -331,20 +322,18 @@ class TimerNotificationBuilder { .setAction(TimerService.ACTION_RESET_TIMER) .putExtra(TimerService.EXTRA_TIMER_ID, timer.getId()); - @DrawableRes final int icon1 = R.drawable.ic_reset_24dp; final CharSequence title1 = res.getText(R.string.timer_reset); final PendingIntent intent1 = Utils.pendingServiceIntent(context, reset); - action = new Action.Builder(icon1, title1, intent1).build(); + action = new Action.Builder(null, title1, intent1).build(); } else { // Multiple missed timers. stateText = res.getString(R.string.timer_multi_missed, count); final Intent reset = TimerService.createResetMissedTimersIntent(context); - @DrawableRes final int icon1 = R.drawable.ic_reset_24dp; final CharSequence title1 = res.getText(R.string.timer_reset_all); final PendingIntent intent1 = Utils.pendingServiceIntent(context, reset); - action = new Action.Builder(icon1, title1, intent1).build(); + action = new Action.Builder(null, title1, intent1).build(); } // Intent to load the app and show the timer when the notification is tapped. diff --git a/src/com/android/deskclock/ringtone/AddCustomRingtoneViewHolder.java b/src/com/android/deskclock/ringtone/AddCustomRingtoneViewHolder.java index 906ec6043..eccd8cfd9 100644 --- a/src/com/android/deskclock/ringtone/AddCustomRingtoneViewHolder.java +++ b/src/com/android/deskclock/ringtone/AddCustomRingtoneViewHolder.java @@ -16,6 +16,7 @@ package com.android.deskclock.ringtone; +import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -46,6 +47,9 @@ final class AddCustomRingtoneViewHolder extends ItemViewHolder<AddCustomRingtone final ImageView imageView = (ImageView) itemView.findViewById(R.id.ringtone_image); imageView.setImageResource(R.drawable.ic_add_24dp); + Context context = itemView.getContext(); + imageView.setColorFilter(context.getResources().getColor(R.color.white, + context.getTheme())); imageView.setAlpha(0.63f); } diff --git a/src/com/android/deskclock/ringtone/RingtonePickerActivity.java b/src/com/android/deskclock/ringtone/RingtonePickerActivity.java index 40ddb0495..571baa75a 100644 --- a/src/com/android/deskclock/ringtone/RingtonePickerActivity.java +++ b/src/com/android/deskclock/ringtone/RingtonePickerActivity.java @@ -16,6 +16,15 @@ package com.android.deskclock.ringtone; +import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; +import static android.media.RingtoneManager.TYPE_ALARM; +import static android.provider.OpenableColumns.DISPLAY_NAME; +import static com.android.deskclock.ItemAdapter.ItemViewHolder.Factory; +import static com.android.deskclock.ringtone.AddCustomRingtoneViewHolder.VIEW_TYPE_ADD_NEW; +import static com.android.deskclock.ringtone.HeaderViewHolder.VIEW_TYPE_ITEM_HEADER; +import static com.android.deskclock.ringtone.RingtoneViewHolder.VIEW_TYPE_CUSTOM_SOUND; +import static com.android.deskclock.ringtone.RingtoneViewHolder.VIEW_TYPE_SYSTEM_SOUND; + import android.app.Dialog; import android.app.DialogFragment; import android.app.FragmentManager; @@ -32,40 +41,26 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.MediaStore; +import android.view.LayoutInflater; +import android.view.MenuItem; + import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.AlertDialog; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import com.android.deskclock.BaseActivity; -import com.android.deskclock.DropShadowController; import com.android.deskclock.ItemAdapter; import com.android.deskclock.ItemAdapter.OnItemClickedListener; import com.android.deskclock.LogUtils; import com.android.deskclock.R; import com.android.deskclock.RingtonePreviewKlaxon; -import com.android.deskclock.actionbarmenu.MenuItemControllerFactory; -import com.android.deskclock.actionbarmenu.NavUpMenuItemController; -import com.android.deskclock.actionbarmenu.OptionsMenuManager; import com.android.deskclock.alarms.AlarmUpdateHandler; import com.android.deskclock.data.DataModel; import com.android.deskclock.provider.Alarm; +import com.android.deskclock.widget.CollapsingToolbarBaseActivity; import java.util.List; -import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; -import static android.media.RingtoneManager.TYPE_ALARM; -import static android.provider.OpenableColumns.DISPLAY_NAME; -import static com.android.deskclock.ItemAdapter.ItemViewHolder.Factory; -import static com.android.deskclock.ringtone.AddCustomRingtoneViewHolder.VIEW_TYPE_ADD_NEW; -import static com.android.deskclock.ringtone.HeaderViewHolder.VIEW_TYPE_ITEM_HEADER; -import static com.android.deskclock.ringtone.RingtoneViewHolder.VIEW_TYPE_CUSTOM_SOUND; -import static com.android.deskclock.ringtone.RingtoneViewHolder.VIEW_TYPE_SYSTEM_SOUND; - /** * This activity presents a set of ringtones from which the user may select one. The set includes: * <ul> @@ -75,7 +70,7 @@ import static com.android.deskclock.ringtone.RingtoneViewHolder.VIEW_TYPE_SYSTEM * <li>user-selected audio files available as ringtones</li> * </ul> */ -public class RingtonePickerActivity extends BaseActivity +public class RingtonePickerActivity extends CollapsingToolbarBaseActivity implements LoaderManager.LoaderCallbacks<List<ItemAdapter.ItemHolder<Uri>>> { /** Key to an extra that defines resource id to the title of this activity. */ @@ -96,12 +91,6 @@ public class RingtonePickerActivity extends BaseActivity /** Key to an instance state value indicating if the selected ringtone is currently playing. */ private static final String STATE_KEY_PLAYING = "extra_is_playing"; - /** The controller that shows the drop shadow when content is not scrolled to the top. */ - private DropShadowController mDropShadowController; - - /** Generates the items in the activity context menu. */ - private OptionsMenuManager mOptionsMenuManager; - /** Displays a set of selectable ringtones. */ private RecyclerView mRecyclerView; @@ -157,11 +146,6 @@ public class RingtonePickerActivity extends BaseActivity setContentView(R.layout.ringtone_picker); setVolumeControlStream(AudioManager.STREAM_ALARM); - mOptionsMenuManager = new OptionsMenuManager(); - mOptionsMenuManager.addMenuItemController(new NavUpMenuItemController(this)) - .addMenuItemController(MenuItemControllerFactory.getInstance() - .buildMenuItemControllers(this)); - final Context context = getApplicationContext(); final Intent intent = getIntent(); @@ -213,18 +197,7 @@ public class RingtonePickerActivity extends BaseActivity } @Override - protected void onResume() { - super.onResume(); - - final View dropShadow = findViewById(R.id.drop_shadow); - mDropShadowController = new DropShadowController(dropShadow, mRecyclerView); - } - - @Override protected void onPause() { - mDropShadowController.stop(); - mDropShadowController = null; - if (mSelectedRingtoneUri != null) { if (mAlarmId != -1) { final Context context = getApplicationContext(); @@ -276,23 +249,6 @@ public class RingtonePickerActivity extends BaseActivity } @Override - public boolean onCreateOptionsMenu(Menu menu) { - mOptionsMenuManager.onCreateOptionsMenu(menu); - return true; - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - mOptionsMenuManager.onPrepareOptionsMenu(menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - return mOptionsMenuManager.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); - } - - @Override public Loader<List<ItemAdapter.ItemHolder<Uri>>> onCreateLoader(int id, Bundle args) { return new RingtoneLoader(getApplicationContext(), mDefaultRingtoneUri, mDefaultRingtoneTitle); diff --git a/src/com/android/deskclock/settings/SettingsActivity.java b/src/com/android/deskclock/settings/SettingsActivity.java index 029987dd1..429a5a271 100644 --- a/src/com/android/deskclock/settings/SettingsActivity.java +++ b/src/com/android/deskclock/settings/SettingsActivity.java @@ -23,34 +23,32 @@ import android.hardware.SensorManager; import android.os.Bundle; import android.os.Vibrator; import android.provider.Settings; +import android.util.Log; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.preference.ListPreference; import androidx.preference.ListPreferenceDialogFragmentCompat; import androidx.preference.Preference; import androidx.preference.PreferenceDialogFragmentCompat; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.TwoStatePreference; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import com.android.deskclock.BaseActivity; -import com.android.deskclock.DropShadowController; import com.android.deskclock.R; import com.android.deskclock.Utils; -import com.android.deskclock.actionbarmenu.MenuItemControllerFactory; -import com.android.deskclock.actionbarmenu.NavUpMenuItemController; -import com.android.deskclock.actionbarmenu.OptionsMenuManager; import com.android.deskclock.data.DataModel; import com.android.deskclock.data.TimeZones; import com.android.deskclock.data.Weekdays; import com.android.deskclock.ringtone.RingtonePickerActivity; +import com.android.deskclock.widget.CollapsingToolbarBaseActivity; import java.util.List; /** * Settings for the Alarm Clock. */ -public final class SettingsActivity extends BaseActivity { +public final class SettingsActivity extends CollapsingToolbarBaseActivity { public static final String KEY_ALARM_SNOOZE = "snooze_duration"; public static final String KEY_ALARM_CRESCENDO = "alarm_crescendo_duration"; @@ -75,65 +73,19 @@ public final class SettingsActivity extends BaseActivity { public static final String PREFS_FRAGMENT_TAG = "prefs_fragment"; public static final String PREFERENCE_DIALOG_FRAGMENT_TAG = "preference_dialog"; - private final OptionsMenuManager mOptionsMenuManager = new OptionsMenuManager(); - - /** - * The controller that shows the drop shadow when content is not scrolled to the top. - */ - private DropShadowController mDropShadowController; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.settings); - - mOptionsMenuManager.addMenuItemController(new NavUpMenuItemController(this)) - .addMenuItemController(MenuItemControllerFactory.getInstance() - .buildMenuItemControllers(this)); // Create the prefs fragment in code to ensure it's created before PreferenceDialogFragment if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() - .replace(R.id.main, new PrefsFragment(), PREFS_FRAGMENT_TAG) + .replace(R.id.content_frame, new PrefsFragment(), PREFS_FRAGMENT_TAG) .disallowAddToBackStack() .commit(); } } - @Override - protected void onResume() { - super.onResume(); - - final View dropShadow = findViewById(R.id.drop_shadow); - final PrefsFragment fragment = - (PrefsFragment) getSupportFragmentManager().findFragmentById(R.id.main); - mDropShadowController = new DropShadowController(dropShadow, fragment.getListView()); - } - - @Override - protected void onPause() { - mDropShadowController.stop(); - super.onPause(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - mOptionsMenuManager.onCreateOptionsMenu(menu); - return true; - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - mOptionsMenuManager.onPrepareOptionsMenu(menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - return mOptionsMenuManager.onOptionsItemSelected(item) - || super.onOptionsItemSelected(item); - } - public static class PrefsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener { @@ -150,6 +102,15 @@ public final class SettingsActivity extends BaseActivity { } @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + int paddingLeftRight = Math.round(getResources().getDimension(R.dimen.settings_padding) * + getResources().getDisplayMetrics().densityDpi / 160f); + view.setPadding(paddingLeftRight, view.getPaddingTop(), paddingLeftRight, + view.getPaddingBottom()); + } + + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/src/com/android/deskclock/settings/SimpleMenuPreference.java b/src/com/android/deskclock/settings/SimpleMenuPreference.java index 579ad578e..faead0f0f 100644 --- a/src/com/android/deskclock/settings/SimpleMenuPreference.java +++ b/src/com/android/deskclock/settings/SimpleMenuPreference.java @@ -24,6 +24,7 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.TextView; import com.android.deskclock.R; import com.android.deskclock.Utils; @@ -133,9 +134,9 @@ public class SimpleMenuPreference extends DropDownPreference { public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) { final View view = super.getDropDownView(position, convertView, parent); if (position == 0) { - view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.white_08p)); - } else { - view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.transparent)); + view.setBackgroundResource(R.drawable.popup_background_selected); + TextView tv = (TextView) view; + tv.setTextColor(getContext().getColor(R.color.black)); } return view; } diff --git a/src/com/android/deskclock/stopwatch/StopwatchCircleView.java b/src/com/android/deskclock/stopwatch/StopwatchCircleView.java index 31ae20d5f..efdee04d0 100644 --- a/src/com/android/deskclock/stopwatch/StopwatchCircleView.java +++ b/src/com/android/deskclock/stopwatch/StopwatchCircleView.java @@ -42,14 +42,13 @@ public final class StopwatchCircleView extends View { /** The size of the dot indicating the user's position within the reference lap. */ private final float mDotRadius; - /** An amount to subtract from the true radius to account for drawing thicknesses. */ - private final float mRadiusOffset; - /** Used to scale the width of the marker to make it similarly visible on all screens. */ private final float mScreenDensity; + private final int mCircleColor; + /** The color indicating the remaining portion of the current lap. */ - private final int mRemainderColor; + private final int mMarkerColor; /** The color indicating the completed portion of the lap. */ private final int mCompletedColor; @@ -57,9 +56,6 @@ public final class StopwatchCircleView extends View { /** The size of the stroke that paints the lap circle. */ private final float mStrokeSize; - /** The size of the stroke that paints the marker for the end of the prior lap. */ - private final float mMarkerStrokeSize; - private final Paint mPaint = new Paint(); private final Paint mFill = new Paint(); private final RectF mArcRect = new RectF(); @@ -73,16 +69,14 @@ public final class StopwatchCircleView extends View { super(context, attrs); final Resources resources = context.getResources(); - final float dotDiameter = resources.getDimension(R.dimen.circletimer_dot_size); - mDotRadius = dotDiameter / 2f; mScreenDensity = resources.getDisplayMetrics().density; mStrokeSize = resources.getDimension(R.dimen.circletimer_circle_size); - mMarkerStrokeSize = resources.getDimension(R.dimen.circletimer_marker_size); - mRadiusOffset = Utils.calculateRadiusOffset(mStrokeSize, dotDiameter, mMarkerStrokeSize); + mDotRadius = mStrokeSize / 2; - mRemainderColor = Color.WHITE; mCompletedColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); + mCircleColor = resources.getColor(R.color.secondary_color, context.getTheme()); + mMarkerColor = Color.WHITE; mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.STROKE); @@ -104,10 +98,10 @@ public final class StopwatchCircleView extends View { // Compute the size and location of the circle to be drawn. final int xCenter = getWidth() / 2; final int yCenter = getHeight() / 2; - final float radius = Math.min(xCenter, yCenter) - mRadiusOffset; + final float radius = Math.min(xCenter, yCenter) - mStrokeSize; // Reset old painting state. - mPaint.setColor(mRemainderColor); + mPaint.setColor(mCircleColor); mPaint.setStrokeWidth(mStrokeSize); final List<Lap> laps = getLaps(); @@ -136,18 +130,18 @@ public final class StopwatchCircleView extends View { mArcRect.right = xCenter + radius; final float redPercent = (float) currentLapTime / (float) firstLapTime; final float whitePercent = 1 - (redPercent > 1 ? 1 : redPercent); - // Draw a white arc to indicate the amount of reference lap that remains. canvas.drawArc(mArcRect, 270 + (1 - whitePercent) * 360, whitePercent * 360, false, mPaint); - // Draw a red arc to indicate the amount of reference lap completed. + + // Draw an arc to indicate the amount of reference lap completed. mPaint.setColor(mCompletedColor); canvas.drawArc(mArcRect, 270, redPercent * 360 , false, mPaint); // Starting on lap 2, a marker can be drawn indicating where the prior lap ended. if (lapCount > 1) { - mPaint.setColor(mRemainderColor); - mPaint.setStrokeWidth(mMarkerStrokeSize); + mPaint.setColor(mMarkerColor); + mPaint.setStrokeWidth(mStrokeSize); final float markerAngle = (float) priorLap.getLapTime() / (float) firstLapTime * 360; final float startAngle = 270 + markerAngle; final float sweepAngle = mScreenDensity * (float) (360 / (radius * Math.PI)); diff --git a/src/com/android/deskclock/stopwatch/StopwatchFragment.java b/src/com/android/deskclock/stopwatch/StopwatchFragment.java index 87d22ea60..06c7578d7 100644 --- a/src/com/android/deskclock/stopwatch/StopwatchFragment.java +++ b/src/com/android/deskclock/stopwatch/StopwatchFragment.java @@ -24,24 +24,25 @@ import android.content.Intent; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Canvas; +import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.os.Bundle; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.core.graphics.ColorUtils; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.SimpleItemAnimator; import android.transition.TransitionManager; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; -import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.core.graphics.ColorUtils; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.SimpleItemAnimator; + import com.android.deskclock.AnimatorUtils; import com.android.deskclock.DeskClockFragment; import com.android.deskclock.LogUtils; @@ -129,7 +130,6 @@ public final class StopwatchFragment extends DeskClockFragment { mLapsList = (RecyclerView) v.findViewById(R.id.laps_list); ((SimpleItemAnimator) mLapsList.getItemAnimator()).setSupportsChangeAnimations(false); mLapsList.setLayoutManager(mLapsLayoutManager); - mLapsList.addItemDecoration(mGradientItemDecoration); // In landscape layouts, the laps list can reach the top of the screen and thus can cause // a drop shadow to appear. The same is not true for portrait landscapes. @@ -138,6 +138,7 @@ public final class StopwatchFragment extends DeskClockFragment { mLapsList.addOnLayoutChangeListener(scrollPositionWatcher); mLapsList.addOnScrollListener(scrollPositionWatcher); } else { + mLapsList.addItemDecoration(mGradientItemDecoration); setTabScrolledToTop(true); } mLapsList.setAdapter(mLapsAdapter); @@ -223,12 +224,12 @@ public final class StopwatchFragment extends DeskClockFragment { } @Override - public void onLeftButtonClick(@NonNull Button left) { + public void onLeftButtonClick(@NonNull ImageView left) { doReset(); } @Override - public void onRightButtonClick(@NonNull Button right) { + public void onRightButtonClick(@NonNull ImageView right) { switch (getStopwatch().getState()) { case RUNNING: doAddLap(); @@ -241,10 +242,10 @@ public final class StopwatchFragment extends DeskClockFragment { private void updateFab(@NonNull ImageView fab) { if (getStopwatch().isRunning()) { - fab.setImageResource(R.drawable.ic_pause_24dp); + fab.setImageResource(R.drawable.ic_play_pause); fab.setContentDescription(fab.getResources().getString(R.string.sw_pause_button)); } else { - fab.setImageResource(R.drawable.ic_start_24dp); + fab.setImageResource(R.drawable.ic_pause_play); fab.setContentDescription(fab.getResources().getString(R.string.sw_start_button)); } fab.setVisibility(VISIBLE); @@ -264,10 +265,12 @@ public final class StopwatchFragment extends DeskClockFragment { } @Override - public void onUpdateFabButtons(@NonNull Button left, @NonNull Button right) { + public void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right) { final Resources resources = getResources(); + final Context context = left.getContext(); + final Drawable icReset = Utils.getVectorDrawable(context, R.drawable.ic_delete); left.setClickable(true); - left.setText(R.string.sw_reset_button); + left.setImageDrawable(icReset); left.setContentDescription(resources.getString(R.string.sw_reset_button)); switch (getStopwatch().getState()) { @@ -279,7 +282,9 @@ public final class StopwatchFragment extends DeskClockFragment { case RUNNING: left.setVisibility(VISIBLE); final boolean canRecordLaps = canRecordMoreLaps(); - right.setText(R.string.sw_lap_button); + final Drawable icLap = Utils.getVectorDrawable(context, + R.drawable.ic_stopwatch_black); + right.setImageDrawable(icLap); right.setContentDescription(resources.getString(R.string.sw_lap_button)); right.setClickable(canRecordLaps); right.setVisibility(canRecordLaps ? VISIBLE : INVISIBLE); @@ -288,7 +293,8 @@ public final class StopwatchFragment extends DeskClockFragment { left.setVisibility(VISIBLE); right.setClickable(true); right.setVisibility(VISIBLE); - right.setText(R.string.sw_share_button); + final Drawable icShare = Utils.getVectorDrawable(context, R.drawable.ic_share); + right.setImageDrawable(icShare); right.setContentDescription(resources.getString(R.string.sw_share_button)); break; } @@ -428,7 +434,8 @@ public final class StopwatchFragment extends DeskClockFragment { // When the lap list is visible, it includes the bottom padding. When it is absent the // appropriate bottom padding must be applied to the container. final Resources res = getResources(); - final int bottom = lapsVisible ? 0 : res.getDimensionPixelSize(R.dimen.fab_height); + final int bottom = lapsVisible ? 0 : res.getDimensionPixelSize( + R.dimen.fab_container_height); final int top = sceneRoot.getPaddingTop(); final int left = sceneRoot.getPaddingLeft(); final int right = sceneRoot.getPaddingRight(); @@ -704,8 +711,8 @@ public final class StopwatchFragment extends DeskClockFragment { updateGradientColors(ThemeUtils.resolveColor(context, android.R.attr.windowBackground)); final Resources resources = context.getResources(); - final float fabHeight = resources.getDimensionPixelSize(R.dimen.fab_height); - mGradientHeight = Math.round(fabHeight * 1.2f); + final float fabHeight = resources.getDimensionPixelSize(R.dimen.fab_container_height); + mGradientHeight = resources.getDimensionPixelSize(R.dimen.fab_container_height); } @Override diff --git a/src/com/android/deskclock/timer/ExpiredTimersActivity.java b/src/com/android/deskclock/timer/ExpiredTimersActivity.java index 30ed121ba..8bd4ba5a4 100644 --- a/src/com/android/deskclock/timer/ExpiredTimersActivity.java +++ b/src/com/android/deskclock/timer/ExpiredTimersActivity.java @@ -14,11 +14,11 @@ package com.android.deskclock.timer; +import android.app.KeyguardManager; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.os.SystemClock; -import androidx.annotation.NonNull; import android.text.TextUtils; import android.transition.AutoTransition; import android.transition.TransitionManager; @@ -30,6 +30,8 @@ import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.TextView; +import androidx.annotation.NonNull; + import com.android.deskclock.BaseActivity; import com.android.deskclock.LogUtils; import com.android.deskclock.R; @@ -81,12 +83,14 @@ public class ExpiredTimersActivity extends BaseActivity { final View view = findViewById(R.id.expired_timers_activity); view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED - | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON - | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON); + setTurnScreenOn(true); + setShowWhenLocked(true); + KeyguardManager kgm = getSystemService(KeyguardManager.class); + kgm.requestDismissKeyguard(this, null); + // Close dialogs and window shade, so this is fully visible sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); diff --git a/src/com/android/deskclock/timer/TimerCircleView.java b/src/com/android/deskclock/timer/TimerCircleView.java index f605f9186..ce181ddb9 100644 --- a/src/com/android/deskclock/timer/TimerCircleView.java +++ b/src/com/android/deskclock/timer/TimerCircleView.java @@ -38,9 +38,6 @@ public final class TimerCircleView extends View { /** The size of the dot indicating the progress through the timer. */ private final float mDotRadius; - /** An amount to subtract from the true radius to account for drawing thicknesses. */ - private final float mRadiusOffset; - /** The color indicating the remaining portion of the timer. */ private final int mRemainderColor; @@ -65,20 +62,17 @@ public final class TimerCircleView extends View { super(context, attrs); final Resources resources = context.getResources(); - final float dotDiameter = resources.getDimension(R.dimen.circletimer_dot_size); - - mDotRadius = dotDiameter / 2f; mStrokeSize = resources.getDimension(R.dimen.circletimer_circle_size); - mRadiusOffset = Utils.calculateRadiusOffset(mStrokeSize, dotDiameter, 0); + mDotRadius = mStrokeSize / 2; - mRemainderColor = Color.WHITE; - mCompletedColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); + mRemainderColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); + mCompletedColor = resources.getColor(R.color.secondary_color, context.getTheme()); mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.STROKE); mFill.setAntiAlias(true); - mFill.setColor(mCompletedColor); + mFill.setColor(mRemainderColor); mFill.setStyle(Paint.Style.FILL); } @@ -98,7 +92,7 @@ public final class TimerCircleView extends View { // Compute the size and location of the circle to be drawn. final int xCenter = getWidth() / 2; final int yCenter = getHeight() / 2; - final float radius = Math.min(xCenter, yCenter) - mRadiusOffset; + final float radius = Math.min(xCenter, yCenter) - mStrokeSize; // Reset old painting state. mPaint.setColor(mRemainderColor); @@ -115,7 +109,7 @@ public final class TimerCircleView extends View { } else if (mTimer.isExpired()) { mPaint.setColor(mCompletedColor); - // Draw a complete white circle; no red arc required. + // Draw a complete circle; no arc required. canvas.drawCircle(xCenter, yCenter, radius, mPaint); // Red percent is 1 since the timer has expired. @@ -137,7 +131,7 @@ public final class TimerCircleView extends View { canvas.drawArc(mArcRect, 270, -redPercent * 360 , false, mPaint); } - // Draw a red dot to indicate current progress through the timer. + // Draw a dot to indicate current progress through the timer. final float dotAngleDegrees = 270 - redPercent * 360; final double dotAngleRadians = Math.toRadians(dotAngleDegrees); final float dotX = xCenter + (float) (radius * Math.cos(dotAngleRadians)); diff --git a/src/com/android/deskclock/timer/TimerFragment.java b/src/com/android/deskclock/timer/TimerFragment.java index 165c359bd..5b2550c26 100644 --- a/src/com/android/deskclock/timer/TimerFragment.java +++ b/src/com/android/deskclock/timer/TimerFragment.java @@ -22,11 +22,9 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.content.Intent; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.SystemClock; -import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; -import androidx.viewpager.widget.ViewPager; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -34,9 +32,12 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; -import android.widget.Button; import android.widget.ImageView; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.viewpager.widget.ViewPager; + import com.android.deskclock.AnimatorUtils; import com.android.deskclock.DeskClock; import com.android.deskclock.DeskClockFragment; @@ -267,26 +268,26 @@ public final class TimerFragment extends DeskClockFragment { fab.setVisibility(VISIBLE); switch (timer.getState()) { case RUNNING: - fab.setImageResource(R.drawable.ic_pause_24dp); + fab.setImageResource(R.drawable.ic_play_pause); fab.setContentDescription(fab.getResources().getString(R.string.timer_stop)); break; case RESET: - fab.setImageResource(R.drawable.ic_start_24dp); + fab.setImageResource(R.drawable.ic_pause_play); fab.setContentDescription(fab.getResources().getString(R.string.timer_start)); break; case PAUSED: - fab.setImageResource(R.drawable.ic_start_24dp); + fab.setImageResource(R.drawable.ic_pause_play); fab.setContentDescription(fab.getResources().getString(R.string.timer_start)); break; case MISSED: case EXPIRED: - fab.setImageResource(R.drawable.ic_stop_24dp); + fab.setImageResource(R.drawable.ic_stop_play); fab.setContentDescription(fab.getResources().getString(R.string.timer_stop)); break; } } else if (mCurrentView == mCreateTimerView) { if (mCreateTimerView.hasValidInput()) { - fab.setImageResource(R.drawable.ic_start_24dp); + fab.setImageResource(R.drawable.ic_pause_play); fab.setContentDescription(fab.getResources().getString(R.string.timer_start)); fab.setVisibility(VISIBLE); } else { @@ -310,21 +311,24 @@ public final class TimerFragment extends DeskClockFragment { } @Override - public void onUpdateFabButtons(@NonNull Button left, @NonNull Button right) { + public void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right) { + final Context context = left.getContext(); + final Drawable icDelete = Utils.getVectorDrawable(context, R.drawable.ic_delete); if (mCurrentView == mTimersView) { left.setClickable(true); - left.setText(R.string.timer_delete); left.setContentDescription(left.getResources().getString(R.string.timer_delete)); left.setVisibility(VISIBLE); + left.setImageDrawable(icDelete); + final Drawable icAdd = Utils.getVectorDrawable(context, R.drawable.ic_add_24dp); + right.setImageDrawable(icAdd); right.setClickable(true); - right.setText(R.string.timer_add_timer); right.setContentDescription(right.getResources().getString(R.string.timer_add_timer)); right.setVisibility(VISIBLE); } else if (mCurrentView == mCreateTimerView) { left.setClickable(true); - left.setText(R.string.timer_cancel); + left.setImageDrawable(icDelete); left.setContentDescription(left.getResources().getString(R.string.timer_cancel)); // If no timers yet exist, the user is forced to create the first one. left.setVisibility(hasTimers() ? VISIBLE : INVISIBLE); @@ -394,7 +398,7 @@ public final class TimerFragment extends DeskClockFragment { } @Override - public void onLeftButtonClick(@NonNull Button left) { + public void onLeftButtonClick(@NonNull ImageView left) { if (mCurrentView == mTimersView) { // Clicking the "delete" button. final Timer timer = getTimer(); @@ -420,7 +424,7 @@ public final class TimerFragment extends DeskClockFragment { } @Override - public void onRightButtonClick(@NonNull Button right) { + public void onRightButtonClick(@NonNull ImageView right) { if (mCurrentView != mCreateTimerView) { animateToView(mCreateTimerView, null, true); } diff --git a/src/com/android/deskclock/timer/TimerItem.java b/src/com/android/deskclock/timer/TimerItem.java index d122d7716..9bdcd2bf7 100644 --- a/src/com/android/deskclock/timer/TimerItem.java +++ b/src/com/android/deskclock/timer/TimerItem.java @@ -19,13 +19,15 @@ package com.android.deskclock.timer; import android.content.Context; import android.content.res.ColorStateList; import android.os.SystemClock; -import androidx.core.view.ViewCompat; import android.text.TextUtils; import android.util.AttributeSet; +import android.view.View; import android.widget.Button; -import android.widget.LinearLayout; import android.widget.TextView; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.view.ViewCompat; + import com.android.deskclock.R; import com.android.deskclock.ThemeUtils; import com.android.deskclock.TimerTextController; @@ -35,10 +37,13 @@ import com.android.deskclock.data.Timer; import static android.R.attr.state_activated; import static android.R.attr.state_pressed; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.view.ViewCompat; + /** * This view is a visual representation of a {@link Timer}. */ -public class TimerItem extends LinearLayout { +public class TimerItem extends ConstraintLayout { /** Displays the remaining time or time since expiration. */ private TextView mTimerText; @@ -115,10 +120,13 @@ public class TimerItem extends LinearLayout { // Update some potentially expensive areas of the user interface only on state changes. if (timer.getState() != mLastState) { + mResetAddButton.setVisibility(View.VISIBLE); mLastState = timer.getState(); final Context context = getContext(); switch (mLastState) { case RESET: + mResetAddButton.setVisibility(View.GONE); + break; case PAUSED: { mResetAddButton.setText(R.string.timer_reset); mResetAddButton.setContentDescription(null); diff --git a/src/com/android/deskclock/timer/TimerSetupView.java b/src/com/android/deskclock/timer/TimerSetupView.java index 557a7d61a..105d2006d 100644 --- a/src/com/android/deskclock/timer/TimerSetupView.java +++ b/src/com/android/deskclock/timer/TimerSetupView.java @@ -17,11 +17,10 @@ package com.android.deskclock.timer; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.Resources; -import android.graphics.PorterDuff; + import androidx.annotation.IdRes; -import androidx.core.view.ViewCompat; + import android.text.BidiFormatter; import android.text.TextUtils; import android.text.format.DateUtils; @@ -36,7 +35,6 @@ import android.widget.TextView; import com.android.deskclock.FabContainer; import com.android.deskclock.FormattedTextUtils; import com.android.deskclock.R; -import com.android.deskclock.ThemeUtils; import com.android.deskclock.uidata.UiDataModel; import java.io.Serializable; @@ -55,7 +53,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener private TextView mTimeView; private View mDeleteView; - private View mDividerView; private TextView[] mDigitViews; /** Updates to the fab are requested via this container. */ @@ -91,7 +88,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener mTimeView = (TextView) findViewById(R.id.timer_setup_time); mDeleteView = findViewById(R.id.timer_setup_delete); - mDividerView = findViewById(R.id.timer_setup_divider); mDigitViews = new TextView[] { (TextView) findViewById(R.id.timer_setup_digit_0), (TextView) findViewById(R.id.timer_setup_digit_1), @@ -105,18 +101,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener (TextView) findViewById(R.id.timer_setup_digit_9), }; - // Tint the divider to match the disabled control color by default and used the activated - // control color when there is valid input. - final Context dividerContext = mDividerView.getContext(); - final int colorControlActivated = ThemeUtils.resolveColor(dividerContext, - R.attr.colorControlActivated); - final int colorControlDisabled = ThemeUtils.resolveColor(dividerContext, - R.attr.colorControlNormal, new int[] { ~android.R.attr.state_enabled }); - ViewCompat.setBackgroundTintList(mDividerView, new ColorStateList( - new int[][] { { android.R.attr.state_activated }, {} }, - new int[] { colorControlActivated, colorControlDisabled })); - ViewCompat.setBackgroundTintMode(mDividerView, PorterDuff.Mode.SRC); - // Initialize the digit buttons. final UiDataModel uidm = UiDataModel.getUiDataModel(); for (final TextView digitView : mDigitViews) { @@ -129,7 +113,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener mDeleteView.setOnLongClickListener(this); updateTime(); - updateDeleteAndDivider(); } public void setFabContainer(FabContainer fabContainer) { @@ -219,12 +202,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener r.getQuantityString(R.plurals.seconds, seconds, seconds))); } - private void updateDeleteAndDivider() { - final boolean enabled = hasValidInput(); - mDeleteView.setEnabled(enabled); - mDividerView.setActivated(enabled); - } - private void updateFab() { mFabContainer.updateFab(FAB_SHRINK_AND_EXPAND); } @@ -258,7 +235,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener // Update the fab, delete, and divider when we have valid input. if (mInputPointer == 0) { updateFab(); - updateDeleteAndDivider(); } } @@ -285,7 +261,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener // Update the fab, delete, and divider when we no longer have valid input. if (mInputPointer == -1) { updateFab(); - updateDeleteAndDivider(); } } @@ -294,7 +269,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener Arrays.fill(mInput, 0); mInputPointer = -1; updateTime(); - updateDeleteAndDivider(); } } @@ -331,7 +305,6 @@ public class TimerSetupView extends LinearLayout implements View.OnClickListener } } updateTime(); - updateDeleteAndDivider(); } } } diff --git a/src/com/android/deskclock/widget/CollapsingToolbarBaseActivity.java b/src/com/android/deskclock/widget/CollapsingToolbarBaseActivity.java new file mode 100644 index 000000000..9554390da --- /dev/null +++ b/src/com/android/deskclock/widget/CollapsingToolbarBaseActivity.java @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2021 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. + */ + +package com.android.deskclock.widget; + +import android.app.ActionBar; +import android.graphics.PorterDuff; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toolbar; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.fragment.app.FragmentActivity; + +import com.android.deskclock.R; + +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.google.android.material.resources.TextAppearanceConfig; + +/** + * A base Activity that has a collapsing toolbar layout is used for the activities intending to + * enable the collapsing toolbar function. + */ +public class CollapsingToolbarBaseActivity extends FragmentActivity { + + private static final float TOOLBAR_LINE_SPACING_MULTIPLIER = 1.1f; + + @Nullable + private CollapsingToolbarLayout mCollapsingToolbarLayout; + @Nullable + private AppBarLayout mAppBarLayout; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // Force loading font synchronously for collapsing toolbar layout + TextAppearanceConfig.setShouldLoadFontSynchronously(true); + super.setContentView(R.layout.collapsing_toolbar_base_layout); + mCollapsingToolbarLayout = findViewById(R.id.collapsing_toolbar); + mAppBarLayout = findViewById(R.id.app_bar); + if (mCollapsingToolbarLayout != null) { + mCollapsingToolbarLayout.setLineSpacingMultiplier(TOOLBAR_LINE_SPACING_MULTIPLIER); + } + disableCollapsingToolbarLayoutScrollingBehavior(); + + final Toolbar toolbar = findViewById(R.id.action_bar); + setActionBar(toolbar); + + // Enable title and home button by default + final ActionBar actionBar = getActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); + actionBar.setDisplayShowTitleEnabled(true); + // We need this to have an always light back arrow + toolbar.getNavigationIcon().setColorFilter(getColor(R.color.system_neutral1_50), + PorterDuff.Mode.SRC_ATOP); + } + } + + @Override + public void setContentView(int layoutResID) { + final ViewGroup parent = findViewById(R.id.content_frame); + if (parent != null) { + parent.removeAllViews(); + } + LayoutInflater.from(this).inflate(layoutResID, parent); + } + + @Override + public void setContentView(View view) { + final ViewGroup parent = findViewById(R.id.content_frame); + if (parent != null) { + parent.addView(view); + } + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + final ViewGroup parent = findViewById(R.id.content_frame); + if (parent != null) { + parent.addView(view, params); + } + } + + @Override + public void setTitle(CharSequence title) { + if (mCollapsingToolbarLayout != null) { + mCollapsingToolbarLayout.setTitle(title); + } else { + super.setTitle(title); + } + } + + @Override + public void setTitle(int titleId) { + if (mCollapsingToolbarLayout != null) { + mCollapsingToolbarLayout.setTitle(getText(titleId)); + } else { + super.setTitle(titleId); + } + } + + @Override + public boolean onNavigateUp() { + if (!super.onNavigateUp()) { + finishAfterTransition(); + } + return true; + } + + /** + * Returns an instance of collapsing toolbar. + */ + @Nullable + public CollapsingToolbarLayout getCollapsingToolbarLayout() { + return mCollapsingToolbarLayout; + } + + /** + * Return an instance of app bar. + */ + @Nullable + public AppBarLayout getAppBarLayout() { + return mAppBarLayout; + } + + private void disableCollapsingToolbarLayoutScrollingBehavior() { + if (mAppBarLayout == null) { + return; + } + final CoordinatorLayout.LayoutParams params = + (CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams(); + final AppBarLayout.Behavior behavior = new AppBarLayout.Behavior(); + behavior.setDragCallback( + new AppBarLayout.Behavior.DragCallback() { + @Override + public boolean canDrag(@NonNull AppBarLayout appBarLayout) { + return false; + } + }); + params.setBehavior(behavior); + } +} diff --git a/src/com/android/deskclock/widget/MotionButton.java b/src/com/android/deskclock/widget/MotionButton.java new file mode 100644 index 000000000..341b45e11 --- /dev/null +++ b/src/com/android/deskclock/widget/MotionButton.java @@ -0,0 +1,185 @@ +package com.android.deskclock.widget; + +/* + * Copyright (C) 2020 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. + */ + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Outline; +import android.graphics.Path; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewOutlineProvider; + +import androidx.appcompat.widget.AppCompatButton; + +import com.android.deskclock.R; + +/** + * A MotionButton is an AppCompatButton that can round its edges. <b>Added in 2.0</b> + * <p> + * Subclass of AppCompatButton to handle rounding edges dynamically. + * </p> + * <h2>MotionButton attributes</h2> + * <td>round</td> + * <td>(id) call the TransitionListener with this trigger id</td> + * </tr> + * <tr> + * <td>roundPercent</td> + * <td>Set the corner radius of curvature as a fraction of the smaller side. + * For squares 1 will result in a circle</td> + * </tr> + * <tr> + * <td>round</td> + * <td>Set the corner radius of curvature as a fraction of the smaller side. + * For squares 1 will result in a circle</td> + * </tr> + * + * </table> + */ +public class MotionButton extends AppCompatButton { + private float mRoundPercent = 0; // rounds the corners as a percent + private float mRound = Float.NaN; // rounds the corners in dp if NaN RoundPercent is in effect + private Path mPath; + ViewOutlineProvider mViewOutlineProvider; + RectF mRect; + + public MotionButton(Context context) { + super(context); + init(context, null); + } + + public MotionButton(Context context, AttributeSet attrs) { + super(context, attrs); + init(context, attrs); + } + + public MotionButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(context, attrs); + } + + private void init(Context context, AttributeSet attrs) { + setPadding(0, 0, 0, 0); + if (attrs != null) { + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MotionButton); + final int N = a.getIndexCount(); + for (int i = 0; i < N; i++) { + int attr = a.getIndex(i); + if (attr == R.styleable.MotionButton_round) { + setRound(a.getDimension(attr, 0)); + } else if (attr == R.styleable.MotionButton_roundPercent) { + setRoundPercent(a.getFloat(attr, 0)); + } + } + a.recycle(); + } + } + + /** + * Set the corner radius of curvature as a fraction of the smaller side. + * For squares 1 will result in a circle + * + * @param round the radius of curvature as a fraction of the smaller width + */ + public void setRoundPercent(float round) { + boolean change = (mRoundPercent != round); + mRoundPercent = round; + if (mRoundPercent != 0.0f) { + if (mPath == null) { + mPath = new Path(); + } + if (mRect == null) { + mRect = new RectF(); + } + if (mViewOutlineProvider == null) { + mViewOutlineProvider = new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + int w = getWidth(); + int h = getHeight(); + float r = Math.min(w, h) * mRoundPercent / 2; + outline.setRoundRect(0, 0, w, h, r); + } + }; + setOutlineProvider(mViewOutlineProvider); + } + setClipToOutline(true); + int w = getWidth(); + int h = getHeight(); + float r = Math.min(w, h) * mRoundPercent / 2; + mRect.set(0, 0, w, h); + mPath.reset(); + mPath.addRoundRect(mRect, r, r, Path.Direction.CW); + } else { + setClipToOutline(false); + } + if (change) { + invalidateOutline(); + } + } + + /** + * Set the corner radius of curvature + * + * @param round the radius of curvature NaN = default meaning roundPercent in effect + */ + public void setRound(float round) { + if (Float.isNaN(round)) { + mRound = round; + float tmp = mRoundPercent; + mRoundPercent = -1; + setRoundPercent(tmp); // force eval of roundPercent + return; + } + boolean change = (mRound != round); + mRound = round; + + if (mRound != 0.0f) { + if (mPath == null) { + mPath = new Path(); + } + if (mRect == null) { + mRect = new RectF(); + } + if (mViewOutlineProvider == null) { + mViewOutlineProvider = new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + int w = getWidth(); + int h = getHeight(); + outline.setRoundRect(0, 0, w, h, mRound); + } + }; + setOutlineProvider(mViewOutlineProvider); + } + setClipToOutline(true); + + int w = getWidth(); + int h = getHeight(); + mRect.set(0, 0, w, h); + mPath.reset(); + mPath.addRoundRect(mRect, mRound, mRound, Path.Direction.CW); + } else { + setClipToOutline(false); + } + if (change) { + invalidateOutline(); + } + + } +} diff --git a/tests/src/com/android/deskclock/widget/MockFabContainer.java b/tests/src/com/android/deskclock/widget/MockFabContainer.java index bdfbf7dd4..0c2d90069 100644 --- a/tests/src/com/android/deskclock/widget/MockFabContainer.java +++ b/tests/src/com/android/deskclock/widget/MockFabContainer.java @@ -41,8 +41,8 @@ public final class MockFabContainer implements FabContainer { public MockFabContainer(DeskClockFragment fragment, Context context) { deskClockFragment = fragment; fab = new ImageView(context); - leftButton = new Button(context); - rightButton = new Button(context); + leftButton = new ImageView(context); + rightButton = new ImageView(context); updateFab(FabContainer.FAB_AND_BUTTONS_IMMEDIATE); |