Dream settings refactor.

We will be re-using the grid UI for the dream complication picker, so
this change refactors some of that logic so it can be re-used in the
complication controller.

We also update some of the UI here to match the most recent UX
decisions.

http://screen/BxhAwZwQSVoxUmN.png

Test: locally on device
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.dream.DreamPickerControllerTest"
Bug: 214250590
Bug: 215703483
Change-Id: I9fbfa0f0cd31ae3d119c7cd1a9562d4cdb203d6c
This commit is contained in:
Lucas Silva
2022-01-26 16:49:22 +00:00
parent 99bd4e45c7
commit 55df7acc51
11 changed files with 335 additions and 219 deletions

View File

@@ -15,28 +15,43 @@
limitations under the License.
-->
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dream_picker_padding">
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/dream_list"
<androidx.cardview.widget.CardView
android:id="@+id/dream_picker_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:nestedScrollingEnabled="false"/>
style="@style/DreamPickerBackgroundStyle">
<Button
android:id="@+id/preview_button"
style="@style/ActionPrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dream_preview_button_title"
app:layout_constraintTop_toBottomOf="@+id/dream_list"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/dream_list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:nestedScrollingEnabled="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<Button
android:id="@+id/preview_button"
style="@style/ActionPrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/dream_preview_button_title"
app:layout_constraintTop_toBottomOf="@+id/dream_list"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

View File

@@ -17,18 +17,17 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
style="@style/DreamCardStyle"
android:clickable="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:minHeight="?android:attr/listPreferredItemHeight">
<androidx.cardview.widget.CardView
@@ -37,16 +36,14 @@
android:layout_height="0dp"
app:cardCornerRadius="@dimen/dream_item_corner_radius"
app:cardElevation="0dp"
app:layout_constraintDimensionRatio="3:2"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</androidx.cardview.widget.CardView>
<Button
@@ -63,12 +60,14 @@
<ImageView
android:id="@+id/icon"
android:layout_width="18dp"
android:layout_width="@dimen/dream_item_icon_size"
android:layout_height="0dp"
android:layout_marginTop="18dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="@dimen/dream_item_title_margin_top"
android:layout_marginStart="@dimen/dream_item_icon_margin_start"
android:layout_marginBottom="@dimen/dream_item_title_margin_bottom"
android:gravity="center_vertical"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@+id/preview_container"
app_layout_constraintEnd_toStartOf="@+id/title_text"
app:layout_constraintStart_toStartOf="parent"/>
@@ -77,9 +76,10 @@
android:id="@+id/title_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="@dimen/dream_item_title_margin_top"
android:layout_marginStart="@dimen/dream_item_title_margin_start"
android:layout_marginBottom="@dimen/dream_item_title_margin_bottom"
android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
@@ -87,18 +87,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/icon"/>
<TextView
android:id="@+id/summary_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="2"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/title_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>