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

Commit 28a8d5a1 authored by Federico Baron's avatar Federico Baron Committed by Android (Google) Code Review
Browse files

Merge changes I8ccf962f,I383c7540 into udc-dev

* changes:
  Turn on the flag for large screen widget picker
  Add test for widget picker on landscape mode for tablets
parents 784a6466 ac978187
Loading
Loading
Loading
Loading
+73 −76
Original line number Diff line number Diff line
@@ -20,22 +20,44 @@
    android:orientation="vertical"
    android:theme="?attr/widgetsTheme">

    <androidx.constraintlayout.widget.ConstraintLayout
    <com.android.launcher3.views.SpringRelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true"
        android:importantForAccessibility="no">

        <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:layout_centerHorizontal="true"
            android:background="@drawable/bg_rounded_corner_bottom_sheet_handle"/>

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            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" />

        <LinearLayout
            android:id="@+id/linear_layout_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/title">

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

                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:layout_weight="0.33">
                <TextView
                    android:id="@+id/fast_scroller_popup"
                    style="@style/FastScrollerPopup"
@@ -58,16 +80,15 @@
            </FrameLayout>

            <FrameLayout
                android:id="@+id/right_pane_container"
                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"
                android:layout_height="match_parent"
                android:layout_weight="0.67"
                android:paddingEnd="16dp"
                android:paddingTop="24dp"
                android:gravity="end"
                android:layout_gravity="end"
                android:paddingStart="8dp"
            android:layout_marginTop="26dp"
            app:layout_constraintWidth_percent="0.67"
            app:layout_constraintBottom_toBottomOf="parent"
                android:orientation="horizontal">
                <TextView
                    android:id="@+id/no_widgets_text"
@@ -93,30 +114,6 @@
                        android:visibility="gone" />
                </ScrollView>
            </FrameLayout>

        <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>
        </LinearLayout>
    </com.android.launcher3.views.SpringRelativeLayout>
</com.android.launcher3.widget.picker.WidgetsFullSheet>
+5 −7
Original line number Diff line number Diff line
@@ -18,13 +18,11 @@

    <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">
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="start"
        android:layout_gravity="start"
        android:layout_alignParentStart="true">
        <com.android.launcher3.widget.picker.WidgetPagedView
            android:id="@+id/widgets_view_pager"
            android:layout_width="match_parent"
+6 −8
Original line number Diff line number Diff line
@@ -18,13 +18,11 @@

    <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">
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="start"
        android:layout_gravity="start"
        android:layout_alignParentStart="true">

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/primary_widgets_list_view"
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ public final class FeatureFlags {
            "SHOW_DOT_PAGINATION", true, "Enable showing dot pagination in workspace");

    public static final BooleanFlag LARGE_SCREEN_WIDGET_PICKER = getDebugFlag(270395809,
            "LARGE_SCREEN_WIDGET_PICKER", false, "Enable new widget picker that takes "
            "LARGE_SCREEN_WIDGET_PICKER", true, "Enable new widget picker that takes "
                    + "advantage of large screen format");

    public static final BooleanFlag ENABLE_NEW_GESTURE_NAV_TUTORIAL = getDebugFlag(270396257,
+23 −7
Original line number Diff line number Diff line
@@ -204,6 +204,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
                && mDeviceProfile.isLandscape
                && LARGE_SCREEN_WIDGET_PICKER.get();
        mHasWorkProfile = context.getSystemService(LauncherApps.class).getProfiles().size() > 1;
        mOrientation = Launcher.getLauncher(context).getOrientation();
        mAdapters.put(AdapterHolder.PRIMARY, new AdapterHolder(AdapterHolder.PRIMARY));
        mAdapters.put(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK));
        mAdapters.put(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
@@ -232,13 +233,22 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        mContent.setClipToOutline(true);

        LayoutInflater layoutInflater = LayoutInflater.from(getContext());
        int contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view
                : R.layout.widgets_full_sheet_recyclerview;

        if (mIsTwoPane) {
            contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view_large_screen
                    : R.layout.widgets_full_sheet_recyclerview_large_screen;
            layoutInflater.inflate(
                    mHasWorkProfile
                           ? R.layout.widgets_full_sheet_paged_view_large_screen
                           : R.layout.widgets_full_sheet_recyclerview_large_screen,
                    findViewById(R.id.recycler_view_container),
                    true);
        } else {
            layoutInflater.inflate(
                    mHasWorkProfile
                            ? R.layout.widgets_full_sheet_paged_view
                            : R.layout.widgets_full_sheet_recyclerview,
                    mContent,
                    true);
        }
        layoutInflater.inflate(contentLayoutRes, mContent, true);

        mFastScroller = findViewById(R.id.fast_scroller);
        if (mIsTwoPane) {
@@ -349,7 +359,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet

        // if the current active page changes to personal or work we set suggestions
        // to be the selected widget
        if (mIsTwoPane && (currentActivePage == PERSONAL_TAB || currentActivePage == WORK_TAB)) {
        if (mIsTwoPane && mSuggestedWidgetsHeader != null
                && (currentActivePage == PERSONAL_TAB || currentActivePage == WORK_TAB)) {
            mSuggestedWidgetsHeader.callOnClick();
        }

@@ -433,8 +444,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        super.onAttachedToWindow();
        mActivityContext.getAppWidgetHolder().addProviderChangeListener(this);
        notifyWidgetProvidersChanged();
        if (!mIsTwoPane) {
            onRecommendedWidgetsBound();
        }
    }

    @Override
    protected void onDetachedFromWindow() {
@@ -696,6 +709,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
                    recommendedWidgetsInTable, maxTableHeight);
        } else {
            mRecommendedWidgetsTable.setVisibility(GONE);
            if (mSuggestedWidgetsContainer != null) {
                mSuggestedWidgetsContainer.setVisibility(GONE);
            }
        }
    }

Loading