diff options
author | 2024-11-08 21:44:05 +0000 | |
---|---|---|
committer | 2024-11-08 21:44:05 +0000 | |
commit | ba81c0f3450a9d432ad95929b65d07182b82f428 (patch) | |
tree | 646adc8232e7d32198297854c5e5d529cf7269b7 /res/drawable | |
parent | 0019e59d99ee9cacad4760d0afc8f04ab28dd6d9 (diff) | |
parent | 7820eab80c030962da61719f1776436dfca53953 (diff) |
Merge "Add focus ring to widgets header" into main
Diffstat (limited to 'res/drawable')
6 files changed, 129 insertions, 21 deletions
diff --git a/res/drawable/bg_widgets_header_states_two_pane.xml b/res/drawable/bg_widgets_header_states_two_pane.xml index 5f4b8c66b4..1ec41a9a0a 100644 --- a/res/drawable/bg_widgets_header_states_two_pane.xml +++ b/res/drawable/bg_widgets_header_states_two_pane.xml @@ -14,18 +14,16 @@ limitations under the License. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - - <item android:state_expanded="true"> - <shape android:shape="rectangle"> - <solid android:color="?attr/widgetPickerHeaderBackgroundColor" /> - <corners android:radius="@dimen/widget_list_top_bottom_corner_radius" /> - </shape> + <item android:state_expanded="true" android:state_focused="false"> + <ripple android:color="@color/accent_ripple_color"> + <item android:drawable="@drawable/bg_widgets_header_two_pane_expanded_unfocused" /> + </ripple> </item> - - <item android:state_expanded="false"> - <shape android:shape="rectangle"> - <solid android:color="@android:color/transparent" /> - <corners android:radius="@dimen/widget_list_top_bottom_corner_radius" /> - </shape> + <item android:state_expanded="false" android:state_focused="false"> + <ripple android:color="@color/accent_ripple_color"> + <item android:drawable="@drawable/bg_widgets_header_two_pane_unexpanded_unfocused" /> + </ripple> </item> + <item android:drawable="@drawable/bg_widgets_header_two_pane_expanded_focused" android:state_expanded="true" android:state_focused="true" /> + <item android:drawable="@drawable/bg_widgets_header_two_pane_unexpanded_focused" android:state_expanded="false" android:state_focused="true" /> </selector> diff --git a/res/drawable/bg_widgets_header_two_pane.xml b/res/drawable/bg_widgets_header_two_pane.xml index ca3feef1f0..e237002898 100644 --- a/res/drawable/bg_widgets_header_two_pane.xml +++ b/res/drawable/bg_widgets_header_two_pane.xml @@ -14,13 +14,10 @@ limitations under the License. --> <inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetTop="@dimen/widget_list_entry_spacing" > - <ripple - android:color="@color/accent_ripple_color" - android:paddingTop="@dimen/widget_list_header_view_vertical_padding" - android:paddingBottom="@dimen/widget_list_header_view_vertical_padding" > - <item android:id="@android:id/mask" - android:drawable="@drawable/bg_widgets_header_states_two_pane" /> + android:insetTop="@dimen/widget_list_entry_spacing"> + <layer-list + android:paddingBottom="@dimen/widget_list_header_view_vertical_padding" + android:paddingTop="@dimen/widget_list_header_view_vertical_padding"> <item android:drawable="@drawable/bg_widgets_header_states_two_pane" /> - </ripple> -</inset> + </layer-list> +</inset>
\ No newline at end of file diff --git a/res/drawable/bg_widgets_header_two_pane_expanded_focused.xml b/res/drawable/bg_widgets_header_two_pane_expanded_focused.xml new file mode 100644 index 0000000000..0ee3d14715 --- /dev/null +++ b/res/drawable/bg_widgets_header_two_pane_expanded_focused.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (C) 2024 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- Draw the focus ring --> + <item> + <shape> + <corners android:radius="@dimen/widget_focus_ring_corner_radius" /> + <stroke + android:width="@dimen/widget_header_focus_ring_width" + android:color="?attr/widgetPickerTabBackgroundSelected" /> + </shape> + </item> + + <!-- Draw the background with padding to make it spaced within the focus ring. --> + <item + android:bottom="@dimen/widget_header_background_border" + android:end="@dimen/widget_header_background_border" + android:start="@dimen/widget_header_background_border" + android:top="@dimen/widget_header_background_border"> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/widget_list_top_bottom_corner_radius" /> + <solid android:color="?attr/widgetPickerHeaderBackgroundColor" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/bg_widgets_header_two_pane_expanded_unfocused.xml b/res/drawable/bg_widgets_header_two_pane_expanded_unfocused.xml new file mode 100644 index 0000000000..9028ebe270 --- /dev/null +++ b/res/drawable/bg_widgets_header_two_pane_expanded_unfocused.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (C) 2024 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" + android:paddingBottom="@dimen/widget_list_header_view_vertical_padding" + android:paddingTop="@dimen/widget_list_header_view_vertical_padding"> + <item> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/widget_list_top_bottom_corner_radius" /> + <solid android:color="?attr/widgetPickerHeaderBackgroundColor" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/bg_widgets_header_two_pane_unexpanded_focused.xml b/res/drawable/bg_widgets_header_two_pane_unexpanded_focused.xml new file mode 100644 index 0000000000..12dc907bd3 --- /dev/null +++ b/res/drawable/bg_widgets_header_two_pane_unexpanded_focused.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (C) 2024 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- Draw the focus ring and a transparent background --> + <item> + <shape> + <corners android:radius="@dimen/widget_focus_ring_corner_radius" /> + <solid android:color="@android:color/transparent" /> + <stroke + android:width="@dimen/widget_header_focus_ring_width" + android:color="?attr/widgetPickerTabBackgroundSelected" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/bg_widgets_header_two_pane_unexpanded_unfocused.xml b/res/drawable/bg_widgets_header_two_pane_unexpanded_unfocused.xml new file mode 100644 index 0000000000..ba26f9fc3e --- /dev/null +++ b/res/drawable/bg_widgets_header_two_pane_unexpanded_unfocused.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (C) 2024 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/widget_list_top_bottom_corner_radius" /> + <solid android:color="@android:color/transparent" /> + </shape> + </item> +</layer-list>
\ No newline at end of file |