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

Commit 11773f47 authored by Steven Ng's avatar Steven Ng
Browse files

Show widget previews in their expected cell sizes

1. Show widget previews in their expected cell sizes.
2. Update the bottom picker to use a table layout rather than
a horizontal scrollbar.
3. Move the title and cell size description to the bottom of
the preview.

Test: Run AddConfigWidgetTest
      Manually open full and bottom widgets picker and observe
      widget previews.
      Video: https://drive.google.com/file/d/1K8A8hK5B4FgPTsX3cb-Yt4a_VjI0pk-w/view?usp=sharing
Bug: 179797520
Change-Id: I938612cb2e2477ce4a3a2d6c8891a0a36fc0978c
parent d6844dcb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@
-->
<com.android.launcher3.dragndrop.LivePreviewWidgetCell
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:paddingHorizontal="@dimen/widget_cell_horizontal_padding"
    android:paddingVertical="@dimen/widget_cell_vertical_padding"
    android:layout_weight="1"
    android:orientation="vertical"
    android:focusable="true"
+3 −1
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@
-->
<com.android.launcher3.widget.WidgetCell
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:paddingHorizontal="@dimen/widget_cell_horizontal_padding"
    android:paddingVertical="@dimen/widget_cell_vertical_padding"
    android:layout_weight="1"
    android:orientation="vertical"
    android:focusable="true"
+28 −38
Original line number Diff line number Diff line
@@ -17,24 +17,23 @@
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/widget_preview_label_vertical_padding"
        android:paddingBottom="@dimen/widget_preview_label_vertical_padding"
        android:paddingLeft="@dimen/widget_preview_label_horizontal_padding"
        android:paddingRight="@dimen/widget_preview_label_horizontal_padding"
        android:orientation="horizontal">
    <!-- The image of the widget. This view does not support padding. Any placement adjustment
         should be done using margins. -->
    <com.android.launcher3.widget.WidgetImageView
        android:id="@+id/widget_preview"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_marginVertical="8dp" />

    <!-- The name of the widget. -->
    <TextView
        android:id="@+id/widget_name"
            android:layout_width="0dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
            android:layout_weight="1"
        android:ellipsize="end"
        android:fadingEdge="horizontal"
            android:gravity="start"
        android:gravity="center_horizontal"
        android:singleLine="true"
        android:maxLines="1"
        android:textColor="?android:attr/textColorSecondary"
@@ -44,20 +43,11 @@
         style. -->
    <TextView
        android:id="@+id/widget_dims"
            android:layout_width="wrap_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:layout_marginLeft="5dp"
        android:gravity="center_horizontal"
        android:textColor="?android:attr/textColorSecondary"
        android:textSize="14sp"
        android:alpha="0.8" />
    </LinearLayout>

    <!-- The image of the widget. This view does not support padding. Any placement adjustment
         should be done using margins. -->
    <com.android.launcher3.widget.WidgetImageView
        android:id="@+id/widget_preview"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
</merge>
 No newline at end of file
+11 −6
Original line number Diff line number Diff line
@@ -44,11 +44,16 @@
        android:textSize="14sp"
        android:text="@string/long_press_widget_to_add"/>

    <include layout="@layout/widgets_scroll_container"
         android:id="@+id/widgets"
         android:layout_width="wrap_content"
    <ScrollView
        android:id="@+id/widgets_table_scroll_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="45dp"
         android:layout_marginBottom="40dp"/>
        android:layout_marginBottom="40dp">
        <include layout="@layout/widgets_table_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal" />
    </ScrollView>

</com.android.launcher3.widget.WidgetsBottomSheet>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
    android:id="@+id/widgets_table"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginHorizontal="8dp"
    android:background="?android:attr/colorPrimaryDark" />
Loading