Merge "Fix QS header constraints so status icons are now ellipsized where there is lack of space." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
08a4e0b4a7
@@ -148,9 +148,4 @@
|
||||
<include layout="@layout/ongoing_privacy_chip"/>
|
||||
</FrameLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:id="@+id/space"
|
||||
/>
|
||||
</com.android.systemui.util.NoRemeasureMotionLayout>
|
||||
@@ -56,13 +56,9 @@
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/space"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/carrier_group"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
@@ -87,39 +83,27 @@
|
||||
<Constraint
|
||||
android:id="@+id/statusIcons">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
|
||||
app:layout_constraintStart_toEndOf="@id/space"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
app:layout_constraintStart_toEndOf="@id/date"
|
||||
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/date"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintBottom_toBottomOf="@id/date"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/batteryRemainingIcon">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/date"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintBottom_toBottomOf="@id/date"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
|
||||
<Constraint
|
||||
android:id="@id/space">
|
||||
<Layout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/date"
|
||||
app:layout_constraintEnd_toStartOf="@id/statusIcons"
|
||||
/>
|
||||
</Constraint>
|
||||
</ConstraintSet>
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.shade
|
||||
|
||||
import android.testing.AndroidTestingRunner
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
|
||||
import androidx.constraintlayout.widget.ConstraintSet.START
|
||||
@@ -92,12 +93,12 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() {
|
||||
assertThat(getConstraint(R.id.clock).layout.horizontalBias).isEqualTo(0f)
|
||||
|
||||
assertThat(getConstraint(R.id.date).layout.startToStart).isEqualTo(PARENT_ID)
|
||||
assertThat(getConstraint(R.id.date).layout.horizontalBias).isEqualTo(0f)
|
||||
assertThat(getConstraint(R.id.date).layout.horizontalBias).isEqualTo(0.5f)
|
||||
|
||||
assertThat(getConstraint(R.id.batteryRemainingIcon).layout.endToEnd)
|
||||
.isEqualTo(PARENT_ID)
|
||||
assertThat(getConstraint(R.id.batteryRemainingIcon).layout.horizontalBias)
|
||||
.isEqualTo(1f)
|
||||
.isEqualTo(0.5f)
|
||||
|
||||
assertThat(getConstraint(R.id.privacy_container).layout.endToEnd)
|
||||
.isEqualTo(R.id.end_guide)
|
||||
@@ -331,10 +332,8 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() {
|
||||
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")
|
||||
@@ -352,11 +351,8 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() {
|
||||
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) ->
|
||||
expect.withMessage("$name changes height")
|
||||
@@ -369,8 +365,8 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
private fun Int.fromConstraint() = when (this) {
|
||||
-1 -> "MATCH_PARENT"
|
||||
-2 -> "WRAP_CONTENT"
|
||||
ViewGroup.LayoutParams.MATCH_PARENT -> "MATCH_PARENT"
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT -> "WRAP_CONTENT"
|
||||
else -> toString()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user