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

Commit 551f0c08 authored by Santiago Etchebehere's avatar Santiago Etchebehere
Browse files

Create an overview "cover" card for theme previews

Add a new card with an overview of the theme components preview.
The current implementation still needs polish (eg, wallpaper flickers
when loading). A follow-up CL will address those issues.

Bug: 128923737
Change-Id: Ib822475dd63d1d49f97d3c9bc96e55f75825c934
parent f64c5d07
Loading
Loading
Loading
Loading
+108 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:showIn="@layout/theme_preview_card">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:layout_marginTop="40dp"
        android:layout_marginBottom="36dp"
        android:gravity="center|bottom"
        android:orientation="horizontal">
        <FrameLayout
            android:layout_width="@dimen/preview_theme_icon_size"
            android:layout_height="@dimen/preview_theme_icon_size"
            android:layout_marginLeft="6dp">
            <ImageView
                android:layout_width="@dimen/preview_theme_icon_size"
                android:layout_height="@dimen/preview_theme_icon_size"
                android:id="@+id/preview_color_qs_0_bg"/>
            <ImageView
                android:layout_width="@dimen/preview_theme_tile_size"
                android:layout_height="@dimen/preview_theme_tile_size"
                android:id="@+id/preview_color_qs_0_icon"
                android:tint="@color/tile_enabled_icon_color"
                android:layout_gravity="center"/>
        </FrameLayout>
        <FrameLayout
            android:layout_width="@dimen/preview_theme_icon_size"
            android:layout_height="@dimen/preview_theme_icon_size"
            android:layout_marginHorizontal="50dp">
            <ImageView
                android:layout_width="@dimen/preview_theme_icon_size"
                android:layout_height="@dimen/preview_theme_icon_size"
                android:id="@+id/preview_color_qs_1_bg"/>
            <ImageView
                android:layout_width="@dimen/preview_theme_tile_size"
                android:layout_height="@dimen/preview_theme_tile_size"
                android:id="@+id/preview_color_qs_1_icon"
                android:tint="@color/tile_enabled_icon_color"
                android:layout_gravity="center"/>
        </FrameLayout>
        <FrameLayout
            android:layout_width="@dimen/preview_theme_icon_size"
            android:layout_height="@dimen/preview_theme_icon_size"
            android:layout_marginRight="6dp">
            <ImageView
                android:layout_width="@dimen/preview_theme_icon_size"
                android:layout_height="@dimen/preview_theme_icon_size"
                android:id="@+id/preview_color_qs_2_bg"
                android:tint="@color/tile_disabled_background_color"/>
            <ImageView
                android:layout_width="@dimen/preview_theme_tile_size"
                android:layout_height="@dimen/preview_theme_tile_size"
                android:id="@+id/preview_color_qs_2_icon"
                android:color="@color/tile_disabled_icon_color"
                android:layout_gravity="center"/>
        </FrameLayout>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="horizontal">
        <ImageView
            android:id="@+id/shape_preview_icon_0"
            android:layout_width="@dimen/preview_theme_shape_size"
            android:layout_height="@dimen/preview_theme_shape_size"
            android:layout_marginVertical="4dp"
            android:elevation="4dp"/>
        <ImageView
            android:id="@+id/shape_preview_icon_1"
            android:layout_width="@dimen/preview_theme_shape_size"
            android:layout_height="@dimen/preview_theme_shape_size"
            android:layout_marginHorizontal="38dp"
            android:layout_marginVertical="4dp"
            android:elevation="4dp"/>
        <ImageView
            android:id="@+id/shape_preview_icon_2"
            android:layout_width="@dimen/preview_theme_shape_size"
            android:layout_height="@dimen/preview_theme_shape_size"
            android:layout_marginVertical="4dp"
            android:layout_marginRight="2dp"
            android:elevation="4dp"/>
    </LinearLayout>
    <include layout="@layout/theme_cover_qsb"/>
</LinearLayout>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 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.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/theme_qsb"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone"/>
 No newline at end of file
+41 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
<androidx.cardview.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/PreviewCard"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
@@ -32,6 +33,45 @@
            android:padding="@dimen/preview_card_padding"
            android:orientation="vertical">

            <FrameLayout
                android:id="@+id/theme_preview_top_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dp"
                android:visibility="gone"
                tools:visibility="visible">
                <TextView
                    android:id="@+id/theme_preview_clock"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="start|center_vertical"
                    android:textColor="@color/icon_thumbnail_color"
                    tools:text="8:10"/>
                <LinearLayout
                    android:id="@+id/theme_preview_top_bar_icons"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="end|center_vertical"
                    android:orientation="horizontal">
                    <ImageView
                        android:id="@+id/preview_icon_0"
                        android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
                        android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
                        android:tint="@color/icon_thumbnail_color"/>
                    <ImageView
                        android:id="@+id/preview_icon_1"
                        android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
                        android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
                        android:layout_marginHorizontal="8dp"
                        android:tint="@color/icon_thumbnail_color"/>
                    <ImageView
                        android:id="@+id/preview_icon_2"
                        android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
                        android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
                        android:tint="@color/icon_thumbnail_color"/>
                </LinearLayout>
            </FrameLayout>

            <TextView
                android:id="@+id/theme_preview_card_header"
                android:layout_width="wrap_content"
@@ -59,7 +99,7 @@
                android:gravity="center"
                android:text="@string/edit_custom_theme_lbl"
                android:textAppearance="@style/EditLabelTextAppearance"
                android:visibility="gone"/>
                android:visibility="invisible"/>
        </LinearLayout>
    </FrameLayout>
</androidx.cardview.widget.CardView>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -58,9 +58,11 @@
    <dimen name="preview_card_padding">24dp</dimen>

    <dimen name="card_title_text_size">16sp</dimen>
    <dimen name="card_cover_title_text_size">24sp</dimen>
    <dimen name="preview_theme_icon_size">40dp</dimen>
    <dimen name="preview_theme_tile_size">20dp</dimen>
    <dimen name="preview_theme_shape_size">52dp</dimen>
    <dimen name="preview_theme_cover_topbar_icon_size">20dp</dimen>

    <dimen name="color_preview_image_width">182dp</dimen>
    <dimen name="color_preview_image_height">194dp</dimen>
@@ -79,4 +81,7 @@

    <dimen name="component_shape_thumb_size">72dp</dimen>
    <dimen name="component_shape_border_width">3dp</dimen>

    <!-- For a corner radius of this size or larger, we'll preview a rounded qsb widget. -->
    <dimen name="roundCornerThreshold">16dp</dimen>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@
        <item name="android:textSize">@dimen/card_title_text_size</item>
    </style>

    <style name="CoverTitleTextAppearance" parent="CardTitleTextAppearance">
        <item name="android:textSize">@dimen/card_cover_title_text_size</item>
    </style>

    <style name="FontCardTitleStyle">
        <item name="android:textAlignment">center</item>
        <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title</item>
Loading