From 8f6523a3d6ff967203c0954f4e690fb8937d2a7d Mon Sep 17 00:00:00 2001 From: Federico Baron Date: Mon, 13 Feb 2023 13:59:16 -0800 Subject: [PATCH] Move 'no widgets found' to right pane and add rounded edges to right pane. Previously 'no widgets found' appeared on the left pane, but in large screen landscape we want it to appear on the right pane. Additionally, we added rounded edges to the right pane that turn into sharp edges when we scroll. Fix: 268558448 Fix: 268557435 Test: Turn on LARGE_SCREEN_WIDGET_PICKER and on tablet landscape mode go to the widget picker and search for a widget that doesn't exist, verify that 'no widgets found' appears on the right pane. Also verify that right pane has rounded corner that turn into sharp corners as we scroll Change-Id: I6c89c63941e3b0680836828d0c7849d789cbce61 --- res/drawable/bg_widgets_content.xml | 24 +++++++-- .../widgets_full_sheet_large_screen.xml | 51 ++++++++++--------- .../widget/picker/WidgetsFullSheet.java | 16 ++++-- .../WidgetsListTableViewHolderBinder.java | 9 ++-- 4 files changed, 63 insertions(+), 37 deletions(-) diff --git a/res/drawable/bg_widgets_content.xml b/res/drawable/bg_widgets_content.xml index 80604308ac..b0b699ba22 100644 --- a/res/drawable/bg_widgets_content.xml +++ b/res/drawable/bg_widgets_content.xml @@ -18,16 +18,32 @@ + + + + + + + + + + + + + + + + @@ -38,8 +54,6 @@ diff --git a/res/layout/widgets_full_sheet_large_screen.xml b/res/layout/widgets_full_sheet_large_screen.xml index 1c0037d698..b99ac5ca6d 100644 --- a/res/layout/widgets_full_sheet_large_screen.xml +++ b/res/layout/widgets_full_sheet_large_screen.xml @@ -31,22 +31,11 @@ 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"> - - - - - + - + android:layout_height="match_parent" + android:gravity="center" + android:textSize="18sp" + android:visibility="gone" + tools:text="No widgets available" /> + + + + { mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder, contentEntry, - 0, Collections.singletonList(data)); + ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST, + Collections.singletonList(data)); }; mRightPane.removeAllViews(); mRightPane.addView(widgetsRowViewHolder.itemView); diff --git a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java index 4c1f7a9954..2e8f0ab1f8 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java +++ b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java @@ -15,9 +15,6 @@ */ package com.android.launcher3.widget.picker; -import static com.android.launcher3.widget.picker.WidgetsListDrawableState.LAST; -import static com.android.launcher3.widget.picker.WidgetsListDrawableState.MIDDLE; - import android.graphics.Bitmap; import android.util.Log; import android.util.Pair; @@ -84,7 +81,11 @@ public final class WidgetsListTableViewHolderBinder Log.d(TAG, String.format("onBindViewHolder [widget#=%d, table.getChildCount=%d]", entry.mWidgets.size(), table.getChildCount())); } - table.setListDrawableState(((position & POSITION_LAST) != 0) ? LAST : MIDDLE); + table.setListDrawableState( + WidgetsListDrawableState.obtain( + (position & POSITION_FIRST) != 0, + (position & POSITION_LAST) != 0)); + List> widgetItemsTable = WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering( entry.mWidgets, entry.getMaxSpanSizeInCells());