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

Commit eb4e8313 authored by Jerry Liu's avatar Jerry Liu
Browse files

Fix clock color container height

In http://ag/33867509 we introduced a bug where when there are two rows of color options, the slider will be pushed down and cut off by the container. This was due to the invisible placeholder that always fills the height of the color container with a fixed height that fits one row of color options.

This CL fixes it by changing the placeholder to the height of two rows of color options on desktop.

Screenshot (Desktop UI on): http://go/scrcast/NTY1MjYyODc3OTMwMjkxMnwzYzg5YzdlZS05Nw
Screenshot (Desktop UI off): http://go/scrcast/NTQyMTkxMzE2ODkzNjk2MHw5ZjA3NjMyYi1kNw

Bug: 415902512
Test: Manually on DUT
Flag: EXEMPT Bug fixes for desktop
Change-Id: I2debf653036df05c50f81197f15da569e54e4ba3
parent 99ecc535
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
     Copyright (C) 2024 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="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.android.customization.picker.color.ui.view.ColorOptionIconView2
        android:layout_width="@dimen/floating_sheet_color_option_size"
        android:layout_height="@dimen/floating_sheet_color_option_size"/>

    <com.android.customization.picker.color.ui.view.ColorOptionIconView2
        android:layout_width="@dimen/floating_sheet_color_option_size"
        android:layout_height="@dimen/floating_sheet_color_option_size"/>
</LinearLayout>
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <include
            layout="@layout/floating_sheet_clock_color_content"
            android:id="@+id/clock_floating_sheet_color_content"
        <ViewStub
            android:id="@+id/clock_color_content_stub"
            android:inflatedId="@+id/clock_floating_sheet_color_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

+84 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingVertical="@dimen/floating_sheet_content_vertical_padding"
    android:orientation="vertical"
    android:clipToPadding="false"
    android:clipChildren="false">

    <TextView
        android:id="@+id/clock_color_title"
        style="@style/CustomizationOptionEntryTitleTextStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/clock_color_title"
        android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding" />

    <TextView
        android:id="@+id/clock_color_description"
        style="@style/CustomizationOptionEntrySubtitleTextStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding"
        android:text="@string/clock_color_description"
        android:layout_marginBottom="16dp" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:clipChildren="false"
        android:layout_marginBottom="20dp">

        <!--
        This is an invisible placeholder put in place so that the parent keeps its height
        stable as the RecyclerView updates from 0 items to N items. Keeping it stable allows
        the layout logic to keep the size of the preview container stable as well, which
        bodes well for setting up the SurfaceView for remote rendering without changing its
        size after the content is loaded into the RecyclerView.

        It's critical for any TextViews inside the included layout to have text.
        -->
        <include
            layout="@layout/color_option2_desktop"
            android:visibility="invisible" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/clock_color_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding"
            android:clipChildren="false"
            android:clipToPadding="false" />
    </FrameLayout>

    <com.google.android.material.slider.Slider
        android:id="@+id/clock_color_slider"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding"
        android:minHeight="@dimen/touch_target_min_height"
        android:contentDescription="@string/accessibility_clock_slider_description"
        app:trackHeight="@dimen/slider_track_height"
        app:thumbHeight="@dimen/slider_thumb_height"
        android:theme="@style/Theme.Material3.DynamicColors.DayNight" />
</LinearLayout>
+9 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wallpaper.customization.ui.binder
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.view.ViewStub
import android.view.ViewTreeObserver.OnGlobalLayoutListener
import android.widget.ImageView
import android.widget.TextView
@@ -166,7 +167,14 @@ object ClockFloatingSheetBinder {
            lifecycleOwner = lifecycleOwner,
        )

        val clockColorContent: View = view.requireViewById(R.id.clock_floating_sheet_color_content)
        val clockColorContentStub: ViewStub = view.requireViewById(R.id.clock_color_content_stub)
        clockColorContentStub.layoutResource =
            if (isDesktopUi) {
                R.layout.floating_sheet_clock_color_desktop_content
            } else {
                R.layout.floating_sheet_clock_color_content
            }
        val clockColorContent: View = clockColorContentStub.inflate()

        val clockColorAdapter =
            createClockColorOptionItemAdapter(