diff options
author | 2024-09-24 22:10:48 +0000 | |
---|---|---|
committer | 2024-09-25 20:34:49 +0000 | |
commit | d4488bfd729b9ed29c5a1d5022b29e7d4a1a3f0e (patch) | |
tree | 5dcbc2db307a0ea0babcea00a7438a786bff92fc /res/drawable | |
parent | 9a779224240db1dfa685ac8835f45b26a8c4f68f (diff) |
Implement focus state on personal/work tab button
figma: https://www.figma.com/design/ccBEWEnusF6lE4edgCw7bG/Android-Interactions-Library?node-id=6315-109525&node-type=frame&t=SBKtwrMnJ0ppeUxa-0
result: https://photos.app.goo.gl/LEWF6tsKz3BXXWuv5
hsv: https://hsv.googleplex.com/4794951907934208
Bug: 327430110
Flag: EXEMPT bugfix
Test: Manual
Change-Id: Ia953c92f30cbd65a83f8e60e8bb2d4b17073b369
Diffstat (limited to 'res/drawable')
5 files changed, 147 insertions, 30 deletions
diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml index 62927afeb7..d200b9f961 100644 --- a/res/drawable/all_apps_tabs_background.xml +++ b/res/drawable/all_apps_tabs_background.xml @@ -13,36 +13,25 @@ See the License for the specific language governing permissions and limitations under the License. --> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/accent_ripple_color"> - - <item android:id="@android:id/mask"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> - <solid android:color="@color/accent_ripple_color" /> - </shape> - </item> - - <item> - <selector android:enterFadeDuration="100"> - <item - android:id="@+id/unselected" - android:state_selected="false"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> - <solid android:color="?attr/materialColorSurfaceBright" /> - </shape> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/all_apps_tabs_background_unselected_focused" android:state_focused="true" android:state_selected="false" /> + <item android:drawable="@drawable/all_apps_tabs_background_selected_focused" android:state_focused="true" android:state_selected="true" /> + <item android:id="@+id/unselected" android:state_focused="false" android:state_selected="false"> + <ripple android:color="@color/accent_ripple_color"> + <item> + <selector android:enterFadeDuration="100"> + <item android:drawable="@drawable/all_apps_tabs_background_unselected" /> + </selector> </item> - - <item - android:id="@+id/selected" - android:state_selected="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> - <solid android:color="?attr/materialColorPrimary" /> - </shape> + </ripple> + </item> + <item android:id="@+id/selected" android:state_focused="false" android:state_selected="true"> + <ripple android:color="@color/accent_ripple_color"> + <item> + <selector android:enterFadeDuration="100"> + <item android:drawable="@drawable/all_apps_tabs_background_selected" /> + </selector> </item> - </selector> + </ripple> </item> - -</ripple>
\ No newline at end of file +</selector>
\ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background_selected.xml b/res/drawable/all_apps_tabs_background_selected.xml new file mode 100644 index 0000000000..47f95dd745 --- /dev/null +++ b/res/drawable/all_apps_tabs_background_selected.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"> + <item + android:bottom="@dimen/all_apps_tabs_focus_width" + android:end="@dimen/all_apps_tabs_focus_width" + android:start="@dimen/all_apps_tabs_focus_width" + android:top="@dimen/all_apps_tabs_focus_width"> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> + <solid android:color="?attr/materialColorPrimary" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background_selected_focused.xml b/res/drawable/all_apps_tabs_background_selected_focused.xml new file mode 100644 index 0000000000..e3d86c04fe --- /dev/null +++ b/res/drawable/all_apps_tabs_background_selected_focused.xml @@ -0,0 +1,37 @@ +<?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> + <corners android:radius="16dp" /> + <solid android:color="?attr/materialColorPrimary" /> + </shape> + </item> + + <item + android:bottom="@dimen/all_apps_tabs_focus_border" + android:end="@dimen/all_apps_tabs_focus_border" + android:start="@dimen/all_apps_tabs_focus_border" + android:top="@dimen/all_apps_tabs_focus_border"> + <shape android:shape="rectangle"> + <corners android:radius="13dp" /> + <solid android:color="?attr/materialColorPrimary" /> + <stroke + android:width="@dimen/all_apps_tabs_focus_padding" + android:color="?attr/materialColorSurfaceDim" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background_unselected.xml b/res/drawable/all_apps_tabs_background_unselected.xml new file mode 100644 index 0000000000..ab592a8304 --- /dev/null +++ b/res/drawable/all_apps_tabs_background_unselected.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"> + <item + android:bottom="@dimen/all_apps_tabs_focus_width" + android:end="@dimen/all_apps_tabs_focus_width" + android:start="@dimen/all_apps_tabs_focus_width" + android:top="@dimen/all_apps_tabs_focus_width"> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> + <solid android:color="?attr/materialColorSurfaceBright" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background_unselected_focused.xml b/res/drawable/all_apps_tabs_background_unselected_focused.xml new file mode 100644 index 0000000000..0016102ef0 --- /dev/null +++ b/res/drawable/all_apps_tabs_background_unselected_focused.xml @@ -0,0 +1,37 @@ +<?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> + <corners android:radius="16dp" /> + <solid android:color="?attr/materialColorPrimary" /> + </shape> + </item> + + <item + android:bottom="@dimen/all_apps_tabs_focus_border" + android:end="@dimen/all_apps_tabs_focus_border" + android:start="@dimen/all_apps_tabs_focus_border" + android:top="@dimen/all_apps_tabs_focus_border"> + <shape android:shape="rectangle"> + <corners android:radius="13dp" /> + <solid android:color="?attr/materialColorSurfaceBright" /> + <stroke + android:width="@dimen/all_apps_tabs_focus_padding" + android:color="?attr/materialColorSurfaceDim" /> + </shape> + </item> +</layer-list>
\ No newline at end of file |