Merge changes I64da9051,Idfaf9e90 into tm-qpr-dev

* changes:
  Bring animations up to spec
  Fix sizes in new header to spec
This commit is contained in:
Fabian Kozynski
2022-10-19 16:44:41 +00:00
committed by Android (Google) Code Review
9 changed files with 94 additions and 49 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

@@ -28,4 +28,11 @@
<!-- The time it takes for the over scroll release animation to complete, in milli seconds. -->
<integer name="lockscreen_shade_over_scroll_release_duration">0</integer>
<!-- Values for transition of QS Headers -->
<integer name="fade_out_complete_frame">14</integer>
<integer name="fade_in_start_frame">58</integer>
<!-- Percentage of displacement for items in QQS to guarantee matching with bottom of clock at
fade_out_complete_frame -->
<dimen name="percent_displacement_at_fade_out" format="float">0.1066</dimen>
</resources>

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

@@ -27,67 +27,60 @@
<KeyPosition
app:keyPositionType="deltaRelative"
app:percentX="0"
app:percentY="0"
app:framePosition="49"
app:percentY="@dimen/percent_displacement_at_fade_out"
app:framePosition="@integer/fade_out_complete_frame"
app:sizePercent="0"
app:curveFit="linear"
app:motionTarget="@id/date" />
<KeyPosition
app:keyPositionType="deltaRelative"
app:percentX="1"
app:percentY="0.51"
app:percentY="0.5"
app:sizePercent="1"
app:framePosition="51"
app:framePosition="50"
app:curveFit="linear"
app:motionTarget="@id/date" />
<KeyAttribute
app:motionTarget="@id/date"
app:framePosition="30"
app:framePosition="14"
android:alpha="0"
/>
<KeyAttribute
app:motionTarget="@id/date"
app:framePosition="70"
app:framePosition="@integer/fade_in_start_frame"
android:alpha="0"
/>
<KeyPosition
app:keyPositionType="pathRelative"
app:keyPositionType="deltaRelative"
app:percentX="0"
app:percentY="0"
app:framePosition="0"
app:curveFit="linear"
app:motionTarget="@id/statusIcons" />
<KeyPosition
app:keyPositionType="pathRelative"
app:percentX="0"
app:percentY="0"
app:framePosition="50"
app:percentY="@dimen/percent_displacement_at_fade_out"
app:framePosition="@integer/fade_out_complete_frame"
app:sizePercent="0"
app:curveFit="linear"
app:motionTarget="@id/statusIcons" />
<KeyPosition
app:keyPositionType="deltaRelative"
app:percentX="1"
app:percentY="0.51"
app:framePosition="51"
app:percentY="0.5"
app:framePosition="50"
app:sizePercent="1"
app:curveFit="linear"
app:motionTarget="@id/statusIcons" />
<KeyAttribute
app:motionTarget="@id/statusIcons"
app:framePosition="30"
app:framePosition="@integer/fade_out_complete_frame"
android:alpha="0"
/>
<KeyAttribute
app:motionTarget="@id/statusIcons"
app:framePosition="70"
app:framePosition="@integer/fade_in_start_frame"
android:alpha="0"
/>
<KeyPosition
app:keyPositionType="deltaRelative"
app:percentX="0"
app:percentY="0"
app:framePosition="50"
app:percentY="@dimen/percent_displacement_at_fade_out"
app:framePosition="@integer/fade_out_complete_frame"
app:percentWidth="1"
app:percentHeight="1"
app:curveFit="linear"
@@ -95,27 +88,27 @@
<KeyPosition
app:keyPositionType="deltaRelative"
app:percentX="1"
app:percentY="0.51"
app:framePosition="51"
app:percentY="0.5"
app:framePosition="50"
app:percentWidth="1"
app:percentHeight="1"
app:curveFit="linear"
app:motionTarget="@id/batteryRemainingIcon" />
<KeyAttribute
app:motionTarget="@id/batteryRemainingIcon"
app:framePosition="30"
app:framePosition="@integer/fade_out_complete_frame"
android:alpha="0"
/>
<KeyAttribute
app:motionTarget="@id/batteryRemainingIcon"
app:framePosition="70"
app:framePosition="@integer/fade_in_start_frame"
android:alpha="0"
/>
<KeyPosition
app:motionTarget="@id/carrier_group"
app:percentX="1"
app:percentY="0.51"
app:framePosition="51"
app:percentY="0.5"
app:framePosition="50"
app:percentWidth="1"
app:percentHeight="1"
app:curveFit="linear"
@@ -126,7 +119,7 @@
android:alpha="0" />
<KeyAttribute
app:motionTarget="@id/carrier_group"
app:framePosition="70"
app:framePosition="@integer/fade_in_start_frame"
android:alpha="0" />
</KeyFrameSet>
</Transition>

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 {