Fix sizes in new header to spec

Also, fix text style to use correct font family and fix pivot for
scaling of clock to always be in the vertical center.

Test: manual
Test: atest LargeScreenShadeHeaderControllerCombinedTest
Fixes: 245971190
Change-Id: Idfaf9e9052cd746affd305e5ab609d509247501d
This commit is contained in:
Fabian Kozynski
2022-10-04 11:20:39 -04:00
parent 3dd646cf20
commit 33960ec668
7 changed files with 65 additions and 20 deletions

View File

@@ -73,8 +73,8 @@
android:singleLine="true"
android:textDirection="locale"
android:textAppearance="@style/TextAppearance.QS.Status"
android:transformPivotX="0sp"
android:transformPivotY="20sp"
android:transformPivotX="0dp"
android:transformPivotY="24dp"
android:scaleX="1"
android:scaleY="1"
/>

View File

@@ -519,7 +519,7 @@
<dimen name="qs_tile_margin_horizontal">8dp</dimen>
<dimen name="qs_tile_margin_vertical">@dimen/qs_tile_margin_horizontal</dimen>
<dimen name="qs_tile_margin_top_bottom">4dp</dimen>
<dimen name="qs_brightness_margin_top">8dp</dimen>
<dimen name="qs_brightness_margin_top">12dp</dimen>
<dimen name="qs_brightness_margin_bottom">16dp</dimen>
<dimen name="qqs_layout_margin_top">16dp</dimen>
<dimen name="qqs_layout_padding_bottom">24dp</dimen>
@@ -572,6 +572,7 @@
<dimen name="qs_header_row_min_height">48dp</dimen>
<dimen name="qs_header_non_clickable_element_height">24dp</dimen>
<dimen name="new_qs_header_non_clickable_element_height">20dp</dimen>
<dimen name="qs_footer_padding">20dp</dimen>
<dimen name="qs_security_footer_height">88dp</dimen>

View File

@@ -128,11 +128,10 @@
<!-- This is hard coded to be sans-serif-condensed to match the icons -->
<style name="TextAppearance.QS.Status">
<item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">14sp</item>
<item name="android:letterSpacing">0.01</item>
<item name="android:lineHeight">20sp</item>
</style>
<style name="TextAppearance.QS.SecurityFooter" parent="@style/TextAppearance.QS.Status">
@@ -143,12 +142,10 @@
<style name="TextAppearance.QS.Status.Carriers" />
<style name="TextAppearance.QS.Status.Carriers.NoCarrierText">
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.QS.Status.Build">
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>

View File

@@ -43,7 +43,8 @@
android:id="@+id/date">
<Layout
android:layout_width="0dp"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
android:layout_marginStart="8dp"
app:layout_constrainedWidth="true"
app:layout_constraintStart_toEndOf="@id/clock"
app:layout_constraintEnd_toStartOf="@id/barrier"
@@ -57,8 +58,8 @@
android:id="@+id/statusIcons">
<Layout
android:layout_width="0dp"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
app:layout_constraintHeight_min="@dimen/qs_header_non_clickable_element_height"
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"
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
app:layout_constraintTop_toTopOf="parent"
@@ -71,9 +72,9 @@
android:id="@+id/batteryRemainingIcon">
<Layout
android:layout_width="wrap_content"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
app:layout_constrainedWidth="true"
app:layout_constraintHeight_min="@dimen/qs_header_non_clickable_element_height"
app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height"
app:layout_constraintStart_toEndOf="@id/statusIcons"
app:layout_constraintEnd_toEndOf="@id/end_guide"
app:layout_constraintTop_toTopOf="parent"

View File

@@ -40,13 +40,13 @@
android:layout_height="@dimen/large_screen_shade_header_min_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/privacy_container"
app:layout_constraintBottom_toTopOf="@id/date"
app:layout_constraintBottom_toBottomOf="@id/carrier_group"
app:layout_constraintEnd_toStartOf="@id/carrier_group"
app:layout_constraintHorizontal_bias="0"
/>
<Transform
android:scaleX="2.4"
android:scaleY="2.4"
android:scaleX="2.57"
android:scaleY="2.57"
/>
</Constraint>
@@ -54,11 +54,11 @@
android:id="@+id/date">
<Layout
android:layout_width="0dp"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/space"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/clock"
app:layout_constraintTop_toBottomOf="@id/carrier_group"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="spread_inside"
/>
@@ -87,7 +87,7 @@
android:id="@+id/statusIcons">
<Layout
android:layout_width="0dp"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
android:layout_height="@dimen/new_qs_header_non_clickable_element_height"
app:layout_constrainedWidth="true"
app:layout_constraintStart_toEndOf="@id/space"
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
@@ -101,8 +101,8 @@
android:id="@+id/batteryRemainingIcon">
<Layout
android:layout_width="wrap_content"
android:layout_height="@dimen/qs_header_non_clickable_element_height"
app:layout_constraintHeight_min="@dimen/qs_header_non_clickable_element_height"
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/statusIcons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/date"

View File

@@ -292,6 +292,7 @@ class LargeScreenShadeHeaderController @Inject constructor(
clock.addOnLayoutChangeListener { v, _, _, _, _, _, _, _, _ ->
val newPivot = if (v.isLayoutRtl) v.width.toFloat() else 0f
v.pivotX = newPivot
v.pivotY = v.height.toFloat() / 2
}
}

View File

@@ -659,6 +659,51 @@ class LargeScreenShadeHeaderControllerCombinedTest : SysuiTestCase() {
verify(privacyIconsController, never()).onParentInvisible()
}
@Test
fun clockPivotYInCenter() {
val captor = ArgumentCaptor.forClass(View.OnLayoutChangeListener::class.java)
verify(clock).addOnLayoutChangeListener(capture(captor))
var height = 100
val width = 50
clock.executeLayoutChange(0, 0, width, height, captor.value)
verify(clock).pivotY = height.toFloat() / 2
height = 150
clock.executeLayoutChange(0, 0, width, height, captor.value)
verify(clock).pivotY = height.toFloat() / 2
}
private fun View.executeLayoutChange(
left: Int,
top: Int,
right: Int,
bottom: Int,
listener: View.OnLayoutChangeListener
) {
val oldLeft = this.left
val oldTop = this.top
val oldRight = this.right
val oldBottom = this.bottom
whenever(this.left).thenReturn(left)
whenever(this.top).thenReturn(top)
whenever(this.right).thenReturn(right)
whenever(this.bottom).thenReturn(bottom)
whenever(this.height).thenReturn(bottom - top)
whenever(this.width).thenReturn(right - left)
listener.onLayoutChange(
this,
oldLeft,
oldTop,
oldRight,
oldBottom,
left,
top,
right,
bottom
)
}
private fun createWindowInsets(
topCutout: Rect? = Rect()
): WindowInsets {