From e8217b3c1b9a69f4e2e7859a13fe8ee0242dec67 Mon Sep 17 00:00:00 2001 From: Federico Baron Date: Mon, 13 Feb 2023 17:03:18 -0800 Subject: [PATCH] Add ripple effect when a header in widget picker is selected. We need to use setSelected in order to add a ripple effect when a header is selected in tablet landscape mode, and to set the style through XML rather than programmatically the way it was done before in the method `setLargeScreenTheme`. Fix: 268558453 Test: Turn on LARGE_SCREEN_WIDGET_PICKER and verify that when selecting a header there's a ripple effect on that header Change-Id: I6cab920258a57118430d1e07416508ef36faa56d --- res/color/app_subtitle_text_dark.xml | 19 ++++ res/color/app_subtitle_text_light.xml | 18 ++++ res/color/app_title_text_dark.xml | 19 ++++ res/color/app_title_text_light.xml | 18 ++++ .../bg_widgets_header_large_screen.xml | 26 ++++++ .../bg_widgets_header_states_large_screen.xml | 31 +++++++ .../widgets_list_row_header_two_pane.xml | 69 +++++++++++++++ res/values/attrs.xml | 2 + res/values/styles.xml | 4 + .../widget/picker/WidgetsFullSheet.java | 8 +- .../widget/picker/WidgetsListAdapter.java | 3 +- .../picker/WidgetsListDrawableState.java | 6 +- .../widget/picker/WidgetsListHeader.java | 88 ++++--------------- .../WidgetsListHeaderViewHolderBinder.java | 21 +++-- ...WidgetsListHeaderViewHolderBinderTest.java | 3 +- 15 files changed, 245 insertions(+), 90 deletions(-) create mode 100644 res/color/app_subtitle_text_dark.xml create mode 100644 res/color/app_subtitle_text_light.xml create mode 100644 res/color/app_title_text_dark.xml create mode 100644 res/color/app_title_text_light.xml create mode 100644 res/drawable/bg_widgets_header_large_screen.xml create mode 100644 res/drawable/bg_widgets_header_states_large_screen.xml create mode 100644 res/layout/widgets_list_row_header_two_pane.xml diff --git a/res/color/app_subtitle_text_dark.xml b/res/color/app_subtitle_text_dark.xml new file mode 100644 index 0000000000..220d10fc8f --- /dev/null +++ b/res/color/app_subtitle_text_dark.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/res/color/app_subtitle_text_light.xml b/res/color/app_subtitle_text_light.xml new file mode 100644 index 0000000000..fb00baac6c --- /dev/null +++ b/res/color/app_subtitle_text_light.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/res/color/app_title_text_dark.xml b/res/color/app_title_text_dark.xml new file mode 100644 index 0000000000..220d10fc8f --- /dev/null +++ b/res/color/app_title_text_dark.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/res/color/app_title_text_light.xml b/res/color/app_title_text_light.xml new file mode 100644 index 0000000000..bb5297319d --- /dev/null +++ b/res/color/app_title_text_light.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/res/drawable/bg_widgets_header_large_screen.xml b/res/drawable/bg_widgets_header_large_screen.xml new file mode 100644 index 0000000000..e1408cc235 --- /dev/null +++ b/res/drawable/bg_widgets_header_large_screen.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/res/drawable/bg_widgets_header_states_large_screen.xml b/res/drawable/bg_widgets_header_states_large_screen.xml new file mode 100644 index 0000000000..1ee5fe5585 --- /dev/null +++ b/res/drawable/bg_widgets_header_states_large_screen.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/layout/widgets_list_row_header_two_pane.xml b/res/layout/widgets_list_row_header_two_pane.xml new file mode 100644 index 0000000000..6465db593e --- /dev/null +++ b/res/layout/widgets_list_row_header_two_pane.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + diff --git a/res/values/attrs.xml b/res/values/attrs.xml index c3bd90e529..f70937a73c 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -55,6 +55,8 @@ + + diff --git a/res/values/styles.xml b/res/values/styles.xml index a0b5570b2b..474a289a2e 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -176,10 +176,14 @@ #E8EAED ?android:attr/textColorPrimary ?android:attr/textColorSecondary + @color/app_title_text_light + @color/app_subtitle_text_light