From 64b0ad623a19c5498015ec47ba238d2d9c5851a3 Mon Sep 17 00:00:00 2001 From: Shamali P Date: Mon, 19 Aug 2024 12:48:53 +0000 Subject: [PATCH 1/2] Focus on first item to match the behavior with widgets list On opening suggestions, was focusing on entire right pane, instead, focusing now on first item to match with the widget apps list below. Bug: 359795405 Test: Talkback Flag: EXEMPT bugfix Change-Id: I4aaefc7642910b544f56522ac0b3cb10454626c7 --- .../widget/picker/WidgetsTwoPaneSheet.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java index c2cd903cde..2653514074 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java +++ b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java @@ -376,17 +376,14 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet { mSuggestedWidgetsPackageUserKey = PackageUserKey.fromPackageItemInfo(packageItemInfo); final boolean isChangingHeaders = mSelectedHeader == null || !mSelectedHeader.equals(mSuggestedWidgetsPackageUserKey); - // If the initial focus view is still focused, it is likely a programmatic header - // click. - if (mSelectedHeader != null - && !getAccessibilityInitialFocusView().isAccessibilityFocused()) { - post(() -> { - mRightPaneScrollView.setAccessibilityPaneTitle(suggestionsRightPaneTitle); - mRightPaneScrollView.performAccessibilityAction( - AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null); - }); - } if (isChangingHeaders) { + // If the initial focus view is still focused or widget picker is still opening, it + // is likely a programmatic header click. + if (mSelectedHeader != null && !mOpenCloseAnimation.getAnimationPlayer().isRunning() + && !getAccessibilityInitialFocusView().isAccessibilityFocused()) { + mRightPaneScrollView.setAccessibilityPaneTitle(suggestionsRightPaneTitle); + focusOnFirstWidgetCell(mWidgetRecommendationsView); + } // If switching from another header, unselect any WidgetCells. This is necessary // because we do not clear/recycle the WidgetCells in the recommendations container // when the header is clicked, only when onRecommendationsBound is called. That @@ -505,9 +502,10 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet { public void onHeaderChanged(@NonNull PackageUserKey selectedHeader) { final boolean isSameHeader = mSelectedHeader != null && mSelectedHeader.equals(selectedHeader); - // If the initial focus view is still focused, it is likely a programmatic header - // click. + // If the initial focus view is still focused or widget picker is still opening, it + // is likely a programmatic header click. final boolean isUserClick = mSelectedHeader != null + && !mOpenCloseAnimation.getAnimationPlayer().isRunning() && !getAccessibilityInitialFocusView().isAccessibilityFocused(); mSelectedHeader = selectedHeader; final boolean showDefaultWidgets = mWidgetOptionsMenuState != null From 8c965c67dc7b0b2f7219d50b2f1b95b59578d707 Mon Sep 17 00:00:00 2001 From: Shamali P Date: Tue, 20 Aug 2024 00:40:56 +0000 Subject: [PATCH 2/2] Adjust tap target of the profile tabs in picker Uses insets on background drawable to maintain visual size. Bug: 360245807 Test: Accessibility scanner Flag: EXEMPT bugfix Change-Id: I1fbc7c2c782a1e331dd1ba77b0a3bf8aad277792 --- .../widget_picker_tabs_background.xml | 63 ++++++++++--------- res/layout/widgets_full_sheet_paged_view.xml | 2 - .../widgets_two_pane_sheet_paged_view.xml | 2 - 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/res/drawable/widget_picker_tabs_background.xml b/res/drawable/widget_picker_tabs_background.xml index a874dd8b90..f6607b7ad1 100644 --- a/res/drawable/widget_picker_tabs_background.xml +++ b/res/drawable/widget_picker_tabs_background.xml @@ -13,36 +13,39 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - \ No newline at end of file + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/widgets_full_sheet_paged_view.xml b/res/layout/widgets_full_sheet_paged_view.xml index 8dc785af66..622f0d6aa5 100644 --- a/res/layout/widgets_full_sheet_paged_view.xml +++ b/res/layout/widgets_full_sheet_paged_view.xml @@ -104,7 +104,6 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="@dimen/widget_tabs_button_horizontal_padding" - android:layout_marginVertical="@dimen/widget_apps_tabs_vertical_padding" android:layout_weight="1" android:background="@drawable/widget_picker_tabs_background" android:text="@string/widgets_full_sheet_personal_tab" @@ -117,7 +116,6 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="@dimen/widget_tabs_button_horizontal_padding" - android:layout_marginVertical="@dimen/widget_apps_tabs_vertical_padding" android:layout_weight="1" android:background="@drawable/widget_picker_tabs_background" android:text="@string/widgets_full_sheet_work_tab" diff --git a/res/layout/widgets_two_pane_sheet_paged_view.xml b/res/layout/widgets_two_pane_sheet_paged_view.xml index 1f41680825..1cbd2bad43 100644 --- a/res/layout/widgets_two_pane_sheet_paged_view.xml +++ b/res/layout/widgets_two_pane_sheet_paged_view.xml @@ -115,7 +115,6 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="@dimen/widget_tabs_button_horizontal_padding" - android:layout_marginVertical="@dimen/widget_apps_tabs_vertical_padding" android:layout_weight="1" android:background="@drawable/widget_picker_tabs_background" android:text="@string/widgets_full_sheet_personal_tab" @@ -128,7 +127,6 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="@dimen/widget_tabs_button_horizontal_padding" - android:layout_marginVertical="@dimen/widget_apps_tabs_vertical_padding" android:layout_weight="1" android:background="@drawable/widget_picker_tabs_background" android:text="@string/widgets_full_sheet_work_tab"