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

Commit 4b1a38bb authored by Federico Baron's avatar Federico Baron
Browse files

Implement two pane widget picker

The widget picker design is currently not optimized for large screen form factor devices.
We resolve that by adding a two pane widget picker like that of the design in go/widget-picker-2023.

Bug: 256684299
Test: Make sure to be on a tablet in landscape mode.
        1.Turn on flag LARGE_SCREEN_WIDGET_PICKER.
        2. Press and hold on an empty spot in workspace until the popup menu appears.
        3. Click widgets.
        4. Notice the new two pane layout
Change-Id: Ia3ea17dc320f72f9bc5dea52399ff51d9161602b
parent 7b7130db
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2023 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="@color/widget_picker_background_selected"
    android:gravity="center"
    >
    <path
        android:fillColor="@android:color/white"
        android:pathData="M16.65,13 L11,7.35 16.65,1.7 22.3,7.35ZM3,11V3H11V11ZM13,21V13H21V21ZM3,21V13H11V21ZM5,9H9V5H5ZM16.675,10.2 L19.5,7.375 16.675,4.55 13.85,7.375ZM15,19H19V15H15ZM5,19H9V15H5ZM9,9ZM13.85,7.375ZM9,15ZM15,15Z"/>
</vector>
+30 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2023 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="oval">
      <size
          android:width="48dp"
          android:height="48dp" />
      <solid android:color="@color/surface"/>
    </shape>
  </item>
  <item
      android:width="24dp"
      android:height="24dp"
      android:drawable="@drawable/widget_suggestions"
      android:gravity="center" />
</layer-list>
+120 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2022 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.
-->
<com.android.launcher3.widget.picker.WidgetsFullSheet xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:theme="?attr/widgetsTheme">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bg_widgets_full_sheet"
        android:focusable="true"
        android:importantForAccessibility="no">

        <FrameLayout
            android:id="@+id/recycler_view_container"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintEnd_toStartOf="@id/right_pane"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/title"
            app:layout_constraintWidth_percent="0.33">

            <TextView
                android:id="@+id/no_widgets_text"
                style="@style/PrimaryHeadline"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:textSize="18sp"
                android:visibility="gone"
                tools:text="No widgets available" />

            <TextView
                android:id="@+id/fast_scroller_popup"
                style="@style/FastScrollerPopup"
                android:layout_marginEnd="@dimen/fastscroll_popup_margin" />

            <!-- Fast scroller popup -->
            <com.android.launcher3.views.RecyclerViewFastScroller
                android:id="@+id/fast_scroller"
                android:layout_width="@dimen/fastscroll_width"
                android:layout_height="match_parent"
                android:layout_marginEnd="@dimen/fastscroll_end_margin" />

            <com.android.launcher3.widget.picker.WidgetsRecyclerView
                android:id="@+id/search_widgets_list_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false"
                android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                android:visibility="gone" />
        </FrameLayout>

        <ScrollView
            android:id="@+id/right_pane"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/recycler_view_container"
            app:layout_constraintTop_toBottomOf="@id/title"
            app:layout_constraintBottom_toBottomOf="parent"
            android:paddingEnd="16dp"
            android:paddingStart="8dp"
            android:layout_marginTop="26dp"
            app:layout_constraintWidth_percent="0.67">

            <com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
                android:id="@+id/recommended_widget_table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/widgets_surface_background"
                android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
                android:visibility="gone" />
        </ScrollView>

        <View
            android:id="@+id/collapse_handle"
            android:layout_width="@dimen/bottom_sheet_handle_width"
            android:layout_height="@dimen/bottom_sheet_handle_height"
            android:layout_marginTop="@dimen/bottom_sheet_handle_margin"
            android:background="@drawable/bg_rounded_corner_bottom_sheet_handle"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/collapse_handle"
            android:layout_marginTop="24dp"
            android:gravity="center_horizontal"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
            android:text="@string/widget_button_text"
            android:textColor="?android:attr/textColorSecondary"
            android:textSize="24sp" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</com.android.launcher3.widget.picker.WidgetsFullSheet>
+122 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2023 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <FrameLayout
        android:id="@+id/widgets_full_sheet_paged_view_large_screen"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintEnd_toStartOf="@id/scrollView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/title"
        app:layout_constraintWidth_percent="0.33">
        <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:descendantFocusability="afterDescendants"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
            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>

        <!-- SearchAndRecommendationsView without the tab layout as well -->
        <com.android.launcher3.views.StickyHeaderLayout
            android:id="@+id/search_and_recommendations_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout
                android:id="@+id/search_bar_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?android:attr/colorBackground"
                android:clipToPadding="false"
                android:elevation="0.1dp"
                android:paddingBottom="8dp"
                android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                launcher:layout_sticky="true">

                <include layout="@layout/widgets_search_bar" />
            </FrameLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/suggestions_header"
                android:layout_marginTop="8dp"
                android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                android:orientation="horizontal">
            </LinearLayout>

            <com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="64dp"
                android:gravity="center_horizontal"
                android:orientation="horizontal"
                android:paddingVertical="8dp"
                android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                android:background="?android:attr/colorBackground"
                style="@style/TextHeadline"
                launcher:layout_sticky="true">

                <Button
                    android:id="@+id/tab_personal"
                    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/all_apps_tabs_background"
                    android:text="@string/widgets_full_sheet_personal_tab"
                    android:textColor="@color/all_apps_tab_text"
                    android:textSize="14sp"
                    style="?android:attr/borderlessButtonStyle" />

                <Button
                    android:id="@+id/tab_work"
                    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/all_apps_tabs_background"
                    android:text="@string/widgets_full_sheet_work_tab"
                    android:textColor="@color/all_apps_tab_text"
                    android:textSize="14sp"
                    style="?android:attr/borderlessButtonStyle" />

            </com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
        </com.android.launcher3.views.StickyHeaderLayout>
    </FrameLayout>
</merge>
+67 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2021 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <FrameLayout
        android:id="@+id/widgets_full_sheet_recyclerview_large_screen"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintEnd_toStartOf="@id/scrollView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/title"
        app:layout_constraintWidth_percent="0.33">

        <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_large_screen"
            android:clipToPadding="false" />

        <!-- SearchAndRecommendationsView without the tab layout as well -->
        <com.android.launcher3.views.StickyHeaderLayout
            android:id="@+id/search_and_recommendations_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout
                android:id="@+id/search_bar_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?android:attr/colorBackground"
                android:clipToPadding="false"
                android:elevation="0.1dp"
                android:paddingBottom="8dp"
                android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                launcher:layout_sticky="true">

                <include layout="@layout/widgets_search_bar" />
            </FrameLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/suggestions_header"
                android:layout_marginTop="8dp"
                android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
                android:orientation="horizontal">
            </LinearLayout>
        </com.android.launcher3.views.StickyHeaderLayout>
    </FrameLayout>
</merge>
Loading