Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSectionTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ class SmartspaceSectionTest : SysuiTestCase() { .thenReturn(smartspaceView) whenever(lockscreenSmartspaceController.buildAndConnectWeatherView(any(), any())) .thenReturn(weatherView) whenever(lockscreenSmartspaceController.buildAndConnectDateView(any(), any())).thenReturn(dateView) whenever(lockscreenSmartspaceController.buildAndConnectDateView(any(), any())) .thenReturn(dateView) whenever(keyguardClockViewModel.hasCustomWeatherDataDisplay) .thenReturn(hasCustomWeatherDataDisplay) whenever(keyguardClockViewModel.clockShouldBeCentered).thenReturn(clockShouldBeCentered) Loading Loading @@ -123,6 +124,7 @@ class SmartspaceSectionTest : SysuiTestCase() { } @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun testAddViews_smartspaceEnabled_notDateWeatherDecoupled() { whenever(keyguardSmartspaceViewModel.isDateWeatherDecoupled).thenReturn(false) underTest.addViews(constraintLayout) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSmartspaceViewModelTest.kt +16 −8 Original line number Diff line number Diff line Loading @@ -126,7 +126,8 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun dateWeatherBelowSmallClock_smartspacelayoutflag_off_true() { val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result).isTrue() } Loading @@ -139,7 +140,8 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { mockConfiguration.fontScale = fontScale mockConfiguration.screenWidthDp = screenWidthDp val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result).isFalse() } Loading @@ -149,17 +151,20 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { fun dateWeatherBelowSmallClock_variousFontAndDisplaySize_false() { mockConfiguration.fontScale = 1.0f mockConfiguration.screenWidthDp = 347 val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result1).isFalse() mockConfiguration.fontScale = 1.2f mockConfiguration.screenWidthDp = 347 val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result2).isFalse() mockConfiguration.fontScale = 1.7f mockConfiguration.screenWidthDp = 412 val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result3).isFalse() } Loading @@ -168,17 +173,20 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { fun dateWeatherBelowSmallClock_variousFontAndDisplaySize_true() { mockConfiguration.fontScale = 1.0f mockConfiguration.screenWidthDp = 310 val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result1).isTrue() mockConfiguration.fontScale = 1.5f mockConfiguration.screenWidthDp = 347 val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result2).isTrue() mockConfiguration.fontScale = 2.0f mockConfiguration.screenWidthDp = 411 val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result3).isTrue() } } packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSmartspaceViewBinder.kt +1 −5 Original line number Diff line number Diff line Loading @@ -143,11 +143,7 @@ object KeyguardSmartspaceViewBinder { view.top = (clockBounds.bottom + yBuffer + offset).toInt() view.bottom = view.top + viewHeight } } else if ( !KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( keyguardRootView.resources.configuration ) ) { } else if (!clockViewModel.dateWeatherBelowSmallClock()) { keyguardRootView.findViewById<View>(smallViewId)?.let { view -> val viewWidth = view.width if (view.isLayoutRtl()) { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt +2 −7 Original line number Diff line number Diff line Loading @@ -121,11 +121,7 @@ constructor( setAlpha(getNonTargetClockFace(clock).views, 0F) if (!keyguardClockViewModel.isLargeClockVisible.value) { if ( KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( context.resources.configuration ) ) { if (keyguardClockViewModel.dateWeatherBelowSmallClock()) { connect( sharedR.id.bc_smartspace_view, TOP, Loading Loading @@ -191,8 +187,7 @@ constructor( val guideline = if (keyguardClockViewModel.clockShouldBeCentered.value) PARENT_ID else R.id.split_shade_guideline val dateWeatherBelowSmallClock = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(context.resources.configuration) val dateWeatherBelowSmallClock = keyguardClockViewModel.dateWeatherBelowSmallClock() constraints.apply { connect(customR.id.lockscreen_clock_view_large, START, PARENT_ID, START) connect(customR.id.lockscreen_clock_view_large, END, guideline, END) Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt +9 −13 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ constructor( private val keyguardRootViewModel: KeyguardRootViewModel, ) : KeyguardSection() { private var smartspaceView: View? = null private var dateView: ViewGroup? = null private var dateView: LinearLayout? = null private var dateViewLargeClock: ViewGroup? = null private var smartspaceVisibilityListener: OnGlobalLayoutListener? = null Loading @@ -77,7 +77,7 @@ constructor( if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return smartspaceView = smartspaceController.buildAndConnectView(constraintLayout) dateView = smartspaceController.buildAndConnectDateView(constraintLayout, false) as? ViewGroup smartspaceController.buildAndConnectDateView(constraintLayout, false) as? LinearLayout var weatherViewLargeClock: View? = null val weatherView: View? = smartspaceController.buildAndConnectWeatherView(constraintLayout, false) Loading @@ -98,17 +98,6 @@ constructor( val index = if (dateViewLargeClock?.childCount == 0) 0 else 1 dateViewLargeClock?.addView(weatherViewLargeClock, index) } if ( KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( context.resources.configuration, keyguardClockViewModel.hasCustomWeatherDataDisplay.value, ) ) { (dateView as? LinearLayout)?.orientation = LinearLayout.HORIZONTAL } else { (dateView as? LinearLayout)?.orientation = LinearLayout.VERTICAL } } if (keyguardSmartspaceViewModel.isDateWeatherDecoupled) { Loading Loading @@ -153,6 +142,13 @@ constructor( context.resources.configuration, keyguardClockViewModel.hasCustomWeatherDataDisplay.value, ) if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) { if (dateWeatherBelowSmallClock) { dateView?.orientation = LinearLayout.HORIZONTAL } else { dateView?.orientation = LinearLayout.VERTICAL } } constraintSet.apply { constrainHeight(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) constrainWidth(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSectionTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ class SmartspaceSectionTest : SysuiTestCase() { .thenReturn(smartspaceView) whenever(lockscreenSmartspaceController.buildAndConnectWeatherView(any(), any())) .thenReturn(weatherView) whenever(lockscreenSmartspaceController.buildAndConnectDateView(any(), any())).thenReturn(dateView) whenever(lockscreenSmartspaceController.buildAndConnectDateView(any(), any())) .thenReturn(dateView) whenever(keyguardClockViewModel.hasCustomWeatherDataDisplay) .thenReturn(hasCustomWeatherDataDisplay) whenever(keyguardClockViewModel.clockShouldBeCentered).thenReturn(clockShouldBeCentered) Loading Loading @@ -123,6 +124,7 @@ class SmartspaceSectionTest : SysuiTestCase() { } @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun testAddViews_smartspaceEnabled_notDateWeatherDecoupled() { whenever(keyguardSmartspaceViewModel.isDateWeatherDecoupled).thenReturn(false) underTest.addViews(constraintLayout) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSmartspaceViewModelTest.kt +16 −8 Original line number Diff line number Diff line Loading @@ -126,7 +126,8 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun dateWeatherBelowSmallClock_smartspacelayoutflag_off_true() { val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result).isTrue() } Loading @@ -139,7 +140,8 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { mockConfiguration.fontScale = fontScale mockConfiguration.screenWidthDp = screenWidthDp val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result).isFalse() } Loading @@ -149,17 +151,20 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { fun dateWeatherBelowSmallClock_variousFontAndDisplaySize_false() { mockConfiguration.fontScale = 1.0f mockConfiguration.screenWidthDp = 347 val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result1).isFalse() mockConfiguration.fontScale = 1.2f mockConfiguration.screenWidthDp = 347 val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result2).isFalse() mockConfiguration.fontScale = 1.7f mockConfiguration.screenWidthDp = 412 val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result3).isFalse() } Loading @@ -168,17 +173,20 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { fun dateWeatherBelowSmallClock_variousFontAndDisplaySize_true() { mockConfiguration.fontScale = 1.0f mockConfiguration.screenWidthDp = 310 val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result1 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result1).isTrue() mockConfiguration.fontScale = 1.5f mockConfiguration.screenWidthDp = 347 val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result2 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result2).isTrue() mockConfiguration.fontScale = 2.0f mockConfiguration.screenWidthDp = 411 val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration) val result3 = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(mockConfiguration, false) assertThat(result3).isTrue() } }
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSmartspaceViewBinder.kt +1 −5 Original line number Diff line number Diff line Loading @@ -143,11 +143,7 @@ object KeyguardSmartspaceViewBinder { view.top = (clockBounds.bottom + yBuffer + offset).toInt() view.bottom = view.top + viewHeight } } else if ( !KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( keyguardRootView.resources.configuration ) ) { } else if (!clockViewModel.dateWeatherBelowSmallClock()) { keyguardRootView.findViewById<View>(smallViewId)?.let { view -> val viewWidth = view.width if (view.isLayoutRtl()) { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt +2 −7 Original line number Diff line number Diff line Loading @@ -121,11 +121,7 @@ constructor( setAlpha(getNonTargetClockFace(clock).views, 0F) if (!keyguardClockViewModel.isLargeClockVisible.value) { if ( KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( context.resources.configuration ) ) { if (keyguardClockViewModel.dateWeatherBelowSmallClock()) { connect( sharedR.id.bc_smartspace_view, TOP, Loading Loading @@ -191,8 +187,7 @@ constructor( val guideline = if (keyguardClockViewModel.clockShouldBeCentered.value) PARENT_ID else R.id.split_shade_guideline val dateWeatherBelowSmallClock = KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock(context.resources.configuration) val dateWeatherBelowSmallClock = keyguardClockViewModel.dateWeatherBelowSmallClock() constraints.apply { connect(customR.id.lockscreen_clock_view_large, START, PARENT_ID, START) connect(customR.id.lockscreen_clock_view_large, END, guideline, END) Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt +9 −13 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ constructor( private val keyguardRootViewModel: KeyguardRootViewModel, ) : KeyguardSection() { private var smartspaceView: View? = null private var dateView: ViewGroup? = null private var dateView: LinearLayout? = null private var dateViewLargeClock: ViewGroup? = null private var smartspaceVisibilityListener: OnGlobalLayoutListener? = null Loading @@ -77,7 +77,7 @@ constructor( if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return smartspaceView = smartspaceController.buildAndConnectView(constraintLayout) dateView = smartspaceController.buildAndConnectDateView(constraintLayout, false) as? ViewGroup smartspaceController.buildAndConnectDateView(constraintLayout, false) as? LinearLayout var weatherViewLargeClock: View? = null val weatherView: View? = smartspaceController.buildAndConnectWeatherView(constraintLayout, false) Loading @@ -98,17 +98,6 @@ constructor( val index = if (dateViewLargeClock?.childCount == 0) 0 else 1 dateViewLargeClock?.addView(weatherViewLargeClock, index) } if ( KeyguardSmartspaceViewModel.dateWeatherBelowSmallClock( context.resources.configuration, keyguardClockViewModel.hasCustomWeatherDataDisplay.value, ) ) { (dateView as? LinearLayout)?.orientation = LinearLayout.HORIZONTAL } else { (dateView as? LinearLayout)?.orientation = LinearLayout.VERTICAL } } if (keyguardSmartspaceViewModel.isDateWeatherDecoupled) { Loading Loading @@ -153,6 +142,13 @@ constructor( context.resources.configuration, keyguardClockViewModel.hasCustomWeatherDataDisplay.value, ) if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) { if (dateWeatherBelowSmallClock) { dateView?.orientation = LinearLayout.HORIZONTAL } else { dateView?.orientation = LinearLayout.VERTICAL } } constraintSet.apply { constrainHeight(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) constrainWidth(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) Loading