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

Commit 38d0a7ca authored by Lucas Silva's avatar Lucas Silva
Browse files

Rewrite dream settings.

The available dreams will now be shown in a grid, with a preview button
at the bottom.

Screenshot (white placeholder image used):
http://screen/6pe6EoACPoQN8TZ.png
http://screen/4nR6Wg5pN7pL6Wb.png

Phone (single column layout):
http://screen/4WFqzZR8Yf9H3VZ.png

Colors and margins will be finalized once final mocks are done.

Bug: 207681076
Bug: 214250590
Test: locally on device
Change-Id: Ie68bdc60e74e72dc3c3cee3f1ffd40f5613109b9
parent b81f2b77
Loading
Loading
Loading
Loading
+22 −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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
    <item android:state_activated="true" android:color="?androidprv:attr/colorSurfaceHighlight"/>
    <item android:color="?androidprv:attr/colorSurface"/>
</selector>
 No newline at end of file
+42 −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.
-->

<androidx.constraintlayout.widget.ConstraintLayout
    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">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/dream_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="true"
        android:nestedScrollingEnabled="false"/>

    <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>
+104 −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.
-->

<androidx.cardview.widget.CardView
    xmlns:android="http://schemas.android.com/apk/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
            android:id="@+id/preview_container"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:cardCornerRadius="@dimen/dream_item_corner_radius"
            app:cardElevation="0dp"
            app:layout_constraintDimensionRatio="3:2"
            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
            android:id="@+id/customize_button"
            style="@style/ActionPrimaryButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:text="@string/customize_button_title"
            app:layout_constraintTop_toTopOf="@+id/preview_container"
            app:layout_constraintBottom_toBottomOf="@+id/preview_container"
            app:layout_constraintStart_toStartOf="@+id/preview_container"
            app:layout_constraintEnd_toEndOf="@+id/preview_container"/>

        <ImageView
            android:id="@+id/icon"
            android:layout_width="18dp"
            android:layout_height="0dp"
            android:layout_marginTop="18dp"
            android:layout_marginStart="10dp"
            android:layout_marginBottom="10dp"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintTop_toBottomOf="@+id/preview_container"
            app_layout_constraintEnd_toStartOf="@+id/title_text"
            app:layout_constraintStart_toStartOf="parent"/>

        <TextView
            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:maxLines="1"
            android:ellipsize="end"
            android:textAppearance="?android:attr/textAppearanceListItemSmall"
            app:layout_constraintTop_toBottomOf="@+id/preview_container"
            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>

res/layout/dream_start_button.xml

deleted100644 → 0
+0 −36
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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:gravity="bottom"
    android:paddingStart="72dp"
    android:paddingEnd="72dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/dream_start_now_button"
        style="@style/ActionPrimaryButton"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/screensaver_settings_dream_start"/>

</LinearLayout>
+7 −0
Original line number Diff line number Diff line
@@ -439,6 +439,13 @@
    <dimen name="chartview_trapezoid_margin_start">1dp</dimen>
    <dimen name="chartview_trapezoid_margin_bottom">2dp</dimen>

    <!-- Dimensions for Dream settings cards -->
    <dimen name="dream_item_min_column_width">230dp</dimen>
    <dimen name="dream_item_corner_radius">@*android:dimen/config_dialogCornerRadius</dimen>
    <dimen name="dream_preference_margin_horizontal">4dp</dimen>
    <dimen name="dream_preference_margin_bottom">8dp</dimen>
    <dimen name="dream_picker_padding">40dp</dimen>

    <!-- Sims/Data mobile/Calls/SMS select dialog-->
    <dimen name="sims_select_margin_bottom">24dp</dimen>
    <dimen name="sims_select_margin_top">8dp</dimen>
Loading