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

Commit 4717594c authored by George Lin's avatar George Lin
Browse files

Fixed width to resolve preview rendering issue on different screens

Instead of fixing the height and have the width calculated according to
the display ratio, we fix the width.

Test: Manually tested on different screens
Bug: 272440255
Change-Id: I1d2f407f007c73cb4bc1f7cdee9b182e16275c8b
parent d0ea239e
Loading
Loading
Loading
Loading
+36 −31
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@

    <FrameLayout
        android:id="@+id/item_view_0"
        android:layout_width="@dimen/clock_carousel_item_width"
        android:layout_height="@dimen/screen_preview_height"
        android:layout_width="@dimen/screen_preview_width"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/clock_carousel_item_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/item_view_1"
@@ -38,23 +38,24 @@
            android:layout_gravity="center"
            android:background="@drawable/carousel_item_card_background"/>

        <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
            android:id="@+id/clock_scale_view_0"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_width="@dimen/screen_preview_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
            <FrameLayout
                android:id="@+id/clock_host_view_0"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:clipChildren="false" />
        </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/item_view_1"
        android:layout_width="@dimen/clock_carousel_item_width"
        android:layout_height="@dimen/screen_preview_height"
        android:layout_width="@dimen/screen_preview_width"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/clock_carousel_item_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/item_view_2"
@@ -67,23 +68,24 @@
            android:layout_gravity="center"
            android:background="@drawable/carousel_item_card_background"/>

        <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
            android:id="@+id/clock_scale_view_1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_width="@dimen/screen_preview_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
            <FrameLayout
                android:id="@+id/clock_host_view_1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:clipChildren="false"/>
        </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/item_view_2"
        android:layout_width="@dimen/clock_carousel_item_width"
        android:layout_height="@dimen/screen_preview_height"
        android:layout_width="@dimen/screen_preview_width"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
@@ -98,23 +100,24 @@
            android:layout_gravity="center"
            android:background="@drawable/carousel_item_card_background"/>

        <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
            android:id="@+id/clock_scale_view_2"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_width="@dimen/screen_preview_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
            <FrameLayout
                android:id="@+id/clock_host_view_2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:clipChildren="false"/>
        </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/item_view_3"
        android:layout_width="@dimen/clock_carousel_item_width"
        android:layout_height="@dimen/screen_preview_height"
        android:layout_width="@dimen/screen_preview_width"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/clock_carousel_item_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/item_view_2"
@@ -127,23 +130,24 @@
            android:layout_gravity="center"
            android:background="@drawable/carousel_item_card_background"/>

        <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
            android:id="@+id/clock_scale_view_3"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_width="@dimen/screen_preview_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
            <FrameLayout
                android:id="@+id/clock_host_view_3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:clipChildren="false"/>
        </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/item_view_4"
        android:layout_width="@dimen/clock_carousel_item_width"
        android:layout_height="@dimen/screen_preview_height"
        android:layout_width="@dimen/screen_preview_width"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/clock_carousel_item_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/item_view_3"
@@ -156,17 +160,18 @@
            android:layout_gravity="center"
            android:background="@drawable/carousel_item_card_background"/>

        <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
            android:id="@+id/clock_scale_view_4"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            android:layout_width="@dimen/screen_preview_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
            <FrameLayout
                android:id="@+id/clock_host_view_4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:clipChildren="false" />
        </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
    </FrameLayout>

    <androidx.constraintlayout.helper.widget.Carousel
+5 −4
Original line number Diff line number Diff line
@@ -13,13 +13,14 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
<com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/screen_preview_height">
    android:layout_width="@dimen/screen_preview_width"
    android:layout_height="wrap_content"
    android:layout_gravity="center">
    <FrameLayout
        android:id="@+id/single_clock_host_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center" />
</com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
 No newline at end of file
</com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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
  -->
<resources>
    <!-- Clock carousel dimens -->
    <dimen name="clock_carousel_item_card_width">114dp</dimen>
    <dimen name="clock_carousel_item_card_height">124dp</dimen>
    <dimen name="clock_carousel_guideline_margin">130dp</dimen>
</resources>
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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
  -->
<resources>
    <!-- Clock carousel dimens -->
    <dimen name="clock_carousel_item_card_width">114dp</dimen>
    <dimen name="clock_carousel_item_card_height">124dp</dimen>
    <dimen name="clock_carousel_guideline_margin">180dp</dimen>
</resources>
+5 −3
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@
  -->
<resources>
    <dimen name="clock_carousel_item_width">607dp</dimen>
    <dimen name="clock_carousel_guideline_margin">290dp</dimen>
    <dimen name="clock_carousel_item_card_width">175dp</dimen>
    <dimen name="clock_carousel_item_card_height">190dp</dimen>

    <!-- Clock carousel dimens -->
    <dimen name="clock_carousel_item_card_width">114dp</dimen>
    <dimen name="clock_carousel_item_card_height">124dp</dimen>
    <dimen name="clock_carousel_guideline_margin">220dp</dimen>
</resources>
Loading