Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,20 @@ class CommunalEditModeViewModelTest : SysuiTestCase() { assertThat(communalInteractor.firstVisibleItemOffset).isEqualTo(offset) } @Test fun scrollPosition_clearsSelectedItem() = kosmos.runTest { val index = 2 val offset = 30 val testKey = "testKey" underTest.setSelectedKey(testKey) assertThat(underTest.selectedKey.value).isNotNull() underTest.onScrollPositionUpdated(index, communalInteractor.firstVisibleItemOffset) assertThat(underTest.selectedKey.value).isEqualTo(testKey) underTest.onScrollPositionUpdated(index, offset) assertThat(underTest.selectedKey.value).isNull() } @Test fun onResizeWidget_logsMetrics() = kosmos.runTest { Loading packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt +7 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,13 @@ constructor( uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_REORDER_WIDGET_CANCEL) } override fun onScrollPositionUpdated(firstVisibleItemIndex: Int, firstVisibleItemScroll: Int) { super.onScrollPositionUpdated(firstVisibleItemIndex, firstVisibleItemScroll) if (!_reorderingWidgets.value && firstVisibleItemScroll != savedFirstScrollOffset) { setSelectedKey(null) } } val isIdleOnCommunal: StateFlow<Boolean> = communalInteractor.isIdleOnCommunal /** Launch the widget picker activity using the given startActivity method. */ Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,20 @@ class CommunalEditModeViewModelTest : SysuiTestCase() { assertThat(communalInteractor.firstVisibleItemOffset).isEqualTo(offset) } @Test fun scrollPosition_clearsSelectedItem() = kosmos.runTest { val index = 2 val offset = 30 val testKey = "testKey" underTest.setSelectedKey(testKey) assertThat(underTest.selectedKey.value).isNotNull() underTest.onScrollPositionUpdated(index, communalInteractor.firstVisibleItemOffset) assertThat(underTest.selectedKey.value).isEqualTo(testKey) underTest.onScrollPositionUpdated(index, offset) assertThat(underTest.selectedKey.value).isNull() } @Test fun onResizeWidget_logsMetrics() = kosmos.runTest { Loading
packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt +7 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,13 @@ constructor( uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_REORDER_WIDGET_CANCEL) } override fun onScrollPositionUpdated(firstVisibleItemIndex: Int, firstVisibleItemScroll: Int) { super.onScrollPositionUpdated(firstVisibleItemIndex, firstVisibleItemScroll) if (!_reorderingWidgets.value && firstVisibleItemScroll != savedFirstScrollOffset) { setSelectedKey(null) } } val isIdleOnCommunal: StateFlow<Boolean> = communalInteractor.isIdleOnCommunal /** Launch the widget picker activity using the given startActivity method. */ Loading