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

Commit e6d73183 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Automerger Merge Worker
Browse files

Merge "Prevent views from changing size in animation" into tm-qpr-dev am: ba9c3d64 am: dece5daa

parents c74282b0 dece5daa
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
        android:id="@+id/clock">
        <Layout
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_height="@dimen/large_screen_shade_header_min_height"
            app:layout_constraintStart_toStartOf="@id/begin_guide"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
@@ -42,7 +42,7 @@
    <Constraint
        android:id="@+id/date">
        <Layout
            android:layout_width="0dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
            android:layout_marginStart="8dp"
            app:layout_constrainedWidth="true"
@@ -57,7 +57,7 @@
    <Constraint
        android:id="@+id/statusIcons">
        <Layout
            android:layout_width="0dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
            app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height"
            app:layout_constraintStart_toEndOf="@id/date"
@@ -65,6 +65,7 @@
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintHorizontal_chainStyle="packed"
            />
    </Constraint>

@@ -80,12 +81,16 @@
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintHorizontal_chainStyle="packed"
            />
    </Constraint>

    <Constraint
        android:id="@+id/carrier_group">
        <Layout
            app:layout_constraintWidth_min="48dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/large_screen_shade_header_min_height"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            />
+7 −6
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
            app:layout_constraintBottom_toBottomOf="@id/carrier_group"
            app:layout_constraintEnd_toStartOf="@id/carrier_group"
            app:layout_constraintHorizontal_bias="0"
            app:layout_constraintHorizontal_chainStyle="spread_inside"
        />
        <Transform
            android:scaleX="2.57"
@@ -53,7 +54,7 @@
    <Constraint
        android:id="@+id/date">
        <Layout
            android:layout_width="0dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@id/space"
@@ -67,16 +68,15 @@
    <Constraint
        android:id="@+id/carrier_group">
        <Layout
            app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
            android:minHeight="@dimen/large_screen_shade_header_min_height"
            app:layout_constraintWidth_min="48dp"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/large_screen_shade_header_min_height"
            app:layout_constraintStart_toEndOf="@id/clock"
            app:layout_constraintTop_toBottomOf="@id/privacy_container"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintBottom_toTopOf="@id/batteryRemainingIcon"
            app:layout_constraintHorizontal_chainStyle="spread_inside"
            />
        <PropertySet
            android:alpha="1"
@@ -86,7 +86,7 @@
    <Constraint
        android:id="@+id/statusIcons">
        <Layout
            android:layout_width="0dp"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
            app:layout_constrainedWidth="true"
            app:layout_constraintStart_toEndOf="@id/space"
@@ -108,6 +108,7 @@
            app:layout_constraintTop_toTopOf="@id/date"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintHorizontal_chainStyle="spread_inside"
            />
    </Constraint>

+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ object CombinedShadeHeadersConstraintManagerImpl : CombinedShadeHeadersConstrain
                    centerEnd,
                    ConstraintSet.END
                )
                constrainWidth(R.id.statusIcons, 0)
            },
            qsConstraintsChanges = {
                setGuidelineBegin(centerStart, offsetFromEdge)
+43 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.R
import com.android.systemui.SysuiTestCase
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -320,6 +321,48 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() {
        assertThat(changes.largeScreenConstraintsChanges).isNull()
    }

    @Test
    fun testRelevantViewsAreNotMatchConstraints() {
        val views = mapOf(
                R.id.clock to "clock",
                R.id.date to "date",
                R.id.statusIcons to "icons",
                R.id.privacy_container to "privacy",
                R.id.carrier_group to "carriers",
                R.id.batteryRemainingIcon to "battery",
        )
        views.forEach { (id, name) ->
            assertWithMessage("$name has 0 height in qqs")
                    .that(qqsConstraint.getConstraint(id).layout.mHeight).isNotEqualTo(0)
            assertWithMessage("$name has 0 width in qqs")
                    .that(qqsConstraint.getConstraint(id).layout.mWidth).isNotEqualTo(0)
            assertWithMessage("$name has 0 height in qs")
                    .that(qsConstraint.getConstraint(id).layout.mHeight).isNotEqualTo(0)
            assertWithMessage("$name has 0 width in qs")
                    .that(qsConstraint.getConstraint(id).layout.mWidth).isNotEqualTo(0)
        }
    }

    @Test
    fun testCheckViewsDontChangeSizeBetweenAnimationConstraints() {
        val views = mapOf(
                R.id.clock to "clock",
                R.id.date to "date",
                R.id.statusIcons to "icons",
                R.id.privacy_container to "privacy",
                R.id.carrier_group to "carriers",
                R.id.batteryRemainingIcon to "battery",
        )
        views.forEach { (id, name) ->
            assertWithMessage("$name changes height")
                    .that(qqsConstraint.getConstraint(id).layout.mHeight)
                    .isEqualTo(qsConstraint.getConstraint(id).layout.mHeight)
            assertWithMessage("$name changes width")
                    .that(qqsConstraint.getConstraint(id).layout.mWidth)
                    .isEqualTo(qsConstraint.getConstraint(id).layout.mWidth)
        }
    }

    private operator fun ConstraintsChanges.invoke() {
        qqsConstraintsChanges?.invoke(qqsConstraint)
        qsConstraintsChanges?.invoke(qsConstraint)