Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01ae913 authored by Shamali Patwa's avatar Shamali Patwa Committed by Android (Google) Code Review
Browse files

Merge changes from topic "sheader-a11y" into main

* changes:
  Fix issue that expanding only search result led to weird scroll
  Fix issue that items were invisible in 2-pane picker with talkback.
parents 43cc25b6 656a0264
Loading
Loading
Loading
Loading
+34 −32
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto">

    <FrameLayout
    <LinearLayout
        android:id="@+id/widgets_two_pane_sheet_paged_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
@@ -23,40 +23,17 @@
        android:layout_gravity="start"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:layout_alignParentStart="true">
        <!-- Note: the paddingHorizontal has to be on WidgetPagedView level so that talkback
         correctly orders the lists to be after the search and suggestions header. See b/209579563.
          -->
        <com.android.launcher3.widget.picker.WidgetPagedView
            android:id="@+id/widgets_view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
            android:descendantFocusability="afterDescendants"
            launcher:pageIndicator="@+id/tabs" >

            <com.android.launcher3.widget.picker.WidgetsRecyclerView
                android:id="@+id/primary_widgets_list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false" />

            <com.android.launcher3.widget.picker.WidgetsRecyclerView
                android:id="@+id/work_widgets_list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false" />

        </com.android.launcher3.widget.picker.WidgetPagedView>

        android:layout_alignParentStart="true"
        android:orientation="vertical">
        <!-- SearchAndRecommendationsView without the tab layout as well -->
        <!-- Note: the horizontal padding matches with the WidgetPagedView -->
        <com.android.launcher3.views.StickyHeaderLayout
        <LinearLayout
            android:id="@+id/search_and_recommendations_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToOutline="true"
            android:elevation="1dp"
            android:background="?attr/widgetPickerPrimarySurfaceColor"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
            android:orientation="vertical">

@@ -67,6 +44,7 @@
                android:orientation="horizontal"
                android:background="?attr/widgetPickerPrimarySurfaceColor"
                android:gravity="center_vertical"
                android:layout_marginBottom="8dp"
                launcher:layout_sticky="true">
                <FrameLayout
                    android:layout_width="0dp"
@@ -98,7 +76,6 @@
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/suggestions_header"
                android:layout_marginTop="8dp"
                android:orientation="horizontal"
                android:background="?attr/widgetPickerPrimarySurfaceColor"
                launcher:layout_sticky="true">
@@ -140,6 +117,31 @@
                    style="?android:attr/borderlessButtonStyle" />

            </com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
        </com.android.launcher3.views.StickyHeaderLayout>
    </FrameLayout>
        </LinearLayout>
        <!-- Note: the paddingHorizontal has to be on WidgetPagedView level so that talkback
 correctly orders the lists to be after the search and suggestions header. See b/209579563.
  -->
        <com.android.launcher3.widget.picker.WidgetPagedView
            android:id="@+id/widgets_view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
            android:descendantFocusability="afterDescendants"
            launcher:pageIndicator="@+id/tabs" >

            <com.android.launcher3.widget.picker.WidgetsRecyclerView
                android:id="@+id/primary_widgets_list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false" />

            <com.android.launcher3.widget.picker.WidgetsRecyclerView
                android:id="@+id/work_widgets_list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false" />

        </com.android.launcher3.widget.picker.WidgetPagedView>
    </LinearLayout>
</merge>
+14 −13
Original line number Diff line number Diff line
@@ -15,28 +15,22 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto">

    <FrameLayout
    <LinearLayout
        android:id="@+id/widgets_two_pane_sheet_recyclerview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="start"
        android:layout_gravity="start"
        android:clipChildren="false"
        android:layout_alignParentStart="true">

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/primary_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
            android:clipToPadding="false" />

        android:layout_alignParentStart="true"
        android:orientation="vertical">
        <!-- SearchAndRecommendationsView without the tab layout as well -->
        <com.android.launcher3.views.StickyHeaderLayout
        <LinearLayout
            android:id="@+id/search_and_recommendations_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToOutline="true"
            android:background="?attr/widgetPickerPrimarySurfaceColor"
            android:orientation="vertical">

            <LinearLayout
@@ -83,6 +77,13 @@
                android:background="?attr/widgetPickerPrimarySurfaceColor"
                launcher:layout_sticky="true">
            </FrameLayout>
        </com.android.launcher3.views.StickyHeaderLayout>
    </FrameLayout>
        </LinearLayout>

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/primary_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
            android:clipToPadding="false" />
    </LinearLayout>
</merge>
 No newline at end of file
+15 −5
Original line number Diff line number Diff line
@@ -145,7 +145,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
    protected DeviceProfile mDeviceProfile;

    protected TextView mNoWidgetsView;
    protected StickyHeaderLayout mSearchScrollView;
    protected LinearLayout mSearchScrollView;
    // Reference to the mSearchScrollView when it is is a sticky header.
    private @Nullable StickyHeaderLayout mStickyHeaderLayout;
    protected WidgetRecommendationsView mWidgetRecommendationsView;
    protected LinearLayout mWidgetRecommendationsContainer;
    protected View mTabBar;
@@ -220,7 +222,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet

    protected void setupViews() {
        mSearchScrollView = findViewById(R.id.search_and_recommendations_container);
        mSearchScrollView.setCurrentRecyclerView(findViewById(R.id.primary_widgets_list_view));
        if (mSearchScrollView instanceof StickyHeaderLayout) {
            mStickyHeaderLayout = (StickyHeaderLayout) mSearchScrollView;
            mStickyHeaderLayout.setCurrentRecyclerView(
                    findViewById(R.id.primary_widgets_list_view));
        }
        mNoWidgetsView = findViewById(R.id.no_widgets_text);
        mFastScroller = findViewById(R.id.fast_scroller);
        mFastScroller.setPopupView(findViewById(R.id.fast_scroller_popup));
@@ -284,7 +290,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
            reset();
            resetExpandedHeaders();
            mCurrentWidgetsRecyclerView = recyclerView;
            mSearchScrollView.setCurrentRecyclerView(recyclerView);
            if (mStickyHeaderLayout != null) {
                mStickyHeaderLayout.setCurrentRecyclerView(recyclerView);
            }
        }
    }

@@ -313,7 +321,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
            mAdapters.get(AdapterHolder.WORK).mWidgetsRecyclerView.scrollToTop();
        }
        mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.scrollToTop();
        mSearchScrollView.reset(/* animate= */ true);
        if (mStickyHeaderLayout != null) {
            mStickyHeaderLayout.reset(/* animate= */ true);
        }
    }

    @VisibleForTesting
@@ -1051,7 +1061,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        }

        private int getEmptySpaceHeight() {
            return mSearchScrollView.getHeaderHeight();
            return mStickyHeaderLayout != null ? mStickyHeaderLayout.getHeaderHeight() : 0;
        }

        void setup(WidgetsRecyclerView recyclerView) {
+0 −9
Original line number Diff line number Diff line
@@ -396,15 +396,6 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
        LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
        if (layoutManager == null) return;

        if (position == mVisibleEntries.size() - 2
                && mVisibleEntries.get(mVisibleEntries.size() - 1)
                instanceof WidgetsListContentEntry) {
            // If the selected header is in the last position and its content is showing, then
            // scroll to the final position so the last list of widgets will show.
            layoutManager.scrollToPosition(mVisibleEntries.size() - 1);
            return;
        }

        // Scroll to the header view's current offset, accounting for the recycler view's padding.
        // If the header view couldn't be found, then it will appear at the top of the list.
        layoutManager.scrollToPositionWithOffset(