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

Commit d21bf861 authored by chihhangchuang's avatar chihhangchuang
Browse files

GridPicker get rid of PreviewPager

Also extract the common part of GridFragment and GridFullPreviewFragment into WallpaperPreviewer and GridOptionPreviewer.

Video: https://drive.google.com/file/d/1FkkarDMTfoBzxpDxm04kbb872KyjNpEe/view?usp=sharing

Test: Manually
Bug: 156059583
Change-Id: I0005f4acc3c8b3588d2aca3150b9e17893715871
parent f07ff3c3
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -31,13 +31,16 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
        <com.android.wallpaper.widget.PreviewPager
            android:id="@+id/grid_preview_pager"
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/secondary_color"
            app:card_style="screen_aspect_ratio"/>
            android:clipToPadding="false"
            android:paddingTop="@dimen/preview_content_padding_top"
            android:paddingBottom="@dimen/preview_content_padding_bottom"
            android:background="@color/fullscreen_preview_background">
            <include layout="@layout/grid_preview_card"/>
        </FrameLayout>

        <FrameLayout
            android:id="@+id/options_section"
+1 −24
Original line number Diff line number Diff line
@@ -31,29 +31,6 @@
        android:clipToPadding="false"
        android:background="@color/fullscreen_preview_background">

        <androidx.cardview.widget.CardView
            style="@style/FullContentPreviewCard"
            android:id="@+id/grid_full_preview_card"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center">

            <ImageView
                android:id="@+id/grid_full_preview_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/primary_color"/>

            <SurfaceView
                android:id="@+id/grid_full_preview_option_surface"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

            <SurfaceView
                android:id="@+id/grid_full_preview_wallpaper_surface"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </androidx.cardview.widget.CardView>
        <include layout="@layout/grid_preview_card"/>
    </FrameLayout>
</LinearLayout>
+14 −28
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
-->
<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="match_parent"
    android:orientation="vertical"
@@ -27,26 +26,21 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.constraintlayout.widget.ConstraintLayout
        <LinearLayout
            android:id="@+id/content_section"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_height="match_parent"
            android:orientation="vertical">

            <com.android.wallpaper.widget.PreviewPager
                android:id="@+id/grid_preview_pager"
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/preview_pager_background"
                app:card_style="screen_aspect_ratio"
                app:layout_constrainedHeight="true"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toTopOf="@id/options_title"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHeight_max="@dimen/preview_pager_max_height"
                app:layout_constraintHeight_min="@dimen/preview_pager_min_height"
                app:layout_constraintVertical_bias="0.0"
                app:layout_constraintVertical_chainStyle="spread_inside"/>
                android:layout_height="@dimen/preview_content_height"
                android:paddingTop="@dimen/preview_content_padding_top"
                android:paddingBottom="@dimen/preview_content_padding_bottom"
                android:clipToPadding="false"
                android:background="@color/fullscreen_preview_background">
                <include layout="@layout/grid_preview_card"/>
            </FrameLayout>

            <TextView
                android:id="@+id/options_title"
@@ -57,22 +51,14 @@
                android:lineHeight="24dp"
                android:singleLine="true"
                android:text="@string/grid_options_title"
                android:textAppearance="@style/TitleTextAppearance"
                app:layout_constraintTop_toBottomOf="@id/grid_preview_pager"
                app:layout_constraintBottom_toTopOf="@id/options_container"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"/>
                android:textAppearance="@style/TitleTextAppearance"/>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/options_container"
                android:layout_width="match_parent"
                android:layout_height="@dimen/options_container_height"
                android:layout_gravity="center_horizontal"
                app:layout_constraintTop_toBottomOf="@+id/options_title"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintVertical_bias="1.0"/>
        </androidx.constraintlayout.widget.ConstraintLayout>
                android:layout_gravity="center_horizontal"/>
        </LinearLayout>

        <androidx.core.widget.ContentLoadingProgressBar
            android:id="@+id/loading_indicator"
+7 −6
Original line number Diff line number Diff line
@@ -18,22 +18,23 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/FullContentPreviewCard"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    android:layout_height="match_parent"
    android:layout_gravity="center">

    <ImageView
        android:id="@+id/grid_preview_image"
    <FrameLayout
        android:id="@+id/grid_preview_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/primary_color" />

    <SurfaceView
        android:id="@+id/grid_preview_surface"
    <ImageView
        android:id="@+id/wallpaper_preview_image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/primary_color" />

    <SurfaceView
        android:id="@+id/wallpaper_surface"
        android:id="@+id/wallpaper_preview_surface"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

+5 −0
Original line number Diff line number Diff line
@@ -70,6 +70,11 @@
    <dimen name="preview_theme_content_bottom">@dimen/min_taptarget_height</dimen>
    <dimen name="preview_theme_cover_content_bottom">@dimen/preview_theme_content_bottom</dimen>

    <!--  For the customization previews on the picker. -->
    <dimen name="preview_content_height">@dimen/preview_pager_height</dimen>
    <dimen name="preview_content_padding_top">@dimen/preview_page_top_margin</dimen>
    <dimen name="preview_content_padding_bottom">@dimen/indicator_container_height</dimen>

    <dimen name="font_preview_body_width">200dp</dimen>
    <dimen name="font_preview_divider_gap">24dp</dimen>

Loading