Merge "Fix carrier name animation during qqs expand" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f79d65f010
@@ -572,6 +572,7 @@
|
||||
<dimen name="qs_brightness_margin_bottom">16dp</dimen>
|
||||
<dimen name="qqs_layout_margin_top">16dp</dimen>
|
||||
<dimen name="qqs_layout_padding_bottom">24dp</dimen>
|
||||
<item name="qqs_expand_clock_scale" format="float" type="dimen">2.57</item>
|
||||
|
||||
<!-- Most of the time it should be the same as notification_side_paddings as it's vertically
|
||||
aligned with notifications. The exception is split shade when this value becomes
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/carrier_group"
|
||||
/>
|
||||
<Transform
|
||||
android:scaleX="2.57"
|
||||
android:scaleY="2.57"
|
||||
android:scaleX="@dimen/qqs_expand_clock_scale"
|
||||
android:scaleY="@dimen/qqs_expand_clock_scale"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.view.WindowInsets
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.core.view.doOnLayout
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.settingslib.Utils
|
||||
import com.android.systemui.Dumpable
|
||||
@@ -220,6 +221,7 @@ constructor(
|
||||
override fun demoCommands() = listOf(DemoMode.COMMAND_CLOCK)
|
||||
override fun dispatchDemoCommand(command: String, args: Bundle) =
|
||||
clock.dispatchDemoCommand(command, args)
|
||||
|
||||
override fun onDemoModeStarted() = clock.onDemoModeStarted()
|
||||
override fun onDemoModeFinished() = clock.onDemoModeFinished()
|
||||
}
|
||||
@@ -259,6 +261,7 @@ constructor(
|
||||
resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_min_height)
|
||||
lastInsets?.let { updateConstraintsForInsets(header, it) }
|
||||
updateResources()
|
||||
updateCarrierGroupPadding()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +294,7 @@ constructor(
|
||||
privacyIconsController.chipVisibilityListener = chipVisibilityListener
|
||||
updateVisibility()
|
||||
updateTransition()
|
||||
updateCarrierGroupPadding()
|
||||
|
||||
header.setOnApplyWindowInsetsListener(insetListener)
|
||||
|
||||
@@ -298,8 +302,6 @@ constructor(
|
||||
val newPivot = if (v.isLayoutRtl) v.width.toFloat() else 0f
|
||||
v.pivotX = newPivot
|
||||
v.pivotY = v.height.toFloat() / 2
|
||||
|
||||
mShadeCarrierGroup.setPaddingRelative((v.width * v.scaleX).toInt(), 0, 0, 0)
|
||||
}
|
||||
clock.setOnClickListener { launchClockActivity() }
|
||||
|
||||
@@ -359,6 +361,14 @@ constructor(
|
||||
.load(context, resources.getXml(R.xml.large_screen_shade_header))
|
||||
}
|
||||
|
||||
private fun updateCarrierGroupPadding() {
|
||||
clock.doOnLayout {
|
||||
val maxClockWidth =
|
||||
(clock.width * resources.getFloat(R.dimen.qqs_expand_clock_scale)).toInt()
|
||||
mShadeCarrierGroup.setPaddingRelative(maxClockWidth, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateConstraintsForInsets(view: MotionLayout, insets: WindowInsets) {
|
||||
val cutout = insets.displayCutout.also { this.cutout = it }
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.mock
|
||||
import org.mockito.Mockito.reset
|
||||
import org.mockito.Mockito.times
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.Mockito.`when` as whenever
|
||||
import org.mockito.junit.MockitoJUnit
|
||||
@@ -387,7 +388,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
|
||||
whenever(clock.isLayoutRtl).thenReturn(false)
|
||||
|
||||
val captor = ArgumentCaptor.forClass(View.OnLayoutChangeListener::class.java)
|
||||
verify(clock).addOnLayoutChangeListener(capture(captor))
|
||||
verify(clock, times(2)).addOnLayoutChangeListener(capture(captor))
|
||||
|
||||
captor.value.onLayoutChange(clock, 0, 1, 2, 3, 4, 5, 6, 7)
|
||||
verify(clock).pivotX = 0f
|
||||
@@ -400,7 +401,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
|
||||
whenever(clock.isLayoutRtl).thenReturn(true)
|
||||
|
||||
val captor = ArgumentCaptor.forClass(View.OnLayoutChangeListener::class.java)
|
||||
verify(clock).addOnLayoutChangeListener(capture(captor))
|
||||
verify(clock, times(2)).addOnLayoutChangeListener(capture(captor))
|
||||
|
||||
captor.value.onLayoutChange(clock, 0, 1, 2, 3, 4, 5, 6, 7)
|
||||
verify(clock).pivotX = width.toFloat()
|
||||
@@ -793,7 +794,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun clockPivotYInCenter() {
|
||||
val captor = ArgumentCaptor.forClass(View.OnLayoutChangeListener::class.java)
|
||||
verify(clock).addOnLayoutChangeListener(capture(captor))
|
||||
verify(clock, times(2)).addOnLayoutChangeListener(capture(captor))
|
||||
var height = 100
|
||||
val width = 50
|
||||
|
||||
@@ -825,16 +826,17 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun carrierLeftPaddingIsSetWhenClockLayoutChanges() {
|
||||
val width = 200
|
||||
whenever(clock.width).thenReturn(width)
|
||||
whenever(clock.scaleX).thenReturn(2.57f) // 2.57 comes from qs_header.xml
|
||||
fun carrierStartPaddingIsSetOnClockLayout() {
|
||||
val clockWidth = 200
|
||||
val maxClockScale = context.resources.getFloat(R.dimen.qqs_expand_clock_scale)
|
||||
val expectedStartPadding = (clockWidth * maxClockScale).toInt()
|
||||
whenever(clock.width).thenReturn(clockWidth)
|
||||
|
||||
val captor = ArgumentCaptor.forClass(View.OnLayoutChangeListener::class.java)
|
||||
verify(clock, times(2)).addOnLayoutChangeListener(capture(captor))
|
||||
captor.allValues.forEach { clock.executeLayoutChange(0, 0, clockWidth, 0, it) }
|
||||
|
||||
verify(clock).addOnLayoutChangeListener(capture(captor))
|
||||
captor.value.onLayoutChange(clock, 0, 0, width, 0, 0, 0, 0, 0)
|
||||
|
||||
verify(carrierGroup).setPaddingRelative(514, 0, 0, 0)
|
||||
verify(carrierGroup).setPaddingRelative(expectedStartPadding, 0, 0, 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user